PyAutomationIO 0.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. automation/__init__.py +46 -0
  2. automation/alarms/__init__.py +563 -0
  3. automation/alarms/states.py +192 -0
  4. automation/alarms/trigger.py +64 -0
  5. automation/buffer.py +132 -0
  6. automation/core.py +1775 -0
  7. automation/dbmodels/__init__.py +23 -0
  8. automation/dbmodels/alarms.py +524 -0
  9. automation/dbmodels/core.py +86 -0
  10. automation/dbmodels/events.py +153 -0
  11. automation/dbmodels/logs.py +155 -0
  12. automation/dbmodels/machines.py +181 -0
  13. automation/dbmodels/opcua.py +81 -0
  14. automation/dbmodels/opcua_server.py +174 -0
  15. automation/dbmodels/tags.py +921 -0
  16. automation/dbmodels/users.py +259 -0
  17. automation/extensions/__init__.py +15 -0
  18. automation/extensions/api.py +149 -0
  19. automation/extensions/cors.py +18 -0
  20. automation/filter/__init__.py +19 -0
  21. automation/iad/__init__.py +3 -0
  22. automation/iad/frozen_data.py +54 -0
  23. automation/iad/out_of_range.py +51 -0
  24. automation/iad/outliers.py +51 -0
  25. automation/logger/__init__.py +0 -0
  26. automation/logger/alarms.py +426 -0
  27. automation/logger/core.py +265 -0
  28. automation/logger/datalogger.py +646 -0
  29. automation/logger/events.py +194 -0
  30. automation/logger/logdict.py +53 -0
  31. automation/logger/logs.py +203 -0
  32. automation/logger/machines.py +248 -0
  33. automation/logger/opcua_server.py +130 -0
  34. automation/logger/users.py +96 -0
  35. automation/managers/__init__.py +4 -0
  36. automation/managers/alarms.py +455 -0
  37. automation/managers/db.py +328 -0
  38. automation/managers/opcua_client.py +186 -0
  39. automation/managers/state_machine.py +183 -0
  40. automation/models.py +174 -0
  41. automation/modules/__init__.py +14 -0
  42. automation/modules/alarms/__init__.py +0 -0
  43. automation/modules/alarms/resources/__init__.py +10 -0
  44. automation/modules/alarms/resources/alarms.py +280 -0
  45. automation/modules/alarms/resources/summary.py +79 -0
  46. automation/modules/events/__init__.py +0 -0
  47. automation/modules/events/resources/__init__.py +10 -0
  48. automation/modules/events/resources/events.py +83 -0
  49. automation/modules/events/resources/logs.py +109 -0
  50. automation/modules/tags/__init__.py +0 -0
  51. automation/modules/tags/resources/__init__.py +8 -0
  52. automation/modules/tags/resources/tags.py +201 -0
  53. automation/modules/users/__init__.py +2 -0
  54. automation/modules/users/resources/__init__.py +10 -0
  55. automation/modules/users/resources/models/__init__.py +2 -0
  56. automation/modules/users/resources/models/roles.py +5 -0
  57. automation/modules/users/resources/models/users.py +14 -0
  58. automation/modules/users/resources/roles.py +38 -0
  59. automation/modules/users/resources/users.py +113 -0
  60. automation/modules/users/roles.py +121 -0
  61. automation/modules/users/users.py +335 -0
  62. automation/opcua/__init__.py +1 -0
  63. automation/opcua/models.py +541 -0
  64. automation/opcua/subscription.py +259 -0
  65. automation/pages/__init__.py +0 -0
  66. automation/pages/alarms.py +34 -0
  67. automation/pages/alarms_history.py +21 -0
  68. automation/pages/assets/styles.css +7 -0
  69. automation/pages/callbacks/__init__.py +28 -0
  70. automation/pages/callbacks/alarms.py +218 -0
  71. automation/pages/callbacks/alarms_summary.py +20 -0
  72. automation/pages/callbacks/db.py +222 -0
  73. automation/pages/callbacks/filter.py +238 -0
  74. automation/pages/callbacks/machines.py +29 -0
  75. automation/pages/callbacks/machines_detailed.py +581 -0
  76. automation/pages/callbacks/opcua.py +266 -0
  77. automation/pages/callbacks/opcua_server.py +244 -0
  78. automation/pages/callbacks/tags.py +495 -0
  79. automation/pages/callbacks/trends.py +119 -0
  80. automation/pages/communications.py +129 -0
  81. automation/pages/components/__init__.py +123 -0
  82. automation/pages/components/alarms.py +151 -0
  83. automation/pages/components/alarms_summary.py +45 -0
  84. automation/pages/components/database.py +128 -0
  85. automation/pages/components/gaussian_filter.py +69 -0
  86. automation/pages/components/machines.py +396 -0
  87. automation/pages/components/opcua.py +384 -0
  88. automation/pages/components/opcua_server.py +53 -0
  89. automation/pages/components/tags.py +253 -0
  90. automation/pages/components/trends.py +66 -0
  91. automation/pages/database.py +26 -0
  92. automation/pages/filter.py +55 -0
  93. automation/pages/machines.py +20 -0
  94. automation/pages/machines_detailed.py +41 -0
  95. automation/pages/main.py +63 -0
  96. automation/pages/opcua_server.py +28 -0
  97. automation/pages/tags.py +40 -0
  98. automation/pages/trends.py +35 -0
  99. automation/singleton.py +30 -0
  100. automation/state_machine.py +1672 -0
  101. automation/tags/__init__.py +2 -0
  102. automation/tags/cvt.py +1198 -0
  103. automation/tags/filter.py +55 -0
  104. automation/tags/tag.py +418 -0
  105. automation/tests/__init__.py +10 -0
  106. automation/tests/test_alarms.py +110 -0
  107. automation/tests/test_core.py +257 -0
  108. automation/tests/test_unit.py +21 -0
  109. automation/tests/test_user.py +155 -0
  110. automation/utils/__init__.py +164 -0
  111. automation/utils/decorators.py +222 -0
  112. automation/utils/npw.py +294 -0
  113. automation/utils/observer.py +21 -0
  114. automation/utils/units.py +118 -0
  115. automation/variables/__init__.py +55 -0
  116. automation/variables/adimentional.py +30 -0
  117. automation/variables/current.py +71 -0
  118. automation/variables/density.py +115 -0
  119. automation/variables/eng_time.py +68 -0
  120. automation/variables/force.py +90 -0
  121. automation/variables/length.py +104 -0
  122. automation/variables/mass.py +80 -0
  123. automation/variables/mass_flow.py +101 -0
  124. automation/variables/percentage.py +30 -0
  125. automation/variables/power.py +113 -0
  126. automation/variables/pressure.py +93 -0
  127. automation/variables/temperature.py +168 -0
  128. automation/variables/volume.py +70 -0
  129. automation/variables/volumetric_flow.py +100 -0
  130. automation/workers/__init__.py +2 -0
  131. automation/workers/logger.py +164 -0
  132. automation/workers/state_machine.py +207 -0
  133. automation/workers/worker.py +36 -0
  134. pyautomationio-0.0.0.dist-info/METADATA +198 -0
  135. pyautomationio-0.0.0.dist-info/RECORD +138 -0
  136. pyautomationio-0.0.0.dist-info/WHEEL +5 -0
  137. pyautomationio-0.0.0.dist-info/licenses/LICENSE +21 -0
  138. pyautomationio-0.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,129 @@
