@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.93 → 0.0.1-alpha.94
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 +208 -27
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +208 -27
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/EditModal/EditModal.d.ts +12 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/EditModal/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +8 -0
- package/package.json +3 -3
|
@@ -33418,7 +33418,7 @@ const prepare = ({
|
|
|
33418
33418
|
permissions: dataForControls.permissions
|
|
33419
33419
|
};
|
|
33420
33420
|
return {
|
|
33421
|
-
key: el.metadata.name
|
|
33421
|
+
key: `${el.metadata.name}${el.metadata.namespace ? `-${el.metadata.namespace}` : ""}`,
|
|
33422
33422
|
...el,
|
|
33423
33423
|
internalDataForControls
|
|
33424
33424
|
};
|
|
@@ -33458,7 +33458,7 @@ const prepare = ({
|
|
|
33458
33458
|
permissions: dataForControls.permissions
|
|
33459
33459
|
};
|
|
33460
33460
|
return {
|
|
33461
|
-
key: el.metadata.name
|
|
33461
|
+
key: `${el.metadata.name}${el.metadata.namespace ? `-${el.metadata.namespace}` : ""}`,
|
|
33462
33462
|
...el.spec,
|
|
33463
33463
|
internalDataForControls
|
|
33464
33464
|
};
|
|
@@ -46816,6 +46816,7 @@ const ItemCounter = ({
|
|
|
46816
46816
|
reqIndex,
|
|
46817
46817
|
jsonPathToArray,
|
|
46818
46818
|
text,
|
|
46819
|
+
errorText,
|
|
46819
46820
|
style
|
|
46820
46821
|
} = data;
|
|
46821
46822
|
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
@@ -46835,12 +46836,14 @@ const ItemCounter = ({
|
|
|
46835
46836
|
}, {});
|
|
46836
46837
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
46837
46838
|
if (jsonRoot === void 0) {
|
|
46838
|
-
|
|
46839
|
+
console.log("Item Counter: ${id}: No root for json path");
|
|
46840
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
46839
46841
|
}
|
|
46840
46842
|
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
|
|
46841
46843
|
const { counter, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
|
|
46842
46844
|
if (errorArrayOfObjects) {
|
|
46843
|
-
|
|
46845
|
+
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
46846
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
46844
46847
|
}
|
|
46845
46848
|
const parsedText = parseAll({ text, replaceValues, multiQueryData });
|
|
46846
46849
|
const parsedTextWithCounter = parsedText.replace("~counter~", String(counter || 0));
|
|
@@ -46870,6 +46873,7 @@ const KeyCounter = ({
|
|
|
46870
46873
|
reqIndex,
|
|
46871
46874
|
jsonPathToObj,
|
|
46872
46875
|
text,
|
|
46876
|
+
errorText,
|
|
46873
46877
|
style
|
|
46874
46878
|
} = data;
|
|
46875
46879
|
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
@@ -46889,12 +46893,14 @@ const KeyCounter = ({
|
|
|
46889
46893
|
}, {});
|
|
46890
46894
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
46891
46895
|
if (jsonRoot === void 0) {
|
|
46892
|
-
|
|
46896
|
+
console.log("Key Counter: ${id}: No root for json path");
|
|
46897
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
46893
46898
|
}
|
|
46894
46899
|
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
|
|
46895
46900
|
const { counter, error: errorArrayOfObjects } = getItemsInside(anythingForNow);
|
|
46896
46901
|
if (errorArrayOfObjects) {
|
|
46897
|
-
|
|
46902
|
+
console.log(`Key Counter: ${id}: ${errorArrayOfObjects}`);
|
|
46903
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
46898
46904
|
}
|
|
46899
46905
|
const parsedText = parseAll({ text, replaceValues, multiQueryData });
|
|
46900
46906
|
const parsedTextWithCounter = parsedText.replace("~counter~", String(counter || 0));
|
|
@@ -46904,6 +46910,96 @@ const KeyCounter = ({
|
|
|
46904
46910
|
] });
|
|
46905
46911
|
};
|
|
46906
46912
|
|
|
46913
|
+
const EditModal = ({
|
|
46914
|
+
open,
|
|
46915
|
+
close,
|
|
46916
|
+
values,
|
|
46917
|
+
openNotificationSuccess,
|
|
46918
|
+
modalTitle,
|
|
46919
|
+
modalDescriptionText,
|
|
46920
|
+
inputLabel
|
|
46921
|
+
}) => {
|
|
46922
|
+
const [error, setError] = useState();
|
|
46923
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
46924
|
+
const [form] = Form.useForm();
|
|
46925
|
+
const labels = Form.useWatch("labels", form);
|
|
46926
|
+
useEffect(() => {
|
|
46927
|
+
if (open) {
|
|
46928
|
+
form.setFieldsValue({
|
|
46929
|
+
labels: values ? Object.entries(values).map(([key, value]) => `${key}=${value}`) : []
|
|
46930
|
+
});
|
|
46931
|
+
}
|
|
46932
|
+
}, [open, form]);
|
|
46933
|
+
const submit = () => {
|
|
46934
|
+
form.validateFields().then(() => {
|
|
46935
|
+
const result = {};
|
|
46936
|
+
labels.forEach((label) => {
|
|
46937
|
+
const [key, value] = label.split("=");
|
|
46938
|
+
result[key] = value || "";
|
|
46939
|
+
});
|
|
46940
|
+
console.log(JSON.stringify(result));
|
|
46941
|
+
if (openNotificationSuccess) {
|
|
46942
|
+
openNotificationSuccess();
|
|
46943
|
+
}
|
|
46944
|
+
}).catch(() => console.log("Validating error"));
|
|
46945
|
+
};
|
|
46946
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
46947
|
+
Modal,
|
|
46948
|
+
{
|
|
46949
|
+
title: modalTitle,
|
|
46950
|
+
open,
|
|
46951
|
+
onOk: () => submit(),
|
|
46952
|
+
onCancel: () => {
|
|
46953
|
+
close();
|
|
46954
|
+
form.resetFields();
|
|
46955
|
+
setIsLoading(false);
|
|
46956
|
+
setError(void 0);
|
|
46957
|
+
},
|
|
46958
|
+
okText: "Save",
|
|
46959
|
+
confirmLoading: isLoading,
|
|
46960
|
+
maskClosable: false,
|
|
46961
|
+
width: "60vw",
|
|
46962
|
+
destroyOnHidden: true,
|
|
46963
|
+
children: [
|
|
46964
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
|
|
46965
|
+
modalDescriptionText,
|
|
46966
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
|
|
46967
|
+
inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { children: inputLabel }),
|
|
46968
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46969
|
+
ResetedFormItem,
|
|
46970
|
+
{
|
|
46971
|
+
name: "labels",
|
|
46972
|
+
hasFeedback: true,
|
|
46973
|
+
validateTrigger: "onBlur",
|
|
46974
|
+
rules: [
|
|
46975
|
+
() => ({
|
|
46976
|
+
validator(_, value) {
|
|
46977
|
+
if (Array.isArray(value) && value.every((str) => typeof str === "string" && str.includes("="))) {
|
|
46978
|
+
return Promise.resolve();
|
|
46979
|
+
}
|
|
46980
|
+
return Promise.reject(new Error("Please enter key=value style"));
|
|
46981
|
+
}
|
|
46982
|
+
})
|
|
46983
|
+
],
|
|
46984
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46985
|
+
Select,
|
|
46986
|
+
{
|
|
46987
|
+
mode: "tags",
|
|
46988
|
+
placeholder: "Enter key=value",
|
|
46989
|
+
filterOption: filterSelectOptions,
|
|
46990
|
+
allowClear: true,
|
|
46991
|
+
tokenSeparators: [" "],
|
|
46992
|
+
open: false
|
|
46993
|
+
}
|
|
46994
|
+
)
|
|
46995
|
+
}
|
|
46996
|
+
)
|
|
46997
|
+
] })
|
|
46998
|
+
]
|
|
46999
|
+
}
|
|
47000
|
+
);
|
|
47001
|
+
};
|
|
47002
|
+
|
|
46907
47003
|
const isRecordStringNumber$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.entries(value).every(([k, v]) => typeof k === "string" && (typeof v === "string" || typeof v === "number"));
|
|
46908
47004
|
const parseArrayOfAny$1 = (value) => {
|
|
46909
47005
|
if (!Array.isArray(value)) {
|
|
@@ -46927,10 +47023,19 @@ const Labels = ({ data, children }) => {
|
|
|
46927
47023
|
id,
|
|
46928
47024
|
reqIndex,
|
|
46929
47025
|
jsonPathToLabels,
|
|
46930
|
-
selectProps
|
|
47026
|
+
selectProps,
|
|
47027
|
+
notificationSuccessMessage,
|
|
47028
|
+
notificationSuccessMessageDescription,
|
|
47029
|
+
modalTitle,
|
|
47030
|
+
modalDescriptionText,
|
|
47031
|
+
inputLabel,
|
|
47032
|
+
containerStyle
|
|
46931
47033
|
} = data;
|
|
47034
|
+
const [api, contextHolder] = notification.useNotification();
|
|
47035
|
+
const [open, setOpen] = useState(false);
|
|
46932
47036
|
const { maxTagTextLength, ...restSelectProps } = selectProps || { maxTagTextLength: void 0 };
|
|
46933
47037
|
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
47038
|
+
const partsOfUrl = usePartsOfUrl();
|
|
46934
47039
|
if (isMultiQueryLoading) {
|
|
46935
47040
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
46936
47041
|
}
|
|
@@ -46940,28 +47045,80 @@ const Labels = ({ data, children }) => {
|
|
|
46940
47045
|
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
|
|
46941
47046
|
] });
|
|
46942
47047
|
}
|
|
47048
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
47049
|
+
acc[index.toString()] = value;
|
|
47050
|
+
return acc;
|
|
47051
|
+
}, {});
|
|
46943
47052
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
46944
47053
|
if (jsonRoot === void 0) {
|
|
46945
47054
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
46946
47055
|
}
|
|
46947
47056
|
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
|
|
46948
47057
|
const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
|
|
46949
|
-
const
|
|
46950
|
-
|
|
46951
|
-
|
|
46952
|
-
|
|
46953
|
-
|
|
46954
|
-
|
|
46955
|
-
|
|
46956
|
-
|
|
46957
|
-
|
|
46958
|
-
|
|
46959
|
-
|
|
46960
|
-
|
|
46961
|
-
|
|
46962
|
-
|
|
46963
|
-
|
|
46964
|
-
|
|
47058
|
+
const notificationSuccessMessagePrepared = parseAll({
|
|
47059
|
+
text: notificationSuccessMessage,
|
|
47060
|
+
replaceValues,
|
|
47061
|
+
multiQueryData
|
|
47062
|
+
});
|
|
47063
|
+
const notificationSuccessMessageDescriptionPrepared = parseAll({
|
|
47064
|
+
text: notificationSuccessMessageDescription,
|
|
47065
|
+
replaceValues,
|
|
47066
|
+
multiQueryData
|
|
47067
|
+
});
|
|
47068
|
+
const modalTitlePrepared = parseAll({ text: modalTitle, replaceValues, multiQueryData });
|
|
47069
|
+
const modalDescriptionTextPrepared = modalDescriptionText ? parseAll({ text: modalDescriptionText, replaceValues, multiQueryData }) : void 0;
|
|
47070
|
+
const inputLabelPrepared = inputLabel ? parseAll({ text: inputLabel, replaceValues, multiQueryData }) : void 0;
|
|
47071
|
+
const openNotificationSuccess = () => {
|
|
47072
|
+
api.success({
|
|
47073
|
+
message: notificationSuccessMessagePrepared,
|
|
47074
|
+
description: notificationSuccessMessageDescriptionPrepared,
|
|
47075
|
+
placement: "bottomRight"
|
|
47076
|
+
});
|
|
47077
|
+
};
|
|
47078
|
+
const EmptySelect = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
47079
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47080
|
+
Button,
|
|
47081
|
+
{
|
|
47082
|
+
type: "text",
|
|
47083
|
+
size: "small",
|
|
47084
|
+
onClick: (e) => {
|
|
47085
|
+
e.stopPropagation();
|
|
47086
|
+
setOpen(true);
|
|
47087
|
+
},
|
|
47088
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
|
|
47089
|
+
}
|
|
47090
|
+
) }),
|
|
47091
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47092
|
+
UncontrolledSelect,
|
|
47093
|
+
{
|
|
47094
|
+
mode: "multiple",
|
|
47095
|
+
...restSelectProps,
|
|
47096
|
+
value: [],
|
|
47097
|
+
options: [],
|
|
47098
|
+
open: false,
|
|
47099
|
+
showSearch: false,
|
|
47100
|
+
removeIcon: () => {
|
|
47101
|
+
return null;
|
|
47102
|
+
},
|
|
47103
|
+
suffixIcon: null,
|
|
47104
|
+
isCursorPointer: true
|
|
47105
|
+
}
|
|
47106
|
+
),
|
|
47107
|
+
children,
|
|
47108
|
+
contextHolder,
|
|
47109
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47110
|
+
EditModal,
|
|
47111
|
+
{
|
|
47112
|
+
open,
|
|
47113
|
+
close: () => setOpen(false),
|
|
47114
|
+
values: labelsRaw,
|
|
47115
|
+
openNotificationSuccess,
|
|
47116
|
+
modalTitle: modalTitlePrepared,
|
|
47117
|
+
modalDescriptionText: modalDescriptionTextPrepared,
|
|
47118
|
+
inputLabel: inputLabelPrepared
|
|
47119
|
+
}
|
|
47120
|
+
)
|
|
47121
|
+
] });
|
|
46965
47122
|
if (!labelsRaw) {
|
|
46966
47123
|
if (errorArrayOfObjects) {
|
|
46967
47124
|
return EmptySelect;
|
|
@@ -46969,7 +47126,19 @@ const Labels = ({ data, children }) => {
|
|
|
46969
47126
|
return EmptySelect;
|
|
46970
47127
|
}
|
|
46971
47128
|
const labels = Object.entries(labelsRaw).map(([key, value]) => `${key}=${value}`);
|
|
46972
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
47129
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
47130
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47131
|
+
Button,
|
|
47132
|
+
{
|
|
47133
|
+
type: "text",
|
|
47134
|
+
size: "small",
|
|
47135
|
+
onClick: (e) => {
|
|
47136
|
+
e.stopPropagation();
|
|
47137
|
+
setOpen(true);
|
|
47138
|
+
},
|
|
47139
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
|
|
47140
|
+
}
|
|
47141
|
+
) }),
|
|
46973
47142
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46974
47143
|
UncontrolledSelect,
|
|
46975
47144
|
{
|
|
@@ -46991,11 +47160,23 @@ const Labels = ({ data, children }) => {
|
|
|
46991
47160
|
},
|
|
46992
47161
|
children: typeof label === "string" ? truncate(label, maxTagTextLength) : "Not a string value"
|
|
46993
47162
|
}
|
|
46994
|
-
) })
|
|
46995
|
-
isCursorPointer: true
|
|
47163
|
+
) })
|
|
46996
47164
|
}
|
|
46997
47165
|
),
|
|
46998
|
-
children
|
|
47166
|
+
children,
|
|
47167
|
+
contextHolder,
|
|
47168
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47169
|
+
EditModal,
|
|
47170
|
+
{
|
|
47171
|
+
open,
|
|
47172
|
+
close: () => setOpen(false),
|
|
47173
|
+
values: labelsRaw,
|
|
47174
|
+
openNotificationSuccess,
|
|
47175
|
+
modalTitle: modalTitlePrepared,
|
|
47176
|
+
modalDescriptionText: modalDescriptionTextPrepared,
|
|
47177
|
+
inputLabel: inputLabelPrepared
|
|
47178
|
+
}
|
|
47179
|
+
)
|
|
46999
47180
|
] });
|
|
47000
47181
|
};
|
|
47001
47182
|
|