-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose essential APIs for Dashboards, ListPage and DetailsPage
- Loading branch information
Showing
40 changed files
with
386 additions
and
104 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
...ges/ceph-storage-plugin/src/components/dashboards/object-service/status-card/statuses.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
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
2 changes: 1 addition & 1 deletion
2
frontend/packages/ceph-storage-plugin/src/components/ocs-install/external-mode/utils.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
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
2 changes: 1 addition & 1 deletion
2
frontend/packages/console-demo-plugin/src/components/dashboards/health.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
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
19 changes: 19 additions & 0 deletions
19
frontend/packages/console-dynamic-plugin-sdk/src/api/dashboard/dashboard-api.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,19 @@ | ||
import { | ||
healthItem, | ||
alertItem, | ||
alertBody, | ||
dashboardGrid, | ||
recentEventsBody, | ||
prometheusUtilizationItem, | ||
} from './dashboard-types'; | ||
|
||
const MockImpl = () => { | ||
throw new Error('You need to configure webpack externals to use this function at runtime.'); | ||
}; | ||
|
||
export const HealthItem: healthItem = MockImpl; | ||
export const AlertItem: alertItem = MockImpl; | ||
export const AlertBody: alertBody = MockImpl; | ||
export const DashboardGrid: dashboardGrid = MockImpl; | ||
export const RecentEventsBody: recentEventsBody = MockImpl; | ||
export const PrometheusUtilizationItem: prometheusUtilizationItem = MockImpl; |
106 changes: 106 additions & 0 deletions
106
frontend/packages/console-dynamic-plugin-sdk/src/api/dashboard/dashboard-types.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,106 @@ | ||
import * as React from 'react'; | ||
import { FirehoseResult, HealthState, EventKind } from '../../extensions'; | ||
|
||
export type healthItem = React.FC<{ | ||
title: string; | ||
className?: string; | ||
details?: string; | ||
state?: HealthState; | ||
popupTitle?: string; | ||
noIcon?: boolean; | ||
icon?: React.ReactNode; | ||
}>; | ||
|
||
export type alertItem = React.FC<{ | ||
alert: any; | ||
}>; | ||
|
||
export type alertBody = React.FC<{ | ||
error?: boolean; | ||
}>; | ||
|
||
export type GridDashboardCard = { | ||
Card: React.ComponentType<any>; | ||
span?: 4 | 6 | 12; | ||
}; | ||
|
||
export type dashboardGrid = React.FC<{ | ||
mainCards: GridDashboardCard[]; | ||
leftCards?: GridDashboardCard[]; | ||
rightCards?: GridDashboardCard[]; | ||
}>; | ||
|
||
export type RecentEventsBodyProps = { | ||
events: FirehoseResult<EventKind[]>; | ||
filter?: (event: EventKind) => boolean; | ||
moreLink?: string; | ||
}; | ||
|
||
export type recentEventsBody = React.FC<RecentEventsBodyProps>; | ||
|
||
export enum LIMIT_STATE { | ||
ERROR = 'ERROR', | ||
WARN = 'WARN', | ||
OK = 'OK', | ||
} | ||
|
||
export type TopConsumerPopoverProp = { | ||
current: string; | ||
max?: string; | ||
limit?: string; | ||
available?: string; | ||
requested?: string; | ||
total?: string; | ||
limitState?: LIMIT_STATE; | ||
requestedState?: LIMIT_STATE; | ||
}; | ||
|
||
export type LimitRequested = { | ||
limit: LIMIT_STATE; | ||
requested: LIMIT_STATE; | ||
}; | ||
|
||
export declare type HumanizeResult = { | ||
string: string; | ||
value: number; | ||
unit: string; | ||
}; | ||
|
||
export type Humanize = ( | ||
v: React.ReactText, | ||
initialUnit?: string, | ||
preferredUnit?: string, | ||
) => HumanizeResult; | ||
|
||
export enum ByteDataTypes { | ||
BinaryBytes = 'binaryBytes', | ||
BinaryBytesWithoutB = 'binaryBytesWithoutB', | ||
DecimalBytes = 'decimalBytes', | ||
DecimalBytesWithoutB = 'decimalBytesWithoutB', | ||
} | ||
|
||
export type PrometheusCommonProps = { | ||
duration: string; | ||
adjustDuration?: (start: number) => number; | ||
title: string; | ||
humanizeValue: Humanize; | ||
byteDataType?: ByteDataTypes; | ||
namespace?: string; | ||
isDisabled?: boolean; | ||
}; | ||
|
||
export type PrometheusUtilizationItemProps = PrometheusCommonProps & { | ||
utilizationQuery: string; | ||
totalQuery?: string; | ||
limitQuery?: string; | ||
requestQuery?: string; | ||
TopConsumerPopover?: React.ComponentType<TopConsumerPopoverProp>; | ||
setTimestamps?: (timestamps: Date[]) => void; | ||
setLimitReqState?: (state: LimitRequested) => void; | ||
}; | ||
|
||
export type prometheusUtilizationItem = React.FC<PrometheusUtilizationItemProps>; | ||
|
||
export type utilizationBody = React.FC<{ | ||
timestamps: Date[]; | ||
}>; |
9 changes: 9 additions & 0 deletions
9
frontend/packages/console-dynamic-plugin-sdk/src/api/factory/factory-api.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,9 @@ | ||
import { detailsPage, listPage, table } from './factory-types'; | ||
|
||
const MockImpl = () => { | ||
throw new Error('You need to configure webpack externals to use this function at runtime.'); | ||
}; | ||
|
||
export const DetailsPage: detailsPage = MockImpl; | ||
export const ListPage: listPage = MockImpl; | ||
export const Table: table = MockImpl; |
73 changes: 73 additions & 0 deletions
73
frontend/packages/console-dynamic-plugin-sdk/src/api/factory/factory-types.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,73 @@ | ||
import { RouteComponentProps } from 'react-router'; | ||
import { K8sResourceCommon, K8sResourceKindReference, FirehoseResource } from '../../extensions'; | ||
|
||
export type listPage = React.FC<{ | ||
ListComponent: React.ComponentType<any>; | ||
kind: string; | ||
helpText?: any; | ||
namespace?: string; | ||
filterLabel?: string; | ||
textFilter?: string; | ||
title?: string; | ||
showTitle?: boolean; | ||
rowFilters?: any[]; | ||
selector?: any; | ||
fieldSelector?: string; | ||
canCreate?: boolean; | ||
createButtonText?: string; | ||
createProps?: any; | ||
mock?: boolean; | ||
badge?: React.ReactNode; | ||
createHandler?: any; | ||
}>; | ||
|
||
export type detailsPage = React.FC<{ | ||
match: RouteComponentProps['match']; | ||
title?: string | JSX.Element; | ||
titleFunc?: (obj: K8sResourceCommon) => string | JSX.Element; | ||
menuActions?: Function[]; | ||
buttonActions?: any[]; | ||
pages?: any[]; | ||
pagesFor?: (obj: K8sResourceCommon) => any[]; | ||
kind: K8sResourceKindReference; | ||
label?: string; | ||
name?: string; | ||
namespace?: string; | ||
resources?: FirehoseResource[]; | ||
breadcrumbsFor?: (obj: K8sResourceCommon) => { name: string; path: string }[]; | ||
customData?: any; | ||
badge?: React.ReactNode; | ||
icon?: React.ComponentType<{ obj: K8sResourceCommon }>; | ||
getResourceStatus?: (resource: K8sResourceCommon) => string; | ||
children?: React.ReactNode; | ||
customKind?: string; | ||
}>; | ||
|
||
export type table = React.FC<{ | ||
customData?: any; | ||
customSorts?: { [key: string]: any }; | ||
data?: any[]; | ||
defaultSortFunc?: string; | ||
defaultSortField?: string; | ||
showNamespaceOverride?: boolean; | ||
filters?: { [key: string]: any }; | ||
Header: (...args) => any[]; | ||
loadError?: string | object; | ||
Row?: Function; | ||
Rows?: (...args) => any[]; | ||
'aria-label': string; | ||
onSelect?: Function; | ||
virtualize?: boolean; | ||
NoDataEmptyMsg?: React.ComponentType<{}>; | ||
EmptyMsg?: React.ComponentType<{}>; | ||
loaded?: boolean; | ||
reduxID?: string; | ||
reduxIDs?: string[]; | ||
rowFilters?: any[]; | ||
label?: string; | ||
columnManagementID?: string; | ||
isPinned?: (val: any) => boolean; | ||
staticFilters?: any[]; | ||
activeColumns?: Set<string>; | ||
kinds?: string[]; | ||
}>; |
8 changes: 8 additions & 0 deletions
8
frontend/packages/console-dynamic-plugin-sdk/src/api/utils/util-api.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,8 @@ | ||
import { horizontalNav, pageHeading } from './util-types'; | ||
|
||
const MockImpl = () => { | ||
throw new Error('You need to configure webpack externals to use this function at runtime.'); | ||
}; | ||
|
||
export const PageHeading: pageHeading = MockImpl; | ||
export const HorizontalNav: horizontalNav = MockImpl; |
33 changes: 33 additions & 0 deletions
33
frontend/packages/console-dynamic-plugin-sdk/src/api/utils/util-types.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,33 @@ | ||
import { K8sResourceKindReference, FirehoseResult, K8sResourceCommon } from '../../extensions'; | ||
|
||
export type pageHeading = React.FC<{ | ||
buttonActions?: any[]; | ||
children?: React.ReactChildren; | ||
detail?: boolean; | ||
kind?: K8sResourceKindReference; | ||
menuActions?: Function[]; | ||
obj?: FirehoseResult<K8sResourceCommon>; | ||
resourceKeys?: string[]; | ||
style?: object; | ||
title?: string | JSX.Element; | ||
titleFunc?: (obj: K8sResourceCommon) => string | JSX.Element; | ||
customData?: any; | ||
badge?: React.ReactNode; | ||
icon?: React.ComponentType<{ obj?: K8sResourceCommon }>; | ||
getResourceStatus?: (resource: K8sResourceCommon) => string; | ||
className?: string; | ||
}>; | ||
|
||
export type horizontalNav = React.FC<{ | ||
className?: string; | ||
obj?: { loaded: boolean; data: K8sResourceCommon }; | ||
label?: string; | ||
pages: any[]; | ||
pagesFor?: (obj: K8sResourceCommon) => any[]; | ||
match: any; | ||
resourceKeys?: string[]; | ||
hideNav?: boolean; | ||
EmptyMsg?: React.ComponentType<any>; | ||
noStatusBox?: boolean; | ||
customData?: any; | ||
}>; |
Oops, something went wrong.