Delete epic
This commit is contained in:
parent
ce6205f61d
commit
10fc8d81c9
@ -1,10 +1,32 @@
|
|||||||
use {
|
use {
|
||||||
crate::{shared::go_to_board, Msg},
|
crate::{shared::go_to_board, ws::send_ws_msg, ModalType, Msg, OperationKind, ResourceKind},
|
||||||
|
jirs_data::WsMsg,
|
||||||
seed::prelude::*,
|
seed::prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn update(msg: &Msg, _model: &mut crate::model::Model, orders: &mut impl Orders<Msg>) {
|
pub fn update(msg: &Msg, model: &mut crate::model::Model, orders: &mut impl Orders<Msg>) {
|
||||||
if let Msg::ModalDropped = msg {
|
let modal = match model.modals.iter_mut().find_map(|modal| {
|
||||||
|
if let ModalType::DeleteEpic(modal) = modal {
|
||||||
|
Some(modal)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Some(modal) => modal,
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
match msg {
|
||||||
|
Msg::ModalDropped => {
|
||||||
go_to_board(orders);
|
go_to_board(orders);
|
||||||
|
}
|
||||||
|
Msg::DeleteEpic => {
|
||||||
|
send_ws_msg(WsMsg::EpicDelete(modal.epic_id), model.ws.as_ref(), orders);
|
||||||
|
}
|
||||||
|
Msg::ResourceChanged(ResourceKind::Epic, OperationKind::SingleRemoved, Some(_)) => {
|
||||||
|
go_to_board(orders);
|
||||||
|
orders.skip().send_msg(Msg::ModalDropped);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,11 @@ pub fn view(model: &model::Model, modal: &Model) -> Node<Msg> {
|
|||||||
.title("Delete empty epic")
|
.title("Delete empty epic")
|
||||||
.cancel_text("Cancel")
|
.cancel_text("Cancel")
|
||||||
.confirm_text("Delete epic")
|
.confirm_text("Delete epic")
|
||||||
|
.on_confirm(mouse_ev("click", move |ev| {
|
||||||
|
ev.stop_propagation();
|
||||||
|
ev.prevent_default();
|
||||||
|
Msg::DeleteEpic
|
||||||
|
}))
|
||||||
.build()
|
.build()
|
||||||
.into_node()
|
.into_node()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user