generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(heureka): adds pagination for component instances on a service d…
…etails panel (#577) * feat(heureka): adds pagination for component instances list on service details page * chore(heureka): removes the commented out code * chore(heureka): optimises graphql queries * chore(heureka): adjusts tests * chore(heureka): adds changeset * feat(heureka): renames name to ccrn for Services, Components and Support Group in all queries * feat(heureka): renames name to ccrn for Services, Components and Support Group in all queries * feat(heureka): adds a test for ComponentInstancesList * feat(heureka): add tests for pagination component
- Loading branch information
Showing
20 changed files
with
335 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@cloudoperators/juno-app-heureka": minor | ||
"@cloudoperators/juno-app-greenhouse": patch | ||
--- | ||
|
||
The pagination is added to the list of component instances for a selected service on the service details page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
apps/heureka/src/components/services/ComponentInstancesList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from "react" | ||
import { useQuery } from "@tanstack/react-query" | ||
import { | ||
ContentHeading, | ||
Container, | ||
DataGrid, | ||
DataGridRow, | ||
DataGridCell, | ||
DataGridHeadCell, | ||
} from "@cloudoperators/juno-ui-components" | ||
import { useGlobalsQueryClientFnReady, useGlobalsQueryOptions, useGlobalsActions } from "../StoreProvider" | ||
import LoadElement from "../shared/LoadElement" | ||
import { severityString, highestSeverity } from "../shared/Helper" | ||
import PaginationComponent from "../shared/PaginationComponent" | ||
import HintNotFound from "../shared/HintNotFound" | ||
|
||
const ComponentInstancesList = ({ serviceCcrn }) => { | ||
const queryOptions = useGlobalsQueryOptions("ComponentInstancesOfService") | ||
const { setQueryOptions } = useGlobalsActions() | ||
const queryClientFnReady = useGlobalsQueryClientFnReady() | ||
|
||
const { data, isLoading } = useQuery({ | ||
queryKey: [ | ||
"ComponentInstancesOfService", | ||
{ | ||
...queryOptions, | ||
filter: { serviceCcrn: [serviceCcrn] }, | ||
}, | ||
], | ||
enabled: !!queryClientFnReady && !!serviceCcrn, | ||
}) | ||
|
||
const items = data?.ComponentInstances?.edges || [] | ||
|
||
return ( | ||
<> | ||
<ContentHeading className="mt-8 mb-2" heading="Component Instances" /> | ||
<DataGrid columns={4}> | ||
<DataGridRow> | ||
<DataGridHeadCell>Component</DataGridHeadCell> | ||
<DataGridHeadCell>Version</DataGridHeadCell> | ||
<DataGridHeadCell>Total Number of Issues</DataGridHeadCell> | ||
<DataGridHeadCell>Highest Severity</DataGridHeadCell> | ||
</DataGridRow> | ||
{isLoading ? ( | ||
<DataGridRow> | ||
<DataGridCell colSpan={4}> | ||
<Container py> | ||
<LoadElement /> | ||
</Container> | ||
</DataGridCell> | ||
</DataGridRow> | ||
) : items.length === 0 ? ( | ||
<HintNotFound text="No component instances available." /> | ||
) : ( | ||
items.map((componentInstance, i) => ( | ||
<DataGridRow key={i}> | ||
<DataGridCell>{componentInstance?.node?.ccrn}</DataGridCell> | ||
<DataGridCell className="break-all overflow-hidden"> | ||
{componentInstance?.node?.componentVersion?.version} | ||
</DataGridCell> | ||
<DataGridCell>{componentInstance?.node?.issueMatches?.totalCount}</DataGridCell> | ||
<DataGridCell> | ||
{severityString(highestSeverity(componentInstance?.node?.issueMatches?.edges))} | ||
</DataGridCell> | ||
</DataGridRow> | ||
)) | ||
)} | ||
</DataGrid> | ||
<PaginationComponent | ||
queryKey="ComponentInstancesOfService" | ||
queryOptions={queryOptions} | ||
entityName="ComponentInstances" | ||
setQueryOptions={setQueryOptions} | ||
countData={data} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export default ComponentInstancesList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.