Skip to content

Commit

Permalink
Merge pull request #106 from chentex/add-status-filter-ocp
Browse files Browse the repository at this point in the history
Add job-status filter on OCP view
  • Loading branch information
chentex authored Jul 5, 2024
2 parents c13254c + ca9d1b6 commit 3abc1c5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
9 changes: 6 additions & 3 deletions frontend/src/components/OCP/OCPHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function OCPHome() {
const [publish, setPublish] = useState(searchParams.get("publish") || ocpJobs.selectedPublish)
const [computeArch, setComputeArch] = useState(searchParams.get("computeArch") || ocpJobs.selectedComputeArch)
const [controlPlaneArch, setControlPlaneArch] = useState(searchParams.get("controlPlaneArch") || ocpJobs.selectedControlPlaneArch)
const [jobStatus, setjobStatus] = useState(searchParams.get("jobStatus") || ocpJobs.selectedJobStatus)
const [startDate, setStartDate] = useState(searchParams.get("startDate") || ocpJobs.startDate) || ""
const [endDate, setEndDate] = useState(searchParams.get("endDate") || ocpJobs.endDate) || ""

Expand All @@ -61,6 +62,7 @@ export function OCPHome() {
{name: "Control Plane Access", onChange: setPublish, value: publish, options: ocpJobs.allPublish},
{name: "Compute Architecture", onChange: setComputeArch, value: computeArch, options: ocpJobs.computeArchs},
{name: "Control Plane Architecture", onChange: setControlPlaneArch, value: controlPlaneArch, options: ocpJobs.controlPlaneArchs},
{name: "Job Status", onChange: setjobStatus, value: jobStatus, options: ocpJobs.jobStatuses},
]

useEffect(() => {
Expand All @@ -80,19 +82,20 @@ export function OCPHome() {
if(publish !== '') buildParams += `&publish=${publish}`
if(computeArch !== '') buildParams += `&computeArch=${computeArch}`
if(controlPlaneArch !== '') buildParams += `&controlPlaneArch=${controlPlaneArch}`
if(jobStatus !== '') buildParams += `&jobStatus=${jobStatus}`
if(startDate !== '') buildParams += `&startDate=${startDate}`
if(endDate !== '') buildParams += `&endDate=${endDate}`
history.push(`/ocp?${buildParams.substring(1)}`, { replace: true });

}, [history, ciSystem, platform, benchmark, version, workerCount, networkType,
jobType, isRehearse, ipsec, fips, encrypted, encryptionType, publish,
computeArch, controlPlaneArch, startDate, endDate])
computeArch, controlPlaneArch, jobStatus, startDate, endDate])

useEffect( ()=>{
dispatch(updateOCPDataFilter({ciSystem, platform, benchmark, version, workerCount, networkType, jobType, isRehearse,
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch}))
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, jobStatus}))
}, [ ciSystem, platform, benchmark, version, workerCount, networkType, jobType, isRehearse,
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, dispatch ])
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, jobStatus, dispatch ])

