C-Dash: Add hyperlinks to job/builds 26/39126/2
authorTibor Frank <tifrank@cisco.com>
Fri, 23 Jun 2023 07:58:36 +0000 (07:58 +0000)
committerTibor Frank <tifrank@cisco.com>
Fri, 23 Jun 2023 08:02:36 +0000 (08:02 +0000)
- performance trending
- test job statistics
- per release performance

Change-Id: I2b0479120906b79d45b1887be1e8bb72d9845585
Signed-off-by: Tibor Frank <tifrank@cisco.com>
csit.infra.dash/app/cdash/report/graphs.py
csit.infra.dash/app/cdash/report/layout.py
csit.infra.dash/app/cdash/stats/layout.py
csit.infra.dash/app/cdash/trending/layout.py
csit.infra.dash/app/cdash/utils/constants.py

index f45e17f..cff5bb6 100644 (file)
@@ -128,6 +128,9 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict,
             y_tput_max = max(max(y_data), y_tput_max)
 
         nr_of_samples = len(y_data)
+        c_data = list()
+        for _, row in itm_data.iterrows():
+            c_data.append(f"{row['job']}/{row['build']}")
         tput_kwargs = dict(
             y=y_data,
             name=(
@@ -139,7 +142,8 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict,
             hoverinfo=u"y+name",
             boxpoints="all",
             jitter=0.3,
-            marker=dict(color=get_color(idx))
+            marker=dict(color=get_color(idx)),
+            customdata=c_data
         )
         tput_traces.append(go.Box(**tput_kwargs))
         show_tput = True
index 06b5d46..fcea2ab 100644 (file)
@@ -1422,22 +1422,34 @@ class Layout:
                 if len(graph_data) == 1:
                     hdrh_data = graph_data[0].get("customdata", None)
                     if hdrh_data:
+                        name = hdrh_data.pop("name")
                         graph = [dbc.Card(
                             class_name="gy-2 p-0",
                             children=[
-                                dbc.CardHeader(hdrh_data.pop("name")),
-                                dbc.CardBody(children=[
-                                    dcc.Graph(
-                                        id="hdrh-latency-graph",
-                                        figure=graph_hdrh_latency(
-                                            hdrh_data, self._graph_layout
-                                        )
+                                dbc.CardHeader(html.A(
+                                    name,
+                                    href=f"{C.URL_JENKINS}{name}",
+                                    target="_blank"
+                                )),
+                                dbc.CardBody(dcc.Graph(
+                                    id="hdrh-latency-graph",
+                                    figure=graph_hdrh_latency(
+                                        hdrh_data, self._graph_layout
                                     )
-                                ])
+                                ))
                             ])
                         ]
             else:
                 raise PreventUpdate
+            list_group_items = list()
+            for k, v in _process_stats(graph_data, trigger.idx):
+                list_group_items.append(dbc.ListGroupItem([dbc.Badge(k), v]))
+            if trigger.idx == "tput" and len(list_group_items) == 1:
+                job = graph_data[0].get("customdata", "")
+                list_group_items.append(dbc.ListGroupItem([
+                    dbc.Badge("csit-ref"),
+                    html.A(job, href=f"{C.URL_JENKINS}{job}", target="_blank")
+                ]))
             metadata = [
                 dbc.Card(
                     class_name="gy-2 p-0",
@@ -1451,16 +1463,9 @@ class Layout:
                             title
                         ]),
                         dbc.CardBody(
+                            dbc.ListGroup(list_group_items, flush=True),
                             id="tput-lat-metadata",
-                            class_name="p-0",
-                            children=[dbc.ListGroup(
-                                [
-                                    dbc.ListGroupItem([dbc.Badge(k), v])
-                                        for k, v in _process_stats(
-                                            graph_data, trigger.idx)
-                                ],
-                                flush=True)
-                            ]
+                            class_name="p-0"
                         )
                     ]
                 )
index 574479e..c818d91 100644 (file)
@@ -194,7 +194,11 @@ class Layout:
             "ri-ttypes-value": self._default["ttype"],
             "ri-cadences-value": self._default["cadence"],
             "dd-tbeds-value": self._default["tbed"],
-            "al-job-children": self._default["job"]
+            "al-job-children": html.A(
+                self._default["job"],
+                href=f"{C.URL_JENKINS}{self._default['job']}",
+                target="_blank"
+            )
         }
 
         # Callbacks:
@@ -671,7 +675,14 @@ class Layout:
                                 "ri-ttypes-value": job_params["ttype"],
                                 "ri-cadences-value": job_params["cadence"],
                                 "dd-tbeds-value": job_params["tbed"],
-                                "al-job-children": job_params["job"]
+                                "al-job-children": html.A(
+                                    self._default["job"],
+                                    href=(
+                                        f"{C.URL_JENKINS}"
+                                        f"{self._default['job']}"
+                                    ),
+                                    target="_blank"
+                                )
                             },
                             None
                         )
