-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scenery and node status view components (#261)
* add scenery and node status view components * update dependencies * update import * fix linting issue? * fix style errors * fix another style error * attempt #2 * update pyproject.toml + Readme + License + tox (#264) * update pyproject.toml + Readme + License + tox * fix issue * fix issue * update the pyproject.toml * fix code style issue * add optislang-dash-lib package --------- Co-authored-by: Jerfried Boly <[email protected]>
- Loading branch information
Showing
5 changed files
with
50 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 14 additions & 7 deletions
21
.../ansys/solutions/{{cookiecutter.__solution_name_slug}}/ui/monitoring_tabs/scenery_page.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 15 additions & 43 deletions
58
...olutions/{{cookiecutter.__solution_name_slug}}/ui/monitoring_tabs/status_overview_page.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,24 @@ | ||
# ©2023, ANSYS Inc. Unauthorized use, distribution or duplication is prohibited. | ||
|
||
"""Frontend of the second step.""" | ||
"""Frontend of the node status overview tab.""" | ||
|
||
from dash import dash_table | ||
from dash_extensions.enrich import html | ||
import pandas as pd | ||
import optislang_dash_lib | ||
|
||
from ansys.solutions.{{ cookiecutter.__solution_name_slug }}.solution.monitoring_step import MonitoringStep | ||
|
||
|
||
class StatusOverviewTable(object): | ||
"""""" | ||
|
||
def __init__(self, data): | ||
"""Constructor.""" | ||
|
||
self.data = data | ||
|
||
def render(self): | ||
"""Generate table.""" | ||
|
||
if isinstance(self.data, pd.DataFrame): | ||
return dash_table.DataTable( | ||
data=self.data.to_dict("records"), | ||
columns=[{"name": i, "id": i, "type": "text"} for i in self.data.columns], | ||
fixed_rows={"headers": True}, | ||
sort_action="native", | ||
row_selectable="multi", | ||
page_action="native", | ||
style_header={ | ||
"textAlign": "center", | ||
"font_family": "Roboto", | ||
"font_size": "15px", | ||
"fontWeight": "bold", | ||
}, | ||
style_cell={ | ||
"textAlign": "center", | ||
"font_family": "Roboto", | ||
"font_size": "15px", | ||
}, | ||
) | ||
|
||
|
||
def layout(monitoring_step: MonitoringStep): | ||
"""Layout of the status overview tab UI.""" | ||
|
||
monitoring_step.get_status_overview() | ||
|
||
status_overview_table = StatusOverviewTable(pd.DataFrame(monitoring_step.status_overview)) | ||
|
||
return html.Div([status_overview_table.render()]) | ||
"""Layout of the node status overview tab.""" | ||
|
||
monitoring_step.get_project_state() # fetches data on page load | ||
|
||
return html.Div( | ||
id="node-status-view", | ||
children=[ | ||
optislang_dash_lib.Nodestatusviewcomponent( | ||
id="node-status-view-component", | ||
project_state=monitoring_step.project_state, | ||
), | ||
], | ||
) |