| 1 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 2 | pub struct ControlOperationHelp { |
| 3 | pub slash_invocation: String, |
| 4 | pub authority: String, |
| 5 | pub summary: String, |
| 6 | pub cli_invocation: String, |
| 7 | } |
| 8 | |
| 9 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 10 | pub struct ControlReceiptOutcome { |
| 11 | pub rendered: String, |
| 12 | pub is_error: bool, |
| 13 | } |
| 14 | |
| 15 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 16 | pub enum LaneControlVerb { |
| 17 | List, |
| 18 | Status, |
| 19 | Interrupt, |
| 20 | Restart, |
| 21 | Resume, |
| 22 | } |
| 23 | |
| 24 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 25 | pub enum FleetControlVerb { |
| 26 | List, |
| 27 | Status, |
| 28 | Interrupt, |
| 29 | Restart, |
| 30 | Resume, |
| 31 | } |
| 32 | |
| 33 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 34 | pub enum FleetRouteSaveKind { |
| 35 | UpdateFleet, |
| 36 | SaveAsNewFleet, |
| 37 | } |
| 38 | |
| 39 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 40 | pub enum FleetUsageKind { |
| 41 | Add, |
| 42 | Remove, |
| 43 | } |
| 44 | |
| 45 | pub trait CommandLaneContext { |
| 46 | fn control_operations(&self) -> Vec<ControlOperationHelp>; |
| 47 | fn resolve_control_verb(&self, verb: &str) -> Option<LaneControlVerb>; |
| 48 | fn execute_control( |
| 49 | &mut self, |
| 50 | verb: LaneControlVerb, |
| 51 | target: Option<&str>, |
| 52 | ) -> ControlReceiptOutcome; |
| 53 | } |
| 54 | |
| 55 | pub trait CommandFleetContext { |
| 56 | fn control_operations(&self) -> Vec<ControlOperationHelp>; |
| 57 | fn resolve_control_verb(&self, verb: &str) -> Option<FleetControlVerb>; |
| 58 | fn run_control( |
| 59 | &mut self, |
| 60 | verb: FleetControlVerb, |
| 61 | target: Option<&str>, |
| 62 | ) -> ControlReceiptOutcome; |
| 63 | fn fleet_models_text(&self) -> String; |
| 64 | fn save_route(&mut self, kind: FleetRouteSaveKind) -> String; |
| 65 | fn usage_text(&self, kind: FleetUsageKind) -> String; |
| 66 | fn prepare_workers_view(&mut self); |
| 67 | fn run_project_context(&mut self, args: Option<&str>) -> ControlReceiptOutcome; |
| 68 | fn run_project_board(&mut self, args: Option<&str>) -> ControlReceiptOutcome; |
| 69 | } |
| 70 | |
| 71 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 72 | pub enum FleetAction { |
| 73 | OpenMissions, |
| 74 | OpenRoster, |
| 75 | OpenSetup, |
| 76 | OpenList, |
| 77 | OpenWorkers, |
| 78 | AddModel { |
| 79 | provider: String, |
| 80 | model: String, |
| 81 | roles: Vec<String>, |
| 82 | }, |
| 83 | RemoveModel { |
| 84 | provider: String, |
| 85 | model: String, |
| 86 | }, |
| 87 | } |
| 88 |