Skip to content

Commit 375be86

Browse files
authored
Merge pull request #97 from vishnuchalla/telco-frontend
Telco frontend
2 parents e3c39d5 + 1117a7c commit 375be86

File tree

19 files changed

+594
-35
lines changed

19 files changed

+594
-35
lines changed

backend/app/api/v1/commons/example_responses.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,21 @@ def response_422():
124124
"endDate": "2023-09-20",
125125
"results": [
126126
{
127+
"uuid": "4de79cb7a1b071bce282e8d0ce2006c7",
128+
"encryptedData": "gAAAAABmR0NYcO6AZo4nGjkT1IBVeoD=",
127129
"ciSystem": "Jenkins",
128-
"uuid": "2cc5d4ca895ca5d84cab0fd7923db93b",
129-
"encrypted": "gAAAAABmQALtP0g5UPMsOjQw46tZ-aBz77yl-8QNI4jwLfIEV1POnOlA1ny89cp3Nrik3OzpNwXrWO3K4ZwtOliTfk0SO5NkNZHY8reJhvOVJBGFEw2enyjRaHp9hIaJdE0Vrfuqt_NjiYX-vOZo0Sjc84R76LvxjAC6f_urceGGZICH36IkT2g=",
130-
"releaseStream": "Release Candidate",
131-
"jobStatus": "success",
130+
"benchmark": "deployment",
131+
"shortVersion": "4.16",
132+
"ocpVersion": "4.16.0-0.nightly-2024-05-16-092402",
133+
"releaseStream": "Nightly",
134+
"nodeName": "kni-qe-66",
135+
"cpu": "Intel(R) Xeon? Gold 5423N",
136+
"formal": "true",
137+
"startDate": "2024-05-16 19:39:48+00:00",
138+
"endDate": "2024-05-16 20:41:48+00:00",
132139
"buildUrl": "https://ci-jenkins-xxx.com/job/your-tests/532",
133-
"startDate": "2024-05-09 14:10:51+00:00",
134-
"endDate": "2024-05-09 14:43:51+00:00",
135-
"product": "telco",
136-
"version": "4.16",
137-
"testName": "reboot"
140+
"jobStatus": "success",
141+
"jobDuration": 3720
138142
},
139143
]
140144
}

backend/app/api/v1/commons/telco.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from app.services.splunk import SplunkService
55
import app.api.v1.commons.hasher as hasher
66
from datetime import datetime, timezone
7+
import app.api.v1.commons.utils as utils
78

89

910
async def getData(start_datetime: date, end_datetime: date, configpath: str):
@@ -40,18 +41,25 @@ async def getData(start_datetime: date, end_datetime: date, configpath: str):
4041
start_timestamp = end_timestamp - execution_time_seconds
4142
start_time_utc = datetime.fromtimestamp(start_timestamp, tz=timezone.utc)
4243
end_time_utc = datetime.fromtimestamp(end_timestamp, tz=timezone.utc)
44+
kernel = test_data['kernel'] if 'kernel' in test_data else "Undefined"
4345

4446
mapped_list.append({
4547
"uuid": hash_digest,
4648
"encryptedData": encrypted_data.decode('utf-8'),
4749
"ciSystem": "Jenkins",
48-
"testName": test_data['test_type'],
49-
"version": test_data['ocp_version'],
50-
"releaseStream": test_data['ocp_build'],
50+
"benchmark": test_data['test_type'],
51+
"kernel": kernel,
52+
"shortVersion": test_data['ocp_version'],
53+
"ocpVersion": test_data['ocp_build'],
54+
"releaseStream": utils.getReleaseStream({'releaseStream': test_data['ocp_build']}),
55+
"nodeName": test_data['node_name'],
56+
"cpu": test_data['cpu'],
57+
'formal': test_data['formal'],
5158
"startDate": str(start_time_utc),
5259
"endDate": str(end_time_utc),
53-
"buildUrl": jenkins_url + "/" + str(test_data['cluster_artifacts']['ref']['jenkins_build']),
54-
"jobStatus": "success"
60+
"buildUrl": jenkins_url + str(test_data['cluster_artifacts']['ref']['jenkins_build']),
61+
"jobStatus": "success",
62+
"jobDuration": execution_time_seconds,
5563
})
5664

5765
jobs = pd.json_normalize(mapped_list)

backend/app/api/v1/endpoints/cpt/maps/telco.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ async def telcoMapper(start_datetime: date, end_datetime: date):
1010
df = await getData(start_datetime, end_datetime, f'telco.splunk')
1111
df.insert(len(df.columns), "product", "telco")
1212
df["releaseStream"] = df.apply(getReleaseStream, axis=1)
13+
df["version"] = df["shortVersion"]
14+
df["testName"] = df["benchmark"]
1315
return df
2.99 KB
Loading

