@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.95 → 0.0.1-alpha.97

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.
@@ -1,7 +1,7 @@
1
1
  import o, { useDebugValue, createElement, useRef, useContext, useState, useLayoutEffect, useEffect, useMemo, memo, useCallback, createContext, Suspense, Fragment } from 'react';
2
2
  import { Input, Tree, Modal, Alert, theme, Select, Tag, Breadcrumb, Spin, Menu, Tooltip, Space, Button, Flex, Table, notification, Typography, Form, Row, Col, Slider, InputNumber, Switch, Card, Dropdown, Result, Progress, Tabs, Popover } from 'antd';
3
3
  import { LoadingOutlined, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, SearchOutlined, CheckOutlined, CloseOutlined, EditOutlined, DeleteOutlined, CaretDownOutlined, CaretRightOutlined, BugOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
4
- import { useQuery, useQueries } from '@tanstack/react-query';
4
+ import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
5
5
  import { Link, useNavigate, useLocation } from 'react-router-dom';
6
6
 
7
7
  function getDefaultExportFromCjs$1 (x) {
@@ -8182,6 +8182,25 @@ const updateEntry = async ({
8182
8182
  const deleteEntry = async ({ endpoint }) => {
8183
8183
  return axios.delete(endpoint);
8184
8184
  };
8185
+ const patchEntryWithReplaceOp = async ({
8186
+ endpoint,
8187
+ pathToValue,
8188
+ body
8189
+ }) => {
8190
+ const patchData = [
8191
+ {
8192
+ op: "replace",
8193
+ path: pathToValue,
8194
+ value: body
8195
+ }
8196
+ ];
8197
+ return axios.patch(endpoint, patchData, {
8198
+ method: "PATCH",
8199
+ headers: {
8200
+ "Content-Type": "application/json-patch+json"
8201
+ }
8202
+ });
8203
+ };
8185
8204
 
8186
8205
  const DeleteModal = ({ name, onClose, endpoint }) => {
8187
8206
  const [error, setError] = useState();
@@ -8506,8 +8525,9 @@ const CustomSelect$5 = st(Select)`
8506
8525
  margin: 0;
8507
8526
  padding: 4px;
8508
8527
 
8509
- && .ant-select-selector {
8528
+ &&& .ant-select-selector {
8510
8529
  background: none;
8530
+ padding-inline-end: ${({ $paddingContainerEnd }) => $paddingContainerEnd || "12px"} !important;
8511
8531
  }
8512
8532
 
8513
8533
  && .ant-select-selector,
@@ -8548,7 +8568,8 @@ const Styled$n = {
8548
8568
  };
8549
8569
 
8550
8570
  const CustomSelect$4 = (props) => {
8551
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$n.CustomSelect, { ...props });
8571
+ const { paddingContainerEnd, ...rest } = props;
8572
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$n.CustomSelect, { $paddingContainerEnd: paddingContainerEnd, ...rest });
8552
8573
  };
8553
8574
 
8554
8575
  const CursorPointerTag = st(Tag)`
@@ -46986,8 +47007,13 @@ const EditModal = ({
46986
47007
  modalDescriptionText,
46987
47008
  inputLabel,
46988
47009
  maxEditTagTextLength,
46989
- allowClearEditSelect
47010
+ allowClearEditSelect,
47011
+ endpoint,
47012
+ pathToValue,
47013
+ editModalWidth,
47014
+ paddingContainerEnd
46990
47015
  }) => {
47016
+ const queryClient = useQueryClient();
46991
47017
  const [error, setError] = useState();
46992
47018
  const [isLoading, setIsLoading] = useState(false);
46993
47019
  const [form] = Form.useForm();
@@ -47007,9 +47033,20 @@ const EditModal = ({
47007
47033
  result[key] = value || "";
47008
47034
  });
47009
47035
  console.log(JSON.stringify(result));
47010
- if (openNotificationSuccess) {
47011
- openNotificationSuccess();
47012
- }
47036
+ setIsLoading(true);
47037
+ setError(void 0);
47038
+ patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
47039
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
47040
+ if (openNotificationSuccess) {
47041
+ openNotificationSuccess();
47042
+ }
47043
+ setIsLoading(false);
47044
+ setError(void 0);
47045
+ close();
47046
+ }).catch((error2) => {
47047
+ setIsLoading(false);
47048
+ setError(error2);
47049
+ });
47013
47050
  }).catch(() => console.log("Validating error"));
47014
47051
  };
47015
47052
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -47027,7 +47064,7 @@ const EditModal = ({
47027
47064
  okText: "Save",
47028
47065
  confirmLoading: isLoading,
47029
47066
  maskClosable: false,
47030
- width: 520,
47067
+ width: editModalWidth || 520,
47031
47068
  destroyOnHidden: true,
47032
47069
  centered: true,
47033
47070
  children: [
@@ -47076,7 +47113,8 @@ const EditModal = ({
47076
47113
  children: typeof label === "string" ? truncate(label, maxEditTagTextLength) : "Not a string value"
47077
47114
  }
47078
47115
  ) });
47079
- }
47116
+ },
47117
+ paddingContainerEnd
47080
47118
  }
