@prorobotech/openapi-k8s-toolkit 1.2.1-alpha.8 → 1.3.0-alpha.1

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.
Files changed (71) hide show
  1. package/dist/openapi-k8s-toolkit.es.js +676 -671
  2. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  3. package/dist/openapi-k8s-toolkit.umd.js +674 -669
  4. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  5. package/dist/types/components/molecules/Terminals/PodLogsMonaco/molecules/MonacoEditor/styled.d.ts +3 -3
  6. package/dist/types/components/molecules/Terminals/PodTerminal/molecules/XTerminal/styled.d.ts +1 -0
  7. package/dist/types/components/organisms/DynamicComponents/atoms/index.d.ts +1 -0
  8. package/dist/types/components/organisms/DynamicComponents/{molecules/Annotations/molecules/EditModal/EditModal.d.ts → atoms/modals/AnnotationsEditModal/AnnotationsEditModal.d.ts} +3 -3
  9. package/dist/types/components/organisms/DynamicComponents/atoms/modals/AnnotationsEditModal/index.d.ts +1 -0
  10. package/dist/types/components/organisms/DynamicComponents/atoms/modals/AnnotationsEditModal/types.d.ts +1 -0
  11. package/dist/types/components/organisms/DynamicComponents/{molecules/Labels/molecules/EditModal/EditModal.d.ts → atoms/modals/LabelsEditModal/LabelsEditModal.d.ts} +2 -2
  12. package/dist/types/components/organisms/DynamicComponents/atoms/modals/LabelsEditModal/index.d.ts +1 -0
  13. package/dist/types/components/organisms/DynamicComponents/atoms/modals/LabelsEditModal/utils.d.ts +1 -0
  14. package/dist/types/components/organisms/DynamicComponents/atoms/modals/LabelsEditModal/utils.test.d.ts +1 -0
  15. package/dist/types/components/organisms/DynamicComponents/{molecules/Taints/molecules/EditModal/EditModal.d.ts → atoms/modals/TaintsEditModal/TaintsEditModal.d.ts} +3 -3
  16. package/dist/types/components/organisms/DynamicComponents/atoms/modals/TaintsEditModal/index.d.ts +1 -0
  17. package/dist/types/components/organisms/DynamicComponents/atoms/modals/TaintsEditModal/types.d.ts +6 -0
  18. package/dist/types/components/organisms/DynamicComponents/{molecules/Tolerations/molecules/EditModal/EditModal.d.ts → atoms/modals/TolerationsEditModal/TolerationsEditModal.d.ts} +3 -3
  19. package/dist/types/components/organisms/DynamicComponents/atoms/modals/TolerationsEditModal/index.d.ts +1 -0
  20. package/dist/types/components/organisms/DynamicComponents/atoms/modals/TolerationsEditModal/types.d.ts +8 -0
  21. package/dist/types/components/organisms/DynamicComponents/atoms/modals/index.d.ts +4 -0
  22. package/dist/types/components/organisms/DynamicComponents/types/Annotations.d.ts +20 -0
  23. package/dist/types/components/organisms/DynamicComponents/types/ArrayOfObjectsToKeyValues.d.ts +13 -0
  24. package/dist/types/components/organisms/DynamicComponents/types/ContentCard.d.ts +4 -0
  25. package/dist/types/components/organisms/DynamicComponents/types/ConverterBytes.d.ts +20 -0
  26. package/dist/types/components/organisms/DynamicComponents/types/ConverterCores.d.ts +21 -0
  27. package/dist/types/components/organisms/DynamicComponents/types/CopyButton.d.ts +10 -0
  28. package/dist/types/components/organisms/DynamicComponents/types/DefaultDiv.d.ts +4 -0
  29. package/dist/types/components/organisms/DynamicComponents/types/DefaultIframe.d.ts +4 -0
  30. package/dist/types/components/organisms/DynamicComponents/types/DropdownRedirect.d.ts +20 -0
  31. package/dist/types/components/organisms/DynamicComponents/types/EnrichedTable.d.ts +21 -0
  32. package/dist/types/components/organisms/DynamicComponents/types/Events.d.ts +22 -0
  33. package/dist/types/components/organisms/DynamicComponents/types/ItemCounter.d.ts +9 -0
  34. package/dist/types/components/organisms/DynamicComponents/types/KeyCounter.d.ts +9 -0
  35. package/dist/types/components/organisms/DynamicComponents/types/Labels.d.ts +30 -0
  36. package/dist/types/components/organisms/DynamicComponents/types/LabelsToSearchParams.d.ts +10 -0
  37. package/dist/types/components/organisms/DynamicComponents/types/MarketplaceCard.d.ts +13 -0
  38. package/dist/types/components/organisms/DynamicComponents/types/OwnerRefs.d.ts +28 -0
  39. package/dist/types/components/organisms/DynamicComponents/types/ProjectInfoCard.d.ts +14 -0
  40. package/dist/types/components/organisms/DynamicComponents/types/PrometheusGraph.d.ts +31 -0
  41. package/dist/types/components/organisms/DynamicComponents/types/ResourceBadge.d.ts +7 -0
  42. package/dist/types/components/organisms/DynamicComponents/types/SecretBase64Plain.d.ts +13 -0
  43. package/dist/types/components/organisms/DynamicComponents/types/SidebarProvider.d.ts +4 -0
  44. package/dist/types/components/organisms/DynamicComponents/types/Spacer.d.ts +4 -0
  45. package/dist/types/components/organisms/DynamicComponents/types/StatusText.d.ts +13 -0
  46. package/dist/types/components/organisms/DynamicComponents/types/Taints.d.ts +21 -0
  47. package/dist/types/components/organisms/DynamicComponents/types/Terminals.d.ts +25 -0
  48. package/dist/types/components/organisms/DynamicComponents/types/Toggler.d.ts +23 -0
  49. package/dist/types/components/organisms/DynamicComponents/types/TogglerSegmented.d.ts +18 -0
  50. package/dist/types/components/organisms/DynamicComponents/types/Tolerations.d.ts +20 -0
  51. package/dist/types/components/organisms/DynamicComponents/types/VMVNC.d.ts +8 -0
  52. package/dist/types/components/organisms/DynamicComponents/types/VisibilityContainer.d.ts +6 -0
  53. package/dist/types/components/organisms/DynamicComponents/types/YamlEditorSingleton.d.ts +14 -0
  54. package/dist/types/components/organisms/DynamicComponents/types/antdComponents.d.ts +31 -0
  55. package/dist/types/components/organisms/DynamicComponents/types/index.d.ts +83 -0
  56. package/dist/types/components/organisms/DynamicComponents/types/multiQuery.d.ts +4 -0
  57. package/dist/types/components/organisms/DynamicComponents/types/parsedText.d.ts +7 -0
  58. package/dist/types/components/organisms/DynamicComponents/types/partsOfUrl.d.ts +4 -0
  59. package/package.json +1 -1
  60. package/dist/types/components/organisms/DynamicComponents/molecules/Annotations/molecules/EditModal/index.d.ts +0 -1
  61. package/dist/types/components/organisms/DynamicComponents/molecules/Annotations/molecules/index.d.ts +0 -1
  62. package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/EditModal/index.d.ts +0 -1
  63. package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/index.d.ts +0 -1
  64. package/dist/types/components/organisms/DynamicComponents/molecules/Taints/molecules/EditModal/index.d.ts +0 -1
  65. package/dist/types/components/organisms/DynamicComponents/molecules/Taints/molecules/index.d.ts +0 -1
  66. package/dist/types/components/organisms/DynamicComponents/molecules/Tolerations/molecules/EditModal/index.d.ts +0 -1
  67. package/dist/types/components/organisms/DynamicComponents/molecules/Tolerations/molecules/index.d.ts +0 -1
  68. package/dist/types/components/organisms/DynamicComponents/types.d.ts +0 -498
  69. /package/dist/types/components/organisms/DynamicComponents/{molecules/Annotations/molecules/EditModal → atoms/modals/AnnotationsEditModal}/styled.d.ts +0 -0
  70. /package/dist/types/components/organisms/DynamicComponents/{molecules/Taints/molecules/EditModal → atoms/modals/TaintsEditModal}/styled.d.ts +0 -0
  71. /package/dist/types/components/organisms/DynamicComponents/{molecules/Tolerations/molecules/EditModal → atoms/modals/TolerationsEditModal}/styled.d.ts +0 -0
