@dovetail-v2/refine 0.3.1 → 0.3.2
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/{MonacoYamlEditor-9b8b7cef.cjs → MonacoYamlEditor-bdd52136.cjs} +15 -7
- package/dist/{MonacoYamlEditor-5e4c98ce.js → MonacoYamlEditor-d09e7de9.js} +15 -7
- package/dist/components/ShowContent/ShowContent.d.ts +4 -16
- package/dist/components/ShowContent/ShowContentView.d.ts +21 -0
- package/dist/components/ShowContent/fields.d.ts +1 -0
- package/dist/components/ShowContent/index.d.ts +1 -0
- package/dist/components/YamlEditor/MonacoYamlEditor.d.ts +5 -5
- package/dist/components/YamlEditor/YamlEditorComponent.d.ts +9 -7
- package/dist/hooks/useEagleTable/columns.d.ts +1 -1
- package/dist/{index-c4f4f337.js → index-3126e84d.js} +568 -414
- package/dist/{index-e9523181.cjs → index-ec66ac8f.cjs} +455 -301
- package/dist/models/deployment-model.d.ts +5 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/replicaset-model.d.ts +17 -0
- package/dist/models/service-model.d.ts +4 -0
- package/dist/models/workload-model.d.ts +6 -0
- package/dist/refine.cjs +3 -1
- package/dist/refine.js +113 -111
- package/dist/style.css +162 -158
- package/dist/utils/match-selector.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const common = require("./common-1eb43414.cjs");
|
|
4
|
+
const yaml = require("js-yaml");
|
|
4
5
|
const monaco = require("monaco-editor");
|
|
5
6
|
const monacoYaml = require("monaco-yaml");
|
|
6
7
|
const React = require("react");
|
|
7
8
|
const ReactDOM = require("react-dom");
|
|
8
|
-
const refine = require("./index-
|
|
9
|
+
const refine = require("./index-ec66ac8f.cjs");
|
|
9
10
|
require("dayjs");
|
|
10
11
|
require("i18next");
|
|
11
12
|
require("@refinedev/core");
|
|
@@ -14,7 +15,6 @@ require("react-router-dom");
|
|
|
14
15
|
require("@cloudtower/eagle");
|
|
15
16
|
require("@cloudtower/icons-react");
|
|
16
17
|
require("lodash-es");
|
|
17
|
-
require("js-yaml");
|
|
18
18
|
require("usehooks-ts");
|
|
19
19
|
require("k8s-api-provider");
|
|
20
20
|
require("@patternfly/react-log-viewer");
|
|
@@ -38,7 +38,7 @@ function _interopNamespaceDefault(e) {
|
|
|
38
38
|
return Object.freeze(n);
|
|
39
39
|
}
|
|
40
40
|
const monaco__namespace = /* @__PURE__ */ _interopNamespaceDefault(monaco);
|
|
41
|
-
|
|
41
|
+
function MonacoYamlEditor(props) {
|
|
42
42
|
const ref = React.useRef(null);
|
|
43
43
|
const instanceRef = React.useRef({
|
|
44
44
|
editor: null
|
|
@@ -78,7 +78,8 @@ const MonacoYamlEditor = (props) => {
|
|
|
78
78
|
isKubernetes: true,
|
|
79
79
|
schemas: finalSchemas
|
|
80
80
|
});
|
|
81
|
-
const
|
|
81
|
+
const defaultValueString = typeof defaultValue === "string" ? defaultValue : yaml.dump(defaultValue);
|
|
82
|
+
const model = monaco__namespace.editor.createModel(defaultValueString, "yaml", uri);
|
|
82
83
|
const editor = monaco__namespace.editor.create(ref.current, {
|
|
83
84
|
automaticLayout: true,
|
|
84
85
|
scrollBeyondLastLine: false,
|
|
@@ -109,14 +110,21 @@ const MonacoYamlEditor = (props) => {
|
|
|
109
110
|
if (editor) {
|
|
110
111
|
const stop = editor.onDidChangeModelContent(() => {
|
|
111
112
|
ReactDOM.unstable_batchedUpdates(() => {
|
|
112
|
-
|
|
113
|
+
const editorValue = editor.getValue();
|
|
114
|
+
const newValue = typeof defaultValue === "string" ? editorValue : yaml.load(editorValue) || {};
|
|
115
|
+
if (typeof defaultValue !== "string" && typeof newValue === "string") {
|
|
116
|
+
onValidate == null ? void 0 : onValidate(false, true);
|
|
117
|
+
} else {
|
|
118
|
+
onValidate == null ? void 0 : onValidate(true, true);
|
|
119
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
120
|
+
}
|
|
113
121
|
});
|
|
114
122
|
});
|
|
115
123
|
return () => {
|
|
116
124
|
stop.dispose();
|
|
117
125
|
};
|
|
118
126
|
}
|
|
119
|
-
}, [onChange]);
|
|
127
|
+
}, [onChange, defaultValue]);
|
|
120
128
|
React.useEffect(() => {
|
|
121
129
|
const editor = instanceRef.current.editor;
|
|
122
130
|
if (editor) {
|
|
@@ -202,5 +210,5 @@ const MonacoYamlEditor = (props) => {
|
|
|
202
210
|
}
|
|
203
211
|
}
|
|
204
212
|
);
|
|
205
|
-
}
|
|
213
|
+
}
|
|
206
214
|
exports.default = MonacoYamlEditor;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports, c as cx_default } from "./common-feae5742.js";
|
|
2
|
+
import yaml from "js-yaml";
|
|
2
3
|
import * as monaco from "monaco-editor";
|
|
3
4
|
import { setDiagnosticsOptions } from "monaco-yaml";
|
|
4
5
|
import { useRef, useEffect } from "react";
|
|
5
6
|
import ReactDOM from "react-dom";
|
|
6
|
-
import { Y as YamlEditorStyle } from "./index-
|
|
7
|
+
import { Y as YamlEditorStyle } from "./index-3126e84d.js";
|
|
7
8
|
import "dayjs";
|
|
8
9
|
import "i18next";
|
|
9
10
|
import "@refinedev/core";
|
|
@@ -12,14 +13,13 @@ import "react-router-dom";
|
|
|
12
13
|
import "@cloudtower/eagle";
|
|
13
14
|
import "@cloudtower/icons-react";
|
|
14
15
|
import "lodash-es";
|
|
15
|
-
import "js-yaml";
|
|
16
16
|
import "usehooks-ts";
|
|
17
17
|
import "k8s-api-provider";
|
|
18
18
|
import "@patternfly/react-log-viewer";
|
|
19
19
|
import "react-hook-form";
|
|
20
20
|
import "sunflower-antd";
|
|
21
21
|
import "antd";
|
|
22
|
-
|
|
22
|
+
function MonacoYamlEditor(props) {
|
|
23
23
|
const ref = useRef(null);
|
|
24
24
|
const instanceRef = useRef({
|
|
25
25
|
editor: null
|
|
@@ -59,7 +59,8 @@ const MonacoYamlEditor = (props) => {
|
|
|
59
59
|
isKubernetes: true,
|
|
60
60
|
schemas: finalSchemas
|
|
61
61
|
});
|
|
62
|
-
const
|
|
62
|
+
const defaultValueString = typeof defaultValue === "string" ? defaultValue : yaml.dump(defaultValue);
|
|
63
|
+
const model = monaco.editor.createModel(defaultValueString, "yaml", uri);
|
|
63
64
|
const editor = monaco.editor.create(ref.current, {
|
|
64
65
|
automaticLayout: true,
|
|
65
66
|
scrollBeyondLastLine: false,
|
|
@@ -90,14 +91,21 @@ const MonacoYamlEditor = (props) => {
|
|
|
90
91
|
if (editor) {
|
|
91
92
|
const stop = editor.onDidChangeModelContent(() => {
|
|
92
93
|
ReactDOM.unstable_batchedUpdates(() => {
|
|
93
|
-
|
|
94
|
+
const editorValue = editor.getValue();
|
|
95
|
+
const newValue = typeof defaultValue === "string" ? editorValue : yaml.load(editorValue) || {};
|
|
96
|
+
if (typeof defaultValue !== "string" && typeof newValue === "string") {
|
|
97
|
+
onValidate == null ? void 0 : onValidate(false, true);
|
|
98
|
+
} else {
|
|
99
|
+
onValidate == null ? void 0 : onValidate(true, true);
|
|
100
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
101
|
+
}
|
|
94
102
|
});
|
|
95
103
|
});
|
|
96
104
|
return () => {
|
|
97
105
|
stop.dispose();
|
|
98
106
|
};
|
|
99
107
|
}
|
|
100
|
-
}, [onChange]);
|
|
108
|
+
}, [onChange, defaultValue]);
|
|
101
109
|
useEffect(() => {
|
|
102
110
|
const editor = instanceRef.current.editor;
|
|
103
111
|
if (editor) {
|
|
@@ -183,7 +191,7 @@ const MonacoYamlEditor = (props) => {
|
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
);
|
|
186
|
-
}
|
|
194
|
+
}
|
|
187
195
|
export {
|
|
188
196
|
MonacoYamlEditor as default
|
|
189
197
|
};
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ResourceModel } from '../../models';
|
|
3
|
-
import {
|
|
4
|
-
type Props<Model extends ResourceModel> =
|
|
5
|
-
|
|
6
|
-
formatter?: (r: Model) => Model;
|
|
7
|
-
Dropdown?: React.FC<{
|
|
8
|
-
record: Model;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
type ShowGroupComponentProps = React.PropsWithChildren<{
|
|
12
|
-
title: string;
|
|
13
|
-
className?: string;
|
|
14
|
-
operationEle?: React.ReactElement | null;
|
|
15
|
-
}>;
|
|
16
|
-
export declare function ShowGroupComponent(props: ShowGroupComponentProps): JSX.Element;
|
|
17
|
-
export declare const ShowContent: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: Props<Model>) => JSX.Element | null;
|
|
3
|
+
import { ShowContentViewProps } from './ShowContentView';
|
|
4
|
+
type Props<Model extends ResourceModel> = Omit<ShowContentViewProps<Model>, 'id' | 'resourceName'>;
|
|
5
|
+
export declare const ShowContent: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: Props<Model>) => JSX.Element;
|
|
18
6
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ResourceModel } from '../../models';
|
|
3
|
+
import { ShowConfig } from './fields';
|
|
4
|
+
export type ShowContentViewProps<Model extends ResourceModel> = {
|
|
5
|
+
id: string;
|
|
6
|
+
resourceName: string;
|
|
7
|
+
showConfig: ShowConfig<Model>;
|
|
8
|
+
formatter?: (r: Model) => Model;
|
|
9
|
+
Dropdown?: React.FC<{
|
|
10
|
+
record: Model;
|
|
11
|
+
}>;
|
|
12
|
+
hideBackButton?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type ShowGroupComponentProps = React.PropsWithChildren<{
|
|
15
|
+
title: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
operationEle?: React.ReactElement | null;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function ShowGroupComponent(props: ShowGroupComponentProps): JSX.Element;
|
|
20
|
+
export declare const ShowContentView: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: ShowContentViewProps<Model>) => JSX.Element | null;
|
|
21
|
+
export {};
|
|
@@ -33,6 +33,7 @@ export type ShowTab<Model extends ResourceModel> = {
|
|
|
33
33
|
groups: ShowGroup<Model>[];
|
|
34
34
|
};
|
|
35
35
|
export interface ShowConfig<Model extends ResourceModel = ResourceModel> {
|
|
36
|
+
basicGroup?: ShowGroup<Model>;
|
|
36
37
|
tabs?: ShowTab<Model>[];
|
|
37
38
|
renderExtraButton?: (record: Model) => React.ReactNode;
|
|
38
39
|
resourceStateMap?: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type JSONSchema7 } from 'json-schema';
|
|
2
3
|
import * as monaco from 'monaco-editor';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
4
|
+
type Props<T extends string | Record<string, unknown> = string> = {
|
|
5
5
|
className?: string;
|
|
6
6
|
id?: string;
|
|
7
|
-
defaultValue:
|
|
7
|
+
defaultValue: T;
|
|
8
8
|
height?: string;
|
|
9
|
-
onChange?: (val:
|
|
9
|
+
onChange?: (val: T) => void;
|
|
10
10
|
onValidate?: (valid: boolean, schemaValid: boolean) => void;
|
|
11
11
|
isScrollOnFocus?: boolean;
|
|
12
12
|
onEditorCreate?: (editor: monaco.editor.IStandaloneCodeEditor) => void;
|
|
@@ -15,5 +15,5 @@ type Props = {
|
|
|
15
15
|
schemas?: JSONSchema7[] | null;
|
|
16
16
|
readOnly?: boolean;
|
|
17
17
|
};
|
|
18
|
-
declare
|
|
18
|
+
declare function MonacoYamlEditor<T extends string | Record<string, unknown> = string>(props: Props<T>): JSX.Element;
|
|
19
19
|
export default MonacoYamlEditor;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { type editor } from 'monaco-editor';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export type YamlEditorProps = {
|
|
4
|
+
export type YamlEditorProps<T extends string | Record<string, unknown> = string> = {
|
|
5
5
|
eleRef?: React.MutableRefObject<HTMLDivElement>;
|
|
6
6
|
title?: string;
|
|
7
|
-
value?:
|
|
8
|
-
defaultValue?:
|
|
7
|
+
value?: T;
|
|
8
|
+
defaultValue?: T;
|
|
9
9
|
errorMsgs?: string[];
|
|
10
10
|
schemas?: JSONSchema7[] | null;
|
|
11
11
|
id?: string;
|
|
@@ -16,15 +16,17 @@ export type YamlEditorProps = {
|
|
|
16
16
|
readOnly?: boolean;
|
|
17
17
|
debounceTime?: number;
|
|
18
18
|
isScrollOnFocus?: boolean;
|
|
19
|
-
onChange?: (value:
|
|
19
|
+
onChange?: (value: T) => void;
|
|
20
20
|
onValidate?: (valid: boolean, schemaValid: boolean) => void;
|
|
21
21
|
onEditorCreate?: (editor: editor.IStandaloneCodeEditor) => void;
|
|
22
22
|
onBlur?: () => void;
|
|
23
23
|
};
|
|
24
|
-
export type YamlEditorHandle = {
|
|
25
|
-
setValue: (value:
|
|
24
|
+
export type YamlEditorHandle<T extends string | Record<string, unknown> = string> = {
|
|
25
|
+
setValue: (value: T) => void;
|
|
26
26
|
setEditorValue: (value: string) => void;
|
|
27
27
|
getEditorValue: () => string;
|
|
28
28
|
getEditorInstance: () => editor.IStandaloneCodeEditor | null;
|
|
29
29
|
};
|
|
30
|
-
export declare const YamlEditorComponent:
|
|
30
|
+
export declare const YamlEditorComponent: <T extends string | Record<string, unknown> = string>(props: YamlEditorProps<T> & {
|
|
31
|
+
ref?: React.Ref<YamlEditorHandle<T>> | undefined;
|
|
32
|
+
}) => React.ReactElement;
|
|
@@ -6,7 +6,7 @@ export declare const CommonSorter: (dataIndex: string[]) => (a: unknown, b: unkn
|
|
|
6
6
|
export declare const NameColumnRenderer: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(i18n: I18nType, resource?: string) => Column<Model>;
|
|
7
7
|
export declare const PlainTextNameColumnRenderer: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(i18n: I18nType) => Column<Model>;
|
|
8
8
|
export declare const NameSpaceColumnRenderer: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(i18n: I18nType) => Column<Model>;
|
|
9
|
-
export declare const StateDisplayColumnRenderer: <Model extends PodModel | JobModel | WorkloadModel | CronJobModel | DaemonSetModel
|
|
9
|
+
export declare const StateDisplayColumnRenderer: <Model extends PodModel | JobModel | ServiceModel | WorkloadModel | CronJobModel | DaemonSetModel>(i18n: I18nType) => Column<Model>;
|
|
10
10
|
export declare const WorkloadImageColumnRenderer: <Model extends WorkloadBaseModel>(i18n: I18nType) => Column<Model>;
|
|
11
11
|
export declare const RestartsColumnRenderer: <Model extends WorkloadModel>(i18n: I18nType) => Column<Model>;
|
|
12
12
|
export declare const ReplicasColumnRenderer: <Model extends WorkloadModel>(i18n: I18nType) => Column<Model>;
|