1 # Copyright (c) 2022 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
18 import dash_bootstrap_components as dbc
21 def table_failed(data: pd.DataFrame, job: str) -> list:
25 job_data = data.loc[(data["job"] == job)]
26 failed = job_data["lst_failed"].to_list()[0]
29 dbc.Table.from_dataframe(pd.DataFrame.from_dict({
30 "Job": job_data["job"],
31 "Build": job_data["build"],
32 "Date": job_data["start"],
33 "DUT": job_data["dut_type"],
34 "DUT Version": job_data["dut_version"],
35 "Hosts": ", ".join(job_data["hosts"].to_list()[0])
36 }), bordered=True, striped=True, hover=True, size="sm", color="light"),
37 dbc.Table.from_dataframe(pd.DataFrame.from_dict({
39 f"Last Failed Tests on "
40 f"{job_data['start'].values[0]} ({len(failed)})"
42 }), bordered=True, striped=True, hover=True, size="sm", color="light")