useEffect(() => {
if(startDate || endDate){
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/store/Actions/ActionCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ export const fetchOCPJobsData = (startDate = '', endDate='') => async dispatch =
const allPublish = GetPublish(results)
const computeArchs = GetComputeArchs(results)
const controlPlaneArchs = GetControlPlaneArchs(results)
const jobStatuses = GetStatuses(results)
const updatedTime = new Date().toLocaleString().replace(', ', ' ').toString();
await dispatch(getOCPJobsData({
data: results, benchmarks, versions, waitForUpdate: false, platforms, workers, networkTypes,
updatedTime, ciSystems, jobTypes, rehearses, allIpsec, allFips, allEncrypted, encryptionTypes,
allPublish, computeArchs, controlPlaneArchs, startDate: api_data.startDate, endDate: api_data.endDate
allPublish, computeArchs, controlPlaneArchs, jobStatuses, startDate: api_data.startDate, endDate: api_data.endDate
}))
await dispatch(updateOCPMetaData({data: results}))
}
Expand Down Expand Up @@ -163,7 +164,7 @@ export const fetchQuayJobsData = (startDate = '', endDate='') => async dispatch
const updatedTime = new Date().toLocaleString().replace(', ', ' ').toString();
await dispatch(getQuayJobsData({
data: results, benchmarks, releaseStreams, waitForUpdate: false, platforms, workers,
hitSizes, concurrencies, imagePushPulls, updatedTime, ciSystems, startDate: api_data.startDate,
hitSizes, concurrencies, imagePushPulls, updatedTime, ciSystems, startDate: api_data.startDate,
endDate: api_data.endDate
}))
await dispatch(updateQuayMetaData({data: results}))
Expand Down Expand Up @@ -273,7 +274,7 @@ const GetCiSystems = (api_data) => {
}

export const GetVersions = (api_data) => {
return Array.from(new Set(api_data.map(item => item.shortVersion).filter(shortVersion => shortVersion !== null && shortVersion !== "").map(shortVersion => shortVersion.toUpperCase().trim()))).sort();
return Array.from(new Set(api_data.map(item => item.shortVersion).filter(shortVersion => shortVersion !== null && shortVersion !== "").map(shortVersion => shortVersion.toUpperCase().trim()))).sort();
}

export const GetBenchmarks = (api_data) => {
Expand Down Expand Up @@ -316,19 +317,19 @@ const GetStatuses = (api_data) => {
}

const GetReleaseStreams = (api_data) => {
return Array.from(new Set(api_data.map(item => item.releaseStream).filter(releaseStream => releaseStream !== null && releaseStream !== "").map(releaseStream => releaseStream.toUpperCase().trim()))).sort();
return Array.from(new Set(api_data.map(item => item.releaseStream).filter(releaseStream => releaseStream !== null && releaseStream !== "").map(releaseStream => releaseStream.toUpperCase().trim()))).sort();
}

const GetFormals = (api_data) => {
return Array.from(new Set(api_data.map(item => item.formal).filter(formal => formal !== null && formal !== "").map(formal => formal.toUpperCase().trim()))).sort();
return Array.from(new Set(api_data.map(item => item.formal).filter(formal => formal !== null && formal !== "").map(formal => formal.toUpperCase().trim()))).sort();
}

const GetNodeNames = (api_data) => {
return Array.from(new Set(api_data.map(item => item.nodeName).filter(nodeName => nodeName !== null && nodeName !== "").map(nodeName => nodeName.toUpperCase().trim()))).sort();
return Array.from(new Set(api_data.map(item => item.nodeName).filter(nodeName => nodeName !== null && nodeName !== "").map(nodeName => nodeName.toUpperCase().trim()))).sort();
}

const GetCpus = (api_data) => {
return Array.from(new Set(api_data.map(item => item.cpu).filter(cpu => cpu !== null && cpu !== "").map(cpu => cpu.toUpperCase().trim()))).sort();
return Array.from(new Set(api_data.map(item => item.cpu).filter(cpu => cpu !== null && cpu !== "").map(cpu => cpu.toUpperCase().trim()))).sort();
}

const GetTestNames = (api_data) => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/store/reducers/InitialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const OCP_INITIAL_DATA = {
allPublish: ["All"],
computeArchs: ["All"],
controlPlaneArchs: ["All"],
jobStatuses: ["All"],
selectedBenchmark: "All",
selectedVersion: "All",
selectedPlatform: "All",
Expand All @@ -35,6 +36,7 @@ export const OCP_INITIAL_DATA = {
selectedPublish: "All",
selectedComputeArch: "All",
selectedControlPlaneArch: "All",
selectedJobStatus: "All",
waitForUpdate: false,
platforms: ["All"],
copyData: [],
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/store/reducers/OCPJobsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const jobsSlice = createSlice({
state.allPublish = ["All", ...action.payload.allPublish]
state.computeArchs = ["All", ...action.payload.computeArchs]
state.controlPlaneArchs = ["All", ...action.payload.controlPlaneArchs]
state.jobStatuses = ["All", ...action.payload.jobStatuses]
state.updatedTime = action.payload.updatedTime
state.error = null
Object.assign(state, getOCPSummary(state.data))
Expand All @@ -37,7 +38,7 @@ const jobsSlice = createSlice({
},
updateOCPDataFilter: (state, action) => {
const {ciSystem, platform, benchmark, version, workerCount, networkType, jobType, isRehearse,
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch} = action.payload
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, jobStatus} = action.payload
state.selectedBenchmark = benchmark
state.selectedVersion = version
state.selectedPlatform = platform
Expand All @@ -53,15 +54,17 @@ const jobsSlice = createSlice({
state.selectedPublish = publish
state.selectedComputeArch = computeArch
state.selectedControlPlaneArch = controlPlaneArch
state.selectedJobStatus = jobStatus
state.data = getOCPUpdatedData(original(state.copyData), platform, benchmark, version, workerCount, networkType, ciSystem, jobType, isRehearse,
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch)
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, jobStatus)
Object.assign(state, getOCPSummary(state.data))
},
updateOCPMetaData: (state, action) => {
state.data = getOCPUpdatedData(action.payload.data, state.selectedPlatform, state.selectedBenchmark,
state.selectedVersion, state.selectedWorkerCount, state.selectedNetworkType, state.selectedCiSystem,
state.selectedJobType, state.selectedRehearse, state.selectedIpsec, state.selectedFips, state.selectedEncrypted,
state.selectedEncryptionType, state.selectedPublish, state.selectedComputeArch, state.selectedControlPlaneArch)
state.selectedEncryptionType, state.selectedPublish, state.selectedComputeArch, state.selectedControlPlaneArch,
state.selectedJobStatus)
Object.assign(state, getOCPSummary(state.data))
},
setWaitForOCPUpdate: (state, action) => {
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/store/reducers/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getCPTUpdatedData = (data, testName, product, ciSystem, jobStatus, release
}

const getOCPUpdatedData = (data, platform, benchmark, version, workerCount, networkType, ciSystem, jobType, isRehearse,
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch) => {
ipsec, fips, encrypted, encryptionType, publish, computeArch, controlPlaneArch, jobStatus) => {
const filterValues = {
"platform": platform, "benchmark": benchmark,
"shortVersion": version, "workerNodesCount": workerCount,
Expand All @@ -34,6 +34,7 @@ const getOCPUpdatedData = (data, platform, benchmark, version, workerCount, netw
"ipsec": ipsec, "fips": fips, "encrypted": encrypted,
"encryptionType": encryptionType, "publish": publish,
"computeArch": computeArch, "controlPlaneArch": controlPlaneArch,
"jobStatus": jobStatus,
}
let filteredData = data
for (let [keyName, value] of Object.entries(filterValues))
Expand All @@ -58,8 +59,8 @@ const getQuayUpdatedData = (data, platform, benchmark, releaseStream, workerCoun

const getTelcoUpdatedData = (data, benchmark, version, releaseStream, ciSystem, formal, nodeName, cpu) => {
const filterValues = {
"cpu": cpu, "benchmark": benchmark, "shortVersion": version,
"releaseStream": releaseStream, "formal": formal, "ciSystem": ciSystem,
"cpu": cpu, "benchmark": benchmark, "shortVersion": version,
"releaseStream": releaseStream, "formal": formal, "ciSystem": ciSystem,
"nodeName": nodeName,
}
let filteredData = data
Expand Down

0 comments on commit 3abc1c5

Please sign in to comment.