@@ -686,7 +697,15 @@ class Layout:
                 ctrl_panel.get("dd-tbeds-value")
             )
 
-            ctrl_panel.set({"al-job-children": job})
+            ctrl_panel.set(
+                {
+                    "al-job-children": html.A(
+                        self._default["job"],
+                        href=f"{C.URL_JENKINS}{self._default['job']}",
+                        target="_blank"
+                    )
+                }
+            )
             plotting_area = self._get_plotting_area(
                 job,
                 gen_new_url(parsed_url, {"job": job})
@@ -804,11 +823,29 @@ class Layout:
                     fail_tests = None
 
                 # Create the content of the offcanvas:
+                list_group_items = list()
+                for itm in lst_graph_data:
+                    lst_itm = itm.split(": ")
+                    if lst_itm[0] == "csit-ref":
+                        list_group_item = dbc.ListGroupItem([
+                            dbc.Badge(lst_itm[0]),
+                            html.A(
+                                lst_itm[1],
+                                href=f"{C.URL_JENKINS}{lst_itm[1]}",
+                                target="_blank"
+                            )
+                        ])
+                    else:
+                        list_group_item = dbc.ListGroupItem([
+                            dbc.Badge(lst_itm[0]),
+                            lst_itm[1]
+                        ])
+                    list_group_items.append(list_group_item)
                 metadata = [
                     dbc.Card(
                         class_name="gy-2 p-0",
                         children=[
-                            dbc.CardHeader(children=[
+                            dbc.CardHeader([
                                 dcc.Clipboard(
                                     target_id="metadata",
                                     title="Copy",
@@ -817,21 +854,9 @@ class Layout:
                                 title
                             ]),
                             dbc.CardBody(
+                                dbc.ListGroup(list_group_items, flush=True),
                                 id="metadata",
-                                class_name="p-0",
-                                children=[dbc.ListGroup(
-                                    children=[
-                                        dbc.ListGroupItem(
-                                            [
-                                                dbc.Badge(
-                                                    x.split(":")[0]
-                                                ),
-                                                x.split(": ")[1]
-                                            ]
-                                        ) for x in lst_graph_data
-                                    ],
-                                    flush=True),
-                                ]
+                                class_name="p-0"
                             )
                         ]
                     )
index f84f8b1..84a68f5 100644 (file)
@@ -1698,11 +1698,27 @@ class Layout:
             metadata = no_update
             graph = list()
 
-            children = [
-                dbc.ListGroupItem(
-                    [dbc.Badge(x.split(":")[0]), x.split(": ")[1]]
-                ) for x in graph_data.get("text", "").split("<br>")
-            ]
+            list_group_items = list()
+            for itm in graph_data.get("text", None).split("<br>"):
+                if not itm:
+                    continue
+                lst_itm = itm.split(": ")
+                if lst_itm[0] == "csit-ref":
+                    list_group_item = dbc.ListGroupItem([
+                        dbc.Badge(lst_itm[0]),
+                        html.A(
+                            lst_itm[1],
+                            href=f"{C.URL_JENKINS}{lst_itm[1]}",
+                            target="_blank"
+                        )
+                    ])
+                else:
+                    list_group_item = dbc.ListGroupItem([
+                        dbc.Badge(lst_itm[0]),
+                        lst_itm[1]
+                    ])
+                list_group_items.append(list_group_item)
+
             if trigger.idx == "tput":
                 title = "Throughput"
             elif trigger.idx == "lat":
@@ -1713,14 +1729,14 @@ class Layout:
                         class_name="gy-2 p-0",
                         children=[
                             dbc.CardHeader(hdrh_data.pop("name")),
-                            dbc.CardBody(children=[
+                            dbc.CardBody(
                                 dcc.Graph(
                                     id="hdrh-latency-graph",
                                     figure=graph_hdrh_latency(
                                         hdrh_data, self._graph_layout
                                     )
                                 )
-                            ])
+                            )
                         ])
                     ]
             else:
@@ -1739,9 +1755,9 @@ class Layout:
                             title
                         ]),
                         dbc.CardBody(
+                            dbc.ListGroup(list_group_items, flush=True),
                             id="tput-lat-metadata",
                             class_name="p-0",
-                            children=[dbc.ListGroup(children, flush=True), ]
                         )
                     ]
                 )
index b797ac2..ee421f1 100644 (file)
@@ -44,6 +44,9 @@ class Constants:
     # External stylesheets.
     EXTERNAL_STYLESHEETS = ["/static/dist/css/bootstrap.css", ]
 
+    # URL to Jenkins
+    URL_JENKINS = "https://jenkins.fd.io/job/"
+
     # URL to the documentation
     URL_DOC_TRENDING = "https://csit.fd.io/cdocs/methodology/trending/analysis/"
     URL_DOC_REL_NOTES = "https://csit.fd.io/cdocs/release_notes/csit_rls2306/"