node_launchpad/
action.rs

1// Copyright 2024 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use crate::upnp::UpnpSupport;
10use crate::{
11    connection_mode::ConnectionMode,
12    mode::{InputMode, Scene},
13    node_stats::NodeStats,
14};
15use serde::{Deserialize, Serialize};
16use std::path::PathBuf;
17use strum::Display;
18
19#[derive(Debug, Clone, PartialEq, Eq, Serialize, Display, Deserialize)]
20pub enum Action {
21    StatusActions(StatusActions),
22    OptionsActions(OptionsActions),
23
24    SwitchScene(Scene),
25    SwitchInputMode(InputMode),
26
27    StoreStorageDrive(PathBuf, String),
28    StoreConnectionMode(ConnectionMode),
29    StorePortRange(u32, u32),
30    StoreRewardsAddress(String),
31    StoreNodesToStart(usize),
32
33    SetUpnpSupport(UpnpSupport),
34
35    Tick,
36    Render,
37    Resize(u16, u16),
38    Suspend,
39    Resume,
40    Quit,
41    Refresh,
42    Error(String),
43    Help,
44    Noop,
45}
46
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Display, Deserialize)]
48pub enum StatusActions {
49    StartNodes,
50    StopNodes,
51    StartNodesCompleted,
52    StopNodesCompleted,
53    ResetNodesCompleted { trigger_start_node: bool },
54    UpdateNodesCompleted,
55    SuccessfullyDetectedNatStatus,
56    ErrorWhileRunningNatDetection,
57    ErrorLoadingNodeRegistry { raw_error: String },
58    ErrorGettingNodeRegistryPath { raw_error: String },
59    ErrorScalingUpNodes { raw_error: String },
60    ErrorStoppingNodes { raw_error: String },
61    ErrorResettingNodes { raw_error: String },
62    ErrorUpdatingNodes { raw_error: String },
63    NodesStatsObtained(NodeStats),
64
65    TriggerManageNodes,
66    TriggerRewardsAddress,
67    TriggerNodeLogs,
68
69    PreviousTableItem,
70    NextTableItem,
71}
72
73#[derive(Debug, Clone, PartialEq, Eq, Serialize, Display, Deserialize)]
74pub enum OptionsActions {
75    ResetNodes,
76    UpdateNodes,
77
78    TriggerChangeDrive,
79    TriggerChangeConnectionMode,
80    TriggerChangePortRange,
81    TriggerRewardsAddress,
82    TriggerUpdateNodes,
83    TriggerResetNodes,
84    TriggerAccessLogs,
85    UpdateConnectionMode(ConnectionMode),
86    UpdatePortRange(u32, u32),
87    UpdateRewardsAddress(String),
88    UpdateStorageDrive(PathBuf, String),
89}