@dovetail-v2/refine 0.0.32 → 0.0.34
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-6563a22b.js → MonacoYamlDiffEditor-799d6dfe.js} +5 -3
- package/dist/{index-3d05d4c7.js → index-3113dd7a.js} +11985 -7646
- package/dist/refine.js +171 -133
- package/dist/refine.umd.cjs +13116 -8930
- package/dist/style.css +75 -42
- package/lib/src/components/DurationTime/index.d.ts +6 -0
- package/lib/src/components/Form/FormModal.d.ts +9 -0
- package/lib/src/components/Form/RefineFormContent.d.ts +12 -0
- package/lib/src/components/Form/RefineFormPage.d.ts +7 -0
- package/lib/src/components/Form/YamlForm.d.ts +26 -0
- package/lib/src/components/Form/index.d.ts +7 -4
- package/lib/src/components/Form/type.d.ts +17 -0
- package/lib/src/components/Form/useRefineForm.d.ts +10 -0
- package/lib/src/components/Form/useYamlForm.d.ts +51 -0
- package/lib/src/components/FormErrorAlert/index.d.ts +1 -0
- package/lib/src/components/FormWidgets/KeyValueListWidget.d.ts +6 -0
- package/lib/src/components/FormWidgets/MetadataForm.d.ts +2 -0
- package/lib/src/components/FormWidgets/NameInputWidget.d.ts +51 -0
- package/lib/src/components/FormWidgets/NamespaceSelectWidget.d.ts +9 -0
- package/lib/src/components/FormWidgets/index.d.ts +4 -0
- package/lib/src/components/FormWidgets/widget.d.ts +5 -0
- package/lib/src/components/ImageNames/index.d.ts +1 -0
- package/lib/src/components/KeyValue/KeyValue.d.ts +6 -5
- package/lib/src/components/KeyValue/KeyValueAnnotation.d.ts +6 -0
- package/lib/src/components/KeyValue/KeyValueSecret.d.ts +5 -0
- package/lib/src/components/KeyValue/index.d.ts +2 -0
- package/lib/src/components/ListPage/index.d.ts +0 -1
- package/lib/src/components/NamespacesFilter/index.d.ts +6 -2
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +2 -1
- package/lib/src/components/PodSelectorTable/index.d.ts +6 -0
- package/lib/src/components/PortsTable/index.d.ts +7 -0
- package/lib/src/components/ReplicasDropdown/index.d.ts +9 -0
- package/lib/src/components/ResourceCRUD/list/index.d.ts +3 -7
- package/lib/src/components/ResourceCRUD/show/index.d.ts +3 -7
- package/lib/src/components/ServiceComponents/index.d.ts +4 -1
- package/lib/src/components/ShowContent/ShowContent.d.ts +5 -0
- package/lib/src/components/ShowContent/fields.d.ts +19 -12
- package/lib/src/components/ShowContent/groups.d.ts +14 -3
- package/lib/src/components/ShowContent/tabs.d.ts +1 -8
- package/lib/src/components/StateTag/StateTag.d.ts +1 -0
- package/lib/src/components/Table/TableToolBar.d.ts +1 -1
- package/lib/src/components/Table/index.d.ts +1 -0
- package/lib/src/components/Time/index.d.ts +1 -1
- package/lib/src/components/ValueDisplay/index.d.ts +9 -0
- package/lib/src/components/WorkloadDropdown/index.d.ts +2 -2
- package/lib/src/components/WorkloadReplicas/index.d.ts +13 -3
- package/lib/src/components/YamlForm/index.d.ts +4 -0
- package/lib/src/components/index.d.ts +2 -3
- package/lib/src/constants/k8s.d.ts +289 -89
- package/lib/src/constants/state.d.ts +2 -1
- package/lib/src/hooks/index.d.ts +1 -1
- package/lib/src/hooks/useDeleteModal/useDeleteModal.d.ts +1 -2
- package/lib/src/hooks/useEagleForm.d.ts +2 -1
- package/lib/src/hooks/useEagleTable/columns.d.ts +8 -2
- package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +4 -0
- package/lib/src/hooks/useOpenForm.d.ts +3 -0
- package/lib/src/i18n.d.ts +168 -15
- package/lib/src/locales/en-US/index.d.ts +104 -1
- package/lib/src/locales/zh-CN/index.d.ts +64 -14
- package/lib/src/models/daemonset-model.d.ts +3 -1
- package/lib/src/models/deployment-model.d.ts +1 -1
- package/lib/src/models/ingress-model.d.ts +5 -3
- package/lib/src/models/job-model.d.ts +2 -0
- package/lib/src/models/statefulset-model.d.ts +1 -1
- package/lib/src/pages/deployments/index.d.ts +0 -1
- package/lib/src/types/resource.d.ts +12 -3
- package/package.json +6 -4
- package/dist/MonacoYamlEditor-a6e20f8c.js +0 -167
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports, c as cx_default, Y as YamlEditorStyle } from "./index-3d05d4c7.js";
|
|
2
|
-
import * as monaco from "monaco-editor";
|
|
3
|
-
import { setDiagnosticsOptions } from "monaco-yaml";
|
|
4
|
-
import { useRef, useEffect } from "react";
|
|
5
|
-
import ReactDOM from "react-dom";
|
|
6
|
-
import "i18next";
|
|
7
|
-
import "@refinedev/core";
|
|
8
|
-
import "qs";
|
|
9
|
-
import "react-router-dom";
|
|
10
|
-
import "@cloudtower/eagle";
|
|
11
|
-
import "js-yaml";
|
|
12
|
-
import "lodash-es";
|
|
13
|
-
import "sunflower-antd";
|
|
14
|
-
import "@cloudtower/icons-react";
|
|
15
|
-
import "antd";
|
|
16
|
-
import "k8s-api-provider";
|
|
17
|
-
const schemaMap = /* @__PURE__ */ new Map();
|
|
18
|
-
const MonacoYamlEditor = (props) => {
|
|
19
|
-
const ref = useRef(null);
|
|
20
|
-
const instanceRef = useRef({ editor: null });
|
|
21
|
-
const {
|
|
22
|
-
defaultValue,
|
|
23
|
-
id,
|
|
24
|
-
height,
|
|
25
|
-
readOnly,
|
|
26
|
-
schema,
|
|
27
|
-
isScrollOnFocus,
|
|
28
|
-
onChange,
|
|
29
|
-
onValidate,
|
|
30
|
-
getInstance,
|
|
31
|
-
onEditorCreate,
|
|
32
|
-
onBlur
|
|
33
|
-
} = props;
|
|
34
|
-
const uri = id ? monaco.Uri.parse(`${id}.yaml`) : void 0;
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (schema) {
|
|
37
|
-
schemaMap.set(id, {
|
|
38
|
-
// Id of the first schema
|
|
39
|
-
uri: String(uri),
|
|
40
|
-
// Associate with our model
|
|
41
|
-
fileMatch: uri ? [String(uri)] : [],
|
|
42
|
-
schema
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
const schemas = [...schemaMap.values()];
|
|
46
|
-
setDiagnosticsOptions({
|
|
47
|
-
enableSchemaRequest: false,
|
|
48
|
-
hover: true,
|
|
49
|
-
completion: true,
|
|
50
|
-
validate: true,
|
|
51
|
-
format: true,
|
|
52
|
-
isKubernetes: true,
|
|
53
|
-
schemas
|
|
54
|
-
});
|
|
55
|
-
const model = monaco.editor.createModel(defaultValue, "yaml", uri);
|
|
56
|
-
const editor = monaco.editor.create(ref.current, {
|
|
57
|
-
automaticLayout: true,
|
|
58
|
-
scrollBeyondLastLine: false,
|
|
59
|
-
model,
|
|
60
|
-
scrollbar: {
|
|
61
|
-
handleMouseWheel: !isScrollOnFocus
|
|
62
|
-
},
|
|
63
|
-
tabSize: 2,
|
|
64
|
-
readOnly,
|
|
65
|
-
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
66
|
-
});
|
|
67
|
-
instanceRef.current.editor = editor;
|
|
68
|
-
getInstance == null ? void 0 : getInstance(editor);
|
|
69
|
-
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
70
|
-
return () => {
|
|
71
|
-
instanceRef.current.editor = null;
|
|
72
|
-
schemaMap.delete(id);
|
|
73
|
-
model.dispose();
|
|
74
|
-
editor.dispose();
|
|
75
|
-
};
|
|
76
|
-
}, [defaultValue, schema, id, readOnly, isScrollOnFocus, getInstance]);
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
const editor = instanceRef.current.editor;
|
|
79
|
-
if (editor) {
|
|
80
|
-
const stop = editor.onDidChangeModelContent(() => {
|
|
81
|
-
ReactDOM.unstable_batchedUpdates(() => {
|
|
82
|
-
onChange == null ? void 0 : onChange(editor.getValue());
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
return () => {
|
|
86
|
-
stop.dispose();
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}, [onChange, instanceRef.current.editor]);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
const editor = instanceRef.current.editor;
|
|
92
|
-
if (editor) {
|
|
93
|
-
const stop = monaco.editor.onDidChangeMarkers((uri2) => {
|
|
94
|
-
var _a;
|
|
95
|
-
const model = (_a = instanceRef.current.editor) == null ? void 0 : _a.getModel();
|
|
96
|
-
const currentEditorUri = model == null ? void 0 : model.uri;
|
|
97
|
-
if (model && uri2.toString() === (currentEditorUri == null ? void 0 : currentEditorUri.toString())) {
|
|
98
|
-
const marks = monaco.editor.getModelMarkers({ owner: "yaml", resource: currentEditorUri });
|
|
99
|
-
const yamlMarks = marks.filter((m) => m.source === "YAML");
|
|
100
|
-
const schemaMarks = marks.filter((m) => m.source !== "YAML");
|
|
101
|
-
const yamlValid = yamlMarks.length === 0;
|
|
102
|
-
const schemaValid = schemaMarks.length === 0;
|
|
103
|
-
onValidate == null ? void 0 : onValidate(yamlValid, schemaValid);
|
|
104
|
-
if (marks.some((mark) => {
|
|
105
|
-
var _a2;
|
|
106
|
-
return (_a2 = mark.source) == null ? void 0 : _a2.includes("yaml-schema");
|
|
107
|
-
})) {
|
|
108
|
-
monaco.editor.setModelMarkers(model, "yaml", marks.map((mark) => ({ ...mark, source: "", resource: {} })));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return () => {
|
|
113
|
-
stop.dispose();
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}, [onValidate, instanceRef.current.editor]);
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
const editor = instanceRef.current.editor;
|
|
119
|
-
if (editor) {
|
|
120
|
-
const stop = editor.onDidBlurEditorWidget(() => {
|
|
121
|
-
ReactDOM.unstable_batchedUpdates(() => {
|
|
122
|
-
onBlur == null ? void 0 : onBlur();
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
return () => {
|
|
126
|
-
stop.dispose();
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}, [onBlur, instanceRef.current.editor]);
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
const editor = instanceRef.current.editor;
|
|
132
|
-
const stops = [];
|
|
133
|
-
if (editor && isScrollOnFocus) {
|
|
134
|
-
stops.push(editor.onDidFocusEditorWidget(() => {
|
|
135
|
-
editor.updateOptions({
|
|
136
|
-
scrollbar: {
|
|
137
|
-
handleMouseWheel: true
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}));
|
|
141
|
-
stops.push(editor.onDidBlurEditorWidget(() => {
|
|
142
|
-
editor.updateOptions({
|
|
143
|
-
scrollbar: {
|
|
144
|
-
handleMouseWheel: false
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
return () => {
|
|
150
|
-
stops.forEach((stop) => stop.dispose());
|
|
151
|
-
};
|
|
152
|
-
}, [instanceRef.current.editor, isScrollOnFocus]);
|
|
153
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
154
|
-
"div",
|
|
155
|
-
{
|
|
156
|
-
ref,
|
|
157
|
-
className: cx_default(YamlEditorStyle, props.className),
|
|
158
|
-
style: {
|
|
159
|
-
width: "100%",
|
|
160
|
-
height: height || "500px"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
export {
|
|
166
|
-
MonacoYamlEditor as default
|
|
167
|
-
};
|