mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-03 18:30:41 +08:00
issue: Adjust available operations
This commit is contained in:
@@ -16,26 +16,18 @@ pub enum Mode {
|
||||
/// selection widget.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
|
||||
pub enum IssueOperation {
|
||||
Show,
|
||||
Delete,
|
||||
Edit,
|
||||
Comment,
|
||||
Show,
|
||||
}
|
||||
|
||||
impl Display for IssueOperation {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
IssueOperation::Show => {
|
||||
write!(f, "show")
|
||||
}
|
||||
IssueOperation::Delete => {
|
||||
write!(f, "delete")
|
||||
}
|
||||
IssueOperation::Edit => {
|
||||
write!(f, "edit")
|
||||
}
|
||||
IssueOperation::Comment => {
|
||||
write!(f, "comment")
|
||||
IssueOperation::Show => {
|
||||
write!(f, "show")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,17 +102,6 @@ impl Widget<IssuesState, Action> for ListPage {
|
||||
});
|
||||
}
|
||||
}
|
||||
Key::Char('c') => {
|
||||
if let Some(selected) = &self.props.selected {
|
||||
let _ = self.action_tx.send(Action::Exit {
|
||||
selection: Some(Selection {
|
||||
operation: Some(IssueOperation::Comment.to_string()),
|
||||
ids: vec![selected.id],
|
||||
args: vec![],
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
Key::Char('e') => {
|
||||
if let Some(selected) = &self.props.selected {
|
||||
let _ = self.action_tx.send(Action::Exit {
|
||||
@@ -124,17 +113,6 @@ impl Widget<IssuesState, Action> for ListPage {
|
||||
});
|
||||
}
|
||||
}
|
||||
Key::Char('d') => {
|
||||
if let Some(selected) = &self.props.selected {
|
||||
let _ = self.action_tx.send(Action::Exit {
|
||||
selection: Some(Selection {
|
||||
operation: Some(IssueOperation::Delete.to_string()),
|
||||
ids: vec![selected.id],
|
||||
args: vec![],
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
<Issues as Widget<IssuesState, Action>>::handle_key_event(&mut self.issues, key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user