@@ -43742,24 +43742,14 @@ const HeightContainer = styled.div`
43742
43742
 
43743
43743
  const filterSelectOptions = (input, option) => (typeof option?.label === "string" ? option.label : "").toLowerCase().includes(input.toLowerCase());
43744
43744
 
43745
- 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"));
43746
- const parseArrayOfAny$1 = (value) => {
43747
- if (!Array.isArray(value)) {
43748
- return { error: "Value on jsonPath is not an array" };
43749
- }
43750
- if (isRecordStringNumber$1(value[0])) {
43751
- return { data: value[0] };
43752
- }
43753
- return { error: "Value on jsonPath is not a record array" };
43754
- };
43755
- const truncate$2 = (text, max) => {
43745
+ const truncate$3 = (text, max) => {
43756
43746
  if (!max) {
43757
43747
  return text;
43758
43748
  }
43759
43749
  return text.length > max ? text.slice(0, max) + "..." : text;
43760
43750
  };
43761
43751
 
43762
- const EditModal$3 = ({
43752
+ const LabelsEditModal = ({
43763
43753
  open,
43764
43754
  close,
43765
43755
  values,
@@ -43873,7 +43863,7 @@ const EditModal$3 = ({
43873
43863
  onClick: (e) => {
43874
43864
  e.stopPropagation();
43875
43865
  },
43876
- children: typeof label === "string" ? truncate$2(label, maxEditTagTextLength) : "Not a string value"
43866
+ children: typeof label === "string" ? truncate$3(label, maxEditTagTextLength) : "Not a string value"
43877
43867
  }
43878
43868
  ) });
43879
43869
  },
@@ -43888,6 +43878,471 @@ const EditModal$3 = ({
43888
43878
  );
43889
43879
  };
43890
43880
 
43881
+ const ResetedFormList$3 = styled(Form.List)`
43882
+ margin-bottom: 8px;
43883
+ `;
43884
+ const Styled$r = {
43885
+ ResetedFormList: ResetedFormList$3
43886
+ };
43887
+
43888
+ const TaintsEditModal = ({
43889
+ open,
43890
+ close,
43891
+ values,
43892
+ openNotificationSuccess,
43893
+ modalTitle,
43894
+ modalDescriptionText,
43895
+ inputLabel,
43896
+ endpoint,
43897
+ pathToValue,
43898
+ editModalWidth,
43899
+ cols,
43900
+ modalDescriptionTextStyle,
43901
+ inputLabelStyle
43902
+ }) => {
43903
+ const queryClient = useQueryClient();
43904
+ const [error, setError] = useState();
43905
+ const [isLoading, setIsLoading] = useState(false);
43906
+ const [form] = Form.useForm();
43907
+ const taints = Form.useWatch("taints", form);
43908
+ useEffect(() => {
43909
+ if (open) {
43910
+ form.setFieldsValue({
43911
+ taints: values || []
43912
+ });
43913
+ }
43914
+ }, [open, form]);
43915
+ const submit = () => {
43916
+ form.validateFields().then(() => {
43917
+ console.log(JSON.stringify(taints));
43918
+ setIsLoading(true);
43919
+ setError(void 0);
43920
+ patchEntryWithReplaceOp({ endpoint, pathToValue, body: taints }).then(() => {
43921
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
43922
+ if (openNotificationSuccess) {
43923
+ openNotificationSuccess();
43924
+ }
43925
+ setIsLoading(false);
43926
+ setError(void 0);
43927
+ close();
43928
+ }).catch((error2) => {
43929
+ setIsLoading(false);
43930
+ setError(error2);
43931
+ });
43932
+ }).catch(() => console.log("Validating error"));
43933
+ };
43934
+ const effectOptions = ["NoSchedule", "PreferNoSchedule", "NoExecute"];
43935
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
43936
+ Modal,
43937
+ {
43938
+ title: modalTitle,
43939
+ open,
43940
+ onOk: () => submit(),
43941
+ onCancel: () => {
43942
+ close();
43943
+ form.resetFields();
43944
+ setIsLoading(false);
43945
+ setError(void 0);
43946
+ },
43947
+ okText: "Save",
43948
+ confirmLoading: isLoading,
43949
+ maskClosable: false,
43950
+ width: editModalWidth || 520,
43951
+ destroyOnHidden: true,
43952
+ centered: true,
43953
+ children: [
43954
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
43955
+ modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
43956
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
43957
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
43958
+ ] }),
43959
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
43960
+ inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
43961
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
43962
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
43963
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Key" }) }),
43964
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Value" }) }),
43965
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Effect" }) }),
43966
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
43967
+ ] }),
43968
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
43969
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$r.ResetedFormList, { name: "taints", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
43970
+ fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
43971
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43972
+ ResetedFormItem$1,
43973
+ {
43974
+ ...restField,
43975
+ name: [name, "key"],
43976
+ rules: [
43977
+ {
43978
+ validator: (_, v) => v === void 0 || typeof v === "string" ? Promise.resolve() : Promise.reject(new Error("Key must be a string."))
43979
+ }
43980
+ ],
43981
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "e.g. dedicated" })
43982
+ }
43983
+ ) }),
43984
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43985
+ ResetedFormItem$1,
43986
+ {
43987
+ ...restField,
43988
+ name: [name, "value"],
43989
+ rules: [
43990
+ {
43991
+ validator: (_, v) => v === void 0 || typeof v === "string" ? Promise.resolve() : Promise.reject(new Error("Value must be a string."))
43992
+ }
43993
+ ],
43994
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "e.g. batch" })
43995
+ }
43996
+ ) }),
43997
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43998
+ ResetedFormItem$1,
43999
+ {
44000
+ ...restField,
44001
+ name: [name, "effect"],
44002
+ rules: [
44003
+ { required: true, message: "Effect is required." },
44004
+ {
44005
+ validator: (_, v) => v && effectOptions.includes(v) ? Promise.resolve() : Promise.reject(new Error("Select a valid effect."))
44006
+ }
44007
+ ],
44008
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44009
+ Select,
44010
+ {
44011
+ placeholder: "Select effect",
44012
+ options: effectOptions.map((eff) => ({ label: eff, value: eff }))
44013
+ }
44014
+ )
44015
+ }
44016
+ ) }),
44017
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
44018
+ ] }, key)),
44019
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
44020
+ ] }) })
44021
+ ] })
44022
+ ]
44023
+ }
44024
+ );
44025
+ };
44026
+
44027
+ const ResetedFormList$2 = styled(Form.List)`
44028
+ margin-bottom: 8px;
44029
+ `;
44030
+ const Styled$q = {
44031
+ ResetedFormList: ResetedFormList$2
44032
+ };
44033
+
44034
+ const TolerationsEditModal = ({
44035
+ open,
44036
+ close,
44037
+ values,
44038
+ openNotificationSuccess,
44039
+ modalTitle,
44040
+ modalDescriptionText,
44041
+ inputLabel,
44042
+ endpoint,
44043
+ pathToValue,
44044
+ editModalWidth,
44045
+ cols,
44046
+ modalDescriptionTextStyle,
44047
+ inputLabelStyle
44048
+ }) => {
44049
+ const queryClient = useQueryClient();
44050
+ const [error, setError] = useState();
44051
+ const [isLoading, setIsLoading] = useState(false);
44052
+ const [form] = Form.useForm();
44053
+ const tolerations = Form.useWatch("tolerations", form);
44054
+ useEffect(() => {
44055
+ if (open) {
44056
+ form.setFieldsValue({
44057
+ tolerations: values || []
44058
+ });
44059
+ }
44060
+ }, [open, form]);
44061
+ const submit = () => {
44062
+ form.validateFields().then(() => {
44063
+ console.log(JSON.stringify(tolerations));
44064
+ setIsLoading(true);
44065
+ setError(void 0);
44066
+ patchEntryWithReplaceOp({ endpoint, pathToValue, body: tolerations }).then(() => {
44067
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
44068
+ if (openNotificationSuccess) {
44069
+ openNotificationSuccess();
44070
+ }
44071
+ setIsLoading(false);
44072
+ setError(void 0);
44073
+ close();
44074
+ }).catch((error2) => {
44075
+ setIsLoading(false);
44076
+ setError(error2);
44077
+ });
44078
+ }).catch(() => console.log("Validating error"));
44079
+ };
44080
+ const operatorOptions = ["Exists", "Equal"];
44081
+ const effectOptions = ["NoSchedule", "PreferNoSchedule", "NoExecute"];
44082
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44083
+ Modal,
44084
+ {
44085
+ title: modalTitle,
44086
+ open,
44087
+ onOk: () => submit(),
44088
+ onCancel: () => {
44089
+ close();
44090
+ form.resetFields();
44091
+ setIsLoading(false);
44092
+ setError(void 0);
44093
+ },
44094
+ okText: "Save",
44095
+ confirmLoading: isLoading,
44096
+ maskClosable: false,
44097
+ width: editModalWidth || 520,
44098
+ destroyOnHidden: true,
44099
+ centered: true,
44100
+ children: [
44101
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
44102
+ modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44103
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
44104
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
44105
+ ] }),
44106
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
44107
+ inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
44108
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44109
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44110
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
44111
+ "Key",
44112
+ " ",
44113
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: "Required when operator is Equal; optional for Exists.", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircleOutlined, {}) })
44114
+ ] }) }) }),
44115
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Operator" }) }),
44116
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
44117
+ "Value",
44118
+ " ",
44119
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: "Required for Equal; must be empty for Exists.", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircleOutlined, {}) })
44120
+ ] }) }) }),
44121
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Effect" }) }),
44122
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[4], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
44123
+ ] }),
44124
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44125
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$q.ResetedFormList, { name: "tolerations", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44126
+ fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44127
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44128
+ ResetedFormItem$1,
44129
+ {
44130
+ ...restField,
44131
+ name: [name, "key"],
44132
+ rules: [
44133
+ ({ getFieldValue }) => ({
44134
+ validator(_, v) {
44135
+ const op = getFieldValue(["tolerations", name, "operator"]);
44136
+ if (op === "Equal" && (!v || v === "")) {
44137
+ return Promise.reject(new Error("Key is required when operator is Equal."));
44138
+ }
44139
+ return Promise.resolve();
44140
+ }
44141
+ })
44142
+ ],
44143
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "key" })
44144
+ }
44145
+ ) }),
44146
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44147
+ ResetedFormItem$1,
44148
+ {
44149
+ ...restField,
44150
+ name: [name, "operator"],
44151
+ rules: [
44152
+ ({ getFieldValue }) => ({
44153
+ validator(_, v) {
44154
+ const nameV = getFieldValue(["tolerations", name, "key"]);
44155
+ if ((nameV === "nameV" || !nameV) && (!v || v !== "Exists")) {
44156
+ return Promise.reject(new Error("Operator must be Exists when `key` is empty"));
44157
+ }
44158
+ return Promise.resolve();
44159
+ }
44160
+ })
44161
+ ],
44162
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44163
+ Select,
44164
+ {
44165
+ placeholder: "Select operator",
44166
+ options: operatorOptions.map((op) => ({ label: op, value: op }))
44167
+ }
44168
+ )
44169
+ }
44170
+ ) }),
44171
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44172
+ ResetedFormItem$1,
44173
+ {
44174
+ ...restField,
44175
+ name: [name, "value"],
44176
+ rules: [
44177
+ ({ getFieldValue }) => ({
44178
+ validator(_, v) {
44179
+ const op = getFieldValue(["tolerations", name, "operator"]);
44180
+ if (op === "Equal" && (!v || v === "")) {
44181
+ return Promise.reject(new Error("Value is required when operator is Equal."));
44182
+ }
44183
+ return Promise.resolve();
44184
+ }
44185
+ })
44186
+ ],
44187
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "value" })
44188
+ }
44189
+ ) }),
44190
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44191
+ ResetedFormItem$1,
44192
+ {
44193
+ ...restField,
44194
+ name: [name, "effect"],
44195
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44196
+ Select,
44197
+ {
44198
+ placeholder: "Select effect",
44199
+ options: effectOptions.map((eff) => ({ label: eff, value: eff }))
44200
+ }
44201
+ )
44202
+ }
44203
+ ) }),
44204
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[4], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
44205
+ ] }, key)),
44206
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
44207
+ ] }) })
44208
+ ] })
44209
+ ]
44210
+ }
44211
+ );
44212
+ };
44213
+
44214
+ const ResetedFormList$1 = styled(Form.List)`
44215
+ margin-bottom: 8px;
44216
+ `;
44217
+ const Styled$p = {
44218
+ ResetedFormList: ResetedFormList$1
44219
+ };
44220
+
44221
+ const AnnotationsEditModal = ({
44222
+ open,
44223
+ close,
44224
+ values,
44225
+ openNotificationSuccess,
44226
+ modalTitle,
44227
+ modalDescriptionText,
44228
+ inputLabel,
44229
+ endpoint,
44230
+ pathToValue,
44231
+ editModalWidth,
44232
+ cols,
44233
+ modalDescriptionTextStyle,
44234
+ inputLabelStyle
44235
+ }) => {
44236
+ const queryClient = useQueryClient();
44237
+ const [error, setError] = useState();
44238
+ const [isLoading, setIsLoading] = useState(false);
44239
+ const [form] = Form.useForm();
44240
+ const annotations = Form.useWatch("annotations", form);
44241
+ useEffect(() => {
44242
+ if (open) {
44243
+ form.setFieldsValue({
44244
+ annotations: values ? Object.entries(values).map(([key, value]) => ({
44245
+ key,
44246
+ value
44247
+ })) : []
44248
+ });
44249
+ }
44250
+ }, [open, form]);
44251
+ const submit = () => {
44252
+ form.validateFields().then(() => {
44253
+ const result = {};
44254
+ annotations.forEach(({ key, value }) => {
44255
+ result[key] = value || "";
44256
+ });
44257
+ console.log(JSON.stringify(result));
44258
+ setIsLoading(true);
44259
+ setError(void 0);
44260
+ patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
44261
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
44262
+ if (openNotificationSuccess) {
44263
+ openNotificationSuccess();
44264
+ }
44265
+ setIsLoading(false);
44266
+ setError(void 0);
44267
+ close();
44268
+ }).catch((error2) => {
44269
+ setIsLoading(false);
44270
+ setError(error2);
44271
+ });
44272
+ }).catch(() => console.log("Validating error"));
44273
+ };
44274
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44275
+ Modal,
44276
+ {
44277
+ title: modalTitle,
44278
+ open,
44279
+ onOk: () => submit(),
44280
+ onCancel: () => {
44281
+ close();
44282
+ form.resetFields();
44283
+ setIsLoading(false);
44284
+ setError(void 0);
44285
+ },
44286
+ okText: "Save",
44287
+ confirmLoading: isLoading,
44288
+ maskClosable: false,
44289
+ width: editModalWidth || 520,
44290
+ destroyOnHidden: true,
44291
+ centered: true,
44292
+ children: [
44293
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
44294
+ modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44295
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
44296
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
44297
+ ] }),
44298
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
44299
+ inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
44300
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44301
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44302
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Key" }) }),
44303
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Value" }) }),
44304
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
44305
+ ] }),
44306
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44307
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$p.ResetedFormList, { name: "annotations", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44308
+ fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44309
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44310
+ ResetedFormItem$1,
44311
+ {
44312
+ ...restField,
44313
+ name: [name, "key"],
44314
+ rules: [{ required: true, message: "Key is required" }],
44315
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "key" })
44316
+ }
44317
+ ) }),
44318
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { ...restField, name: [name, "value"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "value" }) }) }),
44319
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
44320
+ ] }, key)),
44321
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
44322
+ ] }) })
44323
+ ] })
44324
+ ]
44325
+ }
44326
+ );
44327
+ };
44328
+
44329
+ 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"));
44330
+ const parseArrayOfAny$1 = (value) => {
44331
+ if (!Array.isArray(value)) {
44332
+ return { error: "Value on jsonPath is not an array" };
44333
+ }
44334
+ if (isRecordStringNumber$1(value[0])) {
44335
+ return { data: value[0] };
44336
+ }
44337
+ return { error: "Value on jsonPath is not a record array" };
44338
+ };
44339
+ const truncate$2 = (text, max) => {
44340
+ if (!max) {
44341
+ return text;
44342
+ }
44343
+ return text.length > max ? text.slice(0, max) + "..." : text;
44344
+ };
44345
+
43891
44346
  const Labels = ({ data, children }) => {
43892
44347
  const {
43893
44348
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -44015,7 +44470,7 @@ const Labels = ({ data, children }) => {
44015
44470
  children,
44016
44471
  contextHolder,
44017
44472
  /* @__PURE__ */ jsxRuntimeExports.jsx(
44018
- EditModal$3,
44473
+ LabelsEditModal,
44019
44474
  {
44020
44475
  open,
44021
44476
  close: () => setOpen(false),
@@ -44146,7 +44601,7 @@ const Labels = ({ data, children }) => {
44146
44601
  children,
44147
44602
  contextHolder,
44148
44603
  /* @__PURE__ */ jsxRuntimeExports.jsx(
44149
- EditModal$3,
44604
+ LabelsEditModal,
44150
44605
  {
44151
44606
  open,
44152
44607
  close: () => setOpen(false),
@@ -44268,152 +44723,6 @@ const LabelsToSearchParams = ({ data, children }) => {
44268
44723
  ] });
44269
44724
  };
44270
44725
 
44271
- const ResetedFormList$3 = styled(Form.List)`
44272
- margin-bottom: 8px;
44273
- `;
44274
- const Styled$r = {
44275
- ResetedFormList: ResetedFormList$3
44276
- };
44277
-
44278
- const EditModal$2 = ({
44279
- open,
44280
- close,
44281
- values,
44282
- openNotificationSuccess,
44283
- modalTitle,
44284
- modalDescriptionText,
44285
- inputLabel,
44286
- endpoint,
44287
- pathToValue,
44288
- editModalWidth,
44289
- cols,
44290
- modalDescriptionTextStyle,
44291
- inputLabelStyle
44292
- }) => {
44293
- const queryClient = useQueryClient();
44294
- const [error, setError] = useState();
44295
- const [isLoading, setIsLoading] = useState(false);
44296
- const [form] = Form.useForm();
44297
- const taints = Form.useWatch("taints", form);
44298
- useEffect(() => {
44299
- if (open) {
44300
- form.setFieldsValue({
44301
- taints: values || []
44302
- });
44303
- }
44304
- }, [open, form]);
44305
- const submit = () => {
44306
- form.validateFields().then(() => {
44307
- console.log(JSON.stringify(taints));
44308
- setIsLoading(true);
44309
- setError(void 0);
44310
- patchEntryWithReplaceOp({ endpoint, pathToValue, body: taints }).then(() => {
44311
- queryClient.invalidateQueries({ queryKey: ["multi"] });
44312
- if (openNotificationSuccess) {
44313
- openNotificationSuccess();
44314
- }
44315
- setIsLoading(false);
44316
- setError(void 0);
44317
- close();
44318
- }).catch((error2) => {
44319
- setIsLoading(false);
44320
- setError(error2);
44321
- });
44322
- }).catch(() => console.log("Validating error"));
44323
- };
44324
- const effectOptions = ["NoSchedule", "PreferNoSchedule", "NoExecute"];
44325
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44326
- Modal,
44327
- {
44328
- title: modalTitle,
44329
- open,
44330
- onOk: () => submit(),
44331
- onCancel: () => {
44332
- close();
44333
- form.resetFields();
44334
- setIsLoading(false);
44335
- setError(void 0);
44336
- },
44337
- okText: "Save",
44338
- confirmLoading: isLoading,
44339
- maskClosable: false,
44340
- width: editModalWidth || 520,
44341
- destroyOnHidden: true,
44342
- centered: true,
44343
- children: [
44344
- error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
44345
- modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44346
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
44347
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
44348
- ] }),
44349
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
44350
- inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
44351
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44352
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44353
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Key" }) }),
44354
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Value" }) }),
44355
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Effect" }) }),
44356
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
44357
- ] }),
44358
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44359
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$r.ResetedFormList, { name: "taints", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44360
- fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44361
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44362
- ResetedFormItem$1,
44363
- {
44364
- ...restField,
44365
- name: [name, "key"],
44366
- rules: [
44367
- {
44368
- validator: (_, v) => v === void 0 || typeof v === "string" ? Promise.resolve() : Promise.reject(new Error("Key must be a string."))
44369
- }
44370
- ],
44371
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "e.g. dedicated" })
44372
- }
44373
- ) }),
44374
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44375
- ResetedFormItem$1,
44376
- {
44377
- ...restField,
44378
- name: [name, "value"],
44379
- rules: [
44380
- {
44381
- validator: (_, v) => v === void 0 || typeof v === "string" ? Promise.resolve() : Promise.reject(new Error("Value must be a string."))
44382
- }
44383
- ],
44384
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "e.g. batch" })
44385
- }
44386
- ) }),
44387
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44388
- ResetedFormItem$1,
44389
- {
44390
- ...restField,
44391
- name: [name, "effect"],
44392
- rules: [
44393
- { required: true, message: "Effect is required." },
44394
- {
44395
- validator: (_, v) => v && effectOptions.includes(v) ? Promise.resolve() : Promise.reject(new Error("Select a valid effect."))
44396
- }
44397
- ],
44398
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44399
- Select,
44400
- {
44401
- placeholder: "Select effect",
44402
- options: effectOptions.map((eff) => ({ label: eff, value: eff }))
44403
- }
44404
- )
44405
- }
44406
- ) }),
44407
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
44408
- ] }, key)),
44409
- /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
44410
- ] }) })
44411
- ] })
44412
- ]
44413
- }
44414
- );
44415
- };
44416
-
44417
44726
  const flattenOnce$1 = (arr) => arr.reduce((acc, row) => [...acc, ...row], []);
44418
44727
  const ALLOWED_EFFECTS$1 = /* @__PURE__ */ new Set(["NoSchedule", "PreferNoSchedule", "NoExecute"]);
44419
44728
  const isTaintLike = (x) => {
@@ -44531,7 +44840,7 @@ const Taints = ({ data, children }) => {
44531
44840
  ] }) }),
44532
44841
  contextHolder,
44533
44842
  /* @__PURE__ */ jsxRuntimeExports.jsx(
44534
- EditModal$2,
44843
+ TaintsEditModal,
44535
44844
  {
44536
44845
  open,
44537
44846
  close: () => setOpen(false),
@@ -44573,388 +44882,11 @@ const Taints = ({ data, children }) => {
44573
44882
  ] }),
44574
44883
  contextHolder,
44575
44884
  /* @__PURE__ */ jsxRuntimeExports.jsx(
44576
- EditModal$2,
44577
- {
44578
- open,
44579
- close: () => setOpen(false),
44580
- values: taints,
44581
- openNotificationSuccess,
44582
- modalTitle: modalTitlePrepared,
44583
- modalDescriptionText: modalDescriptionTextPrepared,
44584
- inputLabel: inputLabelPrepared,
44585
- endpoint: endpointPrepared,
44586
- pathToValue: pathToValuePrepared,
44587
- editModalWidth,
44588
- cols,
44589
- modalDescriptionTextStyle,
44590
- inputLabelStyle
44591
- }
44592
- )
44593
- ] });
44594
- };
44595
-
44596
- const ResetedFormList$2 = styled(Form.List)`
44597
- margin-bottom: 8px;
44598
- `;
44599
- const Styled$q = {
44600
- ResetedFormList: ResetedFormList$2
44601
- };
44602
-
44603
- const EditModal$1 = ({
44604
- open,
44605
- close,
44606
- values,
44607
- openNotificationSuccess,
44608
- modalTitle,
44609
- modalDescriptionText,
44610
- inputLabel,
44611
- endpoint,
44612
- pathToValue,
44613
- editModalWidth,
44614
- cols,
44615
- modalDescriptionTextStyle,
44616
- inputLabelStyle
44617
- }) => {
44618
- const queryClient = useQueryClient();
44619
- const [error, setError] = useState();
44620
- const [isLoading, setIsLoading] = useState(false);
44621
- const [form] = Form.useForm();
44622
- const tolerations = Form.useWatch("tolerations", form);
44623
- useEffect(() => {
44624
- if (open) {
44625
- form.setFieldsValue({
44626
- tolerations: values || []
44627
- });
44628
- }
44629
- }, [open, form]);
44630
- const submit = () => {
44631
- form.validateFields().then(() => {
44632
- console.log(JSON.stringify(tolerations));
44633
- setIsLoading(true);
44634
- setError(void 0);
44635
- patchEntryWithReplaceOp({ endpoint, pathToValue, body: tolerations }).then(() => {
44636
- queryClient.invalidateQueries({ queryKey: ["multi"] });
44637
- if (openNotificationSuccess) {
44638
- openNotificationSuccess();
44639
- }
44640
- setIsLoading(false);
44641
- setError(void 0);
44642
- close();
44643
- }).catch((error2) => {
44644
- setIsLoading(false);
44645
- setError(error2);
44646
- });
44647
- }).catch(() => console.log("Validating error"));
44648
- };
44649
- const operatorOptions = ["Exists", "Equal"];
44650
- const effectOptions = ["NoSchedule", "PreferNoSchedule", "NoExecute"];
44651
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
44652
- Modal,
44653
- {
44654
- title: modalTitle,
44655
- open,
44656
- onOk: () => submit(),
44657
- onCancel: () => {
44658
- close();
44659
- form.resetFields();
44660
- setIsLoading(false);
44661
- setError(void 0);
44662
- },
44663
- okText: "Save",
44664
- confirmLoading: isLoading,
44665
- maskClosable: false,
44666
- width: editModalWidth || 520,
44667
- destroyOnHidden: true,
44668
- centered: true,
44669
- children: [
44670
- error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
44671
- modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44672
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
44673
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
44674
- ] }),
44675
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
44676
- inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
44677
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44678
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44679
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
44680
- "Key",
44681
- " ",
44682
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: "Required when operator is Equal; optional for Exists.", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircleOutlined, {}) })
44683
- ] }) }) }),
44684
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Operator" }) }),
44685
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
44686
- "Value",
44687
- " ",
44688
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: "Required for Equal; must be empty for Exists.", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircleOutlined, {}) })
44689
- ] }) }) }),
44690
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Effect" }) }),
44691
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[4], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
44692
- ] }),
44693
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
44694
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$q.ResetedFormList, { name: "tolerations", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44695
- fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
44696
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44697
- ResetedFormItem$1,
44698
- {
44699
- ...restField,
44700
- name: [name, "key"],
44701
- rules: [
44702
- ({ getFieldValue }) => ({
44703
- validator(_, v) {
44704
- const op = getFieldValue(["tolerations", name, "operator"]);
44705
- if (op === "Equal" && (!v || v === "")) {
44706
- return Promise.reject(new Error("Key is required when operator is Equal."));
44707
- }
44708
- return Promise.resolve();
44709
- }
44710
- })
44711
- ],
44712
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "key" })
44713
- }
44714
- ) }),
44715
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44716
- ResetedFormItem$1,
44717
- {
44718
- ...restField,
44719
- name: [name, "operator"],
44720
- rules: [
44721
- ({ getFieldValue }) => ({
44722
- validator(_, v) {
44723
- const nameV = getFieldValue(["tolerations", name, "key"]);
44724
- if ((nameV === "nameV" || !nameV) && (!v || v !== "Exists")) {
44725
- return Promise.reject(new Error("Operator must be Exists when `key` is empty"));
44726
- }
44727
- return Promise.resolve();
44728
- }
44729
- })
44730
- ],
44731
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44732
- Select,
44733
- {
44734
- placeholder: "Select operator",
44735
- options: operatorOptions.map((op) => ({ label: op, value: op }))
44736
- }
44737
- )
44738
- }
44739
- ) }),
44740
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44741
- ResetedFormItem$1,
44742
- {
44743
- ...restField,
44744
- name: [name, "value"],
44745
- rules: [
44746
- ({ getFieldValue }) => ({
44747
- validator(_, v) {
44748
- const op = getFieldValue(["tolerations", name, "operator"]);
44749
- if (op === "Equal" && (!v || v === "")) {
44750
- return Promise.reject(new Error("Value is required when operator is Equal."));
44751
- }
44752
- return Promise.resolve();
44753
- }
44754
- })
44755
- ],
44756
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "value" })
44757
- }
44758
- ) }),
44759
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[3], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44760
- ResetedFormItem$1,
44761
- {
44762
- ...restField,
44763
- name: [name, "effect"],
44764
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
44765
- Select,
44766
- {
44767
- placeholder: "Select effect",
44768
- options: effectOptions.map((eff) => ({ label: eff, value: eff }))
44769
- }
44770
- )
44771
- }
44772
- ) }),
44773
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[4], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
44774
- ] }, key)),
44775
- /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
44776
- ] }) })
44777
- ] })
44778
- ]
44779
- }
44780
- );
44781
- };
44782
-
44783
- const flattenOnce = (arr) => arr.reduce((acc, row) => [...acc, ...row], []);
44784
- const ALLOWED_OPERATORS = /* @__PURE__ */ new Set(["Exists", "Equal"]);
44785
- const ALLOWED_EFFECTS = /* @__PURE__ */ new Set(["NoSchedule", "PreferNoSchedule", "NoExecute"]);
44786
- const isToleration = (x) => {
44787
- if (x === null || typeof x !== "object" || Array.isArray(x)) return false;
44788
- const o = x;
44789
- if ("key" in o && typeof o.key !== "string") return false;
44790
- if ("value" in o && typeof o.value !== "string") return false;
44791
- if ("operator" in o) {
44792
- if (typeof o.operator !== "string" || !ALLOWED_OPERATORS.has(o.operator)) {
44793
- return false;
44794
- }
44795
- }
44796
- if ("effect" in o) {
44797
- if (typeof o.effect !== "string" || !ALLOWED_EFFECTS.has(o.effect)) {
44798
- return false;
44799
- }
44800
- }
44801
- return true;
44802
- };
44803
- const filterTolerations = (input) => {
44804
- if (!Array.isArray(input)) return [];
44805
- return input.filter(isToleration);
44806
- };
44807
- const getItemsInside$1 = (value) => {
44808
- if (!Array.isArray(value)) {
44809
- return { error: "Value on jsonPath is not an array" };
44810
- }
44811
- let flattenArrayOfUnknown = [];
44812
- try {
44813
- flattenArrayOfUnknown = flattenOnce(value);
44814
- } catch (e) {
44815
- console.log(e);
44816
- return { error: "Error while flattening" };
44817
- }
44818
- return { counter: flattenArrayOfUnknown.length, tolerations: filterTolerations(flattenArrayOfUnknown) };
44819
- };
44820
-
44821
- const Tolerations = ({
44822
- data,
44823
- children
44824
- }) => {
44825
- const {
44826
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
44827
- id,
44828
- reqIndex,
44829
- jsonPathToArray,
44830
- text,
44831
- errorText,
44832
- notificationSuccessMessage,
44833
- notificationSuccessMessageDescription,
44834
- modalTitle,
44835
- modalDescriptionText,
44836
- modalDescriptionTextStyle,
44837
- inputLabel,
44838
- inputLabelStyle,
44839
- containerStyle,
44840
- endpoint,
44841
- pathToValue,
44842
- editModalWidth,
44843
- cols
44844
- } = data;
44845
- const [api, contextHolder] = notification.useNotification();
44846
- const [open, setOpen] = useState(false);
44847
- const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
44848
- const partsOfUrl = usePartsOfUrl();
44849
- if (isMultiQueryLoading) {
44850
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
44851
- }
44852
- if (isMultiQueryErrors) {
44853
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
44854
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
44855
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
44856
- ] });
44857
- }
44858
- const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
44859
- acc[index.toString()] = value;
44860
- return acc;
44861
- }, {});
44862
- const jsonRoot = multiQueryData[`req${reqIndex}`];
44863
- if (jsonRoot === void 0) {
44864
- console.log(`Item Counter: ${id}: No root for json path`);
44865
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
44866
- }
44867
- const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
44868
- const { counter, tolerations, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
44869
- const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
44870
- text: notificationSuccessMessage,
44871
- replaceValues,
44872
- multiQueryData
44873
- }) : "Success";
44874
- const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
44875
- text: notificationSuccessMessageDescription,
44876
- replaceValues,
44877
- multiQueryData
44878
- }) : "Success";
44879
- const modalTitlePrepared = modalTitle ? parseAll({ text: modalTitle, replaceValues, multiQueryData }) : "Edit";
44880
- const modalDescriptionTextPrepared = modalDescriptionText ? parseAll({ text: modalDescriptionText, replaceValues, multiQueryData }) : void 0;
44881
- const inputLabelPrepared = inputLabel ? parseAll({ text: inputLabel, replaceValues, multiQueryData }) : void 0;
44882
- const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
44883
- const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
44884
- const openNotificationSuccess = () => {
44885
- api.success({
44886
- message: notificationSuccessMessagePrepared,
44887
- description: notificationSuccessMessageDescriptionPrepared,
44888
- placement: "bottomRight"
44889
- });
44890
- };
44891
- if (errorArrayOfObjects) {
44892
- console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
44893
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44894
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: 8, children: [
44895
- errorText,
44896
- /* @__PURE__ */ jsxRuntimeExports.jsx(
44897
- Button,
44898
- {
44899
- type: "text",
44900
- size: "small",
44901
- onClick: (e) => {
44902
- e.stopPropagation();
44903
- setOpen(true);
44904
- },
44905
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
44906
- }
44907
- )
44908
- ] }) }),
44909
- contextHolder,
44910
- /* @__PURE__ */ jsxRuntimeExports.jsx(
44911
- EditModal$1,
44912
- {
44913
- open,
44914
- close: () => setOpen(false),
44915
- values: tolerations,
44916
- openNotificationSuccess,
44917
- modalTitle: modalTitlePrepared,
44918
- modalDescriptionText: modalDescriptionTextPrepared,
44919
- inputLabel: inputLabelPrepared,
44920
- endpoint: endpointPrepared,
44921
- pathToValue: pathToValuePrepared,
44922
- editModalWidth,
44923
- cols,
44924
- modalDescriptionTextStyle,
44925
- inputLabelStyle
44926
- }
44927
- )
44928
- ] });
44929
- }
44930
- const parsedText = parseAll({ text, replaceValues, multiQueryData });
44931
- const parsedTextWithCounter = parsedText.replace("~counter~", String(counter || 0));
44932
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44933
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
44934
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: 8, children: [
44935
- parsedTextWithCounter,
44936
- /* @__PURE__ */ jsxRuntimeExports.jsx(
44937
- Button,
44938
- {
44939
- type: "text",
44940
- size: "small",
44941
- onClick: (e) => {
44942
- e.stopPropagation();
44943
- setOpen(true);
44944
- },
44945
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
44946
- }
44947
- )
44948
- ] }),
44949
- children
44950
- ] }),
44951
- contextHolder,
44952
- /* @__PURE__ */ jsxRuntimeExports.jsx(
44953
- EditModal$1,
44885
+ TaintsEditModal,
44954
44886
  {
44955
44887
  open,
44956
44888
  close: () => setOpen(false),
44957
- values: tolerations,
44889
+ values: taints,
44958
44890
  openNotificationSuccess,
44959
44891
  modalTitle: modalTitlePrepared,
44960
44892
  modalDescriptionText: modalDescriptionTextPrepared,
@@ -44970,119 +44902,194 @@ const Tolerations = ({
44970
44902
  ] });
44971
44903
  };
44972
44904
 
44973
- const ResetedFormList$1 = styled(Form.List)`
44974
- margin-bottom: 8px;
44975
- `;
44976
- const Styled$p = {
44977
- ResetedFormList: ResetedFormList$1
44905
+ const flattenOnce = (arr) => arr.reduce((acc, row) => [...acc, ...row], []);
44906
+ const ALLOWED_OPERATORS = /* @__PURE__ */ new Set(["Exists", "Equal"]);
44907
+ const ALLOWED_EFFECTS = /* @__PURE__ */ new Set(["NoSchedule", "PreferNoSchedule", "NoExecute"]);
44908
+ const isToleration = (x) => {
44909
+ if (x === null || typeof x !== "object" || Array.isArray(x)) return false;
44910
+ const o = x;
44911
+ if ("key" in o && typeof o.key !== "string") return false;
44912
+ if ("value" in o && typeof o.value !== "string") return false;
44913
+ if ("operator" in o) {
44914
+ if (typeof o.operator !== "string" || !ALLOWED_OPERATORS.has(o.operator)) {
44915
+ return false;
44916
+ }
44917
+ }
44918
+ if ("effect" in o) {
44919
+ if (typeof o.effect !== "string" || !ALLOWED_EFFECTS.has(o.effect)) {
44920
+ return false;
44921
+ }
44922
+ }
44923
+ return true;
44924
+ };
44925
+ const filterTolerations = (input) => {
44926
+ if (!Array.isArray(input)) return [];
44927
+ return input.filter(isToleration);
44928
+ };
44929
+ const getItemsInside$1 = (value) => {
44930
+ if (!Array.isArray(value)) {
44931
+ return { error: "Value on jsonPath is not an array" };
44932
+ }
44933
+ let flattenArrayOfUnknown = [];
44934
+ try {
44935
+ flattenArrayOfUnknown = flattenOnce(value);
44936
+ } catch (e) {
44937
+ console.log(e);
44938
+ return { error: "Error while flattening" };
44939
+ }
44940
+ return { counter: flattenArrayOfUnknown.length, tolerations: filterTolerations(flattenArrayOfUnknown) };
44978
44941
  };
44979
44942
 
44980
- const EditModal = ({
44981
- open,
44982
- close,
44983
- values,
44984
- openNotificationSuccess,
44985
- modalTitle,
44986
- modalDescriptionText,
44987
- inputLabel,
44988
- endpoint,
44989
- pathToValue,
44990
- editModalWidth,
44991
- cols,
44992
- modalDescriptionTextStyle,
44993
- inputLabelStyle
44943
+ const Tolerations = ({
44944
+ data,
44945
+ children
44994
44946
  }) => {
44995
- const queryClient = useQueryClient();
44996
- const [error, setError] = useState();
44997
- const [isLoading, setIsLoading] = useState(false);
44998
- const [form] = Form.useForm();
44999
- const annotations = Form.useWatch("annotations", form);
45000
- useEffect(() => {
45001
- if (open) {
45002
- form.setFieldsValue({
45003
- annotations: values ? Object.entries(values).map(([key, value]) => ({
45004
- key,
45005
- value
45006
- })) : []
45007
- });
45008
- }
45009
- }, [open, form]);
45010
- const submit = () => {
45011
- form.validateFields().then(() => {
45012
- const result = {};
45013
- annotations.forEach(({ key, value }) => {
45014
- result[key] = value || "";
45015
- });
45016
- console.log(JSON.stringify(result));
45017
- setIsLoading(true);
45018
- setError(void 0);
45019
- patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
45020
- queryClient.invalidateQueries({ queryKey: ["multi"] });
45021
- if (openNotificationSuccess) {
45022
- openNotificationSuccess();
45023
- }
45024
- setIsLoading(false);
45025
- setError(void 0);
45026
- close();
45027
- }).catch((error2) => {
45028
- setIsLoading(false);
45029
- setError(error2);
45030
- });
45031
- }).catch(() => console.log("Validating error"));
44947
+ const {
44948
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44949
+ id,
44950
+ reqIndex,
44951
+ jsonPathToArray,
44952
+ text,
44953
+ errorText,
44954
+ notificationSuccessMessage,
44955
+ notificationSuccessMessageDescription,
44956
+ modalTitle,
44957
+ modalDescriptionText,
44958
+ modalDescriptionTextStyle,
44959
+ inputLabel,
44960
+ inputLabelStyle,
44961
+ containerStyle,
44962
+ endpoint,
44963
+ pathToValue,
44964
+ editModalWidth,
44965
+ cols
44966
+ } = data;
44967
+ const [api, contextHolder] = notification.useNotification();
44968
+ const [open, setOpen] = useState(false);
44969
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
44970
+ const partsOfUrl = usePartsOfUrl();
44971
+ if (isMultiQueryLoading) {
44972
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
44973
+ }
44974
+ if (isMultiQueryErrors) {
44975
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
44976
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
44977
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
44978
+ ] });
44979
+ }
44980
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
44981
+ acc[index.toString()] = value;
44982
+ return acc;
44983
+ }, {});
44984
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
44985
+ if (jsonRoot === void 0) {
44986
+ console.log(`Item Counter: ${id}: No root for json path`);
44987
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
44988
+ }
44989
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
44990
+ const { counter, tolerations, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
44991
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
44992
+ text: notificationSuccessMessage,
44993
+ replaceValues,
44994
+ multiQueryData
44995
+ }) : "Success";
44996
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
44997
+ text: notificationSuccessMessageDescription,
44998
+ replaceValues,
44999
+ multiQueryData
45000
+ }) : "Success";
45001
+ const modalTitlePrepared = modalTitle ? parseAll({ text: modalTitle, replaceValues, multiQueryData }) : "Edit";
45002
+ const modalDescriptionTextPrepared = modalDescriptionText ? parseAll({ text: modalDescriptionText, replaceValues, multiQueryData }) : void 0;
45003
+ const inputLabelPrepared = inputLabel ? parseAll({ text: inputLabel, replaceValues, multiQueryData }) : void 0;
45004
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
45005
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
45006
+ const openNotificationSuccess = () => {
45007
+ api.success({
45008
+ message: notificationSuccessMessagePrepared,
45009
+ description: notificationSuccessMessageDescriptionPrepared,
45010
+ placement: "bottomRight"
45011
+ });
45032
45012
  };
45033
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
45034
- Modal,
45035
- {
45036
- title: modalTitle,
45037
- open,
45038
- onOk: () => submit(),
45039
- onCancel: () => {
45040
- close();
45041
- form.resetFields();
45042
- setIsLoading(false);
45043
- setError(void 0);
45044
- },
45045
- okText: "Save",
45046
- confirmLoading: isLoading,
45047
- maskClosable: false,
45048
- width: editModalWidth || 520,
45049
- destroyOnHidden: true,
45050
- centered: true,
45051
- children: [
45052
- error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Error while submitting", description: error?.response?.data?.message }),
45053
- modalDescriptionText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45054
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: modalDescriptionTextStyle, children: modalDescriptionText }),
45055
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true })
45056
- ] }),
45057
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Form, { form, children: [
45058
- inputLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(CustomSizeTitle, { $designNewLayout: true, style: inputLabelStyle, children: inputLabel }),
45059
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
45060
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
45061
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Key" }) }),
45062
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Value" }) }),
45063
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}) })
45064
- ] }),
45065
- /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 10, $samespace: true }),
45066
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$p.ResetedFormList, { name: "annotations", children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45067
- fields.map(({ key, name, ...restField }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Row, { gutter: [16, 16], children: [
45068
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[0], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45069
- ResetedFormItem$1,
45070
- {
45071
- ...restField,
45072
- name: [name, "key"],
45073
- rules: [{ required: true, message: "Key is required" }],
45074
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "key" })
45075
- }
45076
- ) }),
45077
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[1], children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { ...restField, name: [name, "value"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: "value" }) }) }),
45078
- /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: cols[2], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "text", onClick: () => remove(name), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MinusIcon, {}) }) })
45079
- ] }, key)),
45080
- /* @__PURE__ */ jsxRuntimeExports.jsx(ResetedFormItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: () => add(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}) }) })
45081
- ] }) })
45082
- ] })
45083
- ]
45084
- }
45085
- );
45013
+ if (errorArrayOfObjects) {
45014
+ console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
45015
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45016
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: 8, children: [
45017
+ errorText,
45018
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
45019
+ Button,
45020
+ {
45021
+ type: "text",
45022
+ size: "small",
45023
+ onClick: (e) => {
45024
+ e.stopPropagation();
45025
+ setOpen(true);
45026
+ },
45027
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
45028
+ }
45029
+ )
45030
+ ] }) }),
45031
+ contextHolder,
45032
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
45033
+ TolerationsEditModal,
45034
+ {
45035
+ open,
45036
+ close: () => setOpen(false),
45037
+ values: tolerations,
45038
+ openNotificationSuccess,
45039
+ modalTitle: modalTitlePrepared,
45040
+ modalDescriptionText: modalDescriptionTextPrepared,
45041
+ inputLabel: inputLabelPrepared,
45042
+ endpoint: endpointPrepared,
45043
+ pathToValue: pathToValuePrepared,
45044
+ editModalWidth,
45045
+ cols,
45046
+ modalDescriptionTextStyle,
45047
+ inputLabelStyle
45048
+ }
45049
+ )
45050
+ ] });
45051
+ }
45052
+ const parsedText = parseAll({ text, replaceValues, multiQueryData });
45053
+ const parsedTextWithCounter = parsedText.replace("~counter~", String(counter || 0));
45054
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45055
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
45056
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { align: "center", gap: 8, children: [
45057
+ parsedTextWithCounter,
45058
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
45059
+ Button,
45060
+ {
45061
+ type: "text",
45062
+ size: "small",
45063
+ onClick: (e) => {
45064
+ e.stopPropagation();
45065
+ setOpen(true);
45066
+ },
45067
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {})
45068
+ }
45069
+ )
45070
+ ] }),
45071
+ children
45072
+ ] }),
45073
+ contextHolder,
45074
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
45075
+ TolerationsEditModal,
45076
+ {
45077
+ open,
45078
+ close: () => setOpen(false),
45079
+ values: tolerations,
45080
+ openNotificationSuccess,
45081
+ modalTitle: modalTitlePrepared,
45082
+ modalDescriptionText: modalDescriptionTextPrepared,
45083
+ inputLabel: inputLabelPrepared,
45084
+ endpoint: endpointPrepared,
45085
+ pathToValue: pathToValuePrepared,
45086
+ editModalWidth,
45087
+ cols,
45088
+ modalDescriptionTextStyle,
45089
+ inputLabelStyle
45090
+ }
45091
+ )
45092
+ ] });
45086
45093
  };
45087
45094
 
45088
45095
  const isObject$2 = (x) => typeof x === "object" && x !== null;
@@ -45189,7 +45196,7 @@ const Annotations = ({
45189
45196
  ] }) }),
45190
45197
  contextHolder,
45191
45198
  /* @__PURE__ */ jsxRuntimeExports.jsx(
45192
- EditModal,
45199
+ AnnotationsEditModal,
45193
45200
  {
45194
45201
  open,
45195
45202
  close: () => setOpen(false),
@@ -45231,7 +45238,7 @@ const Annotations = ({
45231
45238
  ] }),
45232
45239
  contextHolder,
45233
45240
  /* @__PURE__ */ jsxRuntimeExports.jsx(
45234
- EditModal,
45241
+ AnnotationsEditModal,
45235
45242
  {
45236
45243
  open,
45237
45244
  close: () => setOpen(false),
@@ -76963,6 +76970,7 @@ const DefaultIframe = ({ data, children }) => {
76963
76970
  const TitleSelect = styled(Select)`
