@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.86 → 0.0.1-alpha.88

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.
@@ -26410,6 +26410,7 @@ const EnrichedTable$1 = ({
26410
26410
  pathToNavigate,
26411
26411
  recordKeysForNavigation,
26412
26412
  recordKeysForNavigationSecond,
26413
+ recordKeysForNavigationThird,
26413
26414
  additionalPrinterColumnsUndefinedValues,
26414
26415
  additionalPrinterColumnsTrimLengths,
26415
26416
  additionalPrinterColumnsColWidths,
@@ -26484,9 +26485,11 @@ const EnrichedTable$1 = ({
26484
26485
  if (pathToNavigate && recordKeysForNavigation) {
26485
26486
  const recordValueRaw = lodashExports.get(record, recordKeysForNavigation);
26486
26487
  const recordValueRawSecond = recordKeysForNavigationSecond ? lodashExports.get(record, recordKeysForNavigationSecond) : "no-second-record-keys";
26488
+ const recordValueRawThird = recordKeysForNavigationThird ? lodashExports.get(record, recordKeysForNavigationThird) : "no-second-record-keys";
26487
26489
  const recordValue = typeof recordValueRaw === "string" ? recordValueRaw : JSON.stringify(recordValueRaw);
26488
26490
  const recordValueSecond = typeof recordValueRawSecond === "string" ? recordValueRawSecond : JSON.stringify(recordValueRawSecond);
26489
- const newPath = pathToNavigate.replaceAll("~recordValue~", recordValue).replaceAll("~recordValueSecond~", recordValueSecond);
26491
+ const recordValueThird = typeof recordValueRawThird === "string" ? recordValueRawThird : JSON.stringify(recordValueRawThird);
26492
+ const newPath = pathToNavigate.replaceAll("~recordValue~", recordValue).replaceAll("~recordValueSecond~", recordValueSecond).replaceAll("~recordValueThird~", recordValueThird);
26490
26493
  navigate(newPath);
26491
26494
  }
26492
26495
  }
@@ -33469,6 +33472,7 @@ const EnrichedTableProvider = ({
33469
33472
  pathToNavigate: preparedProps.pathToNavigate,
33470
33473
  recordKeysForNavigation: preparedProps.recordKeysForNavigation,
33471
33474
  recordKeysForNavigationSecond: preparedProps.recordKeysForNavigationSecond,
33475
+ recordKeysForNavigationThird: preparedProps.recordKeysForNavigationThird,
33472
33476
  additionalPrinterColumnsUndefinedValues: preparedProps.additionalPrinterColumnsUndefinedValues,
33473
33477
  additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
33474
33478
  additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
@@ -46041,6 +46045,21 @@ const MultiQuery = ({ data }) => {
46041
46045
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedText });
46042
46046
  };
46043
46047
 
46048
+ const formatLocalDate = (iso) => {
46049
+ const date = new Date(iso);
46050
+ return date.toLocaleString(void 0, {
46051
+ year: "numeric",
46052
+ month: "long",
46053
+ day: "numeric",
46054
+ hour: "2-digit",
46055
+ minute: "2-digit",
46056
+ second: "2-digit",
46057
+ hour12: false
46058
+ // set to true for 12-hour clock with AM/PM
46059
+ // timeZoneName: 'short', // e.g. “CEST”
46060
+ });
46061
+ };
46062
+
46044
46063
  const ParsedText = ({ data }) => {
46045
46064
  const { data: multiQueryData, isLoading, isError, errors } = useMultiQuery();
46046
46065
  const partsOfUrl = usePartsOfUrl();
@@ -46057,8 +46076,9 @@ const ParsedText = ({ data }) => {
46057
46076
  acc[index.toString()] = value;
46058
46077
  return acc;
46059
46078
  }, {});
46060
- const preparedTextWithPartsOfUrl = parseAll({ text: data.text, replaceValues, multiQueryData });
46061
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: data.style, children: preparedTextWithPartsOfUrl });
46079
+ const parsedText = parseAll({ text: data.text, replaceValues, multiQueryData });
46080
+ const formattedText = data.formatter ? formatLocalDate(parsedText) : parsedText;
46081
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: data.style, children: formattedText });
46062
46082
  };
46063
46083
 
46064
46084
  const ProjectInfoCard = ({
@@ -46135,12 +46155,44 @@ const DefaultDiv = ({
46135
46155
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...props, children });
46136
46156
  };
46137
46157
 
46158
+ const getResult = ({
46159
+ valuePrepared,
46160
+ criteriaSuccess,
46161
+ criteriaError,
46162
+ valueToCompareSuccess,
46163
+ valueToCompareError,
46164
+ successText,
46165
+ errorText,
46166
+ fallbackText
46167
+ }) => {
46168
+ const success = criteriaSuccess === "equals" ? valueToCompareSuccess.includes(valuePrepared) : !valueToCompareSuccess.includes(valuePrepared);
46169
+ if (success) {
46170
+ return { type: "success", text: successText };
46171
+ }
46172
+ const error = criteriaError === "equals" ? valueToCompareError.includes(valuePrepared) : !valueToCompareError.includes(valuePrepared);
46173
+ if (error) {
46174
+ return { type: "danger", text: errorText };
46175
+ }
46176
+ return { type: "warning", text: fallbackText };
46177
+ };
46178
+
46138
46179
  const StatusText = ({
46139
46180
  data,
46140
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
46141
46181
  children
46142
46182
  }) => {
46143
- const { id, value, criteria, valueToCompare, successText, errorText, ...props } = data;
46183
+ const {
46184
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
46185
+ id,
46186
+ value,
46187
+ criteriaSuccess,
46188
+ criteriaError,
46189
+ valueToCompareSuccess,
46190
+ valueToCompareError,
46191
+ successText,
46192
+ errorText,
46193
+ fallbackText,
46194
+ ...props
46195
+ } = data;
46144
46196
  const { data: multiQueryData, isLoading: isMultiqueryLoading, isError, errors } = useMultiQuery();
46145
46197
  const partsOfUrl = usePartsOfUrl();
46146
46198
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value2, index) => {
@@ -46149,8 +46201,8 @@ const StatusText = ({
46149
46201
  }, {});
46150
46202
  const successTextPrepared = parseAll({ text: successText, replaceValues, multiQueryData });
46151
46203
  const errorTextPrepared = parseAll({ text: errorText, replaceValues, multiQueryData });
46204
+ const fallbackTextPrepared = parseAll({ text: fallbackText, replaceValues, multiQueryData });
46152
46205
  const valuePrepared = parseAll({ text: value, replaceValues, multiQueryData });
46153
- const result = criteria === "equals" ? valueToCompare === valuePrepared : valueToCompare !== valuePrepared;
46154
46206
  if (isMultiqueryLoading) {
46155
46207
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
46156
46208
  }
@@ -46160,8 +46212,18 @@ const StatusText = ({
46160
46212
  /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
46161
46213
  ] });
46162
46214
  }
