@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.55 → 0.0.1-alpha.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/openapi-k8s-toolkit.es.js +73 -9
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +73 -9
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/atoms/ContentCard/ContentCard.d.ts +1 -0
- package/dist/types/components/atoms/ContentCard/styled.d.ts +1 -0
- package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/EnrichedTable.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/EnrichedTable/utils.d.ts +9 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +7 -1
- package/dist/types/localTypes/bff/table.d.ts +1 -0
- package/dist/types/localTypes/dynamicRender.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8393,7 +8393,8 @@ const ContentContainer = st.div`
|
|
|
8393
8393
|
border-radius: 6px;
|
|
8394
8394
|
background-color: ${({ $bgColor }) => $bgColor};
|
|
8395
8395
|
width: 100%;
|
|
8396
|
-
height: 100
|
|
8396
|
+
height: ${({ $maxHeight }) => $maxHeight || "100%"};
|
|
8397
|
+
overflow-y: auto;
|
|
8397
8398
|
padding: 24px;
|
|
8398
8399
|
flex-grow: ${({ $flexGrow }) => $flexGrow};
|
|
8399
8400
|
display: ${({ $displayFlex }) => $displayFlex ? "flex" : "block"};
|
|
@@ -8403,7 +8404,7 @@ const Styled$e = {
|
|
|
8403
8404
|
ContentContainer
|
|
8404
8405
|
};
|
|
8405
8406
|
|
|
8406
|
-
const ContentCard$1 = ({ children, flexGrow, displayFlex, flexFlow }) => {
|
|
8407
|
+
const ContentCard$1 = ({ children, flexGrow, displayFlex, flexFlow, maxHeight }) => {
|
|
8407
8408
|
const { token } = theme.useToken();
|
|
8408
8409
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8409
8410
|
Styled$e.ContentContainer,
|
|
@@ -8413,6 +8414,7 @@ const ContentCard$1 = ({ children, flexGrow, displayFlex, flexFlow }) => {
|
|
|
8413
8414
|
$borderColor: token.colorBorder,
|
|
8414
8415
|
$displayFlex: displayFlex,
|
|
8415
8416
|
$flexFlow: flexFlow,
|
|
8417
|
+
$maxHeight: maxHeight,
|
|
8416
8418
|
children
|
|
8417
8419
|
}
|
|
8418
8420
|
);
|
|
@@ -26341,7 +26343,7 @@ const getEnrichedColumnsWithControls = ({
|
|
|
26341
26343
|
);
|
|
26342
26344
|
},
|
|
26343
26345
|
icon: editIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(EditOutlined, { size: 14 }),
|
|
26344
|
-
disabled: value.permissions && value.permissions.canUpdate ? value.permissions?.canUpdate : false
|
|
26346
|
+
disabled: value.permissions && value.permissions.canUpdate ? !value.permissions?.canUpdate : false
|
|
26345
26347
|
}
|
|
26346
26348
|
),
|
|
26347
26349
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -26357,7 +26359,7 @@ const getEnrichedColumnsWithControls = ({
|
|
|
26357
26359
|
);
|
|
26358
26360
|
},
|
|
26359
26361
|
icon: deleteIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteOutlined, { size: 14 }),
|
|
26360
|
-
disabled: value.permissions && value.permissions.canDelete ? value.permissions?.canDelete : false
|
|
26362
|
+
disabled: value.permissions && value.permissions.canDelete ? !value.permissions?.canDelete : false
|
|
26361
26363
|
}
|
|
26362
26364
|
)
|
|
26363
26365
|
] });
|
|
@@ -26373,6 +26375,7 @@ const EnrichedTable$1 = ({
|
|
|
26373
26375
|
columns,
|
|
26374
26376
|
pathToNavigate,
|
|
26375
26377
|
recordKeysForNavigation,
|
|
26378
|
+
recordKeysForNavigationSecond,
|
|
26376
26379
|
additionalPrinterColumnsUndefinedValues,
|
|
26377
26380
|
additionalPrinterColumnsTrimLengths,
|
|
26378
26381
|
additionalPrinterColumnsColWidths,
|
|
@@ -26446,8 +26449,10 @@ const EnrichedTable$1 = ({
|
|
|
26446
26449
|
onClick: () => {
|
|
26447
26450
|
if (pathToNavigate && recordKeysForNavigation) {
|
|
26448
26451
|
const recordValueRaw = lodashExports.get(record, recordKeysForNavigation);
|
|
26452
|
+
const recordValueRawSecond = recordKeysForNavigationSecond ? lodashExports.get(record, recordKeysForNavigationSecond) : "no-second-record-keys";
|
|
26449
26453
|
const recordValue = typeof recordValueRaw === "string" ? recordValueRaw : JSON.stringify(recordValueRaw);
|
|
26450
|
-
const
|
|
26454
|
+
const recordValueSecond = typeof recordValueRawSecond === "string" ? recordValueRawSecond : JSON.stringify(recordValueRawSecond);
|
|
26455
|
+
const newPath = pathToNavigate.replaceAll("~recordValue~", recordValue).replaceAll("~recordValueSecond~", recordValueSecond);
|
|
26451
26456
|
navigate(newPath);
|
|
26452
26457
|
}
|
|
26453
26458
|
}
|
|
@@ -33429,6 +33434,7 @@ const EnrichedTableProvider = ({
|
|
|
33429
33434
|
columns,
|
|
33430
33435
|
pathToNavigate: preparedProps.pathToNavigate,
|
|
33431
33436
|
recordKeysForNavigation: preparedProps.recordKeysForNavigation,
|
|
33437
|
+
recordKeysForNavigationSecond: preparedProps.recordKeysForNavigationSecond,
|
|
33432
33438
|
additionalPrinterColumnsUndefinedValues: preparedProps.additionalPrinterColumnsUndefinedValues,
|
|
33433
33439
|
additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
|
|
33434
33440
|
additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
|
|
@@ -45250,12 +45256,39 @@ const useTheme = () => {
|
|
|
45250
45256
|
return useContext(ThemeContext);
|
|
45251
45257
|
};
|
|
45252
45258
|
|
|
45259
|
+
const parseMutliqueryText = ({ text, multiQueryData }) => {
|
|
45260
|
+
if (!text) return "";
|
|
45261
|
+
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
45262
|
+
try {
|
|
45263
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
45264
|
+
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
45265
|
+
(m) => m[1]
|
|
45266
|
+
);
|
|
45267
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
|
|
45268
|
+
return value != null ? String(value) : "";
|
|
45269
|
+
} catch {
|
|
45270
|
+
return match;
|
|
45271
|
+
}
|
|
45272
|
+
});
|
|
45273
|
+
};
|
|
45274
|
+
const serializeLabels = (input) => {
|
|
45275
|
+
if (typeof input !== "object" || input === null || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype) {
|
|
45276
|
+
return "Expected a plain object";
|
|
45277
|
+
}
|
|
45278
|
+
const entries = Object.entries(input);
|
|
45279
|
+
if (!entries.map(([, v]) => v).every((v) => typeof v === "string" || typeof v === "number")) {
|
|
45280
|
+
return "All values must be string or number";
|
|
45281
|
+
}
|
|
45282
|
+
return encodeURIComponent(entries.map(([k, v]) => `${k}=${v}`).join(","));
|
|
45283
|
+
};
|
|
45284
|
+
|
|
45253
45285
|
const EnrichedTable = ({
|
|
45254
45286
|
data,
|
|
45255
45287
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45256
45288
|
children
|
|
45257
45289
|
}) => {
|
|
45258
|
-
const {
|
|
45290
|
+
const { data: multiQueryData } = useMultiQuery();
|
|
45291
|
+
const { id, fetchUrl, pathToItems, clusterNamePartOfUrl, labelsSelector, fieldSelector, ...props } = data;
|
|
45259
45292
|
const theme = useTheme();
|
|
45260
45293
|
const partsOfUrl = usePartsOfUrl();
|
|
45261
45294
|
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
@@ -45270,12 +45303,35 @@ const EnrichedTable = ({
|
|
|
45270
45303
|
template: fetchUrl,
|
|
45271
45304
|
replaceValues
|
|
45272
45305
|
});
|
|
45306
|
+
let labelsSuffix;
|
|
45307
|
+
if (labelsSelector) {
|
|
45308
|
+
const parsedObject = Object.fromEntries(
|
|
45309
|
+
Object.entries(labelsSelector).map(
|
|
45310
|
+
([key, value]) => [key, prepareTemplate({ template: parseMutliqueryText({ text: value, multiQueryData }), replaceValues })]
|
|
45311
|
+
)
|
|
45312
|
+
);
|
|
45313
|
+
const serializedLabels = serializeLabels(parsedObject);
|
|
45314
|
+
labelsSuffix = serializeLabels.length > 0 ? `?labelSelector=${serializedLabels}` : void 0;
|
|
45315
|
+
}
|
|
45316
|
+
let fieldSelectorSuffix;
|
|
45317
|
+
if (fieldSelector) {
|
|
45318
|
+
const preparedFieldSelectorValueText = parseMutliqueryText({ text: fieldSelector?.parsedText, multiQueryData });
|
|
45319
|
+
const preparedFieldSelectorValueTextWithPartsOfUrl = prepareTemplate({
|
|
45320
|
+
template: preparedFieldSelectorValueText,
|
|
45321
|
+
replaceValues
|
|
45322
|
+
});
|
|
45323
|
+
const preparedSelector = encodeURIComponent(
|
|
45324
|
+
`${fieldSelector.fieldName}=${preparedFieldSelectorValueTextWithPartsOfUrl}`
|
|
45325
|
+
);
|
|
45326
|
+
const prefix = labelsSelector ? "&fieldSelector=" : "?fieldSelector=";
|
|
45327
|
+
fieldSelectorSuffix = `${prefix}${preparedSelector}`;
|
|
45328
|
+
}
|
|
45273
45329
|
const {
|
|
45274
45330
|
data: fetchedData,
|
|
45275
45331
|
isLoading: isFetchedDataLoading,
|
|
45276
45332
|
error: fetchedDataError
|
|
45277
45333
|
} = useDirectUnknownResource({
|
|
45278
|
-
uri: fetchUrlPrepared
|
|
45334
|
+
uri: `${fetchUrlPrepared}${labelsSuffix || ""}${fieldSelectorSuffix || ""}`,
|
|
45279
45335
|
queryKey: [fetchUrlPrepared]
|
|
45280
45336
|
});
|
|
45281
45337
|
if (!fetchedData) {
|
|
@@ -45290,6 +45346,13 @@ const EnrichedTable = ({
|
|
|
45290
45346
|
JSON.stringify(fetchedDataError)
|
|
45291
45347
|
] });
|
|
45292
45348
|
}
|
|
45349
|
+
const items = _$1.get(fetchedData, pathToItems);
|
|
45350
|
+
if (!items) {
|
|
45351
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
45352
|
+
"No data on this path ",
|
|
45353
|
+
JSON.stringify(pathToItems)
|
|
45354
|
+
] });
|
|
45355
|
+
}
|
|
45293
45356
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
45294
45357
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45295
45358
|
EnrichedTableProvider,
|
|
@@ -45297,7 +45360,7 @@ const EnrichedTable = ({
|
|
|
45297
45360
|
tableMappingsReplaceValues: replaceValues,
|
|
45298
45361
|
cluster: clusterName,
|
|
45299
45362
|
theme,
|
|
45300
|
-
dataItems:
|
|
45363
|
+
dataItems: items,
|
|
45301
45364
|
tableProps: {
|
|
45302
45365
|
borderless: true,
|
|
45303
45366
|
paginationPosition: ["bottomRight"],
|
|
@@ -45306,7 +45369,8 @@ const EnrichedTable = ({
|
|
|
45306
45369
|
deleteIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, {}),
|
|
45307
45370
|
disablePagination: true
|
|
45308
45371
|
},
|
|
45309
|
-
...props
|
|
45372
|
+
...props,
|
|
45373
|
+
withoutControls: true
|
|
45310
45374
|
}
|
|
45311
45375
|
),
|
|
45312
45376
|
children
|