@dovetail-v2/refine 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MonacoYamlDiffEditor.15656940.js → MonacoYamlDiffEditor.dc83b657.js} +1 -1
- package/dist/{index.82c82bb4.js → index.d48047e6.js} +4987 -2669
- package/dist/refine.js +87 -68
- package/dist/refine.umd.cjs +4863 -2545
- package/dist/style.css +17 -32609
- package/lib/src/Dovetail.d.ts +2 -4
- package/lib/src/components/CronJobDropdown/index.d.ts +2 -2
- package/lib/src/components/DrawerShow/DrawerShow.d.ts +1 -1
- package/lib/src/components/EditField/index.d.ts +15 -0
- package/lib/src/components/FormErrorAlert/index.d.ts +8 -0
- package/lib/src/components/FormLayout/index.d.ts +5 -1
- package/lib/src/components/FormModal/index.d.ts +12 -0
- package/lib/src/components/K8sDropdown/index.d.ts +2 -2
- package/lib/src/components/ListPage/index.d.ts +1 -1
- package/lib/src/components/ModalContextProvider/index.d.ts +12 -0
- package/lib/src/components/PageShow/PageShow.d.ts +2 -2
- package/lib/src/components/PodLog/index.d.ts +1 -1
- package/lib/src/components/ResourceCRUD/ResourceCRUD.d.ts +3 -3
- package/lib/src/components/ResourceCRUD/create/index.d.ts +1 -1
- package/lib/src/components/ResourceCRUD/list/index.d.ts +2 -2
- package/lib/src/components/ResourceCRUD/show/index.d.ts +2 -2
- package/lib/src/components/ShowContent/ShowContent.d.ts +2 -2
- package/lib/src/components/ShowContent/fields.d.ts +1 -1
- package/lib/src/components/StateTag/StateTag.d.ts +2 -1
- package/lib/src/components/Table/index.d.ts +9 -4
- package/lib/src/components/WorkloadDropdown/index.d.ts +4 -2
- package/lib/src/components/WorkloadReplicas/index.d.ts +1 -1
- package/lib/src/components/YamlForm/index.d.ts +12 -3
- package/lib/src/components/index.d.ts +1 -0
- package/lib/src/constants/index.d.ts +1 -0
- package/lib/src/constants/state.d.ts +13 -0
- package/lib/src/contexts/component.d.ts +6 -0
- package/lib/src/contexts/configs.d.ts +4 -0
- package/lib/src/contexts/global-store.d.ts +6 -0
- package/lib/src/contexts/index.d.ts +3 -0
- package/lib/src/hooks/index.d.ts +1 -0
- package/lib/src/hooks/useEagleForm.d.ts +2 -1
- package/lib/src/hooks/useEagleTable/columns.d.ts +5 -5
- package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +2 -2
- package/lib/src/hooks/useGlobalStore.d.ts +3 -0
- package/lib/src/hooks/useModal.d.ts +0 -0
- package/lib/src/hooks/useOpenForm.d.ts +5 -0
- package/lib/src/hooks/useSubmitForm.d.ts +13 -0
- package/lib/src/i18n.d.ts +15 -1
- package/lib/src/index.d.ts +3 -0
- package/lib/src/locales/en-US/index.d.ts +2 -0
- package/lib/src/locales/zh-CN/index.d.ts +13 -1
- package/lib/src/main.d.ts +2 -0
- package/lib/src/model/pod-model.d.ts +2 -0
- package/lib/src/models/cronjob-model.d.ts +16 -0
- package/lib/src/models/daemonset-model.d.ts +14 -0
- package/lib/src/models/deployment-model.d.ts +14 -0
- package/lib/src/models/event-model.d.ts +8 -0
- package/lib/src/models/index.d.ts +12 -0
- package/lib/src/models/job-model.d.ts +17 -0
- package/lib/src/models/pod-metrics-model.d.ts +9 -0
- package/lib/src/models/pod-model.d.ts +21 -0
- package/lib/src/models/resource-model.d.ts +21 -0
- package/lib/src/models/statefulset-model.d.ts +14 -0
- package/lib/src/models/types/index.d.ts +1 -0
- package/lib/src/models/types/metric.d.ts +25 -0
- package/lib/src/models/workload-base-model.d.ts +13 -0
- package/lib/src/models/workload-model.d.ts +17 -0
- package/lib/src/pages/configmaps/index.d.ts +1 -1
- package/lib/src/pages/deployments/create/index.d.ts +2 -2
- package/lib/src/pages/jobs/index.d.ts +1 -1
- package/lib/src/pages/secrets/index.d.ts +1 -1
- package/lib/src/pages/services/index.d.ts +1 -1
- package/lib/src/plugins/index.d.ts +2 -0
- package/lib/src/plugins/model-plugin.d.ts +12 -0
- package/lib/src/plugins/relation-plugin.d.ts +27 -0
- package/lib/src/plugins/type.d.ts +8 -0
- package/lib/src/providers/router-provider/index.d.ts +1 -1
- package/lib/src/types/resource.d.ts +11 -5
- package/lib/src/utils/error.d.ts +2 -2
- package/lib/src/utils/form.d.ts +3 -0
- package/lib/src/utils/match-selector.d.ts +3 -0
- package/lib/src/utils/selector.d.ts +1 -1
- package/package.json +12 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import { Job } from 'kubernetes-types/batch/v1';
|
|
3
|
+
import { WorkloadState } from '../constants';
|
|
4
|
+
import { WorkloadBaseModel } from './workload-base-model';
|
|
5
|
+
type RequiredJob = Required<Job> & Unstructured;
|
|
6
|
+
export declare class JobModel extends WorkloadBaseModel {
|
|
7
|
+
_rawYaml: RequiredJob;
|
|
8
|
+
_globalStore: GlobalStore;
|
|
9
|
+
spec?: RequiredJob['spec'];
|
|
10
|
+
status?: RequiredJob['status'];
|
|
11
|
+
constructor(_rawYaml: RequiredJob, _globalStore: GlobalStore);
|
|
12
|
+
get duration(): number;
|
|
13
|
+
get durationDisplay(): string | undefined;
|
|
14
|
+
get completionsDisplay(): string;
|
|
15
|
+
get stateDisplay(): WorkloadState.COMPLETED | WorkloadState.FAILED | WorkloadState.SUSPENDED | WorkloadState.RUNNING;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GlobalStore } from 'k8s-api-provider';
|
|
2
|
+
import { ResourceModel } from './resource-model';
|
|
3
|
+
import { PodMetrics, ResourceQuantity } from './types/metric';
|
|
4
|
+
export declare class PodMetricsModel extends ResourceModel<PodMetrics> {
|
|
5
|
+
_rawYaml: PodMetrics;
|
|
6
|
+
_globalStore: GlobalStore;
|
|
7
|
+
usage: ResourceQuantity;
|
|
8
|
+
constructor(_rawYaml: PodMetrics, _globalStore: GlobalStore);
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import type { Pod } from 'kubernetes-types/core/v1';
|
|
3
|
+
import { ResourceQuantity } from './types/metric';
|
|
4
|
+
import { WorkloadBaseModel } from './workload-base-model';
|
|
5
|
+
type RequiredPod = Required<Pod> & Unstructured;
|
|
6
|
+
export declare class PodModel extends WorkloadBaseModel {
|
|
7
|
+
_rawYaml: RequiredPod;
|
|
8
|
+
_globalStore: GlobalStore;
|
|
9
|
+
request: ResourceQuantity;
|
|
10
|
+
limit: ResourceQuantity;
|
|
11
|
+
spec?: RequiredPod['spec'];
|
|
12
|
+
status?: RequiredPod['status'];
|
|
13
|
+
constructor(_rawYaml: RequiredPod, _globalStore: GlobalStore);
|
|
14
|
+
get imageNames(): string[];
|
|
15
|
+
get restartCount(): number;
|
|
16
|
+
get readyDisplay(): string;
|
|
17
|
+
get readyContainerCount(): number | undefined;
|
|
18
|
+
get containerCount(): number;
|
|
19
|
+
get stateDisplay(): string;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
export type IResourceModel = Unstructured & ResourceModel;
|
|
3
|
+
export declare class ResourceModel<T extends Unstructured = Unstructured> {
|
|
4
|
+
_rawYaml: T;
|
|
5
|
+
_globalStore: GlobalStore;
|
|
6
|
+
id: string;
|
|
7
|
+
apiVersion: T['apiVersion'];
|
|
8
|
+
kind: T['kind'];
|
|
9
|
+
metadata: T['metadata'];
|
|
10
|
+
constructor(_rawYaml: T, _globalStore: GlobalStore);
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
get name(): string | undefined;
|
|
13
|
+
get namespace(): string | undefined;
|
|
14
|
+
get labels(): {
|
|
15
|
+
[name: string]: string;
|
|
16
|
+
} | undefined;
|
|
17
|
+
get annotations(): {
|
|
18
|
+
[name: string]: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
restore(): T;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import { StatefulSet } from 'kubernetes-types/apps/v1';
|
|
3
|
+
import { WorkloadState } from '../constants';
|
|
4
|
+
import { WorkloadModel } from './workload-model';
|
|
5
|
+
type RequiredStatefulSet = Required<StatefulSet> & Unstructured;
|
|
6
|
+
export declare class StatefulSetModel extends WorkloadModel {
|
|
7
|
+
_rawYaml: RequiredStatefulSet;
|
|
8
|
+
_globalStore: GlobalStore;
|
|
9
|
+
spec?: RequiredStatefulSet['spec'];
|
|
10
|
+
status?: RequiredStatefulSet['status'];
|
|
11
|
+
constructor(_rawYaml: RequiredStatefulSet, _globalStore: GlobalStore);
|
|
12
|
+
get stateDisplay(): WorkloadState.UPDATEING | WorkloadState.READY;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metric';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Unstructured } from 'k8s-api-provider';
|
|
2
|
+
type Quantity = string;
|
|
3
|
+
export type ContainerMetrics = {
|
|
4
|
+
name: string;
|
|
5
|
+
usage: {
|
|
6
|
+
cpu?: Quantity;
|
|
7
|
+
memory?: Quantity;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type PodMetrics = {
|
|
11
|
+
timestamp: string;
|
|
12
|
+
window: string;
|
|
13
|
+
containers: ContainerMetrics[];
|
|
14
|
+
} & Unstructured;
|
|
15
|
+
export type ResourceQuantity = {
|
|
16
|
+
cpu: {
|
|
17
|
+
si: string;
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
memory: {
|
|
21
|
+
si: string;
|
|
22
|
+
value: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import type { DaemonSet, Deployment, StatefulSet } from 'kubernetes-types/apps/v1';
|
|
3
|
+
import type { CronJob, Job } from 'kubernetes-types/batch/v1';
|
|
4
|
+
import { Pod } from 'kubernetes-types/core/v1';
|
|
5
|
+
import { ResourceModel } from './resource-model';
|
|
6
|
+
type WorkloadBaseTypes = Required<Deployment | StatefulSet | Job | DaemonSet | CronJob | Pod> & Unstructured;
|
|
7
|
+
export declare class WorkloadBaseModel extends ResourceModel<WorkloadBaseTypes> {
|
|
8
|
+
_rawYaml: WorkloadBaseTypes;
|
|
9
|
+
_globalStore: GlobalStore;
|
|
10
|
+
constructor(_rawYaml: WorkloadBaseTypes, _globalStore: GlobalStore);
|
|
11
|
+
get imageNames(): string[];
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import type { DaemonSet, Deployment, StatefulSet } from 'kubernetes-types/apps/v1';
|
|
3
|
+
import { WorkloadBaseModel } from './workload-base-model';
|
|
4
|
+
type WorkloadTypes = Required<Deployment | StatefulSet | DaemonSet> & Unstructured;
|
|
5
|
+
export declare class WorkloadModel extends WorkloadBaseModel {
|
|
6
|
+
_rawYaml: WorkloadTypes;
|
|
7
|
+
_globalStore: GlobalStore;
|
|
8
|
+
restarts: number;
|
|
9
|
+
spec?: WorkloadTypes['spec'];
|
|
10
|
+
status?: WorkloadTypes['status'];
|
|
11
|
+
constructor(_rawYaml: WorkloadTypes, _globalStore: GlobalStore);
|
|
12
|
+
init(): Promise<void>;
|
|
13
|
+
private getRestarts;
|
|
14
|
+
redeploy(): WorkloadTypes;
|
|
15
|
+
scale(value: number): WorkloadTypes;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured, UnstructuredList, IProviderPlugin, DataList } from 'k8s-api-provider';
|
|
2
|
+
import { ResourceModel } from '../models';
|
|
3
|
+
declare class ModelPlugin implements IProviderPlugin<ResourceModel> {
|
|
4
|
+
_globalStore?: GlobalStore;
|
|
5
|
+
init(globalStore: GlobalStore): void;
|
|
6
|
+
processData(res: UnstructuredList): Promise<DataList<ResourceModel<Unstructured>>>;
|
|
7
|
+
processItem(item: Unstructured): Promise<ResourceModel>;
|
|
8
|
+
restoreData(res: DataList<ResourceModel>): UnstructuredList;
|
|
9
|
+
restoreItem(item: ResourceModel): Unstructured;
|
|
10
|
+
}
|
|
11
|
+
export declare const modelPlugin: ModelPlugin;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GlobalStore, Unstructured, UnstructuredList } from 'k8s-api-provider';
|
|
2
|
+
import { LabelSelector, ObjectMeta } from 'kubernetes-types/meta/v1';
|
|
3
|
+
import { ResourceModel } from '../models';
|
|
4
|
+
export type Relation = {
|
|
5
|
+
kind: string;
|
|
6
|
+
apiVersion: string;
|
|
7
|
+
type: 'creates' | 'uses' | 'applies' | 'owner' | 'selects';
|
|
8
|
+
inbound: boolean;
|
|
9
|
+
name?: string;
|
|
10
|
+
namespace?: string;
|
|
11
|
+
selector?: LabelSelector;
|
|
12
|
+
};
|
|
13
|
+
export type ExtendObjectMeta = ObjectMeta & {
|
|
14
|
+
relations?: Relation[];
|
|
15
|
+
};
|
|
16
|
+
declare class RelationPlugin {
|
|
17
|
+
private globalStore?;
|
|
18
|
+
init(globalStore: GlobalStore): void;
|
|
19
|
+
processData(res: UnstructuredList): Promise<UnstructuredList>;
|
|
20
|
+
processItem(item: Unstructured): Promise<ResourceModel>;
|
|
21
|
+
restoreData(res: UnstructuredList): UnstructuredList;
|
|
22
|
+
restoreItem(item: Unstructured): Unstructured;
|
|
23
|
+
private processPodSelector;
|
|
24
|
+
private appendRelation;
|
|
25
|
+
}
|
|
26
|
+
export declare const relationPlugin: RelationPlugin;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import { ListMeta } from 'kubernetes-types/meta/v1';
|
|
3
|
+
export type DataList<Output extends Unstructured = Unstructured> = {
|
|
4
|
+
apiVersion: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
metadata: ListMeta;
|
|
7
|
+
items: Array<Unstructured & Output>;
|
|
8
|
+
};
|
|
@@ -11,7 +11,7 @@ export declare const convertToNumberIfPossible: (value: string | undefined) => s
|
|
|
11
11
|
export declare const routerProvider: {
|
|
12
12
|
go: () => ({ to, type, query, hash, options: { keepQuery, keepHash } }: GoConfig) => string | void;
|
|
13
13
|
back: () => () => void;
|
|
14
|
-
parse: () => () => ParseResponse
|
|
14
|
+
parse: () => () => ParseResponse;
|
|
15
15
|
Link: React.ForwardRefExoticComponent<Pick<{
|
|
16
16
|
[prop: string]: any;
|
|
17
17
|
to: string;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { ResourceModel } from 'k8s-api-provider';
|
|
2
|
+
import { FormModalProps } from 'src/components/FormModal';
|
|
4
3
|
import { ShowField } from '../components/ShowContent';
|
|
5
4
|
import { Column } from '../components/Table';
|
|
5
|
+
import { ResourceModel } from '../models';
|
|
6
6
|
export declare enum RESOURCE_GROUP {
|
|
7
7
|
WORKLOAD = "WORKLOAD",
|
|
8
8
|
STORAGE = "STORAGE",
|
|
9
9
|
NETWORK = "NETWORK",
|
|
10
10
|
CLUSTER = "CLUSTER"
|
|
11
11
|
}
|
|
12
|
+
export declare enum FormType {
|
|
13
|
+
PAGE = "PAGE",
|
|
14
|
+
MODAL = "MODAL"
|
|
15
|
+
}
|
|
12
16
|
export type WithId<T> = T & {
|
|
13
17
|
id: string;
|
|
14
18
|
};
|
|
@@ -21,10 +25,12 @@ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
|
|
|
21
25
|
parent?: RESOURCE_GROUP;
|
|
22
26
|
formatter?: (v: Model) => Model;
|
|
23
27
|
initValue?: Record<string, unknown>;
|
|
24
|
-
columns?: (
|
|
25
|
-
showFields?: (
|
|
28
|
+
columns?: () => Column<Model>[];
|
|
29
|
+
showFields?: () => ShowField<Model>[][];
|
|
26
30
|
Dropdown?: React.FC<{
|
|
27
|
-
|
|
31
|
+
record: Model;
|
|
28
32
|
}>;
|
|
33
|
+
formType?: FormType;
|
|
34
|
+
FormModal?: React.FC<FormModalProps>;
|
|
29
35
|
isCustom?: boolean;
|
|
30
36
|
};
|
package/lib/src/utils/error.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ type ErrorResponse = {
|
|
|
15
15
|
graphQLErrors?: Cause[];
|
|
16
16
|
};
|
|
17
17
|
export declare function isNetworkError(errors?: Cause[]): boolean;
|
|
18
|
-
export declare function getSubmitError(errorResponse: ErrorResponse | undefined, text: string, i18n: I18n):
|
|
19
|
-
export declare function getCommonErrors(response: ErrorResponse, i18n: I18n):
|
|
18
|
+
export declare function getSubmitError(errorResponse: ErrorResponse | undefined, text: string, i18n: I18n): string;
|
|
19
|
+
export declare function getCommonErrors(response: ErrorResponse, i18n: I18n): string[];
|
|
20
20
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dovetail-v2/refine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"module": "./dist/refine.js",
|
|
11
11
|
"types": "./lib/src/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@cloudtower/eagle": "^0.
|
|
14
|
-
"@cloudtower/icons-react": "^0.
|
|
13
|
+
"@cloudtower/eagle": "^0.27.59",
|
|
14
|
+
"@cloudtower/icons-react": "^0.27.59",
|
|
15
15
|
"@patternfly/react-core": "^5.1.1",
|
|
16
16
|
"@patternfly/react-log-viewer": "^5.0.0",
|
|
17
17
|
"@refinedev/core": "^4.38.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dayjs": "^1.11.10",
|
|
21
21
|
"i18next": "^23.2.3",
|
|
22
22
|
"js-yaml": "^4.1.0",
|
|
23
|
-
"k8s-api-provider": "
|
|
23
|
+
"k8s-api-provider": "0.0.15-beta.6",
|
|
24
24
|
"ky": "^0.33.3",
|
|
25
25
|
"lodash-es": "^4.17.21",
|
|
26
26
|
"mitt": "^3.0.1",
|
|
@@ -60,7 +60,11 @@
|
|
|
60
60
|
"eslint-plugin-react-refresh": "^0.3.4",
|
|
61
61
|
"kubernetes-types": "^1.26.0",
|
|
62
62
|
"vite": "^3.2.7",
|
|
63
|
-
"vite-plugin-commonjs": "^0.10.0"
|
|
63
|
+
"vite-plugin-commonjs": "^0.10.0",
|
|
64
|
+
"jest": "^29",
|
|
65
|
+
"ts-jest": "^29",
|
|
66
|
+
"@types/jest": "^29",
|
|
67
|
+
"@babel/preset-typescript": "^7.10.4"
|
|
64
68
|
},
|
|
65
69
|
"peerDependencies": {
|
|
66
70
|
"@cloudtower/eagle": "^0.26.9",
|
|
@@ -78,7 +82,9 @@
|
|
|
78
82
|
"build": "tsc --emitDeclarationOnly && vite build",
|
|
79
83
|
"preview": "refine start",
|
|
80
84
|
"refine": "refine",
|
|
81
|
-
"test": "
|
|
85
|
+
"unit-test": "jest",
|
|
86
|
+
"playwright-test": "npx playwright test --workers 1",
|
|
87
|
+
"test": "yarn unit-test && yarn playwright-test",
|
|
82
88
|
"lint": "eslint src --ext .ts,.tsx"
|
|
83
89
|
},
|
|
84
90
|
"browserslist": {
|