46163
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Text, { type: result ? "success" : "danger", ...props, children: [
46164
- result ? successTextPrepared : errorTextPrepared,
46215
+ const { type, text } = getResult({
46216
+ valuePrepared,
46217
+ criteriaSuccess,
46218
+ criteriaError,
46219
+ valueToCompareSuccess,
46220
+ valueToCompareError,
46221
+ successText: successTextPrepared,
46222
+ errorText: errorTextPrepared,
46223
+ fallbackText: fallbackTextPrepared
46224
+ });
46225
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Text, { type, ...props, children: [
46226
+ text,
46165
46227
  children
46166
46228
  ] });
46167
46229
  };
@@ -46587,6 +46649,91 @@ const VisibilityContainer = ({
46587
46649
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.VisibilityContainer, { $hidden: valuePrepared === "~undefined-value~", children });
46588
46650
  };
46589
46651
 
46652
+ const unknownToString = (value) => {
46653
+ if (!value) {
46654
+ return "No value";
46655
+ }
46656
+ if (typeof value === "object") {
46657
+ return JSON.stringify(value);
46658
+ }
46659
+ return value.toString();
46660
+ };
46661
+ const flattenOnce = (arr) => arr.reduce((acc, row) => [...acc, ...row], []);
46662
+ const isRecordArray = (val) => {
46663
+ return Array.isArray(val) && val.every(
46664
+ (item) => item !== null && typeof item === "object" && // exclude nested Arrays if you want “plain” objects only:
46665
+ !Array.isArray(item)
46666
+ );
46667
+ };
46668
+ const parseArrayOfAny = (value) => {
46669
+ if (!Array.isArray(value)) {
46670
+ return { error: "Value on jsonPath is not an array" };
46671
+ }
46672
+ let flattenArrayOfUnknown = [];
46673
+ try {
46674
+ flattenArrayOfUnknown = flattenOnce(value);
46675
+ } catch (e) {
46676
+ console.log(e);
46677
+ return { error: "Error while flattening" };
46678
+ }
46679
+ if (isRecordArray(flattenArrayOfUnknown)) {
46680
+ return { data: flattenArrayOfUnknown };
46681
+ }
46682
+ return { error: "Value on jsonPath is not a record array" };
46683
+ };
46684
+
46685
+ const ArrayOfObjectsToKeyValues = ({ data, children }) => {
46686
+ const {
46687
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
46688
+ id,
46689
+ reqIndex,
46690
+ jsonPathToArray,
46691
+ keyFieldName,
46692
+ valueFieldName,
46693
+ separator,
46694
+ containerStyle,
46695
+ rowStyle,
46696
+ keyFieldStyle,
46697
+ valueFieldStyle
46698
+ } = data;
46699
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
46700
+ if (isMultiQueryLoading) {
46701
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
46702
+ }
46703
+ if (isMultiQueryErrors) {
46704
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
46705
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
46706
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
46707
+ ] });
46708
+ }
46709
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
46710
+ if (jsonRoot === void 0) {
46711
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
46712
+ }
46713
+ const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
46714
+ const { data: arrayOfObjects, error: errorArrayOfObjects } = parseArrayOfAny(anythingForNow);
46715
+ if (!arrayOfObjects) {
46716
+ if (errorArrayOfObjects) {
46717
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: errorArrayOfObjects });
46718
+ }
46719
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Not a valid data structure" });
46720
+ }
46721
+ const separatorPrepared = separator || ":";
46722
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
46723
+ arrayOfObjects.map((item) => {
46724
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: rowStyle, children: [
46725
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { style: keyFieldStyle, children: [
46726
+ unknownToString(item[keyFieldName]),
46727
+ separatorPrepared,
46728
+ " "
46729
+ ] }),
46730
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: valueFieldStyle, children: unknownToString(item[valueFieldName]) })
46731
+ ] }, JSON.stringify(item));
46732
+ }),
46733
+ children
46734
+ ] });
46735
+ };
46736
+
46590
46737
  const DynamicComponents = {
46591
46738
  DefaultDiv,
46592
46739
  antdText: AntdText,
@@ -46611,7 +46758,8 @@ const DynamicComponents = {
46611
46758
  NodeTerminal,
46612
46759
  PodLogs,
46613
46760
  YamlEditorSingleton,
46614
- VisibilityContainer
46761
+ VisibilityContainer,
46762
+ ArrayOfObjectsToKeyValues
46615
46763
  };
46616
46764
 
46617
46765
  const prepareUrlsToFetchForDynamicRenderer = ({