-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1722 from pcbailey/add-top-consumers-dashboard-card
Add the top consumers card to dashboard
- Loading branch information
Showing
17 changed files
with
397 additions
and
43 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
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
11 changes: 11 additions & 0 deletions
11
frontend/public/components/dashboard/top-consumers-card/consumers-body.tsx
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,11 @@ | ||
import * as React from 'react'; | ||
|
||
export const ConsumersBody: React.FC<ConsumersBodyProps> = React.memo(({ children }) => ( | ||
<div className="co-consumers-card__body"> | ||
{children} | ||
</div> | ||
)); | ||
|
||
type ConsumersBodyProps = { | ||
children?: React.ReactNode; | ||
}; |
38 changes: 38 additions & 0 deletions
38
frontend/public/components/dashboard/top-consumers-card/consumers-filter.tsx
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,38 @@ | ||
import * as React from 'react'; | ||
|
||
import { CPU_DESC, MEMORY_DESC, STORAGE_DESC, NETWORK_DESC } from './strings'; | ||
import { humanizeNumber, humanizeBinaryBytesWithoutB, humanizeDecimalBytesPerSec, Humanize } from '../../utils'; | ||
import { MetricType } from './metric-type'; | ||
|
||
export const metricTypeMap: MetricTypeMap = { | ||
[MetricType.CPU]: { | ||
description: CPU_DESC, | ||
humanize: humanizeNumber, | ||
}, | ||
[MetricType.MEMORY]: { | ||
description: MEMORY_DESC, | ||
humanize: humanizeBinaryBytesWithoutB, | ||
}, | ||
[MetricType.STORAGE]: { | ||
description: STORAGE_DESC, | ||
humanize: humanizeNumber, | ||
}, | ||
[MetricType.NETWORK]: { | ||
description: NETWORK_DESC, | ||
humanize: humanizeDecimalBytesPerSec, | ||
}, | ||
}; | ||
|
||
export const ConsumersFilter: React.FC<ConsumersFilterProps> = ({ children }) => | ||
<div className="co-consumers-card__filters">{children}</div>; | ||
|
||
type ConsumersFilterProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
type MetricTypeMap = { | ||
[key: string]: { | ||
description: string, | ||
humanize: Humanize, | ||
}, | ||
}; |
2 changes: 2 additions & 0 deletions
2
frontend/public/components/dashboard/top-consumers-card/index.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,2 @@ | ||
export * from './consumers-filter'; | ||
export * from './consumers-body'; |
6 changes: 6 additions & 0 deletions
6
frontend/public/components/dashboard/top-consumers-card/metric-type.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,6 @@ | ||
export enum MetricType { | ||
CPU = 'By CPU', | ||
MEMORY = 'By Memory', | ||
STORAGE = 'By Storage', | ||
NETWORK = 'By Network', | ||
} |
7 changes: 7 additions & 0 deletions
7
frontend/public/components/dashboard/top-consumers-card/strings.js
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 @@ | ||
export const CPU_DESC = 'CPU time'; | ||
export const MEMORY_DESC = 'Memory consumption'; | ||
export const STORAGE_DESC = 'Filesystem IO time'; | ||
export const NETWORK_DESC = 'Network consumption'; | ||
|
||
export const PODS = 'Pods'; | ||
export const NODES = 'Nodes'; |
9 changes: 9 additions & 0 deletions
9
frontend/public/components/dashboard/top-consumers-card/top-consumers-card.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,9 @@ | ||
.co-consumers-card__filters { | ||
border-bottom: 1px solid $pf-color-black-300; | ||
display: flex; | ||
padding-bottom: 0.6em; | ||
} | ||
|
||
.co-consumers-card__body { | ||
text-align: center; | ||
} |
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
11 changes: 11 additions & 0 deletions
11
frontend/public/components/dashboards-page/overview-dashboard/top-consumers-card.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,11 @@ | ||
.co-overview-consumers__dropdown { | ||
width: 100%; | ||
} | ||
|
||
.co-overview-consumers__dropdown--left { | ||
padding-left: 0.3em; | ||
} | ||
|
||
.co-overview-consumers__dropdown--right { | ||
padding-right: 0.3em; | ||
} |
Oops, something went wrong.