76964
76971
  &&.ant-select {
76965
76972
  cursor: pointer;
76973
+ min-width: 200px;
76966
76974
 
76967
76975
  .ant-select-selector {
76968
76976
  border: none;
@@ -77026,12 +77034,14 @@ const DropdownRedirect = ({
77026
77034
  acc[index.toString()] = value;
77027
77035
  return acc;
77028
77036
  }, {});
77037
+ const UNDEFINED_FALLBACK = "~undefined-value~";
77029
77038
  const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
77030
77039
  const apiVersionPrepared = parseAll({ text: apiVersion, replaceValues, multiQueryData });
77031
77040
  const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : void 0;
77032
77041
  const namespacePrepared = namespace ? parseAll({ text: namespace, replaceValues, multiQueryData }) : void 0;
77033
77042
  const pluralPrepared = parseAll({ text: plural, replaceValues, multiQueryData });
77034
- const currentValuePrepared = currentValue ? parseAll({ text: currentValue, replaceValues, multiQueryData }) : void 0;
77043
+ const currentValueRaw = currentValue ? parseWithoutPartsOfUrl({ text: currentValue, multiQueryData, customFallback: UNDEFINED_FALLBACK }) : void 0;
77044
+ const currentValuePrepared = currentValueRaw === UNDEFINED_FALLBACK ? void 0 : currentValueRaw;
77035
77045
  const {
77036
77046
  data: resourceList,
77037
77047
  isLoading: isResourceLoading,
@@ -82876,6 +82886,7 @@ var addonFit = {exports: {}};
82876
82886
  var addonFitExports = addonFit.exports;
82877
82887
 
82878
82888
  const CustomCard$4 = styled.div`
82889
+ display: ${({ $hasError }) => $hasError ? "none" : "block"};
82879
82890
  visibility: ${({ $isVisible }) => $isVisible ? "visible" : "hidden"};
82880
82891
  height: calc(100vh - ${({ $substractHeight }) => $substractHeight}px);
82881
82892
 
@@ -82978,7 +82989,7 @@ const XTerminal$2 = ({ endpoint, namespace, podName, container, substractHeight
82978
82989
  };
82979
82990
  }, [terminal, endpoint, namespace, podName, container]);
82980
82991
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
82981
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.CustomCard, { $isVisible: !isLoading && !error, $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.FullWidthDiv, { $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: terminalRef, style: { width: "100%", height: "100%" } }) }) }),
82992
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.CustomCard, { $isVisible: !isLoading && !error, $hasError: !!error, $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.FullWidthDiv, { $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: terminalRef, style: { width: "100%", height: "100%" } }) }) }),
82982
82993
  isLoading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}),
82983
82994
  error && /* @__PURE__ */ jsxRuntimeExports.jsx(Result, { status: "error", title: "Error", subTitle: error })
82984
82995
  ] });
@@ -83570,19 +83581,16 @@ const CustomCard$1 = styled.div`
83570
83581
  scrollbar-width: thin;
83571
83582
  }
83572
83583
  `;
83573
- const EditorWrapper = styled.div`
83584
+ styled.div`
83574
83585
  position: relative;
83575
83586
  width: 100%;
83576
83587
  `;
83577
- const StreamingOverlay = styled.div`
83578
- position: absolute;
83579
- top: 12px;
83580
- left: 12px;
83581
- z-index: 10;
83588
+ const StreamingBar = styled.div`
83582
83589
  display: flex;
83583
83590
  align-items: center;
83584
83591
  gap: 16px;
83585
- background-color: ${({ $colorBgLayout }) => $colorBgLayout};
83592
+ padding: 12px;
83593
+ background-color: ${({ $isDark }) => $isDark ? "#1e1e1e" : "#fffffe"};
83586
83594
  visibility: ${({ $isVisible }) => $isVisible ? "visible" : "hidden"};
83587
83595
  `;
83588
83596
  const CursorPointerDiv$1 = styled.div`
@@ -83592,8 +83600,7 @@ const CursorPointerDiv$1 = styled.div`
83592
83600
  const Styled$6 = {
83593
83601
  FullWidthDiv: FullWidthDiv$1,
83594
83602
  CustomCard: CustomCard$1,
83595
- EditorWrapper,
83596
- StreamingOverlay,
83603
+ StreamingBar,
83597
83604
  CursorPointerDiv: CursorPointerDiv$1
83598
83605
  };
83599
83606
 
@@ -83602,7 +83609,7 @@ const MonacoEditor = ({
83602
83609
  namespace,
83603
83610
  podName,
83604
83611
  container,
83605
- theme: theme$1,
83612
+ theme,
83606
83613
  substractHeight,
83607
83614
  previous,
83608
83615
  tailLines,
@@ -83610,7 +83617,6 @@ const MonacoEditor = ({
83610
83617
  sinceTime,
83611
83618
  limitBytes
83612
83619
  }) => {
83613
- const { token } = theme.useToken();
83614
83620
  const [notificationApi, contextHolder] = notification.useNotification();
83615
83621
  const [isLoading, setIsLoading] = useState(true);
83616
83622
  const [error, setError] = useState();
@@ -83689,11 +83695,11 @@ const MonacoEditor = ({
83689
83695
  }
83690
83696
  };
83691
83697
  }, [endpoint, namespace, podName, container, previous, tailLines, sinceSeconds, sinceTime, limitBytes, editorReady]);
83692
- const isDark = theme$1 === "dark";
83698
+ const isDark = theme === "dark";
83693
83699
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
83694
83700
  contextHolder,
83695
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$6.CustomCard, { $isVisible: isTerminalVisible, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$6.EditorWrapper, { children: [
83696
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$6.StreamingOverlay, { $isVisible: isTerminalVisible, $colorBgLayout: token.colorBgLayout, children: [
83701
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$6.CustomCard, { $isVisible: isTerminalVisible, children: [
83702
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$6.StreamingBar, { $isVisible: isTerminalVisible, $isDark: isDark, children: [
83697
83703
  /* @__PURE__ */ jsxRuntimeExports.jsx(
83698
83704
  Styled$6.CursorPointerDiv,
83699
83705
  {
@@ -83729,13 +83735,12 @@ const MonacoEditor = ({
83729
83735
  theme: isDark ? "vs-dark" : "vs",
83730
83736
  options: {
83731
83737
  theme: isDark ? "vs-dark" : "vs",
83732
- readOnly: true,
83733
- padding: { top: 56 }
83738
+ readOnly: true
83734
83739
  },
83735
83740
  onMount: handleEditorDidMount
83736
83741
  }
83737
83742
  ) })
83738
- ] }) }),
83743
+ ] }),
83739
83744
  isLoading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}),
83740
83745
  error && /* @__PURE__ */ jsxRuntimeExports.jsx(Result, { status: "error", title: "Error", subTitle: JSON.stringify(error) })
83741
83746
  ] });