@dovetail-v2/refine 0.2.1 → 0.2.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/{MonacoYamlDiffEditor-ddff69c1.js → MonacoYamlDiffEditor-9cc6e5c7.js} +1 -1
- package/dist/{index-c44daab0.js → index-738afc30.js} +54 -32
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +53 -31
- package/lib/components/ShowContent/fields.d.ts +1 -0
- package/lib/components/YamlEditor/YamlEditorComponent.d.ts +3 -0
- package/lib/constants/auth.d.ts +3 -1
- package/package.json +1 -1
|
@@ -9448,6 +9448,8 @@ var AccessControlAuth = /* @__PURE__ */ ((AccessControlAuth2) => {
|
|
|
9448
9448
|
AccessControlAuth2["Edit"] = "Edit";
|
|
9449
9449
|
AccessControlAuth2["Delete"] = "Delete";
|
|
9450
9450
|
AccessControlAuth2["Create"] = "Create";
|
|
9451
|
+
AccessControlAuth2["Read"] = "Read";
|
|
9452
|
+
AccessControlAuth2["None"] = "None";
|
|
9451
9453
|
return AccessControlAuth2;
|
|
9452
9454
|
})(AccessControlAuth || {});
|
|
9453
9455
|
function useSubmitForm(options) {
|
|
@@ -12208,7 +12210,7 @@ function ShowGroupComponent(props) {
|
|
|
12208
12210
|
});
|
|
12209
12211
|
}
|
|
12210
12212
|
const ShowContent = (props) => {
|
|
12211
|
-
var _a, _b, _c, _d, _e;
|
|
12213
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12212
12214
|
const {
|
|
12213
12215
|
showConfig,
|
|
12214
12216
|
formatter,
|
|
@@ -12322,13 +12324,13 @@ const ShowContent = (props) => {
|
|
|
12322
12324
|
},
|
|
12323
12325
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
12324
12326
|
className: cx_default(Typo.Display.d2_regular_title, NameStyle),
|
|
12325
|
-
children: (_c = record == null ? void 0 : record.metadata) == null ? void 0 :
|
|
12327
|
+
children: ((_c = showConfig.displayName) == null ? void 0 : _c.call(showConfig, record)) || ((_d = record == null ? void 0 : record.metadata) == null ? void 0 : _d.name)
|
|
12326
12328
|
}), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
|
|
12327
12329
|
state: stateDisplay,
|
|
12328
12330
|
customResourceStateMap: showConfig.resourceStateMap
|
|
12329
12331
|
}) : void 0]
|
|
12330
12332
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
|
|
12331
|
-
children: [(
|
|
12333
|
+
children: [(_e = showConfig.renderExtraButton) == null ? void 0 : _e.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
|
|
12332
12334
|
resource: resource == null ? void 0 : resource.name,
|
|
12333
12335
|
action: AccessControlAuth.Edit,
|
|
12334
12336
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
|
|
@@ -12336,7 +12338,7 @@ const ShowContent = (props) => {
|
|
|
12336
12338
|
marginRight: 8
|
|
12337
12339
|
},
|
|
12338
12340
|
onClick: openForm,
|
|
12339
|
-
children: ((
|
|
12341
|
+
children: ((_f = config.formConfig) == null ? void 0 : _f.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
|
|
12340
12342
|
})
|
|
12341
12343
|
}) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
|
|
12342
12344
|
record,
|
|
@@ -19512,15 +19514,19 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19512
19514
|
} = props;
|
|
19513
19515
|
const uri = id ? monaco.Uri.parse(`${id}.yaml`) : void 0;
|
|
19514
19516
|
useEffect(() => {
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19517
|
+
if (!window._MonacoSchemaMap) {
|
|
19518
|
+
window._MonacoSchemaMap = /* @__PURE__ */ new Map();
|
|
19519
|
+
}
|
|
19520
|
+
window._MonacoSchemaMap.set(id || "", {
|
|
19521
|
+
// Id of the first schema
|
|
19522
|
+
uri: String(uri),
|
|
19523
|
+
// Associate with our model
|
|
19524
|
+
fileMatch: [String(uri)],
|
|
19525
|
+
schema: {
|
|
19526
|
+
oneOf: schemas || [{ type: "object" }]
|
|
19522
19527
|
}
|
|
19523
|
-
|
|
19528
|
+
});
|
|
19529
|
+
const finalSchemas = [...window._MonacoSchemaMap.values()];
|
|
19524
19530
|
setDiagnosticsOptions({
|
|
19525
19531
|
enableSchemaRequest: false,
|
|
19526
19532
|
validate: true,
|
|
@@ -19541,13 +19547,15 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19541
19547
|
tabSize: 2,
|
|
19542
19548
|
lineNumbersMinChars: 7,
|
|
19543
19549
|
readOnly,
|
|
19544
|
-
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
19550
|
+
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
|
|
19551
|
+
theme: "vs"
|
|
19545
19552
|
});
|
|
19546
19553
|
instanceRef.current.editor = editor;
|
|
19547
19554
|
getInstance == null ? void 0 : getInstance(editor);
|
|
19548
19555
|
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
19549
19556
|
return () => {
|
|
19550
19557
|
instanceRef.current.editor = null;
|
|
19558
|
+
window._MonacoSchemaMap.delete(id || "");
|
|
19551
19559
|
model.dispose();
|
|
19552
19560
|
editor.dispose();
|
|
19553
19561
|
};
|
|
@@ -19564,7 +19572,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19564
19572
|
stop.dispose();
|
|
19565
19573
|
};
|
|
19566
19574
|
}
|
|
19567
|
-
}, [onChange
|
|
19575
|
+
}, [onChange]);
|
|
19568
19576
|
useEffect(() => {
|
|
19569
19577
|
const editor = instanceRef.current.editor;
|
|
19570
19578
|
if (editor) {
|
|
@@ -19598,7 +19606,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19598
19606
|
stop.dispose();
|
|
19599
19607
|
};
|
|
19600
19608
|
}
|
|
19601
|
-
}, [onValidate
|
|
19609
|
+
}, [onValidate]);
|
|
19602
19610
|
useEffect(() => {
|
|
19603
19611
|
const editor = instanceRef.current.editor;
|
|
19604
19612
|
if (editor) {
|
|
@@ -19611,7 +19619,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19611
19619
|
stop.dispose();
|
|
19612
19620
|
};
|
|
19613
19621
|
}
|
|
19614
|
-
}, [onBlur
|
|
19622
|
+
}, [onBlur]);
|
|
19615
19623
|
useEffect(() => {
|
|
19616
19624
|
const editor = instanceRef.current.editor;
|
|
19617
19625
|
const stops = [];
|
|
@@ -19638,7 +19646,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19638
19646
|
return () => {
|
|
19639
19647
|
stops.forEach((stop) => stop.dispose());
|
|
19640
19648
|
};
|
|
19641
|
-
}, [
|
|
19649
|
+
}, [isScrollOnFocus]);
|
|
19642
19650
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19643
19651
|
"div",
|
|
19644
19652
|
{
|
|
@@ -38786,33 +38794,36 @@ const Separator = () => {
|
|
|
38786
38794
|
});
|
|
38787
38795
|
};
|
|
38788
38796
|
const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
|
|
38789
|
-
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-
|
|
38797
|
+
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-9cc6e5c7.js"));
|
|
38790
38798
|
const YamlEditorComponent = forwardRef(
|
|
38791
38799
|
function YamlEditorComponent2(props, ref) {
|
|
38792
38800
|
const {
|
|
38793
38801
|
title,
|
|
38794
38802
|
collapsable = true,
|
|
38795
38803
|
isDefaultCollapsed,
|
|
38804
|
+
value: value2,
|
|
38796
38805
|
defaultValue = "",
|
|
38797
38806
|
height,
|
|
38798
38807
|
readOnly,
|
|
38799
38808
|
errorMsgs = [],
|
|
38800
38809
|
schemas,
|
|
38801
38810
|
eleRef,
|
|
38802
|
-
className
|
|
38811
|
+
className,
|
|
38812
|
+
debounceTime,
|
|
38813
|
+
isScrollOnFocus = true
|
|
38803
38814
|
} = props;
|
|
38804
38815
|
const { t: t2 } = useTranslation();
|
|
38805
38816
|
const [isCollapsed, setIsCollapsed] = useState(
|
|
38806
38817
|
collapsable ? isDefaultCollapsed : false
|
|
38807
38818
|
);
|
|
38808
38819
|
const [isDiff, setIsDiff] = useState(false);
|
|
38809
|
-
const [
|
|
38820
|
+
const [_value, _setValue] = useState(value2 || defaultValue);
|
|
38810
38821
|
const editorInstance = useRef();
|
|
38811
38822
|
const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
|
|
38812
38823
|
const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
|
|
38813
38824
|
useImperativeHandle(ref, () => {
|
|
38814
38825
|
return {
|
|
38815
|
-
setValue,
|
|
38826
|
+
setValue: _setValue,
|
|
38816
38827
|
setEditorValue: (value22) => {
|
|
38817
38828
|
var _a, _b;
|
|
38818
38829
|
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
|
|
@@ -38827,11 +38838,14 @@ const YamlEditorComponent = forwardRef(
|
|
|
38827
38838
|
const onChange = useCallback(
|
|
38828
38839
|
(newVal) => {
|
|
38829
38840
|
var _a;
|
|
38830
|
-
|
|
38841
|
+
_setValue(newVal);
|
|
38831
38842
|
(_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
|
|
38832
38843
|
},
|
|
38833
38844
|
[props.onChange]
|
|
38834
38845
|
);
|
|
38846
|
+
const finalOnChange = useMemo(() => {
|
|
38847
|
+
return debounceTime ? debounce(onChange, debounceTime) : onChange;
|
|
38848
|
+
}, [onChange, debounceTime]);
|
|
38835
38849
|
const onValidate = useCallback(
|
|
38836
38850
|
(valid, schemaValid) => {
|
|
38837
38851
|
var _a;
|
|
@@ -38842,16 +38856,23 @@ const YamlEditorComponent = forwardRef(
|
|
|
38842
38856
|
const onEditorCreate = useCallback(
|
|
38843
38857
|
(editor) => {
|
|
38844
38858
|
var _a, _b, _c;
|
|
38845
|
-
if (editor.getValue() !==
|
|
38846
|
-
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(
|
|
38859
|
+
if (editor.getValue() !== _value) {
|
|
38860
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
|
|
38847
38861
|
}
|
|
38848
38862
|
(_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
|
|
38849
38863
|
},
|
|
38850
|
-
[
|
|
38864
|
+
[_value, props.onEditorCreate]
|
|
38851
38865
|
);
|
|
38852
38866
|
const getInstance = useCallback((ins) => {
|
|
38853
38867
|
editorInstance.current = ins;
|
|
38854
38868
|
}, []);
|
|
38869
|
+
useEffect(() => {
|
|
38870
|
+
var _a, _b;
|
|
38871
|
+
if (value2 !== void 0 && value2 !== _value) {
|
|
38872
|
+
_setValue(value2);
|
|
38873
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
|
|
38874
|
+
}
|
|
38875
|
+
}, [value2]);
|
|
38855
38876
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
38856
38877
|
"div",
|
|
38857
38878
|
{
|
|
@@ -38905,7 +38926,7 @@ const YamlEditorComponent = forwardRef(
|
|
|
38905
38926
|
iconHeight: 16,
|
|
38906
38927
|
onClick: () => {
|
|
38907
38928
|
if (!isCollapsed) {
|
|
38908
|
-
copyToClipboard(
|
|
38929
|
+
copyToClipboard(_value);
|
|
38909
38930
|
setCopyTooltip(t2("dovetail.copied"));
|
|
38910
38931
|
}
|
|
38911
38932
|
}
|
|
@@ -38998,27 +39019,28 @@ const YamlEditorComponent = forwardRef(
|
|
|
38998
39019
|
zIndex: 1
|
|
38999
39020
|
},
|
|
39000
39021
|
children: [
|
|
39001
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39022
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39002
39023
|
MonacoYamlEditor,
|
|
39003
39024
|
{
|
|
39004
39025
|
id: props.id,
|
|
39005
39026
|
getInstance,
|
|
39006
|
-
defaultValue:
|
|
39027
|
+
defaultValue: _value,
|
|
39007
39028
|
height,
|
|
39008
|
-
onChange,
|
|
39029
|
+
onChange: finalOnChange,
|
|
39009
39030
|
onValidate,
|
|
39010
39031
|
onEditorCreate,
|
|
39011
39032
|
onBlur: props.onBlur,
|
|
39012
39033
|
schemas,
|
|
39013
|
-
readOnly
|
|
39034
|
+
readOnly,
|
|
39035
|
+
isScrollOnFocus
|
|
39014
39036
|
}
|
|
39015
39037
|
) }) }),
|
|
39016
|
-
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39038
|
+
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39017
39039
|
MonacoYamlDiffEditor,
|
|
39018
39040
|
{
|
|
39019
39041
|
id: props.id,
|
|
39020
39042
|
origin: defaultValue,
|
|
39021
|
-
modified:
|
|
39043
|
+
modified: _value,
|
|
39022
39044
|
height
|
|
39023
39045
|
}
|
|
39024
39046
|
) }) : null
|
package/dist/refine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bP, cF, A, aY, a_, aH, cd, bm, a3, cr, cf, aS, V, C, l, cL, aK, br, ae, cN, ak, ar, cW, az, cg, ce, cZ, aO, by, y, aF, bF, cY, cG, bI, D, b3, au, bL, at, av, a2, cc, cb, cX, bk, aW, cI, af, bS, cK, cJ, cM, cp, aI, al, v, t, cO, I, bv, aV, w, Q, bg, bi, ch, cQ, aN, bu, as, aA, aB, aa, aC, aZ, aG, bG, bJ, ab, d7, cq, cA, bO, N, a4, g, aX, a8, bR, bA, bz, cP, c2, d2, i, d1, aL, bs, cj, O, bc, bd, bq, K, be, L, bf, F, b7, cD, E, b6, J, ba, G, b8, H, b9, M, c3, bb, cC, ac, d5, d4, P, bo, x, ag, aj, c1, bl, cU, cT, b1, bw, c9, c8, s, aM, bn, z, bx, b2, d6, B, ct, cH, bM, bU, bV, d9, aJ, R, ai, ap, ao, bN, am, cV, c5, an, cE, ca, bj, bC, aw, k, U, T, bh, cw, cz, cv, cu, cx, cy, cs, ck, cn, co, cm, cl, ci, cB, bW, aP, bt, aD, o, bZ, n, a$, d0, q, b_, b0, p, aU, bp, m, c$, aR, aT, c7, bE, bD, c6, aQ, S, bH, c_, d3, b4, b5, bB, bK, c4, b$, c0, ad, a1, cS, ah, W, cR, aq, ay, ax, h, aE, bX, X, a5, d, dc, db, de, d8, a9, df, da, bT, dd, a7, a6, r, a, c, e, Z, Y, _, f, $, u, bQ, a0, bY, b } from "./index-
|
|
1
|
+
import { bP, cF, A, aY, a_, aH, cd, bm, a3, cr, cf, aS, V, C, l, cL, aK, br, ae, cN, ak, ar, cW, az, cg, ce, cZ, aO, by, y, aF, bF, cY, cG, bI, D, b3, au, bL, at, av, a2, cc, cb, cX, bk, aW, cI, af, bS, cK, cJ, cM, cp, aI, al, v, t, cO, I, bv, aV, w, Q, bg, bi, ch, cQ, aN, bu, as, aA, aB, aa, aC, aZ, aG, bG, bJ, ab, d7, cq, cA, bO, N, a4, g, aX, a8, bR, bA, bz, cP, c2, d2, i, d1, aL, bs, cj, O, bc, bd, bq, K, be, L, bf, F, b7, cD, E, b6, J, ba, G, b8, H, b9, M, c3, bb, cC, ac, d5, d4, P, bo, x, ag, aj, c1, bl, cU, cT, b1, bw, c9, c8, s, aM, bn, z, bx, b2, d6, B, ct, cH, bM, bU, bV, d9, aJ, R, ai, ap, ao, bN, am, cV, c5, an, cE, ca, bj, bC, aw, k, U, T, bh, cw, cz, cv, cu, cx, cy, cs, ck, cn, co, cm, cl, ci, cB, bW, aP, bt, aD, o, bZ, n, a$, d0, q, b_, b0, p, aU, bp, m, c$, aR, aT, c7, bE, bD, c6, aQ, S, bH, c_, d3, b4, b5, bB, bK, c4, b$, c0, ad, a1, cS, ah, W, cR, aq, ay, ax, h, aE, bX, X, a5, d, dc, db, de, d8, a9, df, da, bT, dd, a7, a6, r, a, c, e, Z, Y, _, f, $, u, bQ, a0, bY, b } from "./index-738afc30.js";
|
|
2
2
|
import "@cloudtower/eagle";
|
|
3
3
|
import "@refinedev/core";
|
|
4
4
|
import "react";
|
package/dist/refine.umd.cjs
CHANGED
|
@@ -9454,6 +9454,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9454
9454
|
AccessControlAuth2["Edit"] = "Edit";
|
|
9455
9455
|
AccessControlAuth2["Delete"] = "Delete";
|
|
9456
9456
|
AccessControlAuth2["Create"] = "Create";
|
|
9457
|
+
AccessControlAuth2["Read"] = "Read";
|
|
9458
|
+
AccessControlAuth2["None"] = "None";
|
|
9457
9459
|
return AccessControlAuth2;
|
|
9458
9460
|
})(AccessControlAuth || {});
|
|
9459
9461
|
function useSubmitForm(options) {
|
|
@@ -12214,7 +12216,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12214
12216
|
});
|
|
12215
12217
|
}
|
|
12216
12218
|
const ShowContent = (props) => {
|
|
12217
|
-
var _a, _b, _c, _d, _e;
|
|
12219
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12218
12220
|
const {
|
|
12219
12221
|
showConfig,
|
|
12220
12222
|
formatter,
|
|
@@ -12328,13 +12330,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12328
12330
|
},
|
|
12329
12331
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
12330
12332
|
className: cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
|
|
12331
|
-
children: (_c = record == null ? void 0 : record.metadata) == null ? void 0 :
|
|
12333
|
+
children: ((_c = showConfig.displayName) == null ? void 0 : _c.call(showConfig, record)) || ((_d = record == null ? void 0 : record.metadata) == null ? void 0 : _d.name)
|
|
12332
12334
|
}), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
|
|
12333
12335
|
state: stateDisplay,
|
|
12334
12336
|
customResourceStateMap: showConfig.resourceStateMap
|
|
12335
12337
|
}) : void 0]
|
|
12336
12338
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
|
|
12337
|
-
children: [(
|
|
12339
|
+
children: [(_e = showConfig.renderExtraButton) == null ? void 0 : _e.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
|
|
12338
12340
|
resource: resource == null ? void 0 : resource.name,
|
|
12339
12341
|
action: AccessControlAuth.Edit,
|
|
12340
12342
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
|
|
@@ -12342,7 +12344,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12342
12344
|
marginRight: 8
|
|
12343
12345
|
},
|
|
12344
12346
|
onClick: openForm,
|
|
12345
|
-
children: ((
|
|
12347
|
+
children: ((_f = config.formConfig) == null ? void 0 : _f.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
|
|
12346
12348
|
})
|
|
12347
12349
|
}) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown, {
|
|
12348
12350
|
record,
|
|
@@ -19518,15 +19520,19 @@ var __publicField = (obj, key, value) => {
|
|
|
19518
19520
|
} = props;
|
|
19519
19521
|
const uri = id ? monaco__namespace.Uri.parse(`${id}.yaml`) : void 0;
|
|
19520
19522
|
React.useEffect(() => {
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19523
|
+
if (!window._MonacoSchemaMap) {
|
|
19524
|
+
window._MonacoSchemaMap = /* @__PURE__ */ new Map();
|
|
19525
|
+
}
|
|
19526
|
+
window._MonacoSchemaMap.set(id || "", {
|
|
19527
|
+
// Id of the first schema
|
|
19528
|
+
uri: String(uri),
|
|
19529
|
+
// Associate with our model
|
|
19530
|
+
fileMatch: [String(uri)],
|
|
19531
|
+
schema: {
|
|
19532
|
+
oneOf: schemas || [{ type: "object" }]
|
|
19528
19533
|
}
|
|
19529
|
-
|
|
19534
|
+
});
|
|
19535
|
+
const finalSchemas = [...window._MonacoSchemaMap.values()];
|
|
19530
19536
|
monacoYaml.setDiagnosticsOptions({
|
|
19531
19537
|
enableSchemaRequest: false,
|
|
19532
19538
|
validate: true,
|
|
@@ -19547,13 +19553,15 @@ var __publicField = (obj, key, value) => {
|
|
|
19547
19553
|
tabSize: 2,
|
|
19548
19554
|
lineNumbersMinChars: 7,
|
|
19549
19555
|
readOnly,
|
|
19550
|
-
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
19556
|
+
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
|
|
19557
|
+
theme: "vs"
|
|
19551
19558
|
});
|
|
19552
19559
|
instanceRef.current.editor = editor;
|
|
19553
19560
|
getInstance == null ? void 0 : getInstance(editor);
|
|
19554
19561
|
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
19555
19562
|
return () => {
|
|
19556
19563
|
instanceRef.current.editor = null;
|
|
19564
|
+
window._MonacoSchemaMap.delete(id || "");
|
|
19557
19565
|
model.dispose();
|
|
19558
19566
|
editor.dispose();
|
|
19559
19567
|
};
|
|
@@ -19570,7 +19578,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19570
19578
|
stop.dispose();
|
|
19571
19579
|
};
|
|
19572
19580
|
}
|
|
19573
|
-
}, [onChange
|
|
19581
|
+
}, [onChange]);
|
|
19574
19582
|
React.useEffect(() => {
|
|
19575
19583
|
const editor = instanceRef.current.editor;
|
|
19576
19584
|
if (editor) {
|
|
@@ -19604,7 +19612,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19604
19612
|
stop.dispose();
|
|
19605
19613
|
};
|
|
19606
19614
|
}
|
|
19607
|
-
}, [onValidate
|
|
19615
|
+
}, [onValidate]);
|
|
19608
19616
|
React.useEffect(() => {
|
|
19609
19617
|
const editor = instanceRef.current.editor;
|
|
19610
19618
|
if (editor) {
|
|
@@ -19617,7 +19625,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19617
19625
|
stop.dispose();
|
|
19618
19626
|
};
|
|
19619
19627
|
}
|
|
19620
|
-
}, [onBlur
|
|
19628
|
+
}, [onBlur]);
|
|
19621
19629
|
React.useEffect(() => {
|
|
19622
19630
|
const editor = instanceRef.current.editor;
|
|
19623
19631
|
const stops = [];
|
|
@@ -19644,7 +19652,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19644
19652
|
return () => {
|
|
19645
19653
|
stops.forEach((stop) => stop.dispose());
|
|
19646
19654
|
};
|
|
19647
|
-
}, [
|
|
19655
|
+
}, [isScrollOnFocus]);
|
|
19648
19656
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19649
19657
|
"div",
|
|
19650
19658
|
{
|
|
@@ -38799,26 +38807,29 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38799
38807
|
title,
|
|
38800
38808
|
collapsable = true,
|
|
38801
38809
|
isDefaultCollapsed,
|
|
38810
|
+
value: value2,
|
|
38802
38811
|
defaultValue = "",
|
|
38803
38812
|
height,
|
|
38804
38813
|
readOnly,
|
|
38805
38814
|
errorMsgs = [],
|
|
38806
38815
|
schemas,
|
|
38807
38816
|
eleRef,
|
|
38808
|
-
className
|
|
38817
|
+
className,
|
|
38818
|
+
debounceTime,
|
|
38819
|
+
isScrollOnFocus = true
|
|
38809
38820
|
} = props;
|
|
38810
38821
|
const { t: t2 } = useTranslation();
|
|
38811
38822
|
const [isCollapsed, setIsCollapsed] = React.useState(
|
|
38812
38823
|
collapsable ? isDefaultCollapsed : false
|
|
38813
38824
|
);
|
|
38814
38825
|
const [isDiff, setIsDiff] = React.useState(false);
|
|
38815
|
-
const [
|
|
38826
|
+
const [_value, _setValue] = React.useState(value2 || defaultValue);
|
|
38816
38827
|
const editorInstance = React.useRef();
|
|
38817
38828
|
const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
|
|
38818
38829
|
const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
|
|
38819
38830
|
React.useImperativeHandle(ref, () => {
|
|
38820
38831
|
return {
|
|
38821
|
-
setValue,
|
|
38832
|
+
setValue: _setValue,
|
|
38822
38833
|
setEditorValue: (value22) => {
|
|
38823
38834
|
var _a, _b;
|
|
38824
38835
|
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
|
|
@@ -38833,11 +38844,14 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38833
38844
|
const onChange = React.useCallback(
|
|
38834
38845
|
(newVal) => {
|
|
38835
38846
|
var _a;
|
|
38836
|
-
|
|
38847
|
+
_setValue(newVal);
|
|
38837
38848
|
(_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
|
|
38838
38849
|
},
|
|
38839
38850
|
[props.onChange]
|
|
38840
38851
|
);
|
|
38852
|
+
const finalOnChange = React.useMemo(() => {
|
|
38853
|
+
return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
|
|
38854
|
+
}, [onChange, debounceTime]);
|
|
38841
38855
|
const onValidate = React.useCallback(
|
|
38842
38856
|
(valid, schemaValid) => {
|
|
38843
38857
|
var _a;
|
|
@@ -38848,16 +38862,23 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38848
38862
|
const onEditorCreate = React.useCallback(
|
|
38849
38863
|
(editor) => {
|
|
38850
38864
|
var _a, _b, _c;
|
|
38851
|
-
if (editor.getValue() !==
|
|
38852
|
-
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(
|
|
38865
|
+
if (editor.getValue() !== _value) {
|
|
38866
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
|
|
38853
38867
|
}
|
|
38854
38868
|
(_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
|
|
38855
38869
|
},
|
|
38856
|
-
[
|
|
38870
|
+
[_value, props.onEditorCreate]
|
|
38857
38871
|
);
|
|
38858
38872
|
const getInstance = React.useCallback((ins) => {
|
|
38859
38873
|
editorInstance.current = ins;
|
|
38860
38874
|
}, []);
|
|
38875
|
+
React.useEffect(() => {
|
|
38876
|
+
var _a, _b;
|
|
38877
|
+
if (value2 !== void 0 && value2 !== _value) {
|
|
38878
|
+
_setValue(value2);
|
|
38879
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
|
|
38880
|
+
}
|
|
38881
|
+
}, [value2]);
|
|
38861
38882
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
38862
38883
|
"div",
|
|
38863
38884
|
{
|
|
@@ -38911,7 +38932,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38911
38932
|
iconHeight: 16,
|
|
38912
38933
|
onClick: () => {
|
|
38913
38934
|
if (!isCollapsed) {
|
|
38914
|
-
copyToClipboard(
|
|
38935
|
+
copyToClipboard(_value);
|
|
38915
38936
|
setCopyTooltip(t2("dovetail.copied"));
|
|
38916
38937
|
}
|
|
38917
38938
|
}
|
|
@@ -39004,27 +39025,28 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39004
39025
|
zIndex: 1
|
|
39005
39026
|
},
|
|
39006
39027
|
children: [
|
|
39007
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39028
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39008
39029
|
MonacoYamlEditor,
|
|
39009
39030
|
{
|
|
39010
39031
|
id: props.id,
|
|
39011
39032
|
getInstance,
|
|
39012
|
-
defaultValue:
|
|
39033
|
+
defaultValue: _value,
|
|
39013
39034
|
height,
|
|
39014
|
-
onChange,
|
|
39035
|
+
onChange: finalOnChange,
|
|
39015
39036
|
onValidate,
|
|
39016
39037
|
onEditorCreate,
|
|
39017
39038
|
onBlur: props.onBlur,
|
|
39018
39039
|
schemas,
|
|
39019
|
-
readOnly
|
|
39040
|
+
readOnly,
|
|
39041
|
+
isScrollOnFocus
|
|
39020
39042
|
}
|
|
39021
39043
|
) }) }),
|
|
39022
|
-
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39044
|
+
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39023
39045
|
MonacoYamlDiffEditor$2,
|
|
39024
39046
|
{
|
|
39025
39047
|
id: props.id,
|
|
39026
39048
|
origin: defaultValue,
|
|
39027
|
-
modified:
|
|
39049
|
+
modified: _value,
|
|
39028
39050
|
height
|
|
39029
39051
|
}
|
|
39030
39052
|
) }) : null
|
|
@@ -39,6 +39,7 @@ export interface ShowConfig<Model extends ResourceModel = ResourceModel> {
|
|
|
39
39
|
color: Record<string, StatusCapsuleColor | 'loading'>;
|
|
40
40
|
text: Record<string, string>;
|
|
41
41
|
};
|
|
42
|
+
displayName?: (record: Model) => string | undefined;
|
|
42
43
|
}
|
|
43
44
|
export declare const ImageField: <Model extends WorkloadBaseModel>(i18n: I18nType) => ShowField<Model>;
|
|
44
45
|
export declare const ReplicaField: <Model extends JobModel | WorkloadModel>() => ShowField<Model>;
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
export type YamlEditorProps = {
|
|
5
5
|
eleRef?: React.MutableRefObject<HTMLDivElement>;
|
|
6
6
|
title?: string;
|
|
7
|
+
value?: string;
|
|
7
8
|
defaultValue?: string;
|
|
8
9
|
errorMsgs?: string[];
|
|
9
10
|
schemas?: JSONSchema7[] | null;
|
|
@@ -13,6 +14,8 @@ export type YamlEditorProps = {
|
|
|
13
14
|
collapsable?: boolean;
|
|
14
15
|
isDefaultCollapsed?: boolean;
|
|
15
16
|
readOnly?: boolean;
|
|
17
|
+
debounceTime?: number;
|
|
18
|
+
isScrollOnFocus?: boolean;
|
|
16
19
|
onChange?: (value: string) => void;
|
|
17
20
|
onValidate?: (valid: boolean, schemaValid: boolean) => void;
|
|
18
21
|
onEditorCreate?: (editor: monaco.editor.IStandaloneCodeEditor) => void;
|
package/lib/constants/auth.d.ts
CHANGED