frontend/src/App.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import {
66
PageSection,
77
PageSectionVariants,
88
} from '@patternfly/react-core';
9-
import {fetchOCPJobsData, fetchCPTJobsData, fetchQuayJobsData} from "./store/Actions/ActionCreator";
9+
import {fetchOCPJobsData, fetchCPTJobsData, fetchQuayJobsData, fetchTelcoJobsData} from "./store/Actions/ActionCreator";
1010
import {useDispatch} from "react-redux";
1111
import {Route, Switch, BrowserRouter as Router} from "react-router-dom";
1212
import {NavBar} from "./components/NavBar/NavBar";
1313
import {HomeView} from "./components/Home/HomeView";
1414
import {OCPHome} from './components/OCP/OCPHome';
1515
import {QuayHome} from './components/Quay/QuayHome';
16+
import {TelcoHome} from './components/Telco/TelcoHome';
1617

1718

1819
export const App = () => {
@@ -23,6 +24,7 @@ export const App = () => {
2324
await dispatch(fetchOCPJobsData())
2425
await dispatch(fetchCPTJobsData())
2526
await dispatch(fetchQuayJobsData())
27+
await dispatch(fetchTelcoJobsData())
2628
}
2729
fetchData()
2830
}, [dispatch])
@@ -45,6 +47,7 @@ export const App = () => {
4547
<Route path="/home"><HomeView /></Route>
4648
<Route path="/ocp"><OCPHome /></Route>
4749
<Route path="/quay"><QuayHome /></Route>
50+
<Route path="/telco"><TelcoHome /></Route>
4851
</Switch>
4952
</PageSection>
5053
</Page>

frontend/src/components/NavBar/ToolBar.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ export const ToolBar = () => {
2323
return styles;
2424
};
2525

26-
// Selectors for both ocpJobs and quayJobs
26+
// Selectors for OCP, Quay and Telco jobs
2727
const ocpJobResults = useSelector((state) => state.ocpJobs);
2828
const quayJobResults = useSelector((state) => state.quayJobs);
29+
const telcoJobResults = useSelector((state) => state.telcoJobs);
2930

3031
const NavItems = (
3132
<>
@@ -45,7 +46,6 @@ export const ToolBar = () => {
4546
onClick={() => setActive("/ocp")}
4647
/>
4748
</ToolbarItem>
48-
{/* New Quay ToolbarItem */}
4949
<ToolbarItem>
5050
<Link
5151
to="/quay"
@@ -54,6 +54,14 @@ export const ToolBar = () => {
5454
onClick={() => setActive("/quay")}
5555
/>
5656
</ToolbarItem>
57+
<ToolbarItem>
58+
<Link
59+
to="/telco"
60+
children={"Telco"}
61+
style={linkStyle("/telco")}
62+
onClick={() => setActive("/telco")}
63+
/>
64+
</ToolbarItem>
5765
</>
5866
);
5967

@@ -70,7 +78,11 @@ export const ToolBar = () => {
7078
<Text4
7179
style={{ color: "#FFFFFF" }}
7280
value={`Last Updated Time | ${
73-
active === "/ocp" ? ocpJobResults.updatedTime : quayJobResults.updatedTime
81+
active === "/ocp"
82+
? ocpJobResults.updatedTime
83+
: active === "/quay"
84+
? quayJobResults.updatedTime
85+
: telcoJobResults.updatedTime
7486
}`}
7587
/>
7688
</ToolbarItem>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {Grid, GridItem} from "@patternfly/react-core";
2+
import InstallCard from "./InstallCard";
3+
import React from "react";
4+
import {DisplayGraph} from "./DisplayGraph";
5+
6+
7+
export const BenchmarkResults = ({dataset, isExpanded}) => {
8+
return (
9+
<> {
10+
( isExpanded &&
11+
<Grid className='demoCard' hasGutter>
12+
<GridItem span={"6"}>
13+
<InstallCard data={ dataset }
14+
isExpanded={isExpanded} />
15+
</GridItem>
16+
</Grid>
17+
) || <>NO Data</>
18+
}
19+
</>
20+
)
21+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {PlotlyView} from "../ReactGraphs/plotly/PlotlyView";
2+
import React, {useEffect} from "react";
3+
import {useDispatch, useSelector} from "react-redux";
4+
import CardView from "../PatternflyComponents/Card/CardView";
5+
import {Text6} from "../PatternflyComponents/Text/Text";
6+
import {SplitView} from "../PatternflyComponents/Split/SplitView";
7+
import {Spinner} from "@patternfly/react-core";
8+
import {fetchGraphData} from "../../store/Actions/ActionCreator";
9+
10+
11+
export const DisplayGraph = ({uuid, benchmark}) => {
12+
13+
const [isExpanded, setExpanded] = React.useState(true)
14+
const onExpand = () => setExpanded(!isExpanded)
15+
16+
const dispatch = useDispatch()
17+
const job_results = useSelector(state => state.graph)
18+
const graphData = job_results.uuid_results[uuid]
19+
20+
useEffect(() => {
21+
dispatch(fetchGraphData(uuid))
22+
}, [dispatch, uuid])
23+
24+
const getGraphBody = () => {
25+
return (job_results.graphError && <Text6 value={job_results.graphError}/>) ||
26+
(graphData && <PlotlyView data={graphData} />) ||
27+
<SplitView splitValues={[<Spinner issvg={"true"} />, <Text6 value="Awaiting Results"/>]} />
28+
}
29+
30+
return <>
31+
<CardView header={(benchmark && benchmark) || <Text6 value={"Graph Result"} />}
32+
body={ getGraphBody() }
33+
isExpanded={isExpanded}
34+
expandView={true}
35+
onExpand={onExpand}
36+
/>
37+
</>
38+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import React from 'react';
2+
import { Card, CardTitle, CardBody, CardFooter, CardHeader, CardExpandableContent } from '@patternfly/react-core';
3+
import { Grid, GridItem } from '@patternfly/react-core';
4+
import { Spinner } from '@patternfly/react-core';
5+
import { formatTime } from '../../helpers/Formatters'
6+
import { FaCheck, FaExclamationCircle, FaExclamationTriangle } from "react-icons/fa";
7+
import { DisplaySplunk } from '../commons/DisplaySplunk';
8+
9+
10+
export default function InstallCard(props) {
11+
let config = props.data
12+
const [isExpanded, setExpanded] = React.useState([true, null])
13+
14+
15+
const onExpand = () => {
16+
setExpanded(!isExpanded)
17+
};
18+
19+
const icons = {
20+
"failed": <><FaExclamationCircle color="red"/></>,
21+
"success": <><FaCheck color="green"/></>,
22+
"upstream_failed": <><FaExclamationTriangle color="yellow"/></>,
23+
24+
}
25+
26+
if (config) {
27+
return (
28+
<Card isExpanded={isExpanded}>
29+
<CardHeader
30+
onExpand={onExpand}
31+
toggleButtonProps={{
32+
id: 'toggle-button',
33+
'aria-label': 'Details',
34+
'aria-labelledby': 'titleId toggle-button',
35+
'aria-expanded': isExpanded
36+
}}
37+
>
38+
<CardTitle>Configs</CardTitle>
39+
40+
</CardHeader>
41+
<CardExpandableContent>
42+
<CardBody>
43+
<Grid>
44+
<GridItem rowSpan="1">
45+
<Card><CardHeader><CardTitle>Cluster Metadata</CardTitle></CardHeader>
46+
<CardBody>
47+
<ul>
48+
<li><span class="list-item-key">Release Binary</span>: {config.cluster_version && config.cluster_version || config.ocpVersion}</li>
49+
<li><span class="list-item-key">Cluster Name</span>: {config.cluster_name && config.cluster_name || config.nodeName}</li>
50+
<li><span class="list-item-key">Cluster Type</span>: {config.cluster_type && config.cluster_type || "SNO spoke"}</li>
51+
<li><span class="list-item-key">Network Type</span>: {config.network_type && config.network_type || "OVNKubernetes"}</li>
52+
<li><span class="list-item-key">CPU</span>: {config.cpu_version && config.cpu_version || config.cpu}</li>
53+
<li><span class="list-item-key">Kernel</span>: {config.kernel_version && config.kernel_version || config.kernel}</li>
54+
<li><span class="list-item-key">IsFormal</span>: {config.is_formal && config.is_formal || config.formal}</li>
55+
<li><span class="list-item-key">Benchmark Status</span>: {icons[config.job_status && config.job_status || config.jobStatus] || config.job_status && config.job_status || config.jobStatus}</li>
56+
<li><span class="list-item-key">Duration</span>: {formatTime(config.job_duration && config.job_duration || config.jobDuration)}</li>
57+
</ul>
58+
</CardBody>
59+
</Card>
60+
</GridItem>
61+
<DisplaySplunk benchmarkConfigs={ config } />
62+
<GridItem span="6">
63+
<Card><CardHeader><CardTitle>Node Types</CardTitle></CardHeader>
64+
<CardBody>
65+
<ul>
66+
<li><span class="list-item-key">Master</span>: {config.master_type && config.master_type || "Baremetal"}</li>
67+
<li><span class="list-item-key">Workload</span>: {config.workload_type && config.workload_type || config.benchmark}</li>
68+
</ul>
69+
</CardBody>
70+
</Card>
71+
</GridItem>
72+
<GridItem span="6">
73+
<Card><CardHeader><CardTitle>Node Counts</CardTitle></CardHeader>
74+
<CardBody>
75+
<ul>
76+
<li><span class="list-item-key">Master</span>: {config.master_count && config.master_count || "1"}</li>
77+
<li><span class="list-item-key">Total Nodes</span>: {config.workload_count && config.workload_count || "1"}</li>
78+
</ul>
79+
</CardBody>
80+
</Card>
81+
</GridItem>
82+
</Grid>
83+
</CardBody></CardExpandableContent>
84+
85+
86+
</Card>)
87+
} else {
88+
return (
89+
<Card>
90+
<CardTitle>Install Configuration</CardTitle>
91+
<CardBody><Spinner isSVG /><br />Awaiting Results</CardBody>
92+
<CardFooter></CardFooter>
93+
</Card>
94+
)
95+
}
96+
97+
}

0 commit comments

Comments
 (0)