1use opcua::types::NodeId;
2
3use crate::model::DetailTab;
4use crate::types::{
5 AuthMode, EndpointInfo, LogLine, MethodCallOutcome, MethodSignature, NodeSummary,
6 ReferenceRow, SecurityMode, TreeChild, WriteTarget,
7};
8
9#[derive(Debug, Clone)]
10pub enum UiAction {
11 EndpointEdited(String),
12 ConnectClicked,
13 DisconnectClicked,
14 NodeToggleExpand(NodeId),
15 NodeSelected(NodeId),
16 TabSelected(DetailTab),
17 RefreshClicked,
18 OpenEndpointPicker,
19 CloseEndpointPicker,
20 ForceRefreshEndpoints,
21 SelectEndpoint(EndpointInfo),
22 ClearSelectedEndpoint,
23 SetAuthMode(AuthMode),
24 SetEndpointModeFilter(SecurityMode),
25 AuthUsernameEdited(String),
26 AuthPasswordEdited(String),
27 AuthCertPathEdited(String),
28 AuthKeyPathEdited(String),
29 PickAuthCertPath,
30 PickAuthKeyPath,
31 ConfirmConnect,
32 CopyPath(NodeId),
33 CopyNodeId(NodeId),
34 CopyNodeValue,
35 ClearSelection,
36 OpenMethodCall(NodeId),
37 CloseMethodCall,
38 MethodArgEdited { index: usize, value: String },
39 CallMethodConfirmed,
40 Subscribe(NodeId),
41 Unsubscribe(NodeId),
42 OpenAttributeEdit { node: NodeId, attr_name: String },
43 CloseAttributeEdit,
44 AttributeValueEdited(String),
45 ConfirmAttributeEdit,
46}
47
48#[derive(Debug)]
49pub enum UiUpdate {
50 ConnectStarted,
51 ConnectFinished(Result<(), String>),
52 DisconnectStarted,
53 DisconnectFinished,
54 ConnectionLost,
55 Reconnected {
56 fresh: bool,
57 },
58 ReconnectFailed(String),
59 ChildrenLoaded {
60 parent: NodeId,
61 children: Result<Vec<TreeChild>, String>,
62 },
63 SummaryLoaded {
64 node: NodeId,
65 summary: Result<NodeSummary, String>,
66 },
67 ReferencesLoaded {
68 node: NodeId,
69 refs: Result<Vec<ReferenceRow>, String>,
70 },
71 EndpointsDiscovered {
72 url: String,
73 result: Result<Vec<EndpointInfo>, String>,
74 },
75 CertPathPicked(String),
76 KeyPathPicked(String),
77 FilePickerClosed,
78 PathReady {
79 node: NodeId,
80 path: Result<String, String>,
81 },
82 SelectionPathResolved {
83 url: String,
84 path: Vec<NodeId>,
85 },
86 RestoreSelection(NodeId),
87 MethodSignatureLoaded {
88 node: NodeId,
89 result: Result<MethodSignature, String>,
90 },
91 MethodCallFinished {
92 node: NodeId,
93 result: Result<MethodCallOutcome, String>,
94 },
95 SubscribeFinished {
96 node: NodeId,
97 result: Result<String, String>,
98 },
99 UnsubscribeFinished {
100 node: NodeId,
101 result: Result<(), String>,
102 },
103 DataChange {
104 node: NodeId,
105 value: String,
106 status: String,
107 timestamp: Option<String>,
108 },
109 AttributeEditTargetLoaded {
110 node: NodeId,
111 attr_name: String,
112 result: Result<WriteTarget, String>,
113 },
114 AttributeWriteFinished {
115 node: NodeId,
116 attr_name: String,
117 result: Result<(), String>,
118 },
119 Log(LogLine),
120}