1
+ import dash
2
+ import dash_mantine_components as dmc
3
+ import dash_bootstrap_components as dbc
4
+ from automation.pages.components import Components
5
+ from automation.pages.components.opcua import OPCUAComponents
6
+
7
+ # Set React version to 18.2.0
8
+ dash._dash_renderer._set_react_version('18.2.0')
9
+ dash.register_page(__name__, path="/")
10
+ opcua_components = OPCUAComponents()
11
+
12
+
13
+ layout = dmc.MantineProvider(
14
+ [
15
+ dbc.Container(
16
+ [
17
+ dash.html.Div(
18
+ [
19
+ Components.modal_error(
20
+ title="Success",
21
+ modal_id="modal-success-opcua-connection",
22
+ button_close_id="close-success-opcua-connection",
23
+ body_id="modal-success-opcua-connection-body"
24
+ ),
25
+ Components.modal_error(
26
+ title="Error",
27
+ modal_id="modal-error-opcua-connection",
28
+ button_close_id="close-error-opcua-connection",
29
+ body_id="modal-error-opcua-connection-body"
30
+ ),
31
+ dbc.Row(
32
+ [
33
+ dbc.Col(
34
+ [
35
+ dash.html.H1("OPCUA")
36
+ ],
37
+ width=6,
38
+ className="col-md-2"
39
+ ),
40
+
41
+ dbc.Col(
42
+ [
43
+ dash.html.Div(
44
+ [
45
+ dbc.Button(
46
+ "Create",
47
+ color="info",
48
+ outline=True,
49
+ id="add_server_button",
50
+ ),
51
+ dbc.Button(
52
+ "Remove",
53
+ color="danger",
54
+ outline=True,
55
+ disabled=False,
56
+ id="remove_server_button"
57
+ ),
58
+ dbc.Button(
59
+ "Download",
60
+ color="primary",
61
+ outline=True,
62
+ disabled=False,
63
+ id="download_node_info_button"
64
+ ),
65
+ ],
66
+ className="d-grid gap-2 d-flex justify-content-end",
67
+ )
68
+ ],
69
+ # width={
70
+ # "size": 3,
71
+ # "offset": 7
72
+ # }
73
+ width=6,
74
+ className="col-md-10"
75
+ )
76
+ ]
77
+ )
78
+ ]
79
+ ),
80
+
81
+ dash.html.Div(
82
+ [
83
+ dbc.Row(
84
+ [
85
+ dbc.Col(
86
+ [],
87
+ id="server_tree",
88
+ width=12,
89
+ className="col-md-2 mb-3"
90
+ ),
91
+ dbc.Col(
92
+ opcua_components.data_access_view_table(),
93
+ id="data_access_view_table",
94
+ width=12,
95
+ className="col-md-10"
96
+ )
97
+ ]
98
+ ),
99
+ ]
100
+ ),
101
+
102
+ OPCUAComponents.add_server(
103
+ title="Add Server",
104
+ modal_id="add_server_modal",
105
+ body_id="add_server_body_modal",
106
+ ok_button_id="add_server_ok_button_modal",
107
+ cancel_button_id="add_server_cancel_button_modal"
108
+ ),
109
+ OPCUAComponents.remove_server(
110
+ title="Remove Server",
111
+ modal_id="remove_server_modal",
112
+ body_id="remove_server_body_modal",
113
+ ok_button_id="remove_server_ok_button_modal",
114
+ cancel_button_id="remove_server_cancel_button_modal"
115
+ ),
116
+ OPCUAComponents.download_node_info(
117
+ title="Download Node Info",
118
+ modal_id="download_node_info_modal",
119
+ body_id="download_node_info_body_modal",
120
+ ok_button_id="download_node_info_ok_button_modal",
121
+ cancel_button_id="download_node_info_cancel_button_modal"
122
+ ),
123
+ dash.dcc.Download(id="download")
124
+ ],
125
+ fluid=False,
126
+ className="my-3"
127
+ ),
128
+ ]
129
+ )
@@ -0,0 +1,123 @@
1
+ import dash
2
+ import dash_bootstrap_components as dbc
3
+ from dash import html
4
+
5
+ class Components:
6
+
7
+ @classmethod
8
+ def page_title(cls, title:str):
9
+
10
+ return dash.html.H1(title)
11
+
12
+ @classmethod
13
+ def modal_error(cls, title:str, modal_id:str, button_close_id:str, body_id:str):
14
+
15
+ return dash.html.Div(
16
+ [
17
+ dbc.Modal(
18
+ [
19
+ dbc.ModalHeader(dbc.ModalTitle(title), close_button=True),
20
+ dbc.ModalBody("This modal is vertically centered", id=body_id),
21
+ dbc.ModalFooter(
22
+ dbc.Button(
23
+ "Close",
24
+ id=button_close_id,
25
+ className="ms-auto",
26
+ n_clicks=0,
27
+ )
28
+ ),
29
+ ],
30
+ id=modal_id,
31
+ centered=True,
32
+ is_open=False,
33
+ ),
34
+ ]
35
+ )
36
+
37
+ @classmethod
38
+ def modal_confirm(cls, title:str, modal_id:str, body_id:str, yes_button_id:str, no_button_id:str):
39
+
40
+ return dash.html.Div(
41
+ [
42
+ dbc.Modal(
43
+ [
44
+ dbc.ModalHeader(dbc.ModalTitle(title), close_button=True),
45
+ dbc.ModalBody("This modal is vertically centered", id=body_id),
46
+ dbc.ModalFooter(
47
+ [
48
+ dbc.Button(
49
+ "Yes",
50
+ id=yes_button_id,
51
+ className="ms-auto",
52
+ n_clicks=0,
53
+ ),
54
+ dbc.Button(
55
+ "No",
56
+ id=no_button_id,
57
+ className="ms-auto",
58
+ n_clicks=0,
59
+ )
60
+ ]
61
+ ),
62
+ ],
63
+ id=modal_id,
64
+ centered=True,
65
+ is_open=False,
66
+ ),
67
+ ]
68
+ )
69
+
70
+ @classmethod
71
+ def navbar(cls)->dbc.NavbarSimple:
72
+
73
+ return dbc.NavbarSimple(
74
+ children=[
75
+ dbc.DropdownMenu(
76
+ children=[
77
+ dbc.DropdownMenuItem("Communications", header=True),
78
+ dbc.DropdownMenuItem("OPCUA Client", href="/"),
79
+ dbc.DropdownMenuItem("OPCUA Server", href="/opcua-server"),
80
+ ],
81
+ nav=True,
82
+ in_navbar=True,
83
+ label="Communications",
84
+ ),
85
+ dbc.NavItem(dbc.NavLink("Database", href="/database")),
86
+ dbc.DropdownMenu(
87
+ children=[
88
+ dbc.DropdownMenuItem("Tags", header=True),
89
+ dbc.DropdownMenuItem("Definition", href="/tags", id="tags_definition_link"),
90
+ dbc.DropdownMenuItem("Trends", href="/trends"),
91
+ dbc.DropdownMenuItem("Filter", href="/filter"),
92
+ ],
93
+ nav=True,
94
+ in_navbar=True,
95
+ label="Tags",
96
+ ),
97
+ dbc.DropdownMenu(
98
+ children=[
99
+ dbc.DropdownMenuItem("Alarms", header=True),
100
+ dbc.DropdownMenuItem("Definition", href="/alarms"),
101
+ dbc.DropdownMenuItem("History", href="/alarms-history"),
102
+ ],
103
+ nav=True,
104
+ in_navbar=True,
105
+ label="Alarms",
106
+ ),
107
+ dbc.DropdownMenu(
108
+ children=[
109
+ dbc.DropdownMenuItem("Machines", header=True),
110
+ dbc.DropdownMenuItem("Summary", href="/machines"),
111
+ dbc.DropdownMenuItem("Detailed", href="/machines-detailed"),
112
+ ],
113
+ nav=True,
114
+ in_navbar=True,
115
+ label="Machines",
116
+ ),
117
+ ],
118
+ fluid=True, # Navbar container is modified.
119
+ brand=html.Span("PyAutomation Configuration", className="custom-brand-class mx-2"), # Styles are applied to the HTML brand element.
120
+ brand_href="/",
121
+ color="primary",
122
+ dark=True,
123
+ )
@@ -0,0 +1,151 @@
1
+ import dash
2
+ import dash_bootstrap_components as dbc
3
+ from ... import PyAutomation
4
+
5
+ app = PyAutomation()
6
+
7
+ class AlarmsComponents:
8
+
9
+ @classmethod
10
+ def create_alarm_form(cls):
11
+ r"""
12
+ Documentation here
13
+ """
14
+ return dash.html.Div(
15
+ [
16
+ dash.dcc.Location(id='alarms_page', refresh=False),
17
+ dbc.Accordion(
18
+ [
19
+ dbc.AccordionItem(
20
+ [
21
+ dbc.Row(
22
+ [
23
+ dbc.Col(
24
+ dbc.InputGroup(
25
+ [
26
+ dbc.InputGroupText("Tag"),
27
+ dbc.Select(
28
+ options=[
29
+ {"label": tag["name"], "value": tag["name"]} for tag in app.cvt.get_tags()
30
+ ],
31
+ id="tag_alarm_input"
32
+ ),
33
+ ],
34
+ size="md",
35
+ ),
36
+ width=12,
37
+ className="col-sm-12 col-md-3"
38
+ ),
39
+
40
+ dbc.Col(
41
+ dbc.InputGroup(
42
+ [
43
+ dbc.Input(placeholder="Alarm Name", id="alarm_name_input"),
44
+ ],
45
+ size="md"
46
+ ),
47
+ width=12,
48
+ className="col-sm-12 col-md-3"
49
+ ),
50
+
51
+ dbc.Col(
52
+ dbc.InputGroup(
53
+ [
54
+ dbc.InputGroupText(dbc.RadioButton(id="alarm_description_radio_button"), class_name="radiobutton-box"),
55
+ dbc.Input(placeholder="Alarm Description (Optional)", id="alarm_description_input", disabled=True),
56
+ ],
57
+ size="md"
58
+ ),
59
+ width=12,
60
+ className="col-sm-12 col-md-6"
61
+ ),
62
+
63
+ dbc.Col(
64
+ dbc.InputGroup(
65
+ [
66
+ dbc.InputGroupText("Type"), dbc.Select(options=[], id="alarm_type_input"),
67
+ ],
68
+ size="md"
69
+ ),
70
+ width=12,
71
+ className="col-sm-12 col-md-3"
72
+ ),
73
+
74
+ dbc.Col(
75
+ dbc.InputGroup(
76
+ [
77
+ dbc.Input(placeholder="Trigger Value", id="alarm_trigger_value_input"),
78
+ dbc.InputGroupText('', id="alarm_trigger_unit")
79
+ ],
80
+ size="md"
81
+ ),
82
+ width=12,
83
+ className="col-sm-12 col-md-3"
84
+ ),
85
+
86
+ dbc.Col(
87
+ dbc.Button(
88
+ "Create",
89
+ color="primary",
90
+ outline=True,
91
+ disabled=True,
92
+ id="create_alarm_button",
93
+ className="w-100"
94
+ ),
95
+ width="auto",
96
+ className="d-flex justify-content-center align-items-center"
97
+ ),
98
+ ],
99
+ className="form g-3"
100
+ ),
101
+ ],
102
+ title="Create Alarm",
103
+ className="my-3"
104
+ )
105
+ ],
106
+ start_collapsed=True,
107
+ )
108
+ ]
109
+ )
110
+
111
+ @classmethod
112
+ def alarms_table(cls)->dash.dash_table.DataTable:
113
+ r"""
114
+ Documentation here
115
+ """
116
+ return dbc.Container(
117
+ dbc.Row(
118
+ dbc.Col(
119
+ dash.dash_table.DataTable(
120
+ data=[],
121
+ columns=[
122
+ {'name': 'id', 'id': 'id', 'editable': False},
123
+ {'name': 'name', 'id': 'name'},
124
+ {'name': 'tag', 'id': 'tag', 'presentation': 'dropdown'},
125
+ {'name': 'state', 'id': 'state', 'editable': False},
126
+ {'name': 'description', 'id': 'description'},
127
+ {'name': 'alarm_type', 'id': 'alarm_type', 'presentation': 'dropdown'},
128
+ {'name': 'trigger_value', 'id': 'trigger_value', 'type': "numeric"}
129
+ ],
130
+ id="alarms_datatable",
131
+ filter_action="native",
132
+ sort_action="native",
133
+ sort_mode="multi",
134
+ row_deletable=False,
135
+ selected_columns=[],
136
+ page_action="native",
137
+ page_current= 0,
138
+ page_size= 10,
139
+ persistence=True,
140
+ editable=True,
141
+ persisted_props=['data'],
142
+ export_format='xlsx',
143
+ export_headers='display',
144
+ style_table={'overflowX': 'auto'},
145
+ ),
146
+ width=12,
147
+ )
148
+ ),
149
+ fluid=True,
150
+ className="mx-0 px-0"
151
+ )
@@ -0,0 +1,45 @@
1
+ import dash
2
+ import dash_bootstrap_components as dbc
3
+
4
+ class AlarmSummaryComponents:
5
+
6
+ @classmethod
7
+ def alarm_summary_table(cls)->dash.dash_table.DataTable:
8
+ r"""
9
+ Documentation here
10
+ """
11
+ return dbc.Container(
12
+ dbc.Row(
13
+ dbc.Col(
14
+ dash.dash_table.DataTable(
15
+ data=[],
16
+ columns=[
17
+ {'name': 'id', 'id': 'id', 'editable': False},
18
+ {'name': 'name', 'id': 'name', 'editable': False},
19
+ {'name': 'tag', 'id': 'tag', 'editable': False},
20
+ {'name': 'description', 'id': 'description', 'editable': False},
21
+ {'name': 'state', 'id': 'state', 'editable': False},
22
+ {'name': 'alarm_time', 'id': 'alarm_time', 'editable': False},
23
+ {'name': 'ack_time', 'id': 'ack_time', 'editable': False}
24
+ ],
25
+ id="alarms_summary_datatable",
26
+ filter_action="native",
27
+ sort_action="native",
28
+ sort_mode="multi",
29
+ selected_columns=[],
30
+ page_action="native",
31
+ page_current= 0,
32
+ page_size= 10,
33
+ persistence=True,
34
+ editable=True,
35
+ persisted_props=['data'],
36
+ export_format='xlsx',
37
+ export_headers='display',
38
+ style_table={'overflowX': 'auto'},
39
+ ),
40
+ width=12,
41
+ )
42
+ ),
43
+ fluid=True,
44
+ className="mx-0 px-0"
45
+ )
@@ -0,0 +1,128 @@
1
+ import dash
2
+ import dash_bootstrap_components as dbc
3
+
4
+ class DatabaseComponents:
5
+
6
+ @classmethod
7
+ def create_db_config_form(cls):
8
+ r"""
9
+ Documentation here
10
+ """
11
+ return dash.html.Div(
12
+ [
13
+ dash.dcc.Location(id='database_page', refresh=False),
14
+ dbc.Accordion(
15
+ [
16
+
17
+ dbc.AccordionItem(
18
+ [
19
+ dbc.Row(
20
+ [
21
+ dbc.Col([
22
+ dbc.InputGroup(
23
+ [
24
+ dbc.InputGroupText("Type"),
25
+ dbc.Select(
26
+ options=[
27
+ {"label": "postgresql", "value": "postgresql"},
28
+ {"label": "mysql", "value": "mysql"},
29
+ {"label": "sqlite", "value": "sqlite"}
30
+ ],
31
+ id="db_type_input"
32
+ ),
33
+
34
+ ],
35
+ size="md"
36
+ )
37
+ ],
38
+ width=12,
39
+ className="col-sm-12 col-md-2"
40
+ ),
41
+ dbc.Col(
42
+ [
43
+ dbc.InputGroup(
44
+ [
45
+ dbc.Input(placeholder="DB Name", id="db_name_input")
46
+ ],
47
+ size="md"
48
+ )
49
+ ],
50
+ width=12,
51
+ className="col-sm-12 col-md-2"
52
+ ),
53
+
54
+ dbc.Col(
55
+ [
56
+ dbc.InputGroup(
57
+ [
58
+ dbc.Input(placeholder="DB Host", id="db_host_input")
59
+ ],
60
+ size="md"
61
+ )
62
+ ],
63
+ width=12,
64
+ className="col-sm-12 col-md-2"
65
+ ),
66
+
67
+ dbc.Col(
68
+ [
69
+ dbc.InputGroup(
70
+ [
71
+ dbc.Input(placeholder="DB Port", id="db_port_input", type="number")
72
+ ],
73
+ size="md"
74
+ )
75
+ ],
76
+ width=12,
77
+ className="col-sm-12 col-md-1"
78
+ ),
79
+
80
+ dbc.Col(
81
+ [
82
+ dbc.InputGroup(
83
+ [
84
+ dbc.Input(placeholder="DB User", id="db_user_input")
85
+ ],
86
+ size="md"
87
+ )
88
+ ],
89
+ width=12,
90
+ className="col-sm-12 col-md-2"
91
+ ),
92
+
93
+ dbc.Col(
94
+ [
95
+ dbc.InputGroup(
96
+ [
97
+ dbc.Input(type="password", placeholder="DB Password", id="db_password_input")
98
+ ],
99
+ size="md")
100
+ ],
101
+ width=12,
102
+ className="col-sm-12 col-md-3"
103
+ ),
104
+
105
+ dbc.Col(
106
+ dbc.Button(
107
+ "Connect",
108
+ color="primary",
109
+ outline=True,
110
+ disabled=True,
111
+ id="connect_disconnect_db_button",
112
+ className="w-100"
113
+ ),
114
+ width="auto",
115
+ className="d-flex justify-content-center align-items-center"
116
+ ),
117
+ ],
118
+ className="form g-3"
119
+ ),
120
+ ],
121
+ title="Connection Settings",
122
+ className="my-3"
123
+ )
124
+ ],
125
+ start_collapsed=False,
126
+ )
127
+ ]
128
+ )
@@ -0,0 +1,69 @@
1
+ import dash
2
+ import plotly.graph_objects as go
3
+
4
+ fig = go.Figure()
5
+
6
+ class FilterComponents:
7
+
8
+ @classmethod
9
+ def tags(cls)->dash.dcc.Dropdown:
10
+ r"""
11
+ Documentation here
12
+ """
13
+ return dash.dcc.Dropdown(
14
+ options = [],
15
+ multi=True,
16
+ id="filter_tags_dropdown",
17
+ persistence=True
18
+ )
19
+
20
+ @classmethod
21
+ def last_values(cls)->dash.dcc.Dropdown:
22
+ r"""
23
+ Documentation here
24
+ """
25
+ return dash.dcc.Dropdown(
26
+ options=[
27
+ {'label': 'last 10 seconds', 'value': 10},
28
+ {'label': 'last 30 seconds', 'value': 30},
29
+ {'label': 'last minute', 'value': 60},
30
+ {'label': 'last 2 min.', 'value': 2 * 60},
31
+ {'label': 'last 5 min.', 'value': 5 * 60},
32
+ {'label': 'last 10 min.', 'value': 10 * 60}
33
+ ],
34
+ value=10,
35
+ clearable=False,
36
+ id="filter_last_values_dropdown"
37
+ )
38
+
39
+ @classmethod
40
+ def current_value_table(cls)->dash.dash_table.DataTable:
41
+ r"""
42
+ Documentation here
43
+ """
44
+ return dash.dash_table.DataTable(
45
+ data=[],
46
+ columns=[
47
+ {'name': 'id', 'id': 'id', 'editable': False},
48
+ {'name': 'display_name', 'id': 'display_name', 'editable': False},
49
+ {'name': 'gaussian_filter', 'id': 'gaussian_filter', 'type': 'boolean', 'editable': True},
50
+ {'name': 'threshold', 'id': 'threshold', 'type': 'numeric', 'editable': True},
51
+ {'name': 'R-value [%]', 'id': 'R-value', 'type': 'numeric', 'editable': True},
52
+ ],
53
+ id="filter_cvt_datatable",
54
+ selected_columns=[],
55
+ page_action="native",
56
+ page_current= 0,
57
+ page_size= 10,
58
+ persistence=True,
59
+ persisted_props=['data']
60
+ )
61
+
62
+ @classmethod
63
+ def plot(cls)->dash.dcc.Graph:
64
+ r"""
65
+ Documentation here
66
+ """
67
+ return dash.dcc.Graph(
68
+ figure=fig,
69
+ id="filter_trends_figure")