diff --git a/backend/kernelCI_app/views/treeDetailsView.py b/backend/kernelCI_app/views/treeDetailsView.py index d673606f..2982b53c 100644 --- a/backend/kernelCI_app/views/treeDetailsView.py +++ b/backend/kernelCI_app/views/treeDetailsView.py @@ -165,33 +165,43 @@ def get(self, request, commit_hash: str | None): return JsonResponse( { - "bootArchSummary": list(self.bootArchSummary.values()), - "testArchSummary": list(self.test_arch_summary.values()), - "buildsSummary": self.build_summary, - "bootFailReasons": self.bootFailReasons, - "testFailReasons": self.testFailReasons, - "testPlatformsWithErrors": list(self.testPlatformsWithErrors), - "bootPlatformsFailing": list(self.bootPlatformsFailing), - "testConfigs": self.test_configs, - "bootConfigs": self.bootConfigs, - "testStatusSummary": self.testStatusSummary, - "bootStatusSummary": self.bootStatusSummary, - "bootHistory": self.bootHistory, - "testHistory": self.testHistory, - "bootIssues": self.bootIssues, - "testIssues": self.testIssues, - "testEnvironmentCompatible": self.testEnvironmentCompatible, - "bootEnvironmentCompatible": self.bootEnvironmentCompatible, - "testEnvironmentMisc": self.testEnvironmentMisc, - "bootEnvironmentMisc": self.bootEnvironmentMisc, - "hardwareUsed": list(self.hardwareUsed), - "failedTestsWithUnknownIssues": self.failedTestsWithUnknownIssues, - "failedBootsWithUnknownIssues": self.failedBootsWithUnknownIssues, "builds": self.builds, - "buildsIssues": self.build_issues, - "failedBuildsWithUnknownIssues": self.failed_builds_with_unknown_issues, - "treeUrl": self.tree_url, - "git_commit_tags": self.git_commit_tags, + "boots": self.bootHistory, + "tests": self.testHistory, + "summary": { + "builds": { + "status": self.build_summary["builds"], + "architectures": self.build_summary["architectures"], + "configs": self.build_summary["configs"], + "issues": self.build_issues, + "unknown_issues": self.failed_builds_with_unknown_issues, + }, + "boots": { + "status": self.bootStatusSummary, + "architectures": list(self.bootArchSummary.values()), + "configs": self.bootConfigs, + "issues": self.bootIssues, + "unknown_issues": self.failedBootsWithUnknownIssues, + "enviroment_compatible": self.bootEnvironmentCompatible, + "enviroment_misc": self.bootEnvironmentMisc, + "fail_reasons": self.bootFailReasons, + "failed_platforms": list(self.bootPlatformsFailing), + }, + "tests": { + "status": self.testStatusSummary, + "architectures": list(self.test_arch_summary.values()), + "configs": self.test_configs, + "issues": self.testIssues, + "unknown_issues": self.failedTestsWithUnknownIssues, + "enviroment_compatible": self.testEnvironmentCompatible, + "enviroment_misc": self.testEnvironmentMisc, + "fail_reasons": self.testFailReasons, + "failed_platforms": list(self.testPlatformsWithErrors), + }, + "hardware": list(self.hardwareUsed), + "tree_url": self.tree_url, + "git_commit_tags": self.git_commit_tags, + }, }, safe=False, ) diff --git a/dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx b/dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx index 2e9b0fec..f0aefbf2 100644 --- a/dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx +++ b/dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx @@ -99,10 +99,13 @@ const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => { const hardwareData = useMemo(() => { return { - ...data?.bootEnvironmentCompatible, - ...data?.bootEnvironmentMisc, + ...data?.summary.boots.enviroment_compatible, + ...data?.summary.boots.enviroment_misc, }; - }, [data?.bootEnvironmentCompatible, data?.bootEnvironmentMisc]); + }, [ + data?.summary.boots.enviroment_compatible, + data?.summary.boots.enviroment_misc, + ]); if (error || !treeId) { return ( @@ -121,7 +124,7 @@ const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => { if (!data) return
; - if (data.bootHistory.length < 1) { + if (data.boots.length < 1) { return ( } @@ -140,22 +143,22 @@ const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => {
} - statusCounts={data.bootStatusSummary} + statusCounts={data.summary.boots.status} /> } - configStatusCounts={data.bootConfigs} + configStatusCounts={data.summary.boots.configs} diffFilter={diffFilter} /> } - archCompilerErrors={data.bootArchSummary} + archCompilerErrors={data.summary.boots.architectures} diffFilter={diffFilter} /> } - issues={data.bootIssues} - failedWithUnknownIssues={data.failedBootsWithUnknownIssues} + issues={data.summary.boots.issues} + failedWithUnknownIssues={data.summary.boots.unknown_issues} diffFilter={diffFilter} issueFilterSection="bootIssue" detailsId={treeId} @@ -174,25 +177,25 @@ const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => { } - statusCounts={data.bootStatusSummary} + statusCounts={data.summary.boots.status} />
} - configStatusCounts={data.bootConfigs} + configStatusCounts={data.summary.boots.configs} diffFilter={diffFilter} /> } - archCompilerErrors={data.bootArchSummary} + archCompilerErrors={data.summary.boots.architectures} diffFilter={diffFilter} /> } - issues={data.bootIssues} - failedWithUnknownIssues={data.failedBootsWithUnknownIssues} + issues={data.summary.boots.issues} + failedWithUnknownIssues={data.summary.boots.unknown_issues} diffFilter={diffFilter} issueFilterSection="bootIssue" detailsId={treeId} @@ -212,7 +215,7 @@ const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => { tableKey="treeDetailsBoots" filter={tableFilter.bootsTable} onClickFilter={onClickFilter} - testHistory={data.bootHistory} + testHistory={data.boots} getRowLink={getRowLink} updatePathFilter={updatePathFilter} currentPathFilter={currentPathFilter} diff --git a/dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx b/dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx index 1244ad44..4801ffc3 100644 --- a/dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx +++ b/dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx @@ -101,10 +101,13 @@ const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => { const hardwareData = useMemo(() => { return { - ...data?.testEnvironmentCompatible, - ...data?.testEnvironmentMisc, + ...data?.summary.tests.enviroment_compatible, + ...data?.summary.tests.enviroment_misc, }; - }, [data?.testEnvironmentCompatible, data?.testEnvironmentMisc]); + }, [ + data?.summary.tests.enviroment_compatible, + data?.summary.tests.enviroment_misc, + ]); if (error || !treeId) { return ( @@ -123,7 +126,7 @@ const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => { if (!data) return
; - if (data.testHistory.length < 1) { + if (data.tests.length < 1) { return ( } @@ -142,22 +145,22 @@ const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => {
} - statusCounts={data.testStatusSummary} + statusCounts={data.summary.tests.status} /> } - configStatusCounts={data.testConfigs} + configStatusCounts={data.summary.tests.configs} diffFilter={diffFilter} /> } - archCompilerErrors={data.testArchSummary} + archCompilerErrors={data.summary.tests.architectures} diffFilter={diffFilter} /> } - issues={data.testIssues} - failedWithUnknownIssues={data.failedTestsWithUnknownIssues} + issues={data.summary.tests.issues} + failedWithUnknownIssues={data.summary.tests.unknown_issues} diffFilter={diffFilter} issueFilterSection="testIssue" detailsId={treeId} @@ -176,25 +179,25 @@ const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => { } - statusCounts={data.testStatusSummary} + statusCounts={data.summary.tests.status} />
} - configStatusCounts={data.testConfigs} + configStatusCounts={data.summary.tests.configs} diffFilter={diffFilter} /> } - archCompilerErrors={data.testArchSummary} + archCompilerErrors={data.summary.tests.architectures} diffFilter={diffFilter} /> } - issues={data.testIssues} - failedWithUnknownIssues={data.failedTestsWithUnknownIssues} + issues={data.summary.tests.issues} + failedWithUnknownIssues={data.summary.tests.unknown_issues} diffFilter={diffFilter} issueFilterSection="testIssue" detailsId={treeId} @@ -213,7 +216,7 @@ const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => { { - const { valid, invalid } = data?.buildsSummary.builds ?? {}; - const { testStatusSummary } = data ?? {}; + const { valid, invalid } = data?.summary.builds.status ?? {}; + const { status: testStatusSummary } = data?.summary.tests ?? {}; - const { bootStatusSummary } = data ?? {}; + const { status: bootStatusSummary } = data?.summary.boots ?? {}; return { 'global.tests': testStatusSummary ? ( @@ -226,12 +226,12 @@ function TreeDetails(): JSX.Element { const treeDetailsData: ITreeDetails = useMemo( () => ({ - architectures: sanitizeArchs(data?.buildsSummary.architectures), - configs: sanitizeConfigs(data?.buildsSummary.configs), + architectures: sanitizeArchs(data?.summary.builds.architectures), + configs: sanitizeConfigs(data?.summary.builds.configs), builds: sanitizeBuilds(data?.builds), - buildsSummary: sanitizeBuildsSummary(data?.buildsSummary.builds), - buildsIssues: data?.buildsIssues || [], - failedBuildsWithUnknownIssues: data?.failedBuildsWithUnknownIssues, + buildsSummary: sanitizeBuildsSummary(data?.summary.builds.status), + buildsIssues: data?.summary.builds.issues || [], + failedBuildsWithUnknownIssues: data?.summary.builds.unknown_issues, }), [data], ); @@ -279,7 +279,7 @@ function TreeDetails(): JSX.Element { gitUrl={treeInfo?.gitUrl} commitHash={treeId} commitName={treeInfo?.commitName} - commitTags={data?.git_commit_tags} + commitTags={data?.summary.git_commit_tags} />
} - hardwareUsed={data?.hardwareUsed} + hardwareUsed={data?.summary.hardware} diffFilter={diffFilter} />
- {data?.treeUrl && ( + {data?.summary.tree_url && (
diff --git a/dashboard/src/pages/TreeDetails/TreeDetailsFilter.tsx b/dashboard/src/pages/TreeDetails/TreeDetailsFilter.tsx index 558f8178..b055d3bb 100644 --- a/dashboard/src/pages/TreeDetails/TreeDetailsFilter.tsx +++ b/dashboard/src/pages/TreeDetails/TreeDetailsFilter.tsx @@ -55,11 +55,11 @@ export const createFilter = (data: TTreeTestsFullData | undefined): TFilter => { compilers[b.compiler ?? 'Unknown'] = false; }); - data.hardwareUsed.forEach(h => (hardware[h] = false)); + data.summary.hardware.forEach(h => (hardware[h] = false)); - data.buildsIssues.forEach(i => (buildIssue[i.id] = false)); - data.bootIssues.forEach(i => (bootIssue[i.id] = false)); - data.testIssues.forEach(i => (testIssue[i.id] = false)); + data.summary.builds.issues.forEach(i => (buildIssue[i.id] = false)); + data.summary.boots.issues.forEach(i => (bootIssue[i.id] = false)); + data.summary.tests.issues.forEach(i => (testIssue[i.id] = false)); } return { diff --git a/dashboard/src/types/tree/TreeDetails.tsx b/dashboard/src/types/tree/TreeDetails.tsx index 0a105d68..b6c5167b 100644 --- a/dashboard/src/types/tree/TreeDetails.tsx +++ b/dashboard/src/types/tree/TreeDetails.tsx @@ -63,38 +63,40 @@ export type TTreeTestsData = { environmentCompatible: PropertyStatusCounts; }; +type TestSummary = { + status: StatusCounts; + architectures: ArchCompilerStatus[]; + configs: PropertyStatusCounts; + issues: TIssue[]; + unknown_issues: number; + enviroment_compatible: PropertyStatusCounts; + enviroment_misc: PropertyStatusCounts; + fail_reasons: Record; + failed_platforms: string[]; +}; + +type BuildSummary = { + status: BuildStatus; + architectures: Architecture; + configs: Record; + issues: TIssue[]; + unknown_issues: number; +}; + +type Summary = { + boots: TestSummary; + builds: BuildSummary; + tests: TestSummary; + hardware: string[]; + tree_url: string; + git_commit_tags: string[]; +}; + export type TTreeTestsFullData = { - bootArchSummary: ArchCompilerStatus[]; - testArchSummary: ArchCompilerStatus[]; - bootFailReasons: ErrorMessageCounts; - testFailReasons: ErrorMessageCounts; - testPlatformsWithErrors: string[]; - bootPlatformsFailing: string[]; - testConfigs: PropertyStatusCounts; - bootConfigs: PropertyStatusCounts; - testStatusSummary: StatusCounts; - bootStatusSummary: StatusCounts; - bootHistory: TestHistory[]; - testHistory: TestHistory[]; - bootIssues: TIssue[]; - testIssues: TIssue[]; - testEnvironmentCompatible: PropertyStatusCounts; - bootEnvironmentCompatible: PropertyStatusCounts; - testEnvironmentMisc: PropertyStatusCounts; - bootEnvironmentMisc: PropertyStatusCounts; - hardwareUsed: string[]; - failedTestsWithUnknownIssues: number; - failedBootsWithUnknownIssues: number; builds: BuildsTabBuild[]; - buildsSummary: { - builds: BuildStatus; - configs: Record; - architectures: Architecture; - }; - buildsIssues: TIssue[]; - failedBuildsWithUnknownIssues: number; - treeUrl: string; - git_commit_tags: string[]; + boots: TestHistory[]; + tests: TestHistory[]; + summary: Summary; }; export const possibleTabs = [