-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add deployment flow RQs (#503)
- Loading branch information
1 parent
367853d
commit 2ed51bb
Showing
4 changed files
with
199 additions
and
45 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 |
---|---|---|
@@ -1,3 +1,26 @@ | ||
import { K8s } from '@kinvolk/headlamp-plugin/lib'; | ||
import { streamResults } from '../../../common/streamResults'; | ||
import { ResourceQuotaKubeObjectConfig } from './config'; | ||
import { RESOURCE_QUOTA_LABEL_TENANT } from './labels'; | ||
import { StreamListProps } from './types'; | ||
|
||
export class ResourceQuotaKubeObject extends K8s.ResourceClasses.ResourceQuota {} | ||
const { | ||
name: { pluralForm }, | ||
version, | ||
} = ResourceQuotaKubeObjectConfig; | ||
|
||
export class ResourceQuotaKubeObject extends K8s.ResourceClasses.ResourceQuota { | ||
static streamList({ | ||
namespace, | ||
tenantNamespace, | ||
dataHandler, | ||
errorHandler, | ||
}: StreamListProps): () => void { | ||
console.log(tenantNamespace); | ||
|
||
const url = `/api/${version}/namespaces/${namespace}/${pluralForm}`; | ||
return streamResults(url, dataHandler, errorHandler, { | ||
labelSelector: `${RESOURCE_QUOTA_LABEL_TENANT}=edp-workload-${tenantNamespace}`, | ||
}); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import { KubeObjectInterface } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster'; | ||
|
||
export interface ResourceQuotaKubeObjectInterface extends KubeObjectInterface {} | ||
|
||
export interface StreamListProps { | ||
namespace: string; | ||
tenantNamespace: string; | ||
dataHandler: (data: ResourceQuotaKubeObjectInterface[]) => void; | ||
errorHandler: (err: Error) => void; | ||
} |
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,40 @@ | ||
import { PercentageCircle } from '@kinvolk/headlamp-plugin/lib/CommonComponents'; | ||
import { Box, Stack, Typography, useTheme } from '@mui/material'; | ||
import React from 'react'; | ||
import { QuotaDetails } from '../../types'; | ||
import { getColorByLoadPercentage } from '../../utils'; | ||
|
||
export const RQItem = ({ entity, details }: { entity: string; details: QuotaDetails }) => { | ||
const theme = useTheme(); | ||
|
||
const { hard, used } = details; | ||
const loadPercentage = Math.floor((used / hard) * 100); | ||
const color = getColorByLoadPercentage(theme, loadPercentage); | ||
|
||
return ( | ||
<Box sx={{ flex: '1 1 0', minWidth: theme.typography.pxToRem(100) }}> | ||
<Stack alignItems="center" spacing={1}> | ||
<Typography color="primary.dark" variant="subtitle2"> | ||
{entity} | ||
</Typography> | ||
<Box sx={{ width: '40px', height: '40px' }}> | ||
<PercentageCircle | ||
data={[ | ||
{ | ||
name: 'OK', | ||
value: loadPercentage, | ||
fill: color, | ||
}, | ||
]} | ||
total={100} | ||
size={50} | ||
thickness={6} | ||
/> | ||
</Box> | ||
<Typography color="primary.dark" variant="caption"> | ||
{details?.['used_initial']} / {details?.['hard_initial']} | ||
</Typography> | ||
</Stack> | ||
</Box> | ||
); | ||
}; |
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