Skip to content

Commit cfb25a4

Browse files
author
Amrit Kashyap Borah
committed
chore: move content from fe-lib
1 parent 2163c58 commit cfb25a4

8 files changed

Lines changed: 165 additions & 0 deletions

File tree

src/Common/Constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ export const ROUTES = {
232232
LICENSE_DATA: 'license/data',
233233
ENV: 'env',
234234
APP_METADATA: 'app-metadata',
235+
APPS_OVERVIEW: 'overview/apps-overview',
236+
WORKFLOW_OVERVIEW: 'overview/workflow-overview',
237+
DORA_METRICS: 'overview/dora-metrics',
238+
BUILD_DEPLOYMENT_ACTIVITY: 'overview/build-deployment-activity',
239+
BUILD_DEPLOYMENT_ACTIVITY_DETAILED: 'overview/build-deployment-activity/detailed',
240+
PIPELINE_INSIGHTS: 'overview/pipeline-insights',
235241
} as const
236242

237243
export enum KEY_VALUE {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { CHART_COLORS } from '@Shared/Components/Charts'
2+
import { useTheme } from '@Shared/Providers/ThemeProvider'
3+
4+
import { ChartTooltipProps } from './types'
5+
6+
export const LoadingDonutChart = () => (
7+
<div className="flex p-20 dc__gap-20 h-200">
8+
<div className="dc__border-radius-50-per h-150 w-150 shimmer" />
9+
<div className="flexbox-col dc__gap-8">
10+
<span className="shimmer w-80px" />
11+
<span className="shimmer w-80px" />
12+
</div>
13+
</div>
14+
)
15+
16+
export const ChartTooltip = ({ title, label, value, chartColorKey }: ChartTooltipProps) => {
17+
const { appTheme } = useTheme()
18+
const backgroundColor = CHART_COLORS[appTheme][chartColorKey]
19+
return (
20+
<div className="dc__mxw-200 flexbox-col dc__gap-8 py-6 px-10 fw-4">
21+
{title && <span className="fw-6">{title}</span>}
22+
<div className="flexbox dc__gap-4">
23+
<div className="py-4">
24+
<div className="icon-dim-12 br-2" style={{ backgroundColor }} />
25+
</div>
26+
<div className="flexbox-col dc__gap-12">
27+
<span>
28+
{label}:&nbsp;{value}
29+
</span>
30+
</div>
31+
</div>
32+
</div>
33+
)
34+
}
35+
36+
export const ChartColorIndicator = ({ title, backgroundColor }: { title: string; backgroundColor: string }) => (
37+
<div className="flexbox dc__gap-4">
38+
<div className="py-4">
39+
<div className="icon-dim-12 br-2" style={{ backgroundColor }} />
40+
</div>
41+
<span>{title}</span>
42+
</div>
43+
)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { SortingOrder } from '@Common/Constants'
2+
import { SelectPickerOptionType } from '@Shared/Components'
3+
4+
import { RelativeTimeWindow, TIME_WINDOW } from './types'
5+
6+
const OVERVIEW_DEFAULT_PAGE_SIZE = {
7+
SMALL: 5,
8+
MEDIUM: 10,
9+
LARGE: 20,
10+
}
11+
12+
export const OVERVIEW_PAGE_SIZE_OPTIONS = [
13+
{
14+
value: OVERVIEW_DEFAULT_PAGE_SIZE.MEDIUM,
15+
selected: true,
16+
},
17+
{
18+
value: OVERVIEW_DEFAULT_PAGE_SIZE.LARGE,
19+
selected: false,
20+
},
21+
]
22+
23+
export const OVERVIEW_PAGE_SIZE_OPTIONS_SMALL = [
24+
{
25+
value: OVERVIEW_DEFAULT_PAGE_SIZE.SMALL,
26+
selected: true,
27+
},
28+
{
29+
value: OVERVIEW_DEFAULT_PAGE_SIZE.MEDIUM,
30+
selected: false,
31+
},
32+
]
33+
34+
export const RELATIVE_TIME_WINDOW_LABEL_MAP: Record<RelativeTimeWindow, string> = {
35+
[RelativeTimeWindow.LAST_7_DAYS]: 'Last 7 Days',
36+
[RelativeTimeWindow.LAST_30_DAYS]: 'Last 30 Days',
37+
[RelativeTimeWindow.LAST_90_DAYS]: 'Last 90 Days',
38+
}
39+
40+
export const RELATIVE_TIME_WINDOW_SELECT_OPTIONS: SelectPickerOptionType<RelativeTimeWindow>[] = (
41+
Object.keys(RELATIVE_TIME_WINDOW_LABEL_MAP) as RelativeTimeWindow[]
42+
).map((value) => ({
43+
label: RELATIVE_TIME_WINDOW_LABEL_MAP[value],
44+
value,
45+
}))
46+
47+
export const SORT_ORDER_OPTIONS: SelectPickerOptionType<SortingOrder>[] = [
48+
{ label: 'Low to high', value: SortingOrder.ASC },
49+
{ label: 'High to low', value: SortingOrder.DESC },
50+
]
51+
52+
export const TIME_WINDOW_LABEL_MAP: Record<TIME_WINDOW, string> = {
53+
[TIME_WINDOW.TODAY]: 'Today',
54+
[TIME_WINDOW.THIS_WEEK]: 'This week',
55+
[TIME_WINDOW.THIS_MONTH]: 'This month',
56+
[TIME_WINDOW.THIS_QUARTER]: 'This quarter',
57+
[TIME_WINDOW.LAST_WEEK]: 'Last week',
58+
[TIME_WINDOW.LAST_MONTH]: 'Last month',
59+
}
60+
61+
export const TIME_WINDOW_SELECT_OPTIONS: SelectPickerOptionType<TIME_WINDOW>[] = (
62+
Object.keys(TIME_WINDOW_LABEL_MAP) as TIME_WINDOW[]
63+
).map((value) => ({
64+
label: TIME_WINDOW_LABEL_MAP[value],
65+
value,
66+
}))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './components'
2+
export * from './constants'
3+
export * from './types'
4+
export * from './utils'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { ChartColorKey } from '@Shared/Components/Charts/types'
2+
3+
export enum ProdNonProdSelectValueTypes {
4+
ALL = 'All',
5+
PRODUCTION = 'Prod',
6+
NON_PRODUCTION = 'Non-Prod',
7+
}
8+
9+
export enum RelativeTimeWindow {
10+
LAST_7_DAYS = 'last7Days',
11+
LAST_30_DAYS = 'last30Days',
12+
LAST_90_DAYS = 'last90Days',
13+
}
14+
15+
export interface ChartTooltipProps {
16+
title?: string
17+
label: string
18+
value: string | number
19+
chartColorKey: ChartColorKey
20+
}
21+
22+
export enum TIME_WINDOW {
23+
TODAY = 'today',
24+
THIS_WEEK = 'week',
25+
THIS_MONTH = 'month',
26+
THIS_QUARTER = 'quarter',
27+
LAST_WEEK = 'lastWeek',
28+
LAST_MONTH = 'lastMonth',
29+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import dayjs from 'dayjs'
2+
3+
import { DATE_TIME_FORMATS } from '@Common/Constants'
4+
5+
export const parseTimestampToDate = (timestamp: string): string => {
6+
const dateObj = dayjs(timestamp)
7+
return dateObj.format(DATE_TIME_FORMATS.DD_MMM)
8+
}

src/Pages-Devtron-2.0/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './CostVisibility'
33
export * from './DataProtectionManagement'
44
export * from './InfrastructureManagement'
55
export * from './SecurityCenter'
6+
export * from './Shared'

src/Shared/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import dayjs from 'dayjs'
2+
3+
import { DATE_TIME_FORMATS } from '@Common/Constants'
4+
5+
export const parseTimestampToDate = (timestamp: string): string => {
6+
const dateObj = dayjs(timestamp)
7+
return dateObj.format(DATE_TIME_FORMATS.DD_MMM)
8+
}

0 commit comments

Comments
 (0)