@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.16 → 1.2.0-alpha.18
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 +40 -47
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +40 -47
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/EnrichedTableProvider.d.ts +1 -0
- package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.d.ts +2 -1
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8630,10 +8630,6 @@
|
|
|
8630
8630
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$y.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
|
|
8631
8631
|
};
|
|
8632
8632
|
|
|
8633
|
-
const getKinds = async ({ cluster }) => {
|
|
8634
|
-
return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8635
|
-
};
|
|
8636
|
-
|
|
8637
8633
|
const kindByGvr = (entries) => (gvr) => {
|
|
8638
8634
|
const [group = "", v = "", resource = ""] = gvr.split("~", 3);
|
|
8639
8635
|
const norm = (s) => s.trim();
|
|
@@ -8642,6 +8638,10 @@
|
|
|
8642
8638
|
return uniq.length === 1 ? uniq[0] : void 0;
|
|
8643
8639
|
};
|
|
8644
8640
|
|
|
8641
|
+
const getKinds = async ({ cluster }) => {
|
|
8642
|
+
return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8643
|
+
};
|
|
8644
|
+
|
|
8645
8645
|
const parseK8sVersion$1 = (raw) => {
|
|
8646
8646
|
const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
|
|
8647
8647
|
if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
|
|
@@ -8686,6 +8686,23 @@
|
|
|
8686
8686
|
);
|
|
8687
8687
|
};
|
|
8688
8688
|
|
|
8689
|
+
const useKinds = ({
|
|
8690
|
+
cluster,
|
|
8691
|
+
refetchInterval,
|
|
8692
|
+
isEnabled
|
|
8693
|
+
}) => {
|
|
8694
|
+
return reactQuery.useQuery({
|
|
8695
|
+
queryKey: ["useKinds", cluster],
|
|
8696
|
+
queryFn: () => getKinds({ cluster }),
|
|
8697
|
+
select: (data) => ({
|
|
8698
|
+
kindIndex: data.data,
|
|
8699
|
+
kindsWithVersion: getSortedKindsAll(data.data)
|
|
8700
|
+
}),
|
|
8701
|
+
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
|
|
8702
|
+
enabled: isEnabled
|
|
8703
|
+
});
|
|
8704
|
+
};
|
|
8705
|
+
|
|
8689
8706
|
const getDirectUnknownResource = async ({ uri }) => {
|
|
8690
8707
|
return axios.get(uri);
|
|
8691
8708
|
};
|
|
@@ -9392,27 +9409,11 @@
|
|
|
9392
9409
|
const useK8sSmartResource = (params) => {
|
|
9393
9410
|
const { cluster, apiGroup, apiVersion, plural } = params;
|
|
9394
9411
|
const base = useK8sSmartResourceWithoutKinds(params);
|
|
9395
|
-
const
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
return void 0;
|
|
9401
|
-
}
|
|
9402
|
-
getKinds({ cluster }).then((data) => {
|
|
9403
|
-
if (cancelled) {
|
|
9404
|
-
return;
|
|
9405
|
-
}
|
|
9406
|
-
setKindsWithVersion(getSortedKindsAll(data.data));
|
|
9407
|
-
}).catch(() => {
|
|
9408
|
-
if (!cancelled) {
|
|
9409
|
-
setKindsWithVersion(void 0);
|
|
9410
|
-
}
|
|
9411
|
-
});
|
|
9412
|
-
return () => {
|
|
9413
|
-
cancelled = true;
|
|
9414
|
-
};
|
|
9415
|
-
}, [cluster]);
|
|
9412
|
+
const { data: kindsData } = useKinds({
|
|
9413
|
+
cluster,
|
|
9414
|
+
isEnabled: !!cluster
|
|
9415
|
+
});
|
|
9416
|
+
const kindsWithVersion = kindsData?.kindsWithVersion;
|
|
9416
9417
|
const resolveKindByGvr = React$1.useMemo(
|
|
9417
9418
|
() => kindsWithVersion ? kindByGvr(kindsWithVersion) : void 0,
|
|
9418
9419
|
[kindsWithVersion]
|
|
@@ -35111,6 +35112,7 @@
|
|
|
35111
35112
|
k8sResource,
|
|
35112
35113
|
dataForControls,
|
|
35113
35114
|
baseprefix,
|
|
35115
|
+
pathToKey,
|
|
35114
35116
|
...props
|
|
35115
35117
|
} = data;
|
|
35116
35118
|
const theme = useTheme();
|
|
@@ -35276,6 +35278,7 @@
|
|
|
35276
35278
|
dataForControls: dataForControlsPrepared,
|
|
35277
35279
|
withoutControls: !dataForControlsPrepared,
|
|
35278
35280
|
baseprefix,
|
|
35281
|
+
pathToKey,
|
|
35279
35282
|
...props
|
|
35280
35283
|
}
|
|
35281
35284
|
),
|
|
@@ -46509,23 +46512,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
46509
46512
|
return uniq.length === 1 ? uniq[0] : void 0;
|
|
46510
46513
|
};
|
|
46511
46514
|
|
|
46512
|
-
const useKinds = ({
|
|
46513
|
-
cluster,
|
|
46514
|
-
refetchInterval,
|
|
46515
|
-
isEnabled
|
|
46516
|
-
}) => {
|
|
46517
|
-
return reactQuery.useQuery({
|
|
46518
|
-
queryKey: ["useKinds", cluster],
|
|
46519
|
-
queryFn: () => getKinds({ cluster }),
|
|
46520
|
-
select: (data) => ({
|
|
46521
|
-
kindIndex: data.data,
|
|
46522
|
-
kindsWithVersion: getSortedKindsAll(data.data)
|
|
46523
|
-
}),
|
|
46524
|
-
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
|
|
46525
|
-
enabled: isEnabled
|
|
46526
|
-
});
|
|
46527
|
-
};
|
|
46528
|
-
|
|
46529
46515
|
const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
|
|
46530
46516
|
if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
|
|
46531
46517
|
let arrayJsonPath = jsonPathToArrayOfRefs.trim();
|
|
@@ -77298,6 +77284,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
77298
77284
|
|
|
77299
77285
|
const prepare = ({
|
|
77300
77286
|
dataItems,
|
|
77287
|
+
pathToKey,
|
|
77301
77288
|
resourceSchema,
|
|
77302
77289
|
dataForControls,
|
|
77303
77290
|
additionalPrinterColumns
|
|
@@ -77368,13 +77355,15 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
77368
77355
|
onDeleteHandle: dataForControls.onDeleteHandle,
|
|
77369
77356
|
permissions: dataForControls.permissions
|
|
77370
77357
|
};
|
|
77358
|
+
const key2 = pathToKey ? jp.query(el, `$${pathToKey}`)[0] : `${el.metadata.name}${el.metadata.namespace ? `-${el.metadata.namespace}` : ""}`;
|
|
77371
77359
|
return {
|
|
77372
|
-
key:
|
|
77360
|
+
key: key2,
|
|
77373
77361
|
...el,
|
|
77374
77362
|
internalDataForControls
|
|
77375
77363
|
};
|
|
77376
77364
|
}
|
|
77377
|
-
|
|
77365
|
+
const key = pathToKey ? jp.query(el, `$${pathToKey}`)[0] : JSON.stringify(el);
|
|
77366
|
+
return { key, ...el };
|
|
77378
77367
|
}
|
|
77379
77368
|
return {};
|
|
77380
77369
|
});
|
|
@@ -77451,13 +77440,15 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
77451
77440
|
onDeleteHandle: dataForControls.onDeleteHandle,
|
|
77452
77441
|
permissions: dataForControls.permissions
|
|
77453
77442
|
};
|
|
77443
|
+
const key2 = pathToKey ? jp.query(el, `$${pathToKey}`)[0] : `${el.metadata.name}${el.metadata.namespace ? `-${el.metadata.namespace}` : ""}`;
|
|
77454
77444
|
return {
|
|
77455
|
-
key:
|
|
77445
|
+
key: key2,
|
|
77456
77446
|
...el.spec,
|
|
77457
77447
|
internalDataForControls
|
|
77458
77448
|
};
|
|
77459
77449
|
}
|
|
77460
|
-
|
|
77450
|
+
const key = pathToKey ? jp.query(el, `$${pathToKey}`)[0] : JSON.stringify(el.spec);
|
|
77451
|
+
return { key, ...el.spec };
|
|
77461
77452
|
}
|
|
77462
77453
|
return {};
|
|
77463
77454
|
});
|
|
@@ -77482,7 +77473,8 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
77482
77473
|
forceDefaultAdditionalPrinterColumns,
|
|
77483
77474
|
selectData,
|
|
77484
77475
|
tableProps,
|
|
77485
|
-
withoutControls
|
|
77476
|
+
withoutControls,
|
|
77477
|
+
pathToKey
|
|
77486
77478
|
}) => {
|
|
77487
77479
|
const location = reactRouterDom.useLocation();
|
|
77488
77480
|
const [preparedProps, setPreparedProps] = React$1.useState();
|
|
@@ -77545,6 +77537,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
77545
77537
|
const fullPath = `${location.pathname}${location.search}`;
|
|
77546
77538
|
const { dataSource, columns } = prepare({
|
|
77547
77539
|
dataItems,
|
|
77540
|
+
pathToKey,
|
|
77548
77541
|
resourceSchema,
|
|
77549
77542
|
dataForControls: dataForControls ? {
|
|
77550
77543
|
...dataForControls,
|