@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.74 → 0.0.1-alpha.75
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 +117 -20
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +117 -19
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/BlackholeForm/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/YamlEditorSingleton.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/utils.d.ts +8 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +11 -0
- package/package.json +1 -1
|
@@ -41632,7 +41632,7 @@ const Styled$g = {
|
|
|
41632
41632
|
BigText: BigText$1
|
|
41633
41633
|
};
|
|
41634
41634
|
|
|
41635
|
-
const YamlEditorSingleton = ({
|
|
41635
|
+
const YamlEditorSingleton$1 = ({
|
|
41636
41636
|
theme: theme$1,
|
|
41637
41637
|
cluster,
|
|
41638
41638
|
prefillValuesSchema,
|
|
@@ -41660,13 +41660,14 @@ const YamlEditorSingleton = ({
|
|
|
41660
41660
|
const { namespace } = currentValues.metadata;
|
|
41661
41661
|
const { name } = currentValues.metadata;
|
|
41662
41662
|
const body = currentValues;
|
|
41663
|
-
const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "
|
|
41663
|
+
const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis"}/${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${typeName}/${isCreate ? "" : name}`;
|
|
41664
41664
|
if (isCreate) {
|
|
41665
41665
|
createNewEntry({ endpoint, body }).then((res) => {
|
|
41666
41666
|
console.log(res);
|
|
41667
41667
|
if (backlink) {
|
|
41668
41668
|
navigate(backlink);
|
|
41669
41669
|
}
|
|
41670
|
+
setIsLoading(false);
|
|
41670
41671
|
}).catch((error2) => {
|
|
41671
41672
|
console.log("Form submit error", error2);
|
|
41672
41673
|
setIsLoading(false);
|
|
@@ -41678,6 +41679,7 @@ const YamlEditorSingleton = ({
|
|
|
41678
41679
|
if (backlink) {
|
|
41679
41680
|
navigate(backlink);
|
|
41680
41681
|
}
|
|
41682
|
+
setIsLoading(false);
|
|
41681
41683
|
}).catch((error2) => {
|
|
41682
41684
|
console.log("Form submit error", error2);
|
|
41683
41685
|
setIsLoading(false);
|
|
@@ -43931,7 +43933,7 @@ const BlackholeFormDataProvider = ({
|
|
|
43931
43933
|
}
|
|
43932
43934
|
if (modeData?.current === "Manual") {
|
|
43933
43935
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43934
|
-
YamlEditorSingleton,
|
|
43936
|
+
YamlEditorSingleton$1,
|
|
43935
43937
|
{
|
|
43936
43938
|
theme,
|
|
43937
43939
|
cluster,
|
|
@@ -46055,7 +46057,7 @@ const useTheme = () => {
|
|
|
46055
46057
|
return useContext(ThemeContext);
|
|
46056
46058
|
};
|
|
46057
46059
|
|
|
46058
|
-
const parseMutliqueryText$
|
|
46060
|
+
const parseMutliqueryText$4 = ({ text, multiQueryData }) => {
|
|
46059
46061
|
if (!text) return "";
|
|
46060
46062
|
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
46061
46063
|
try {
|
|
@@ -46109,14 +46111,14 @@ const EnrichedTable = ({
|
|
|
46109
46111
|
replaceValues
|
|
46110
46112
|
});
|
|
46111
46113
|
const fetchUrlPrepared = prepareTemplate({
|
|
46112
|
-
template: parseMutliqueryText$
|
|
46114
|
+
template: parseMutliqueryText$4({ text: fetchUrl, multiQueryData }),
|
|
46113
46115
|
replaceValues
|
|
46114
46116
|
});
|
|
46115
46117
|
let labelsSuffix;
|
|
46116
46118
|
if (labelsSelector) {
|
|
46117
46119
|
const parsedObject = Object.fromEntries(
|
|
46118
46120
|
Object.entries(labelsSelector).map(
|
|
46119
|
-
([key, value]) => [key, prepareTemplate({ template: parseMutliqueryText$
|
|
46121
|
+
([key, value]) => [key, prepareTemplate({ template: parseMutliqueryText$4({ text: value, multiQueryData }), replaceValues })]
|
|
46120
46122
|
)
|
|
46121
46123
|
);
|
|
46122
46124
|
const serializedLabels = serializeLabels(parsedObject);
|
|
@@ -46129,7 +46131,7 @@ const EnrichedTable = ({
|
|
|
46129
46131
|
}
|
|
46130
46132
|
let fieldSelectorSuffix;
|
|
46131
46133
|
if (fieldSelector) {
|
|
46132
|
-
const preparedFieldSelectorValueText = parseMutliqueryText$
|
|
46134
|
+
const preparedFieldSelectorValueText = parseMutliqueryText$4({ text: fieldSelector?.parsedText, multiQueryData });
|
|
46133
46135
|
const preparedFieldSelectorValueTextWithPartsOfUrl = prepareTemplate({
|
|
46134
46136
|
template: preparedFieldSelectorValueText,
|
|
46135
46137
|
replaceValues
|
|
@@ -46192,7 +46194,7 @@ const EnrichedTable = ({
|
|
|
46192
46194
|
] });
|
|
46193
46195
|
};
|
|
46194
46196
|
|
|
46195
|
-
const parseMutliqueryText$
|
|
46197
|
+
const parseMutliqueryText$3 = ({ text, multiQueryData }) => {
|
|
46196
46198
|
if (!text) return "";
|
|
46197
46199
|
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
46198
46200
|
try {
|
|
@@ -46230,15 +46232,15 @@ const PodTerminal = ({
|
|
|
46230
46232
|
return acc;
|
|
46231
46233
|
}, {});
|
|
46232
46234
|
const clusterPrepared = prepareTemplate({
|
|
46233
|
-
template: parseMutliqueryText$
|
|
46235
|
+
template: parseMutliqueryText$3({ text: cluster, multiQueryData }),
|
|
46234
46236
|
replaceValues
|
|
46235
46237
|
});
|
|
46236
46238
|
const namespacePrepared = prepareTemplate({
|
|
46237
|
-
template: parseMutliqueryText$
|
|
46239
|
+
template: parseMutliqueryText$3({ text: namespace, multiQueryData }),
|
|
46238
46240
|
replaceValues
|
|
46239
46241
|
});
|
|
46240
46242
|
const podNamePrepared = prepareTemplate({
|
|
46241
|
-
template: parseMutliqueryText$
|
|
46243
|
+
template: parseMutliqueryText$3({ text: podName, multiQueryData }),
|
|
46242
46244
|
replaceValues
|
|
46243
46245
|
});
|
|
46244
46246
|
const {
|
|
@@ -46287,7 +46289,7 @@ const factoryConfigContext = createContextFactory();
|
|
|
46287
46289
|
const FactoryConfigContextProvider = factoryConfigContext.Provider;
|
|
46288
46290
|
const useFactoryConfig = factoryConfigContext.useTypedContext;
|
|
46289
46291
|
|
|
46290
|
-
const parseMutliqueryText$
|
|
46292
|
+
const parseMutliqueryText$2 = ({ text, multiQueryData }) => {
|
|
46291
46293
|
if (!text) return "";
|
|
46292
46294
|
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
46293
46295
|
try {
|
|
@@ -46324,11 +46326,11 @@ const NodeTerminal = ({
|
|
|
46324
46326
|
return acc;
|
|
46325
46327
|
}, {});
|
|
46326
46328
|
const clusterPrepared = prepareTemplate({
|
|
46327
|
-
template: parseMutliqueryText$
|
|
46329
|
+
template: parseMutliqueryText$2({ text: cluster, multiQueryData }),
|
|
46328
46330
|
replaceValues
|
|
46329
46331
|
});
|
|
46330
46332
|
const nodeNamePrepared = prepareTemplate({
|
|
46331
|
-
template: parseMutliqueryText$
|
|
46333
|
+
template: parseMutliqueryText$2({ text: nodeName, multiQueryData }),
|
|
46332
46334
|
replaceValues
|
|
46333
46335
|
});
|
|
46334
46336
|
if (isMultiqueryLoading) {
|
|
@@ -46349,7 +46351,7 @@ const NodeTerminal = ({
|
|
|
46349
46351
|
] });
|
|
46350
46352
|
};
|
|
46351
46353
|
|
|
46352
|
-
const parseMutliqueryText = ({ text, multiQueryData }) => {
|
|
46354
|
+
const parseMutliqueryText$1 = ({ text, multiQueryData }) => {
|
|
46353
46355
|
if (!text) return "";
|
|
46354
46356
|
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
46355
46357
|
try {
|
|
@@ -46388,15 +46390,15 @@ const PodLogs = ({
|
|
|
46388
46390
|
return acc;
|
|
46389
46391
|
}, {});
|
|
46390
46392
|
const clusterPrepared = prepareTemplate({
|
|
46391
|
-
template: parseMutliqueryText({ text: cluster, multiQueryData }),
|
|
46393
|
+
template: parseMutliqueryText$1({ text: cluster, multiQueryData }),
|
|
46392
46394
|
replaceValues
|
|
46393
46395
|
});
|
|
46394
46396
|
const namespacePrepared = prepareTemplate({
|
|
46395
|
-
template: parseMutliqueryText({ text: namespace, multiQueryData }),
|
|
46397
|
+
template: parseMutliqueryText$1({ text: namespace, multiQueryData }),
|
|
46396
46398
|
replaceValues
|
|
46397
46399
|
});
|
|
46398
46400
|
const podNamePrepared = prepareTemplate({
|
|
46399
|
-
template: parseMutliqueryText({ text: podName, multiQueryData }),
|
|
46401
|
+
template: parseMutliqueryText$1({ text: podName, multiQueryData }),
|
|
46400
46402
|
replaceValues
|
|
46401
46403
|
});
|
|
46402
46404
|
const {
|
|
@@ -46443,6 +46445,100 @@ const PodLogs = ({
|
|
|
46443
46445
|
] });
|
|
46444
46446
|
};
|
|
46445
46447
|
|
|
46448
|
+
const parseMutliqueryText = ({ text, multiQueryData }) => {
|
|
46449
|
+
if (!text) return "";
|
|
46450
|
+
return text.replace(/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\]\}/g, (match, reqIndexStr, rawPath) => {
|
|
46451
|
+
try {
|
|
46452
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
46453
|
+
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
46454
|
+
(m) => m[1]
|
|
46455
|
+
);
|
|
46456
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`], path);
|
|
46457
|
+
return value != null ? String(value) : "";
|
|
46458
|
+
} catch {
|
|
46459
|
+
return match;
|
|
46460
|
+
}
|
|
46461
|
+
});
|
|
46462
|
+
};
|
|
46463
|
+
|
|
46464
|
+
const YamlEditorSingleton = ({
|
|
46465
|
+
data,
|
|
46466
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46467
|
+
children
|
|
46468
|
+
}) => {
|
|
46469
|
+
const { data: multiQueryData, isLoading: isMultiqueryLoading } = useMultiQuery();
|
|
46470
|
+
const {
|
|
46471
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46472
|
+
id,
|
|
46473
|
+
cluster,
|
|
46474
|
+
isNameSpaced,
|
|
46475
|
+
type,
|
|
46476
|
+
apiGroup,
|
|
46477
|
+
apiVersion,
|
|
46478
|
+
typeName,
|
|
46479
|
+
prefillValuesRequestIndex,
|
|
46480
|
+
substractHeight,
|
|
46481
|
+
...props
|
|
46482
|
+
} = data;
|
|
46483
|
+
const [height, setHeight] = useState(0);
|
|
46484
|
+
useEffect(() => {
|
|
46485
|
+
const height2 = window.innerHeight - (substractHeight || 340);
|
|
46486
|
+
setHeight(height2);
|
|
46487
|
+
const handleResize = () => {
|
|
46488
|
+
setHeight(height2);
|
|
46489
|
+
};
|
|
46490
|
+
window.addEventListener("resize", handleResize);
|
|
46491
|
+
return () => {
|
|
46492
|
+
window.removeEventListener("resize", handleResize);
|
|
46493
|
+
};
|
|
46494
|
+
}, [substractHeight]);
|
|
46495
|
+
const theme = useTheme();
|
|
46496
|
+
const partsOfUrl = usePartsOfUrl();
|
|
46497
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
46498
|
+
acc[index.toString()] = value;
|
|
46499
|
+
return acc;
|
|
46500
|
+
}, {});
|
|
46501
|
+
const clusterPrepared = prepareTemplate({
|
|
46502
|
+
template: parseMutliqueryText({ text: cluster, multiQueryData }),
|
|
46503
|
+
replaceValues
|
|
46504
|
+
});
|
|
46505
|
+
const apiGroupPrepared = prepareTemplate({
|
|
46506
|
+
template: parseMutliqueryText({ text: apiGroup, multiQueryData }),
|
|
46507
|
+
replaceValues
|
|
46508
|
+
});
|
|
46509
|
+
const apiVersionPrepared = prepareTemplate({
|
|
46510
|
+
template: parseMutliqueryText({ text: apiVersion, multiQueryData }),
|
|
46511
|
+
replaceValues
|
|
46512
|
+
});
|
|
46513
|
+
const typeNamePrepared = prepareTemplate({
|
|
46514
|
+
template: parseMutliqueryText({ text: typeName, multiQueryData }),
|
|
46515
|
+
replaceValues
|
|
46516
|
+
});
|
|
46517
|
+
const prefillValues = multiQueryData[`req${prefillValuesRequestIndex}`];
|
|
46518
|
+
if (isMultiqueryLoading) {
|
|
46519
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
46520
|
+
}
|
|
46521
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46522
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46523
|
+
YamlEditorSingleton$1,
|
|
46524
|
+
{
|
|
46525
|
+
cluster: clusterPrepared,
|
|
46526
|
+
theme,
|
|
46527
|
+
prefillValuesSchema: prefillValues,
|
|
46528
|
+
isNameSpaced,
|
|
46529
|
+
isCreate: false,
|
|
46530
|
+
type,
|
|
46531
|
+
apiGroupApiVersion: type === "builtin" ? "api/v1" : `${apiGroupPrepared}/${apiVersionPrepared}`,
|
|
46532
|
+
typeName: typeNamePrepared,
|
|
46533
|
+
designNewLayout: true,
|
|
46534
|
+
designNewLayoutHeight: height,
|
|
46535
|
+
...props
|
|
46536
|
+
}
|
|
46537
|
+
),
|
|
46538
|
+
children
|
|
46539
|
+
] });
|
|
46540
|
+
};
|
|
46541
|
+
|
|
46446
46542
|
const DynamicComponents = {
|
|
46447
46543
|
DefaultDiv,
|
|
46448
46544
|
antdText: AntdText,
|
|
@@ -46464,7 +46560,8 @@ const DynamicComponents = {
|
|
|
46464
46560
|
EnrichedTable,
|
|
46465
46561
|
PodTerminal,
|
|
46466
46562
|
NodeTerminal,
|
|
46467
|
-
PodLogs
|
|
46563
|
+
PodLogs,
|
|
46564
|
+
YamlEditorSingleton
|
|
46468
46565
|
};
|
|
46469
46566
|
|
|
46470
46567
|
const prepareUrlsToFetchForDynamicRenderer = ({
|
|
@@ -46966,5 +47063,5 @@ const useCrdData = ({
|
|
|
46966
47063
|
});
|
|
46967
47064
|
};
|
|
46968
47065
|
|
|
46969
|
-
export { BackToDefaultIcon, BlackholeForm, BlackholeFormDataProvider, ContentCard$1 as ContentCard, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EditIcon, EnrichedTable$1 as EnrichedTable, EnrichedTableProvider, LockedIcon, ManageableBreadcrumbs, ManageableBreadcrumbsWithDataProvider, ManageableSidebar, ManageableSidebarWithDataProvider, MarketPlace, MarketplaceCard$1 as MarketplaceCard, MinusIcon, NodeTerminal$1 as NodeTerminal, PauseCircleIcon, PlusIcon, PodLogs$1 as PodLogs, PodLogsMonaco, PodTerminal$1 as PodTerminal, ProjectInfoCard$1 as ProjectInfoCard, ResumeCircleIcon, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UnlockedIcon, UpIcon, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getObjectFormItemsDraft, getPrefixSubarrays, getStringByName, getSwagger, groupsToTreeData, isFlatObject, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, usePermissions };
|
|
47066
|
+
export { BackToDefaultIcon, BlackholeForm, BlackholeFormDataProvider, ContentCard$1 as ContentCard, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EditIcon, EnrichedTable$1 as EnrichedTable, EnrichedTableProvider, LockedIcon, ManageableBreadcrumbs, ManageableBreadcrumbsWithDataProvider, ManageableSidebar, ManageableSidebarWithDataProvider, MarketPlace, MarketplaceCard$1 as MarketplaceCard, MinusIcon, NodeTerminal$1 as NodeTerminal, PauseCircleIcon, PlusIcon, PodLogs$1 as PodLogs, PodLogsMonaco, PodTerminal$1 as PodTerminal, ProjectInfoCard$1 as ProjectInfoCard, ResumeCircleIcon, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UnlockedIcon, UpIcon, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getObjectFormItemsDraft, getPrefixSubarrays, getStringByName, getSwagger, groupsToTreeData, isFlatObject, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, usePermissions };
|
|
46970
47067
|
//# sourceMappingURL=openapi-k8s-toolkit.es.js.map
|