@prorobotech/openapi-k8s-toolkit 0.0.1-alpha.53 → 0.0.1-alpha.55

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.
@@ -26341,7 +26341,7 @@ const getEnrichedColumnsWithControls = ({
26341
26341
  );
26342
26342
  },
26343
26343
  icon: editIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(EditOutlined, { size: 14 }),
26344
- disabled: !value.permissions.canUpdate
26344
+ disabled: value.permissions && value.permissions.canUpdate ? value.permissions?.canUpdate : false
26345
26345
  }
26346
26346
  ),
26347
26347
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -26357,7 +26357,7 @@ const getEnrichedColumnsWithControls = ({
26357
26357
  );
26358
26358
  },
26359
26359
  icon: deleteIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteOutlined, { size: 14 }),
26360
- disabled: !value.permissions.canDelete
26360
+ disabled: value.permissions && value.permissions.canDelete ? value.permissions?.canDelete : false
26361
26361
  }
26362
26362
  )
26363
26363
  ] });
@@ -26366,7 +26366,7 @@ const getEnrichedColumnsWithControls = ({
26366
26366
  ];
26367
26367
  };
26368
26368
 
26369
- const EnrichedTable = ({
26369
+ const EnrichedTable$1 = ({
26370
26370
  theme,
26371
26371
  baseprefix,
26372
26372
  dataSource,
@@ -26378,8 +26378,7 @@ const EnrichedTable = ({
26378
26378
  additionalPrinterColumnsColWidths,
26379
26379
  selectData,
26380
26380
  withoutControls = false,
26381
- tableProps,
26382
- maxHeight
26381
+ tableProps
26383
26382
  }) => {
26384
26383
  const navigate = useNavigate();
26385
26384
  if (!columns) {
@@ -26417,15 +26416,15 @@ const EnrichedTable = ({
26417
26416
  {
26418
26417
  dataSource,
26419
26418
  columns: columnsWithControls,
26420
- pagination: maxHeight ? false : {
26419
+ pagination: tableProps?.disablePagination ? false : {
26421
26420
  position: tableProps?.paginationPosition || ["bottomLeft"],
26422
26421
  showSizeChanger: true,
26423
26422
  defaultPageSize: 10,
26424
26423
  hideOnSinglePage: false,
26425
26424
  showTotal
26426
26425
  },
26427
- scroll: { x: maxHeight ? void 0 : "max-content", y: maxHeight },
26428
- virtual: !!maxHeight,
26426
+ scroll: { x: "max-content", y: tableProps?.maxHeight },
26427
+ virtual: tableProps?.virtual,
26429
26428
  rowSelection: selectData ? {
26430
26429
  type: "checkbox",
26431
26430
  columnWidth: 48,
@@ -33385,7 +33384,7 @@ const EnrichedTableProvider = ({
33385
33384
  forceDefaultAdditionalPrinterColumns,
33386
33385
  selectData,
33387
33386
  tableProps,
33388
- maxHeight
33387
+ withoutControls
33389
33388
  }) => {
33390
33389
  const [preparedProps, setPreparedProps] = useState();
33391
33390
  const [isLoading, setIsLoading] = useState(false);
@@ -33422,7 +33421,7 @@ const EnrichedTableProvider = ({
33422
33421
  additionalPrinterColumns: preparedProps.additionalPrinterColumns
33423
33422
  });
33424
33423
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
33425
- EnrichedTable,
33424
+ EnrichedTable$1,
33426
33425
  {
33427
33426
  theme,
33428
33427
  baseprefix,
@@ -33435,7 +33434,7 @@ const EnrichedTableProvider = ({
33435
33434
  additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
33436
33435
  selectData,
33437
33436
  tableProps,
33438
- maxHeight
33437
+ withoutControls
33439
33438
  }
33440
33439
  );
33441
33440
  };
@@ -45245,6 +45244,75 @@ const SidebarProvider = ({
45245
45244
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableSidebarWithDataProvider, { replaceValues, ...props });
45246
45245
  };
45247
45246
 
45247
+ const ThemeContext = createContext("dark");
45248
+ const ThemeProvider = ({ theme, children }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: theme, children });
45249
+ const useTheme = () => {
45250
+ return useContext(ThemeContext);
45251
+ };
45252
+
45253
+ const EnrichedTable = ({
45254
+ data,
45255
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
45256
+ children
45257
+ }) => {
45258
+ const { id, fetchUrl, clusterNamePartOfUrl, ...props } = data;
45259
+ const theme = useTheme();
45260
+ const partsOfUrl = usePartsOfUrl();
45261
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
45262
+ acc[index.toString()] = value;
45263
+ return acc;
45264
+ }, {});
45265
+ const clusterName = prepareTemplate({
45266
+ template: clusterNamePartOfUrl,
45267
+ replaceValues
45268
+ });
45269
+ const fetchUrlPrepared = prepareTemplate({
45270
+ template: fetchUrl,
45271
+ replaceValues
45272
+ });
45273
+ const {
45274
+ data: fetchedData,
45275
+ isLoading: isFetchedDataLoading,
45276
+ error: fetchedDataError
45277
+ } = useDirectUnknownResource({
45278
+ uri: fetchUrlPrepared,
45279
+ queryKey: [fetchUrlPrepared]
45280
+ });
45281
+ if (!fetchedData) {
45282
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No data has been fetched" });
45283
+ }
45284
+ if (isFetchedDataLoading) {
45285
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
45286
+ }
45287
+ if (fetchedDataError) {
45288
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
45289
+ "Error: ",
45290
+ JSON.stringify(fetchedDataError)
45291
+ ] });
45292
+ }
45293
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
45294
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
45295
+ EnrichedTableProvider,
45296
+ {
45297
+ tableMappingsReplaceValues: replaceValues,
45298
+ cluster: clusterName,
45299
+ theme,
45300
+ dataItems: fetchedData.items,
45301
+ tableProps: {
45302
+ borderless: true,
45303
+ paginationPosition: ["bottomRight"],
45304
+ isTotalLeft: true,
45305
+ editIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, {}),
45306
+ deleteIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, {}),
45307
+ disablePagination: true
45308
+ },
45309
+ ...props
45310
+ }
45311
+ ),
45312
+ children
45313
+ ] });
45314
+ };
45315
+
45248
45316
  const DynamicComponents = {
45249
45317
  DefaultDiv,
45250
45318
  antdText: AntdText,
@@ -45262,7 +45330,8 @@ const DynamicComponents = {
45262
45330
  ContentCard,
45263
45331
  Spacer,
45264
45332
  StatusText,
45265
- SidebarProvider
45333
+ SidebarProvider,
45334
+ EnrichedTable
45266
45335
  };
45267
45336
 
45268
45337
  const prepareUrlsToFetchForDynamicRenderer = ({
@@ -45283,12 +45352,12 @@ const prepareUrlsToFetchForDynamicRenderer = ({
45283
45352
 
45284
45353
  const DynamicRendererWithProviders = (props) => {
45285
45354
  const location = useLocation();
45286
- const { urlsToFetch } = props;
45355
+ const { urlsToFetch, theme } = props;
45287
45356
  const preparedUrlsToFetch = prepareUrlsToFetchForDynamicRenderer({
45288
45357
  urls: urlsToFetch,
45289
45358
  locationPathname: location.pathname
45290
45359
  });
45291
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PartsOfUrlProvider, { value: { partsOfUrl: location.pathname.split("/") }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryProvider, { urls: preparedUrlsToFetch, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) }) });
45360
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PartsOfUrlProvider, { value: { partsOfUrl: location.pathname.split("/") }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryProvider, { urls: preparedUrlsToFetch, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) }) }) });
45292
45361
  };
45293
45362
 
45294
45363
  const isLeafNode = (value) => {
@@ -45764,5 +45833,5 @@ const useCrdData = ({
45764
45833
  });
45765
45834
  };
45766
45835
 
45767
- export { BackToDefaultIcon, BlackholeForm, BlackholeFormDataProvider, ContentCard$1 as ContentCard, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EditIcon, EnrichedTable, EnrichedTableProvider, LockedIcon, ManageableBreadcrumbs, ManageableBreadcrumbsWithDataProvider, ManageableSidebar, ManageableSidebarWithDataProvider, MarketPlace, MarketplaceCard$1 as MarketplaceCard, MinusIcon, PlusIcon, ProjectInfoCard$1 as ProjectInfoCard, 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 };
45836
+ 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, PlusIcon, ProjectInfoCard$1 as ProjectInfoCard, 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 };
45768
45837
  //# sourceMappingURL=openapi-k8s-toolkit.es.js.map