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

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();
@@ -46986,8 +47005,12 @@ const EditModal = ({
46986
47005
  modalDescriptionText,
46987
47006
  inputLabel,
46988
47007
  maxEditTagTextLength,
46989
- allowClearEditSelect
47008
+ allowClearEditSelect,
47009
+ endpoint,
47010
+ pathToValue,
47011
+ editModalWidth
46990
47012
  }) => {
47013
+ const queryClient = useQueryClient();
46991
47014
  const [error, setError] = useState();
46992
47015
  const [isLoading, setIsLoading] = useState(false);
46993
47016
  const [form] = Form.useForm();
@@ -47007,9 +47030,20 @@ const EditModal = ({
47007
47030
  result[key] = value || "";
47008
47031
  });
47009
47032
  console.log(JSON.stringify(result));
47010
- if (openNotificationSuccess) {
47011
- openNotificationSuccess();
47012
- }
47033
+ setIsLoading(true);
47034
+ setError(void 0);
47035
+ patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
47036
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
47037
+ if (openNotificationSuccess) {
47038
+ openNotificationSuccess();
47039
+ }
47040
+ setIsLoading(false);
47041
+ setError(void 0);
47042
+ close();
47043
+ }).catch((error2) => {
47044
+ setIsLoading(false);
47045
+ setError(error2);
47046
+ });
47013
47047
  }).catch(() => console.log("Validating error"));
47014
47048
  };
47015
47049
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -47027,7 +47061,7 @@ const EditModal = ({
47027
47061
  okText: "Save",
47028
47062
  confirmLoading: isLoading,
47029
47063
  maskClosable: false,
47030
- width: 520,
47064
+ width: editModalWidth || 520,
47031
47065
  destroyOnHidden: true,
47032
47066
  centered: true,
47033
47067
  children: [
@@ -47094,6 +47128,7 @@ const Labels = ({ data, children }) => {
47094
47128
  reqIndex,
47095
47129
  jsonPathToLabels,
47096
47130
  selectProps,
47131
+ readOnly,
47097
47132
  notificationSuccessMessage,
47098
47133
  notificationSuccessMessageDescription,
47099
47134
  modalTitle,
@@ -47101,7 +47136,10 @@ const Labels = ({ data, children }) => {
47101
47136
  inputLabel,
47102
47137
  containerStyle,
47103
47138
  maxEditTagTextLength,
47104
- allowClearEditSelect
47139
+ allowClearEditSelect,
47140
+ endpoint,
47141
+ pathToValue,
47142
+ editModalWidth
47105
47143
  } = data;
47106
47144
  const [api, contextHolder] = notification.useNotification();
47107
47145
  const [open, setOpen] = useState(false);
@@ -47127,19 +47165,21 @@ const Labels = ({ data, children }) => {
47127
47165
  }
47128
47166
  const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
47129
47167
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
47130
- const notificationSuccessMessagePrepared = parseAll({
47168
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
47131
47169
  text: notificationSuccessMessage,
47132
47170
  replaceValues,
47133
47171
  multiQueryData
47134
- });
47135
- const notificationSuccessMessageDescriptionPrepared = parseAll({
47172
+ }) : "Success";
47173
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
47136
47174
  text: notificationSuccessMessageDescription,
47137
47175
  replaceValues,
47138
47176
  multiQueryData
47139
- });
47140
- const modalTitlePrepared = parseAll({ text: modalTitle, replaceValues, multiQueryData });
47177
+ }) : "Success";
47178
+ const modalTitlePrepared = modalTitle ? parseAll({ text: modalTitle, replaceValues, multiQueryData }) : "Edit";
47141
47179
  const modalDescriptionTextPrepared = modalDescriptionText ? parseAll({ text: modalDescriptionText, replaceValues, multiQueryData }) : void 0;
47142
47180
  const inputLabelPrepared = inputLabel ? parseAll({ text: inputLabel, replaceValues, multiQueryData }) : void 0;
47181
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
47182
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
47143
47183
  const openNotificationSuccess = () => {
47144
47184
  api.success({
47145
47185
  message: notificationSuccessMessagePrepared,
@@ -47148,7 +47188,7 @@ const Labels = ({ data, children }) => {
47148
47188
  });
47149
47189
  };
47150
47190
  const EmptySelect = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
47151
- /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47191
+ !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47152
47192
  Button,
47153
47193
  {
47154
47194
  type: "text",
@@ -47189,7 +47229,10 @@ const Labels = ({ data, children }) => {
47189
47229
  modalDescriptionText: modalDescriptionTextPrepared,
47190
47230
  inputLabel: inputLabelPrepared,
47191
47231
  maxEditTagTextLength,
47192
- allowClearEditSelect
47232
+ allowClearEditSelect,
47233
+ endpoint: endpointPrepared,
47234
+ pathToValue: pathToValuePrepared,
47235
+ editModalWidth
47193
47236
  }
47194
47237
  )
47195
47238
  ] });
@@ -47201,7 +47244,7 @@ const Labels = ({ data, children }) => {
47201
47244
  }
47202
47245
  const labels = Object.entries(labelsRaw).map(([key, value]) => `${key}=${value}`);
47203
47246
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
47204
- /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47247
+ !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47205
47248
  Button,
47206
47249
  {
47207
47250
  type: "text",
@@ -47250,7 +47293,10 @@ const Labels = ({ data, children }) => {
47250
47293
  modalDescriptionText: modalDescriptionTextPrepared,
47251
47294
  inputLabel: inputLabelPrepared,
47252
47295
  maxEditTagTextLength,
47253
- allowClearEditSelect
47296
+ allowClearEditSelect,
47297
+ endpoint: endpointPrepared,
47298
+ pathToValue: pathToValuePrepared,
47299
+ editModalWidth
47254
47300
  }
47255
47301
  )
47256
47302
  ] });