X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fdash%2Fapp%2Fpal%2Ftrending%2Flayout.py;h=690a9b72e0a2d50747c2947bb5296a4112e9cc0c;hp=11900c68fe2c3cf7518f5eb5b17c2f8e4591a87b;hb=dcdb82a6a1ae769c72546d642b1c3a38299d97b8;hpb=a26be9497d6c268f135d81bc3ad5572e16b23f19 diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py index 11900c68fe..690a9b72e0 100644 --- a/resources/tools/dash/app/pal/trending/layout.py +++ b/resources/tools/dash/app/pal/trending/layout.py @@ -35,14 +35,14 @@ class Layout: """ """ - NO_GRAPH = {"data": [], "layout": {}, "frames": []} + STYLE_DISABLED = {"display": "none"} + STYLE_ENABLED = {"display": "inherit"} CL_ALL_DISABLED = [{ "label": "All", "value": "all", "disabled": True }] - CL_ALL_ENABLED = [{ "label": "All", "value": "all", @@ -154,6 +154,7 @@ class Layout: ), dcc.Loading( dbc.Offcanvas( + class_name="w-50", id="offcanvas-metadata", title="Throughput And Latency", placement="end", @@ -420,6 +421,7 @@ class Layout: children=[ dcc.DatePickerRange( id="dpr-period", + className="d-flex justify-content-center", min_date_allowed=\ datetime.utcnow()-timedelta(days=180), max_date_allowed=datetime.utcnow(), @@ -431,30 +433,29 @@ class Layout: ] ), dbc.Row( + id="row-card-sel-tests", class_name="gy-1", + style=self.STYLE_DISABLED, children=[ - dbc.Card( - class_name="p-0", - children=[ - dbc.Label( - "Selected tests", - class_name="p-0" - ), - dbc.Checklist( - id="cl-selected", - options=[], - inline=False - ) - ], - color="light", - outline=True + dbc.Label( + "Selected tests", + class_name="p-0" + ), + dbc.Checklist( + class_name="overflow-auto", + id="cl-selected", + options=[], + inline=False, + style={"max-height": "12em"}, ) - ] + ], ), dbc.Row( + id="row-btns-sel-tests", + style=self.STYLE_DISABLED, children=[ dbc.ButtonGroup( - [ + children=[ dbc.Button( id="btn-sel-remove-all", children="Remove All", @@ -478,7 +479,7 @@ class Layout: ) ], size="md", - ), + ) ] ), ] @@ -614,6 +615,8 @@ class Layout: Output("row-graph-tput", "children"), Output("row-graph-lat", "children"), Output("row-btn-download", "children"), + Output("row-card-sel-tests", "style"), + Output("row-btns-sel-tests", "style"), Output("dd-ctrl-phy", "value"), Output("dd-ctrl-area", "options"), Output("dd-ctrl-area", "disabled"), @@ -670,6 +673,8 @@ class Layout: row_fig_tput = no_update row_fig_lat = no_update row_btn_dwnld = no_update + row_card_sel_tests = no_update + row_btns_sel_tests = no_update ctrl_panel = self.ControlPanel(cp_data) @@ -870,6 +875,8 @@ class Layout: "core": core.lower(), "testtype": ttype.lower() }) + row_card_sel_tests = self.STYLE_ENABLED + row_btns_sel_tests = self.STYLE_ENABLED ctrl_panel.set(ctrl_panel.defaults) ctrl_panel.set({ "cl-selected-options": self._list_tests(store_sel) @@ -887,6 +894,8 @@ class Layout: row_fig_tput = self.PLACEHOLDER row_fig_lat = self.PLACEHOLDER row_btn_dwnld = self.PLACEHOLDER + row_card_sel_tests = self.STYLE_DISABLED + row_btns_sel_tests = self.STYLE_DISABLED store_sel = list() ctrl_panel.set({ "cl-selected-options": list() @@ -913,6 +922,8 @@ class Layout: row_fig_tput = self.PLACEHOLDER row_fig_lat = self.PLACEHOLDER row_btn_dwnld = self.PLACEHOLDER + row_card_sel_tests = self.STYLE_DISABLED + row_btns_sel_tests = self.STYLE_DISABLED store_sel = list() ctrl_panel.set({ "cl-selected-options": list() @@ -920,7 +931,8 @@ class Layout: ret_val = [ ctrl_panel.panel, store_sel, - row_fig_tput, row_fig_lat, row_btn_dwnld + row_fig_tput, row_fig_lat, row_btn_dwnld, + row_card_sel_tests, row_btns_sel_tests ] ret_val.extend(ctrl_panel.values()) return ret_val @@ -945,14 +957,24 @@ class Layout: trigger_id = callback_context.triggered[0]["prop_id"].split(".")[0] if trigger_id == "graph-tput": title = "Throughput" - txt = tput_data["points"][0]["text"].replace("
", "\n") + array = tput_data["points"][0]["text"].split("
") + children = [ + dbc.ListGroupItem( + [dbc.Badge(x.split(":")[0]), x.split(": ")[1]] + ) for x in array + ] elif trigger_id == "graph-latency": title = "Latency" - txt = lat_data["points"][0]["text"].replace("
", "\n") + array = lat_data["points"][0]["text"].split("
") + children = [ + dbc.ListGroupItem( + [dbc.Badge(x.split(":")[0]), x.split(": ")[1]] + ) for x in array + ] hdrh_data = lat_data["points"][0].get("customdata", None) if hdrh_data: graph = [dbc.Card( - class_name="g-0", + class_name="gy-2 p-0", children=[ dbc.CardHeader(hdrh_data.pop("name")), dbc.CardBody(children=[ @@ -967,7 +989,7 @@ class Layout: ] metadata = [ dbc.Card( - class_name="g-0", + class_name="gy-2 p-0", children=[ dbc.CardHeader(children=[ dcc.Clipboard( @@ -979,7 +1001,10 @@ class Layout: ]), dbc.CardBody( id="tput-lat-metadata", - children=[txt] + class_name="p-0", + children=[ + dbc.ListGroup(children, flush=True) + ] ) ] )