Fix some compile errors
This commit is contained in:
parent
dc977891de
commit
fd4e04647e
@ -34,7 +34,7 @@ pub fn view(model: &model::Model, modal: &Model) -> Node<Msg> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn warning(model: &model::Model, modal: &Model) -> Node<Msg> {
|
fn warning(model: &model::Model, modal: &Model) -> Node<Msg> {
|
||||||
let issues: Vec<Node<Msg>> = modal
|
let issues = modal
|
||||||
.related_issues
|
.related_issues
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|id| model.issues_by_id.get(id))
|
.flat_map(|id| model.issues_by_id.get(id))
|
||||||
@ -48,12 +48,11 @@ fn warning(model: &model::Model, modal: &Model) -> Node<Msg> {
|
|||||||
issue.title.as_str()
|
issue.title.as_str()
|
||||||
]
|
]
|
||||||
]]
|
]]
|
||||||
})
|
});
|
||||||
.collect();
|
|
||||||
|
|
||||||
let close = StyledButton {
|
let close = StyledButton {
|
||||||
text: Some("Close"),
|
text: Some("Close"),
|
||||||
on_click: Some(mouse_ev("click", move |ev| {
|
on_click: Some(mouse_ev(Ev::Click, move |ev| {
|
||||||
ev.stop_propagation();
|
ev.stop_propagation();
|
||||||
ev.prevent_default();
|
ev.prevent_default();
|
||||||
Msg::ModalDropped
|
Msg::ModalDropped
|
||||||
|
@ -27,14 +27,14 @@ impl Model {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let related_issues = model
|
let related_issues = model
|
||||||
.issues()
|
.issue_ids
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|issue| {
|
.filter_map(|id| {
|
||||||
if issue.epic_id == Some(epic_id) {
|
model
|
||||||
Some(issue.id)
|
.issues_by_id
|
||||||
} else {
|
.get(id)
|
||||||
None
|
.filter(|issue| issue.epic_id == Some(epic_id))
|
||||||
}
|
.map(|issue| issue.id)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
Self {
|
Self {
|
||||||
|
@ -16,8 +16,12 @@ impl EpicsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_issues_per_epic(model: &Model) -> HashMap<EpicId, Vec<IssueId>> {
|
pub fn build_issues_per_epic(model: &Model) -> HashMap<EpicId, Vec<IssueId>> {
|
||||||
model.issues().iter().fold(
|
model
|
||||||
HashMap::with_capacity(model.issues().len()),
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id))
|
||||||
|
.fold(
|
||||||
|
HashMap::with_capacity(model.issue_ids.len()),
|
||||||
|mut h, issue| {
|
|mut h, issue| {
|
||||||
if let Some(epic_id) = issue.epic_id.as_ref() {
|
if let Some(epic_id) = issue.epic_id.as_ref() {
|
||||||
h.entry(*epic_id).or_default().push(issue.id);
|
h.entry(*epic_id).or_default().push(issue.id);
|
||||||
|
@ -20,8 +20,14 @@ pub struct IssuesAndFiltersPage {
|
|||||||
impl IssuesAndFiltersPage {
|
impl IssuesAndFiltersPage {
|
||||||
pub fn new(model: &model::Model) -> Self {
|
pub fn new(model: &model::Model) -> Self {
|
||||||
let jql = Jql::default();
|
let jql = Jql::default();
|
||||||
let visible_issues = Self::visible_issues(model.issues(), &jql);
|
let visible_issues = Self::visible_issues(
|
||||||
let active_id = model.issues().first().as_ref().map(|issue| issue.id);
|
model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id)),
|
||||||
|
&jql,
|
||||||
|
);
|
||||||
|
let active_id = model.issue_ids.first().copied();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
visible_issues,
|
visible_issues,
|
||||||
@ -34,9 +40,11 @@ impl IssuesAndFiltersPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visible_issues(issues: &[Issue], jql: &Jql) -> Vec<IssueId> {
|
pub fn visible_issues<'l, IssueStream>(issues: IssueStream, jql: &Jql) -> Vec<IssueId>
|
||||||
|
where
|
||||||
|
IssueStream: std::iter::Iterator<Item = &'l Issue>,
|
||||||
|
{
|
||||||
issues
|
issues
|
||||||
.iter()
|
|
||||||
.filter(|issue| jql.is_visible(issue))
|
.filter(|issue| jql.is_visible(issue))
|
||||||
.map(|issue| issue.id)
|
.map(|issue| issue.id)
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -37,15 +37,24 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
.jql
|
.jql
|
||||||
.remove_from(idx);
|
.remove_from(idx);
|
||||||
let issues = super::IssuesAndFiltersPage::visible_issues(
|
let issues = super::IssuesAndFiltersPage::visible_issues(
|
||||||
model.issues(),
|
model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id)),
|
||||||
&crate::match_page!(model, IssuesAndFilters).jql,
|
&crate::match_page!(model, IssuesAndFilters).jql,
|
||||||
);
|
);
|
||||||
crate::match_page_mut!(model, IssuesAndFilters).visible_issues = issues;
|
crate::match_page_mut!(model, IssuesAndFilters).visible_issues = issues;
|
||||||
}
|
}
|
||||||
Msg::ResourceChanged(ResourceKind::Issue, OperationKind::ListLoaded, _) => {
|
Msg::ResourceChanged(ResourceKind::Issue, OperationKind::ListLoaded, _) => {
|
||||||
let jql = &match_page!(model, IssuesAndFilters).jql;
|
let jql = &match_page!(model, IssuesAndFilters).jql;
|
||||||
let issues = super::IssuesAndFiltersPage::visible_issues(model.issues(), jql);
|
let issues = super::IssuesAndFiltersPage::visible_issues(
|
||||||
let first_id = model.issues().first().as_ref().map(|issue| issue.id);
|
model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id)),
|
||||||
|
jql,
|
||||||
|
);
|
||||||
|
let first_id = model.issue_ids.first().copied();
|
||||||
let page = crate::match_page_mut!(model, IssuesAndFilters);
|
let page = crate::match_page_mut!(model, IssuesAndFilters);
|
||||||
if page.active_id.is_none() {
|
if page.active_id.is_none() {
|
||||||
page.active_id = first_id;
|
page.active_id = first_id;
|
||||||
@ -56,7 +65,7 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
crate::match_page_mut!(model, IssuesAndFilters).active_id = Some(id);
|
crate::match_page_mut!(model, IssuesAndFilters).active_id = Some(id);
|
||||||
}
|
}
|
||||||
Msg::SetActiveIssue(None) => {
|
Msg::SetActiveIssue(None) => {
|
||||||
let first_id = model.issues().first().as_ref().map(|issue| issue.id);
|
let first_id = model.issue_ids.first().copied();
|
||||||
crate::match_page_mut!(model, IssuesAndFilters).active_id = first_id;
|
crate::match_page_mut!(model, IssuesAndFilters).active_id = first_id;
|
||||||
}
|
}
|
||||||
Msg::StyledSelectChanged(
|
Msg::StyledSelectChanged(
|
||||||
@ -114,7 +123,10 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
page.current_jql_part.reset();
|
page.current_jql_part.reset();
|
||||||
page.current_jql_part.opened = true;
|
page.current_jql_part.opened = true;
|
||||||
let issues = super::IssuesAndFiltersPage::visible_issues(
|
let issues = super::IssuesAndFiltersPage::visible_issues(
|
||||||
model.issues(),
|
model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id)),
|
||||||
&crate::match_page!(model, IssuesAndFilters).jql,
|
&crate::match_page!(model, IssuesAndFilters).jql,
|
||||||
);
|
);
|
||||||
crate::match_page_mut!(model, IssuesAndFilters).visible_issues = issues;
|
crate::match_page_mut!(model, IssuesAndFilters).visible_issues = issues;
|
||||||
|
@ -120,7 +120,10 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
crate::match_page!(model, Project),
|
crate::match_page!(model, Project),
|
||||||
model.epics(),
|
model.epics(),
|
||||||
model.issue_statuses(),
|
model.issue_statuses(),
|
||||||
model.issues(),
|
model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id)),
|
||||||
model.user(),
|
model.user(),
|
||||||
);
|
);
|
||||||
crate::match_page_mut!(model, Project).visible_issues = visible_issues;
|
crate::match_page_mut!(model, Project).visible_issues = visible_issues;
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use seed::*;
|
|
||||||
use seed::prelude::*;
|
|
||||||
|
|
||||||
use jirs_data::{IssueStatus, ProjectCategory, TimeTracking};
|
use jirs_data::{IssueStatus, ProjectCategory, TimeTracking};
|
||||||
|
use seed::prelude::*;
|
||||||
|
use seed::*;
|
||||||
|
|
||||||
use crate::{FieldId, Msg, ProjectFieldId};
|
|
||||||
use crate::components::styled_button::{ButtonVariant, StyledButton};
|
use crate::components::styled_button::{ButtonVariant, StyledButton};
|
||||||
use crate::components::styled_checkbox::{ChildBuilder, StyledCheckbox, StyledCheckboxState};
|
use crate::components::styled_checkbox::{ChildBuilder, StyledCheckbox, StyledCheckboxState};
|
||||||
use crate::components::styled_editor::render_styled_editor;
|
use crate::components::styled_editor::render_styled_editor;
|
||||||
@ -19,6 +17,7 @@ use crate::components::styled_textarea::StyledTextarea;
|
|||||||
use crate::model::{self, Model, PageContent};
|
use crate::model::{self, Model, PageContent};
|
||||||
use crate::pages::project_settings_page::{events, ProjectSettingsPage};
|
use crate::pages::project_settings_page::{events, ProjectSettingsPage};
|
||||||
use crate::shared::inner_layout;
|
use crate::shared::inner_layout;
|
||||||
|
use crate::{FieldId, Msg, ProjectFieldId};
|
||||||
|
|
||||||
static TIME_TRACKING_FIBONACCI: &str = include_str!("./time_tracking_fibonacci.txt");
|
static TIME_TRACKING_FIBONACCI: &str = include_str!("./time_tracking_fibonacci.txt");
|
||||||
static TIME_TRACKING_HOURLY: &str = include_str!("./time_tracking_hourly.txt");
|
static TIME_TRACKING_HOURLY: &str = include_str!("./time_tracking_hourly.txt");
|
||||||
@ -206,10 +205,18 @@ fn category_select_option<'l>(pc: ProjectCategory) -> StyledSelectOption<'l> {
|
|||||||
fn columns_section(model: &Model, page: &ProjectSettingsPage) -> Node<Msg> {
|
fn columns_section(model: &Model, page: &ProjectSettingsPage) -> Node<Msg> {
|
||||||
let width = 100f64 / (model.issue_statuses.len() + 1) as f64;
|
let width = 100f64 / (model.issue_statuses.len() + 1) as f64;
|
||||||
let column_style = format!("width: calc({width}% - 10px)", width = width);
|
let column_style = format!("width: calc({width}% - 10px)", width = width);
|
||||||
let per_column_issue_count = model.issues().iter().fold(HashMap::new(), |mut h, issue| {
|
let per_column_issue_count = model
|
||||||
|
.issue_ids
|
||||||
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id))
|
||||||
|
.iter()
|
||||||
|
.fold(
|
||||||
|
HashMap::with_capacity(model.issue_statuses_by_id.len()),
|
||||||
|
|mut h, issue| {
|
||||||
*h.entry(issue.issue_status_id).or_insert(0) += 1;
|
*h.entry(issue.issue_status_id).or_insert(0) += 1;
|
||||||
h
|
h
|
||||||
});
|
},
|
||||||
|
);
|
||||||
let columns: Vec<Node<Msg>> = model
|
let columns: Vec<Node<Msg>> = model
|
||||||
.issue_statuses
|
.issue_statuses
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -240,8 +240,9 @@ fn issue_list(page: &ReportsPage, project_name: &str, this_month_updated: &[&Iss
|
|||||||
|
|
||||||
fn this_month_updated<'a>(model: &'a Model, page: &ReportsPage) -> Vec<&'a Issue> {
|
fn this_month_updated<'a>(model: &'a Model, page: &ReportsPage) -> Vec<&'a Issue> {
|
||||||
model
|
model
|
||||||
.issues()
|
.issue_ids
|
||||||
.iter()
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id))
|
||||||
.filter(|issue| {
|
.filter(|issue| {
|
||||||
issue.updated_at.date() >= page.first_day && issue.updated_at.date() <= page.last_day
|
issue.updated_at.date() >= page.first_day && issue.updated_at.date() <= page.last_day
|
||||||
})
|
})
|
||||||
|
@ -30,8 +30,9 @@ pub fn change_position(below_id: EpicId, model: &mut Model) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let (issue_status_id, epic_id) = model
|
let (issue_status_id, epic_id) = model
|
||||||
.issues()
|
.issue_ids
|
||||||
.iter()
|
.iter()
|
||||||
|
.filter_map(|id| model.issues_by_id.get(id))
|
||||||
.find_map(|issue| {
|
.find_map(|issue| {
|
||||||
if issue.id == dragged_id {
|
if issue.id == dragged_id {
|
||||||
Some((issue.issue_status_id, issue.epic_id))
|
Some((issue.issue_status_id, issue.epic_id))
|
||||||
|
Loading…
Reference in New Issue
Block a user