-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement clusters in k8s infra monitoring
- Loading branch information
1 parent
c106f1c
commit 92bd7d4
Showing
33 changed files
with
5,254 additions
and
25 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,64 @@ | ||
import { ApiBaseInstance } from 'api'; | ||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler'; | ||
import { AxiosError } from 'axios'; | ||
import { ErrorResponse, SuccessResponse } from 'types/api'; | ||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; | ||
import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; | ||
|
||
export interface K8sClustersListPayload { | ||
filters: TagFilter; | ||
groupBy?: BaseAutocompleteData[]; | ||
offset?: number; | ||
limit?: number; | ||
orderBy?: { | ||
columnName: string; | ||
order: 'asc' | 'desc'; | ||
}; | ||
} | ||
|
||
export interface K8sClustersData { | ||
clusterUID: string; | ||
cpuUsage: number; | ||
cpuAllocatable: number; | ||
memoryUsage: number; | ||
memoryAllocatable: number; | ||
meta: { | ||
k8s_cluster_name: string; | ||
k8s_cluster_uid: string; | ||
}; | ||
} | ||
|
||
export interface K8sClustersListResponse { | ||
status: string; | ||
data: { | ||
type: string; | ||
records: K8sClustersData[]; | ||
groups: null; | ||
total: number; | ||
sentAnyHostMetricsData: boolean; | ||
isSendingK8SAgentMetrics: boolean; | ||
}; | ||
} | ||
|
||
export const getK8sClustersList = async ( | ||
props: K8sClustersListPayload, | ||
signal?: AbortSignal, | ||
headers?: Record<string, string>, | ||
): Promise<SuccessResponse<K8sClustersListResponse> | ErrorResponse> => { | ||
try { | ||
const response = await ApiBaseInstance.post('/clusters/list', props, { | ||
signal, | ||
headers, | ||
}); | ||
|
||
return { | ||
statusCode: 200, | ||
error: null, | ||
message: 'Success', | ||
payload: response.data, | ||
params: props, | ||
}; | ||
} catch (error) { | ||
return ErrorResponseHandler(error as AxiosError); | ||
} | ||
}; |
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
7 changes: 7 additions & 0 deletions
7
...end/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.interfaces.ts
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,7 @@ | ||
import { K8sClustersData } from 'api/infraMonitoring/getK8sClustersList'; | ||
|
||
export type ClusterDetailsProps = { | ||
cluster: K8sClustersData | null; | ||
isModalTimeSelection: boolean; | ||
onClose: () => void; | ||
}; |
247 changes: 247 additions & 0 deletions
247
frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.styles.scss
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,247 @@ | ||
.cluster-detail-drawer { | ||
border-left: 1px solid var(--bg-slate-500); | ||
background: var(--bg-ink-400); | ||
box-shadow: -4px 10px 16px 2px rgba(0, 0, 0, 0.2); | ||
|
||
.ant-drawer-header { | ||
padding: 8px 16px; | ||
border-bottom: none; | ||
|
||
align-items: stretch; | ||
|
||
border-bottom: 1px solid var(--bg-slate-500); | ||
background: var(--bg-ink-400); | ||
} | ||
|
||
.ant-drawer-close { | ||
margin-inline-end: 0px; | ||
} | ||
|
||
.ant-drawer-body { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 16px; | ||
} | ||
|
||
.title { | ||
color: var(--text-vanilla-400); | ||
font-family: 'Geist Mono'; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 20px; /* 142.857% */ | ||
letter-spacing: -0.07px; | ||
} | ||
|
||
.radio-button { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding-top: var(--padding-1); | ||
border: 1px solid var(--bg-slate-400); | ||
background: var(--bg-ink-300); | ||
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.cluster-detail-drawer__cluster { | ||
.cluster-details-grid { | ||
.labels-row, | ||
.values-row { | ||
display: grid; | ||
grid-template-columns: 1fr 1.5fr 1.5fr 1.5fr; | ||
gap: 30px; | ||
align-items: center; | ||
} | ||
|
||
.labels-row { | ||
margin-bottom: 8px; | ||
} | ||
|
||
.cluster-details-metadata-label { | ||
color: var(--text-vanilla-400); | ||
font-family: Inter; | ||
font-size: 11px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 18px; /* 163.636% */ | ||
letter-spacing: 0.44px; | ||
text-transform: uppercase; | ||
} | ||
|
||
.cluster-details-metadata-value { | ||
color: var(--text-vanilla-400); | ||
font-family: 'Geist Mono'; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 20px; /* 142.857% */ | ||
letter-spacing: -0.07px; | ||
|
||
width: 100%; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.status-tag { | ||
margin: 0; | ||
|
||
&.active { | ||
color: var(--success-500); | ||
background: var(--success-100); | ||
border-color: var(--success-500); | ||
} | ||
|
||
&.inactive { | ||
color: var(--error-500); | ||
background: var(--error-100); | ||
border-color: var(--error-500); | ||
} | ||
} | ||
|
||
.progress-container { | ||
width: 158px; | ||
.ant-progress { | ||
margin: 0; | ||
|
||
.ant-progress-text { | ||
font-weight: 600; | ||
} | ||
} | ||
} | ||
|
||
.ant-card { | ||
&.ant-card-bordered { | ||
border: 1px solid var(--bg-slate-500) !important; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.tabs-and-search { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin: 16px 0; | ||
|
||
.action-btn { | ||
border-radius: 2px; | ||
border: 1px solid var(--bg-slate-400); | ||
background: var(--bg-ink-300); | ||
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
} | ||
|
||
.views-tabs-container { | ||
margin-top: 1.5rem; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
|
||
.views-tabs { | ||
color: var(--text-vanilla-400); | ||
|
||
.view-title { | ||
display: flex; | ||
gap: var(--margin-2); | ||
align-items: center; | ||
justify-content: center; | ||
font-size: var(--font-size-xs); | ||
font-style: normal; | ||
font-weight: var(--font-weight-normal); | ||
} | ||
|
||
.tab { | ||
border: 1px solid var(--bg-slate-400); | ||
width: 114px; | ||
} | ||
|
||
.tab::before { | ||
background: var(--bg-slate-400); | ||
} | ||
|
||
.selected_view { | ||
background: var(--bg-slate-300); | ||
color: var(--text-vanilla-100); | ||
border: 1px solid var(--bg-slate-400); | ||
} | ||
|
||
.selected_view::before { | ||
background: var(--bg-slate-400); | ||
} | ||
} | ||
|
||
.compass-button { | ||
width: 30px; | ||
height: 30px; | ||
|
||
border-radius: 2px; | ||
border: 1px solid var(--bg-slate-400); | ||
background: var(--bg-ink-300); | ||
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||
} | ||
} | ||
.ant-drawer-close { | ||
padding: 0px; | ||
} | ||
} | ||
|
||
.lightMode { | ||
.ant-drawer-header { | ||
border-bottom: 1px solid var(--bg-vanilla-400); | ||
background: var(--bg-vanilla-100); | ||
} | ||
|
||
.cluster-detail-drawer { | ||
.title { | ||
color: var(--text-ink-300); | ||
} | ||
|
||
.cluster-detail-drawer__cluster { | ||
.ant-typography { | ||
color: var(--text-ink-300); | ||
background: transparent; | ||
} | ||
} | ||
|
||
.radio-button { | ||
border: 1px solid var(--bg-vanilla-400); | ||
background: var(--bg-vanilla-100); | ||
color: var(--text-ink-300); | ||
} | ||
|
||
.views-tabs { | ||
.tab { | ||
background: var(--bg-vanilla-100); | ||
} | ||
|
||
.selected_view { | ||
background: var(--bg-vanilla-300); | ||
border: 1px solid var(--bg-slate-300); | ||
color: var(--text-ink-400); | ||
} | ||
|
||
.selected_view::before { | ||
background: var(--bg-vanilla-300); | ||
border-left: 1px solid var(--bg-slate-300); | ||
} | ||
} | ||
|
||
.compass-button { | ||
border: 1px solid var(--bg-vanilla-300); | ||
background: var(--bg-vanilla-100); | ||
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.tabs-and-search { | ||
.action-btn { | ||
border: 1px solid var(--bg-vanilla-400); | ||
background: var(--bg-vanilla-100); | ||
color: var(--text-ink-300); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.