@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.145 → 0.0.1-alpha.146
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/openapi-k8s-toolkit.es.js +25 -13
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +25 -13
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/hiddenExpanded.d.ts +1 -0
- package/package.json +1 -1
|
@@ -47957,8 +47957,9 @@ const sanitizeWildcardPath = (p) => {
|
|
|
47957
47957
|
return out;
|
|
47958
47958
|
};
|
|
47959
47959
|
const isPlainObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
47960
|
-
const expandOneTemplate = (tpl, node, base = [], out = []) => {
|
|
47960
|
+
const expandOneTemplate = (tpl, node, base = [], out = [], opts) => {
|
|
47961
47961
|
wgroup(`expand tpl=${prettyPath(tpl)} from base=${prettyPath(base)}`);
|
|
47962
|
+
const tplHasWildcard = tpl.some((seg) => seg === "*");
|
|
47962
47963
|
const step = (i, curr, path) => {
|
|
47963
47964
|
wdbg("step", {
|
|
47964
47965
|
i,
|
|
@@ -47986,10 +47987,13 @@ const expandOneTemplate = (tpl, node, base = [], out = []) => {
|
|
|
47986
47987
|
} else ;
|
|
47987
47988
|
return;
|
|
47988
47989
|
}
|
|
47990
|
+
const isLast = i === tpl.length - 1;
|
|
47989
47991
|
if (isPlainObj(curr) && seg in curr) {
|
|
47990
47992
|
step(i + 1, curr[seg], [...path, seg]);
|
|
47991
47993
|
} else if (Array.isArray(curr) && typeof seg === "number" && curr[seg] !== void 0) {
|
|
47992
47994
|
step(i + 1, curr[seg], [...path, seg]);
|
|
47995
|
+
} else if (isLast && opts?.includeMissingFinalForWildcard && tplHasWildcard) {
|
|
47996
|
+
out.push([...path, seg]);
|
|
47993
47997
|
} else ;
|
|
47994
47998
|
};
|
|
47995
47999
|
step(0, node, base);
|
|
@@ -48000,7 +48004,9 @@ const expandWildcardTemplates = (templates, values, opts) => {
|
|
|
48000
48004
|
const acc = [];
|
|
48001
48005
|
const seen = /* @__PURE__ */ new Set();
|
|
48002
48006
|
for (const tpl of templates) {
|
|
48003
|
-
const hits = expandOneTemplate(tpl, values
|
|
48007
|
+
const hits = expandOneTemplate(tpl, values, [], [], {
|
|
48008
|
+
includeMissingFinalForWildcard: opts?.includeMissingFinalForWildcard
|
|
48009
|
+
});
|
|
48004
48010
|
for (const p of hits) {
|
|
48005
48011
|
const k = JSON.stringify(p);
|
|
48006
48012
|
if (!seen.has(k)) {
|
|
@@ -48094,6 +48100,7 @@ const BlackholeForm = ({
|
|
|
48094
48100
|
const { token } = theme.useToken();
|
|
48095
48101
|
const navigate = useNavigate();
|
|
48096
48102
|
const [form] = Form.useForm();
|
|
48103
|
+
const allValues = Form.useWatch([], form);
|
|
48097
48104
|
const namespaceFromFormData = Form.useWatch(["metadata", "namespace"], form);
|
|
48098
48105
|
const [properties, setProperties] = useState(staticProperties);
|
|
48099
48106
|
const [yamlValues, setYamlValues] = useState();
|
|
@@ -48228,28 +48235,28 @@ const BlackholeForm = ({
|
|
|
48228
48235
|
return normalizeValuesForQuotasToNumber(prefillValuesSchema, staticProperties);
|
|
48229
48236
|
}, [prefillValuesSchema, staticProperties]);
|
|
48230
48237
|
const initialValues = useMemo(() => {
|
|
48231
|
-
const
|
|
48238
|
+
const allValues2 = {};
|
|
48232
48239
|
if (isCreate) {
|
|
48233
|
-
_$1.set(
|
|
48234
|
-
_$1.set(
|
|
48240
|
+
_$1.set(allValues2, ["apiVersion"], apiGroupApiVersion === "api/v1" ? "v1" : apiGroupApiVersion);
|
|
48241
|
+
_$1.set(allValues2, ["kind"], kindName);
|
|
48235
48242
|
}
|
|
48236
48243
|
if (formsPrefills) {
|
|
48237
48244
|
formsPrefills.spec.values.forEach(({ path, value }) => {
|
|
48238
48245
|
const hasWildcard = path.some((seg) => seg === "*");
|
|
48239
48246
|
if (!hasWildcard) {
|
|
48240
|
-
_$1.set(
|
|
48247
|
+
_$1.set(allValues2, path, value);
|
|
48241
48248
|
}
|
|
48242
48249
|
});
|
|
48243
48250
|
}
|
|
48244
48251
|
if (prefillValueNamespaceOnly) {
|
|
48245
|
-
_$1.set(
|
|
48252
|
+
_$1.set(allValues2, ["metadata", "namespace"], prefillValueNamespaceOnly);
|
|
48246
48253
|
}
|
|
48247
48254
|
if (normalizedPrefill) {
|
|
48248
48255
|
Object.entries(normalizedPrefill).forEach(([flatKey, v]) => {
|
|
48249
|
-
_$1.set(
|
|
48256
|
+
_$1.set(allValues2, flatKey.split("."), v);
|
|
48250
48257
|
});
|
|
48251
48258
|
}
|
|
48252
|
-
const sorted = Object.fromEntries(Object.entries(
|
|
48259
|
+
const sorted = Object.fromEntries(Object.entries(allValues2).sort(([a], [b]) => a.localeCompare(b)));
|
|
48253
48260
|
return sorted;
|
|
48254
48261
|
}, [formsPrefills, prefillValueNamespaceOnly, isCreate, apiGroupApiVersion, kindName, normalizedPrefill]);
|
|
48255
48262
|
const prefillTemplates = useMemo(() => {
|
|
@@ -48305,7 +48312,8 @@ const BlackholeForm = ({
|
|
|
48305
48312
|
useEffect(() => {
|
|
48306
48313
|
if (!initialValues) return;
|
|
48307
48314
|
const hiddenResolved = expandWildcardTemplates(hiddenWildcardTemplates, initialValues, {
|
|
48308
|
-
includeMissingExact: true
|
|
48315
|
+
includeMissingExact: true,
|
|
48316
|
+
includeMissingFinalForWildcard: true
|
|
48309
48317
|
});
|
|
48310
48318
|
wdbg("hidden resolved", hiddenResolved.map(prettyPath));
|
|
48311
48319
|
setResolvedHiddenPaths(hiddenResolved);
|
|
@@ -48348,13 +48356,14 @@ const BlackholeForm = ({
|
|
|
48348
48356
|
});
|
|
48349
48357
|
}, 300);
|
|
48350
48358
|
const onValuesChangeCallback = useCallback(
|
|
48351
|
-
(values) => {
|
|
48359
|
+
(values, flag) => {
|
|
48360
|
+
console.log("fired", flag);
|
|
48352
48361
|
const vRaw = values ?? form.getFieldsValue(true);
|
|
48353
48362
|
const v = scrubLiteralWildcardKeys(vRaw);
|
|
48354
48363
|
const hiddenResolved = expandWildcardTemplates(
|
|
48355
48364
|
hiddenWildcardTemplates,
|
|
48356
48365
|
v,
|
|
48357
|
-
{ includeMissingExact: true }
|
|
48366
|
+
{ includeMissingExact: true, includeMissingFinalForWildcard: true }
|
|
48358
48367
|
// only hidden opts in
|
|
48359
48368
|
);
|
|
48360
48369
|
wdbg("hidden resolved", hiddenResolved.map(prettyPath));
|
|
@@ -48448,6 +48457,9 @@ const BlackholeForm = ({
|
|
|
48448
48457
|
expandedWildcardTemplates
|
|
48449
48458
|
]
|
|
48450
48459
|
);
|
|
48460
|
+
useEffect(() => {
|
|
48461
|
+
onValuesChangeCallback(void 0, "fuck me");
|
|
48462
|
+
}, [allValues]);
|
|
48451
48463
|
const debouncedPostYamlToValues = useDebounceCallback((payload, myId) => {
|
|
48452
48464
|
try {
|
|
48453
48465
|
yamlToValuesAbortRef.current?.abort();
|
|
@@ -48696,7 +48708,7 @@ const BlackholeForm = ({
|
|
|
48696
48708
|
};
|
|
48697
48709
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
48698
48710
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$d.Container, { $designNewLayout: designNewLayout, $designNewLayoutHeight: designNewLayoutHeight, children: [
|
|
48699
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$d.OverflowContainer, { ref: overflowRef, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, initialValues, onValuesChange:
|
|
48711
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$d.OverflowContainer, { ref: overflowRef, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, initialValues, onValuesChange: onValuesChangeCallback, children: [
|
|
48700
48712
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DesignNewLayoutProvider, { value: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsx(OnValuesChangeCallbackProvider, { value: onValuesChangeCallback, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IsTouchedPersistedProvider, { value: {}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(HiddenPathsProvider, { value: resolvedHiddenStringPaths, children: getObjectFormItemsDraft({
|
|
48701
48713
|
properties,
|
|
48702
48714
|
name: [],
|