47081
47119
  )
47082
47120
  }
@@ -47094,6 +47132,7 @@ const Labels = ({ data, children }) => {
47094
47132
  reqIndex,
47095
47133
  jsonPathToLabels,
47096
47134
  selectProps,
47135
+ readOnly,
47097
47136
  notificationSuccessMessage,
47098
47137
  notificationSuccessMessageDescription,
47099
47138
  modalTitle,
@@ -47101,7 +47140,11 @@ const Labels = ({ data, children }) => {
47101
47140
  inputLabel,
47102
47141
  containerStyle,
47103
47142
  maxEditTagTextLength,
47104
- allowClearEditSelect
47143
+ allowClearEditSelect,
47144
+ endpoint,
47145
+ pathToValue,
47146
+ editModalWidth,
47147
+ paddingContainerEnd
47105
47148
  } = data;
47106
47149
  const [api, contextHolder] = notification.useNotification();
47107
47150
  const [open, setOpen] = useState(false);
@@ -47127,19 +47170,21 @@ const Labels = ({ data, children }) => {
47127
47170
  }
47128
47171
  const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
47129
47172
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
47130
- const notificationSuccessMessagePrepared = parseAll({
47173
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
47131
47174
  text: notificationSuccessMessage,
47132
47175
  replaceValues,
47133
47176
  multiQueryData
47134
- });
47135
- const notificationSuccessMessageDescriptionPrepared = parseAll({
47177
+ }) : "Success";
47178
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
47136
47179
  text: notificationSuccessMessageDescription,
47137
47180
  replaceValues,
47138
47181
  multiQueryData
47139
- });
47140
- const modalTitlePrepared = parseAll({ text: modalTitle, replaceValues, multiQueryData });
47182
+ }) : "Success";
47183
+ const modalTitlePrepared = modalTitle ? parseAll({ text: modalTitle, replaceValues, multiQueryData }) : "Edit";
47141
47184
  const modalDescriptionTextPrepared = modalDescriptionText ? parseAll({ text: modalDescriptionText, replaceValues, multiQueryData }) : void 0;
47142
47185
  const inputLabelPrepared = inputLabel ? parseAll({ text: inputLabel, replaceValues, multiQueryData }) : void 0;
47186
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
47187
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
47143
47188
  const openNotificationSuccess = () => {
47144
47189
  api.success({
47145
47190
  message: notificationSuccessMessagePrepared,
@@ -47148,7 +47193,7 @@ const Labels = ({ data, children }) => {
47148
47193
  });
47149
47194
  };
47150
47195
  const EmptySelect = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
47151
- /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47196
+ !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47152
47197
  Button,
47153
47198
  {
47154
47199
  type: "text",
@@ -47189,7 +47234,11 @@ const Labels = ({ data, children }) => {
47189
47234
  modalDescriptionText: modalDescriptionTextPrepared,
47190
47235
  inputLabel: inputLabelPrepared,
47191
47236
  maxEditTagTextLength,
47192
- allowClearEditSelect
47237
+ allowClearEditSelect,
47238
+ endpoint: endpointPrepared,
47239
+ pathToValue: pathToValuePrepared,
47240
+ editModalWidth,
47241
+ paddingContainerEnd
47193
47242
  }
47194
47243
  )
47195
47244
  ] });
@@ -47201,7 +47250,7 @@ const Labels = ({ data, children }) => {
47201
47250
  }
47202
47251
  const labels = Object.entries(labelsRaw).map(([key, value]) => `${key}=${value}`);
47203
47252
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
47204
- /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47253
+ !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47205
47254
  Button,
47206
47255
  {
47207
47256
  type: "text",
@@ -47250,7 +47299,11 @@ const Labels = ({ data, children }) => {
47250
47299
  modalDescriptionText: modalDescriptionTextPrepared,
47251
47300
  inputLabel: inputLabelPrepared,
47252
47301
  maxEditTagTextLength,
47253
- allowClearEditSelect
47302
+ allowClearEditSelect,
47303
+ endpoint: endpointPrepared,
47304
+ pathToValue: pathToValuePrepared,
47305
+ editModalWidth,
47306
+ paddingContainerEnd
47254
47307
  }
47255
47308
  )
47256
47309
  ] });