@backstage/plugin-kubernetes-react 0.5.5 → 0.5.6-next.1

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/Cluster/Cluster.esm.js +64 -39
  3. package/dist/components/Cluster/Cluster.esm.js.map +1 -1
  4. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js +44 -32
  5. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
  6. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js +20 -17
  7. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
  8. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +149 -100
  9. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
  10. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js +20 -17
  11. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
  12. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js +8 -5
  13. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
  14. package/dist/components/CustomResources/CustomResources.esm.js +8 -7
  15. package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
  16. package/dist/components/CustomResources/DefaultCustomResource.esm.js +41 -39
  17. package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
  18. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js +19 -16
  19. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
  20. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js +59 -43
  21. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
  22. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js +19 -16
  23. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
  24. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js +19 -16
  25. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
  26. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +102 -70
  27. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
  28. package/dist/components/ErrorPanel/ErrorPanel.esm.js +21 -9
  29. package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
  30. package/dist/components/ErrorReporting/ErrorReporting.esm.js +7 -4
  31. package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
  32. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js +6 -5
  33. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
  34. package/dist/components/IngressesAccordions/IngressDrawer.esm.js +19 -16
  35. package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
  36. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js +15 -11
  37. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
  38. package/dist/components/JobsAccordions/JobsAccordions.esm.js +49 -31
  39. package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
  40. package/dist/components/JobsAccordions/JobsDrawer.esm.js +18 -15
  41. package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
  42. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js +40 -31
  43. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
  44. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js +57 -42
  45. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
  46. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js +95 -75
  47. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
  48. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js +36 -32
  49. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
  50. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js +4 -3
  51. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
  52. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js +7 -6
  53. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
  54. package/dist/components/Pods/ErrorList/ErrorList.esm.js +27 -21
  55. package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
  56. package/dist/components/Pods/Events/Events.esm.js +30 -23
  57. package/dist/components/Pods/Events/Events.esm.js.map +1 -1
  58. package/dist/components/Pods/FixDialog/FixDialog.esm.js +85 -51
  59. package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
  60. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js +25 -21
  61. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -1
  62. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +137 -95
  63. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
  64. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js +36 -9
  65. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
  66. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +89 -64
  67. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
  68. package/dist/components/Pods/PodLogs/PodLogs.esm.js +30 -25
  69. package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
  70. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js +6 -6
  71. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
  72. package/dist/components/Pods/PodsTable.esm.js +12 -11
  73. package/dist/components/Pods/PodsTable.esm.js.map +1 -1
  74. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js +24 -15
  75. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
  76. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js +19 -16
  77. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  78. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js +21 -12
  79. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
  80. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js +19 -16
  81. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  82. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +98 -66
  83. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  84. package/dist/hooks/Cluster.esm.js +2 -2
  85. package/dist/hooks/Cluster.esm.js.map +1 -1
  86. package/dist/hooks/GroupedResponses.esm.js +2 -2
  87. package/dist/hooks/GroupedResponses.esm.js.map +1 -1
  88. package/dist/hooks/PodNamesWithErrors.esm.js +2 -2
  89. package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
  90. package/dist/hooks/PodNamesWithMetrics.esm.js +2 -2
  91. package/dist/hooks/PodNamesWithMetrics.esm.js.map +1 -1
  92. package/dist/hooks/useMatchingErrors.esm.js +2 -2
  93. package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
  94. package/dist/hooks/usePodMetrics.esm.js +4 -2
  95. package/dist/hooks/usePodMetrics.esm.js.map +1 -1
  96. package/dist/index.d.ts +47 -46
  97. package/dist/utils/pod.esm.js +25 -15
  98. package/dist/utils/pod.esm.js.map +1 -1
  99. package/package.json +13 -13
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Entity } from '@backstage/catalog-model';
2
2
  import { ObjectsByEntityResponse, CustomResourceMatcher, ClientPodStatus, GroupedResponses, ClusterAttributes, DetectedError, KubernetesRequestBody, WorkloadsByEntityRequest, CustomObjectsByEntityRequest, ClusterObjects, DetectedErrorsByCluster, ClientContainerStatus } from '@backstage/plugin-kubernetes-common';
3
- import * as React from 'react';
4
- import React__default from 'react';
3
+ import * as react from 'react';
4
+ import { ReactNode, FC } from 'react';
5
5
  import { IObjectMeta, IIoK8sApimachineryPkgApisMetaV1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
6
6
  import { TypeMeta } from '@kubernetes-models/base';
7
7
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
@@ -9,6 +9,7 @@ import { OAuthApi, OpenIdConnectApi, DiscoveryApi, FetchApi, ProfileInfoApi } fr
9
9
  import * as kubernetes_models_v1 from 'kubernetes-models/v1';
10
10
  import { Event, Pod, IContainer, IContainerStatus } from 'kubernetes-models/v1';
11
11
  import { JsonObject } from '@backstage/types';
12
+ import * as react_jsx_runtime from 'react/jsx-runtime';
12
13
  import { V2HorizontalPodAutoscaler, V1Job, V1ObjectMeta, V1Pod } from '@kubernetes/client-node';
13
14
  import * as react_use_esm_useAsyncFn from 'react-use/esm/useAsyncFn';
14
15
  import { Pod as Pod$1 } from 'kubernetes-models/v1/Pod';
@@ -38,31 +39,31 @@ declare const useCustomResources: (entity: Entity, customResourceMatchers: Custo
38
39
  /**
39
40
  * @public
40
41
  */
41
- declare const PodNamesWithErrorsContext: React__default.Context<Set<string>>;
42
+ declare const PodNamesWithErrorsContext: react.Context<Set<string>>;
42
43
 
43
44
  /**
44
45
  * @public
45
46
  */
46
- declare const PodNamesWithMetricsContext: React__default.Context<Map<string, ClientPodStatus>>;
47
+ declare const PodNamesWithMetricsContext: react.Context<Map<string, ClientPodStatus>>;
47
48
 
48
49
  /**
49
50
  *
50
51
  *
51
52
  * @public
52
53
  */
53
- declare const GroupedResponsesContext: React__default.Context<GroupedResponses>;
54
+ declare const GroupedResponsesContext: react.Context<GroupedResponses>;
54
55
 
55
56
  /**
56
57
  * @public
57
58
  */
58
- declare const ClusterContext: React__default.Context<ClusterAttributes>;
59
+ declare const ClusterContext: react.Context<ClusterAttributes>;
59
60
 
60
61
  /**
61
62
  * Context for Pod Metrics
62
63
  *
63
64
  * @public
64
65
  */
65
- declare const PodMetricsContext: React__default.Context<Map<string, ClientPodStatus[]>>;
66
+ declare const PodMetricsContext: react.Context<Map<string, ClientPodStatus[]>>;
66
67
  /**
67
68
  * @public
68
69
  */
@@ -81,7 +82,7 @@ declare const usePodMetrics: (clusterName: string, matcher: PodMetricsMatcher) =
81
82
  *
82
83
  * @public
83
84
  */
84
- declare const DetectedErrorsContext: React__default.Context<DetectedError[]>;
85
+ declare const DetectedErrorsContext: react.Context<DetectedError[]>;
85
86
  /**
86
87
  *
87
88
  * @public
@@ -380,14 +381,14 @@ declare function getDefaultFormatters(deps: {
380
381
  type ClusterProps = {
381
382
  clusterObjects: ClusterObjects;
382
383
  podsWithErrors: Set<string>;
383
- children?: React__default.ReactNode;
384
+ children?: ReactNode;
384
385
  };
385
386
  /**
386
387
  * Component for rendering Kubernetes resources in a cluster
387
388
  *
388
389
  * @public
389
390
  */
390
- declare const Cluster: ({ clusterObjects, podsWithErrors }: ClusterProps) => React__default.JSX.Element;
391
+ declare const Cluster: ({ clusterObjects, podsWithErrors }: ClusterProps) => react_jsx_runtime.JSX.Element;
391
392
 
392
393
  /**
393
394
  *
@@ -395,14 +396,14 @@ declare const Cluster: ({ clusterObjects, podsWithErrors }: ClusterProps) => Rea
395
396
  * @public
396
397
  */
397
398
  type CronJobsAccordionsProps = {
398
- children?: React__default.ReactNode;
399
+ children?: ReactNode;
399
400
  };
400
401
  /**
401
402
  *
402
403
  *
403
404
  * @public
404
405
  */
405
- declare const CronJobsAccordions: ({}: CronJobsAccordionsProps) => React__default.JSX.Element;
406
+ declare const CronJobsAccordions: ({}: CronJobsAccordionsProps) => react_jsx_runtime.JSX.Element;
406
407
 
407
408
  /**
408
409
  *
@@ -410,14 +411,14 @@ declare const CronJobsAccordions: ({}: CronJobsAccordionsProps) => React__defaul
410
411
  * @public
411
412
  */
412
413
  interface CustomResourcesProps {
413
- children?: React__default.ReactNode;
414
+ children?: ReactNode;
414
415
  }
415
416
  /**
416
417
  *
417
418
  *
418
419
  * @public
419
420
  */
420
- declare const CustomResources: ({}: CustomResourcesProps) => React__default.JSX.Element;
421
+ declare const CustomResources: ({}: CustomResourcesProps) => react_jsx_runtime.JSX.Element;
421
422
 
422
423
  /**
423
424
  *
@@ -428,14 +429,14 @@ type ErrorPanelProps = {
428
429
  entityName: string;
429
430
  errorMessage?: string;
430
431
  clustersWithErrors?: ClusterObjects[];
431
- children?: React__default.ReactNode;
432
+ children?: ReactNode;
432
433
  };
433
434
  /**
434
435
  *
435
436
  *
436
437
  * @public
437
438
  */
438
- declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: ErrorPanelProps) => React__default.JSX.Element;
439
+ declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: ErrorPanelProps) => react_jsx_runtime.JSX.Element;
439
440
 
440
441
  /**
441
442
  *
@@ -451,14 +452,14 @@ type ErrorReportingProps = {
451
452
  *
452
453
  * @public
453
454
  */
454
- declare const ErrorReporting: ({ detectedErrors, clusters, }: ErrorReportingProps) => React.JSX.Element;
455
+ declare const ErrorReporting: ({ detectedErrors, clusters, }: ErrorReportingProps) => react_jsx_runtime.JSX.Element;
455
456
 
456
457
  /** @public */
457
458
  declare const HorizontalPodAutoscalerDrawer: (props: {
458
459
  hpa: V2HorizontalPodAutoscaler;
459
460
  expanded?: boolean;
460
- children?: React__default.ReactNode;
461
- }) => React__default.JSX.Element;
461
+ children?: ReactNode;
462
+ }) => react_jsx_runtime.JSX.Element;
462
463
 
463
464
  /**
464
465
  *
@@ -471,7 +472,7 @@ type IngressesAccordionsProps = {};
471
472
  *
472
473
  * @public
473
474
  */
474
- declare const IngressesAccordions: ({}: IngressesAccordionsProps) => React__default.JSX.Element;
475
+ declare const IngressesAccordions: ({}: IngressesAccordionsProps) => react_jsx_runtime.JSX.Element;
475
476
 
476
477
  /**
477
478
  *
@@ -480,14 +481,14 @@ declare const IngressesAccordions: ({}: IngressesAccordionsProps) => React__defa
480
481
  */
481
482
  type JobsAccordionsProps = {
482
483
  jobs: V1Job[];
483
- children?: React__default.ReactNode;
484
+ children?: ReactNode;
484
485
  };
485
486
  /**
486
487
  *
487
488
  *
488
489
  * @public
489
490
  */
490
- declare const JobsAccordions: ({ jobs }: JobsAccordionsProps) => React__default.JSX.Element;
491
+ declare const JobsAccordions: ({ jobs }: JobsAccordionsProps) => react_jsx_runtime.JSX.Element;
491
492
 
492
493
  /**
493
494
  *
@@ -497,14 +498,14 @@ declare const JobsAccordions: ({ jobs }: JobsAccordionsProps) => React__default.
497
498
  type LinkErrorPanelProps = {
498
499
  cluster: ClusterAttributes;
499
500
  errorMessage?: string;
500
- children?: React__default.ReactNode;
501
+ children?: ReactNode;
501
502
  };
502
503
  /**
503
504
  *
504
505
  *
505
506
  * @public
506
507
  */
507
- declare const LinkErrorPanel: ({ cluster, errorMessage, }: LinkErrorPanelProps) => React__default.JSX.Element;
508
+ declare const LinkErrorPanel: ({ cluster, errorMessage, }: LinkErrorPanelProps) => react_jsx_runtime.JSX.Element;
508
509
  /**
509
510
  *
510
511
  *
@@ -523,13 +524,13 @@ interface KubernetesStructuredMetadataTableDrawerProps<T extends KubernetesDrawe
523
524
  buttonVariant?: 'h5' | 'subtitle2';
524
525
  kind: string;
525
526
  expanded?: boolean;
526
- children?: React__default.ReactNode;
527
+ children?: ReactNode;
527
528
  }
528
529
  /**
529
530
  *
530
531
  * @public
531
532
  */
532
- declare const KubernetesStructuredMetadataTableDrawer: <T extends KubernetesDrawerable>({ object, renderObject, kind, buttonVariant, expanded, children, }: KubernetesStructuredMetadataTableDrawerProps<T>) => React__default.JSX.Element;
533
+ declare const KubernetesStructuredMetadataTableDrawer: <T extends KubernetesDrawerable>({ object, renderObject, kind, buttonVariant, expanded, children, }: KubernetesStructuredMetadataTableDrawerProps<T>) => react_jsx_runtime.JSX.Element;
533
534
 
534
535
  /**
535
536
  * The type of object that can be represented by the Drawer
@@ -548,16 +549,16 @@ interface KubernetesObject {
548
549
  interface KubernetesDrawerProps {
549
550
  open?: boolean;
550
551
  kubernetesObject: KubernetesObject;
551
- label: React__default.ReactNode;
552
- drawerContentsHeader?: React__default.ReactNode;
553
- children?: React__default.ReactNode;
552
+ label: ReactNode;
553
+ drawerContentsHeader?: ReactNode;
554
+ children?: ReactNode;
554
555
  }
555
556
  /**
556
557
  * Button/Drawer component for Kubernetes Objects
557
558
  *
558
559
  * @public
559
560
  */
560
- declare const KubernetesDrawer: ({ open, label, drawerContentsHeader, kubernetesObject, children, }: KubernetesDrawerProps) => React__default.JSX.Element;
561
+ declare const KubernetesDrawer: ({ open, label, drawerContentsHeader, kubernetesObject, children, }: KubernetesDrawerProps) => react_jsx_runtime.JSX.Element;
561
562
 
562
563
  /**
563
564
  * Props of ManifestYaml
@@ -572,7 +573,7 @@ interface ManifestYamlProps {
572
573
  *
573
574
  * @public
574
575
  */
575
- declare const ManifestYaml: ({ object }: ManifestYamlProps) => React__default.JSX.Element;
576
+ declare const ManifestYaml: ({ object }: ManifestYamlProps) => react_jsx_runtime.JSX.Element;
576
577
 
577
578
  /**
578
579
  * Wraps a pod with the associated detected errors and cluster
@@ -599,7 +600,7 @@ interface PodDrawerProps {
599
600
  *
600
601
  * @public
601
602
  */
602
- declare const PodDrawer: ({ podAndErrors, open }: PodDrawerProps) => React__default.JSX.Element;
603
+ declare const PodDrawer: ({ podAndErrors, open }: PodDrawerProps) => react_jsx_runtime.JSX.Element;
603
604
 
604
605
  /**
605
606
  * Contains the details needed to make a log request to Kubernetes, except the container name
@@ -634,7 +635,7 @@ interface PodLogsProps {
634
635
  *
635
636
  * @public
636
637
  */
637
- declare const PodLogs: React__default.FC<PodLogsProps>;
638
+ declare const PodLogs: FC<PodLogsProps>;
638
639
 
639
640
  /**
640
641
  * Props for PodLogsDialog
@@ -649,7 +650,7 @@ interface PodLogsDialogProps {
649
650
  *
650
651
  * @public
651
652
  */
652
- declare const PodLogsDialog: ({ containerScope }: PodLogsDialogProps) => React__default.JSX.Element;
653
+ declare const PodLogsDialog: ({ containerScope }: PodLogsDialogProps) => react_jsx_runtime.JSX.Element;
653
654
 
654
655
  /**
655
656
  * Arguments for usePodLogs
@@ -685,7 +686,7 @@ interface ContainerCardProps {
685
686
  *
686
687
  * @public
687
688
  */
688
- declare const ContainerCard: React__default.FC<ContainerCardProps>;
689
+ declare const ContainerCard: FC<ContainerCardProps>;
689
690
 
690
691
  /**
691
692
  * Props for PendingPodContent
@@ -700,7 +701,7 @@ interface PendingPodContentProps {
700
701
  *
701
702
  * @public
702
703
  */
703
- declare const PendingPodContent: ({ pod }: PendingPodContentProps) => React__default.JSX.Element;
704
+ declare const PendingPodContent: ({ pod }: PendingPodContentProps) => react_jsx_runtime.JSX.Element;
704
705
 
705
706
  /**
706
707
  * Props for FixDialog
@@ -718,7 +719,7 @@ interface FixDialogProps {
718
719
  *
719
720
  * @public
720
721
  */
721
- declare const FixDialog: React__default.FC<FixDialogProps>;
722
+ declare const FixDialog: FC<FixDialogProps>;
722
723
 
723
724
  /**
724
725
  * Props for Events
@@ -734,7 +735,7 @@ interface EventsContentProps {
734
735
  *
735
736
  * @public
736
737
  */
737
- declare const EventsContent: ({ events, warningEventsOnly, }: EventsContentProps) => React__default.JSX.Element;
738
+ declare const EventsContent: ({ events, warningEventsOnly, }: EventsContentProps) => react_jsx_runtime.JSX.Element;
738
739
  /**
739
740
  * Props for Events
740
741
  *
@@ -751,7 +752,7 @@ interface EventsProps {
751
752
  *
752
753
  * @public
753
754
  */
754
- declare const Events: ({ involvedObjectName, namespace, clusterName, warningEventsOnly, }: EventsProps) => React__default.JSX.Element;
755
+ declare const Events: ({ involvedObjectName, namespace, clusterName, warningEventsOnly, }: EventsProps) => react_jsx_runtime.JSX.Element;
755
756
 
756
757
  /**
757
758
  * Arguments for useEvents
@@ -783,7 +784,7 @@ interface ErrorListProps {
783
784
  *
784
785
  * @public
785
786
  */
786
- declare const ErrorList: ({ podAndErrors }: ErrorListProps) => React__default.JSX.Element;
787
+ declare const ErrorList: ({ podAndErrors }: ErrorListProps) => react_jsx_runtime.JSX.Element;
787
788
 
788
789
  /**
789
790
  *
@@ -811,14 +812,14 @@ type PodColumns = 'READY' | 'RESOURCE';
811
812
  type PodsTablesProps = {
812
813
  pods: Pod$1 | V1Pod[];
813
814
  extraColumns?: PodColumns[];
814
- children?: React__default.ReactNode;
815
+ children?: ReactNode;
815
816
  };
816
817
  /**
817
818
  *
818
819
  *
819
820
  * @public
820
821
  */
821
- declare const PodsTable: ({ pods, extraColumns }: PodsTablesProps) => React__default.JSX.Element;
822
+ declare const PodsTable: ({ pods, extraColumns }: PodsTablesProps) => react_jsx_runtime.JSX.Element;
822
823
 
823
824
  /**
824
825
  *
@@ -831,7 +832,7 @@ type ServicesAccordionsProps = {};
831
832
  *
832
833
  * @public
833
834
  */
834
- declare const ServicesAccordions: ({}: ServicesAccordionsProps) => React__default.JSX.Element;
835
+ declare const ServicesAccordions: ({}: ServicesAccordionsProps) => react_jsx_runtime.JSX.Element;
835
836
 
836
837
  /**
837
838
  * Context for Pod Metrics
@@ -850,7 +851,7 @@ interface ResourceUtilizationProps {
850
851
  *
851
852
  * @public
852
853
  */
853
- declare const ResourceUtilization: ({ compressed, title, usage, total, totalFormatted, }: ResourceUtilizationProps) => React__default.JSX.Element;
854
+ declare const ResourceUtilization: ({ compressed, title, usage, total, totalFormatted, }: ResourceUtilizationProps) => react_jsx_runtime.JSX.Element;
854
855
 
855
856
  /**
856
857
  * Props drilled down to the PodExecTerminal component
@@ -868,13 +869,13 @@ interface PodExecTerminalProps {
868
869
  *
869
870
  * @public
870
871
  */
871
- declare const PodExecTerminal: (props: PodExecTerminalProps) => React__default.JSX.Element;
872
+ declare const PodExecTerminal: (props: PodExecTerminalProps) => react_jsx_runtime.JSX.Element;
872
873
 
873
874
  /**
874
875
  * Opens a terminal connected to the given pod's container in a dialog
875
876
  *
876
877
  * @public
877
878
  */
878
- declare const PodExecTerminalDialog: (props: PodExecTerminalProps) => false | React__default.JSX.Element | undefined;
879
+ declare const PodExecTerminalDialog: (props: PodExecTerminalProps) => false | react_jsx_runtime.JSX.Element | undefined;
879
880
 
880
881
  export { AksClusterLinksFormatter, AksKubernetesAuthProvider, Cluster, ClusterContext, type ClusterLinksFormatter, type ClusterLinksFormatterOptions, type ClusterProps, ContainerCard, type ContainerCardProps, type ContainerScope, CronJobsAccordions, type CronJobsAccordionsProps, CustomResources, type CustomResourcesProps, DEFAULT_FORMATTER_NAME, DetectedErrorsContext, EksClusterLinksFormatter, ErrorList, type ErrorListProps, type ErrorMatcher, ErrorPanel, type ErrorPanelProps, ErrorReporting, type ErrorReportingProps, Events, EventsContent, type EventsContentProps, type EventsOptions, type EventsProps, FixDialog, type FixDialogProps, type FormatClusterLinkOptions, GkeClusterLinksFormatter, GoogleKubernetesAuthProvider, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, type IngressesAccordionsProps, JobsAccordions, type JobsAccordionsProps, type KubernetesApi, type KubernetesAuthProvider, KubernetesAuthProviders, type KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesClusterLinkFormatter, type KubernetesClusterLinkFormatterApi, KubernetesDrawer, type KubernetesDrawerProps, type KubernetesDrawerable, type KubernetesObject, type KubernetesObjects, type KubernetesProxyApi, KubernetesProxyClient, KubernetesStructuredMetadataTableDrawer, type KubernetesStructuredMetadataTableDrawerProps, LinkErrorPanel, type LinkErrorPanelProps, ManifestYaml, type ManifestYamlProps, OidcKubernetesAuthProvider, OpenshiftClusterLinksFormatter, PendingPodContent, type PendingPodContentProps, type PodAndErrors, type PodColumns, PodDrawer, type PodDrawerProps, PodExecTerminal, PodExecTerminalDialog, type PodExecTerminalProps, PodLogs, PodLogsDialog, type PodLogsDialogProps, type PodLogsOptions, type PodLogsProps, PodMetricsContext, type PodMetricsMatcher, PodNamesWithErrorsContext, PodNamesWithMetricsContext, type PodScope, PodsTable, type PodsTablesProps, READY_COLUMNS, RESOURCE_COLUMNS, RancherClusterLinksFormatter, ResourceUtilization, type ResourceUtilizationProps, ServerSideKubernetesAuthProvider, ServicesAccordions, type ServicesAccordionsProps, StandardClusterLinksFormatter, getDefaultFormatters, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesClusterLinkFormatterApiRef, kubernetesProxyApiRef, useCustomResources, useEvents, useKubernetesObjects, useMatchingErrors, usePodLogs, usePodMetrics };
@@ -1,4 +1,5 @@
1
- import React__default, { Fragment } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Fragment } from 'react';
2
3
  import '@material-ui/core/Chip';
3
4
  import { StatusOK, SubvalueCell, StatusError, StatusAborted } from '@backstage/core-components';
4
5
  import { formatMillicores, bytesToMiB } from './resources.esm.js';
@@ -20,13 +21,22 @@ const containerStatuses = (pod) => {
20
21
  }
21
22
  const waiting = next.state.waiting;
22
23
  const terminated = next.state.terminated;
23
- const renderCell = (reason) => /* @__PURE__ */ React__default.createElement(Fragment, { key: `${pod.metadata?.name}-${next.name}` }, /* @__PURE__ */ React__default.createElement(
24
- SubvalueCell,
25
- {
26
- value: reason === "Completed" ? /* @__PURE__ */ React__default.createElement(StatusOK, null, "Container: ", next.name) : /* @__PURE__ */ React__default.createElement(StatusError, null, "Container: ", next.name),
27
- subvalue: reason
28
- }
29
- ), /* @__PURE__ */ React__default.createElement("br", null));
24
+ const renderCell = (reason) => /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsx(
26
+ SubvalueCell,
27
+ {
28
+ value: reason === "Completed" ? /* @__PURE__ */ jsxs(StatusOK, { children: [
29
+ "Container: ",
30
+ next.name
31
+ ] }) : /* @__PURE__ */ jsxs(StatusError, { children: [
32
+ "Container: ",
33
+ next.name
34
+ ] }),
35
+ subvalue: reason
36
+ }
37
+ ),
38
+ /* @__PURE__ */ jsx("br", {})
39
+ ] }, `${pod.metadata?.name}-${next.name}`);
30
40
  if (waiting) {
31
41
  accum.push(renderCell(waiting.reason));
32
42
  }
@@ -36,27 +46,27 @@ const containerStatuses = (pod) => {
36
46
  return accum;
37
47
  }, []);
38
48
  if (errors.length === 0) {
39
- return /* @__PURE__ */ React__default.createElement(StatusOK, null, "OK");
49
+ return /* @__PURE__ */ jsx(StatusOK, { children: "OK" });
40
50
  }
41
51
  return errors;
42
52
  };
43
53
  const renderCondition = (condition) => {
44
54
  const status = condition.status;
45
55
  if (status === "True") {
46
- return [condition.type, /* @__PURE__ */ React__default.createElement(StatusOK, null, "True")];
56
+ return [condition.type, /* @__PURE__ */ jsx(StatusOK, { children: "True" })];
47
57
  } else if (status === "False") {
48
58
  return [
49
59
  condition.type,
50
- /* @__PURE__ */ React__default.createElement(
60
+ /* @__PURE__ */ jsx(
51
61
  SubvalueCell,
52
62
  {
53
- value: /* @__PURE__ */ React__default.createElement(StatusError, null, "False"),
63
+ value: /* @__PURE__ */ jsx(StatusError, { children: "False" }),
54
64
  subvalue: condition.message ?? ""
55
65
  }
56
66
  )
57
67
  ];
58
68
  }
59
- return [condition.type, /* @__PURE__ */ React__default.createElement(StatusAborted, null)];
69
+ return [condition.type, /* @__PURE__ */ jsx(StatusAborted, {})];
60
70
  };
61
71
  const currentToDeclaredResourceToPerc = (current, resource) => {
62
72
  if (Number(resource) === 0) return `0%`;
@@ -77,7 +87,7 @@ const podStatusToCpuUtil = (podStatus) => {
77
87
  if (typeof cpuUtil.currentUsage === "number") {
78
88
  currentUsage = cpuUtil.currentUsage / 10;
79
89
  }
80
- return /* @__PURE__ */ React__default.createElement(
90
+ return /* @__PURE__ */ jsx(
81
91
  SubvalueCell,
82
92
  {
83
93
  value: `requests: ${currentToDeclaredResourceToPerc(
@@ -93,7 +103,7 @@ const podStatusToCpuUtil = (podStatus) => {
93
103
  };
94
104
  const podStatusToMemoryUtil = (podStatus) => {
95
105
  const memUtil = podStatus.memory;
96
- return /* @__PURE__ */ React__default.createElement(
106
+ return /* @__PURE__ */ jsx(
97
107
  SubvalueCell,
98
108
  {
99
109
  value: `requests: ${currentToDeclaredResourceToPerc(
@@ -1 +1 @@
1
- {"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport React, { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as React.ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses","React"],"mappings":";;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA;AAC3D;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI,GAAA,CAAA,CAAE,cAAc,CAAC,CAAA;AAClE;AAEa,MAAA,iBAAA,GAAoB,CAAC,GAAwB,KAAA;AACxD,EAAA,MAAM,qBAAwB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAChE,EAAA,MAAM,MAAS,GAAA,qBAAA,CAAsB,MAAO,CAAA,CAAC,OAAO,IAAS,KAAA;AAC3D,IAAI,IAAA,IAAA,CAAK,UAAU,KAAW,CAAA,EAAA;AAC5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"}
1
+ {"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses"],"mappings":";;;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA;AAC3D;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI,GAAA,CAAA,CAAE,cAAc,CAAC,CAAA;AAClE;AAEa,MAAA,iBAAA,GAAoB,CAAC,GAAwB,KAAA;AACxD,EAAA,MAAM,qBAAwB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAChE,EAAA,MAAM,MAAS,GAAA,qBAAA,CAAsB,MAAO,CAAA,CAAC,OAAO,IAAS,KAAA;AAC3D,IAAI,IAAA,IAAA,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+1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes-react",
3
- "version": "0.5.5",
3
+ "version": "0.5.6-next.1",
4
4
  "description": "Web library for the kubernetes-react plugin",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -40,11 +40,11 @@
40
40
  "types": "./dist/index.d.ts",
41
41
  "typesVersions": {
42
42
  "*": {
43
- "*": [
44
- "dist/index.d.ts"
45
- ],
46
43
  "alpha": [
47
44
  "dist/alpha.d.ts"
45
+ ],
46
+ "package.json": [
47
+ "package.json"
48
48
  ]
49
49
  }
50
50
  },
@@ -62,12 +62,12 @@
62
62
  "test": "backstage-cli package test"
63
63
  },
64
64
  "dependencies": {
65
- "@backstage/catalog-model": "^1.7.3",
66
- "@backstage/core-components": "^0.17.0",
67
- "@backstage/core-plugin-api": "^1.10.5",
68
- "@backstage/errors": "^1.2.7",
69
- "@backstage/plugin-kubernetes-common": "^0.9.4",
70
- "@backstage/types": "^1.2.1",
65
+ "@backstage/catalog-model": "1.7.3",
66
+ "@backstage/core-components": "0.17.1-next.1",
67
+ "@backstage/core-plugin-api": "1.10.6-next.0",
68
+ "@backstage/errors": "1.2.7",
69
+ "@backstage/plugin-kubernetes-common": "0.9.4",
70
+ "@backstage/types": "1.2.1",
71
71
  "@kubernetes-models/apimachinery": "^2.0.0",
72
72
  "@kubernetes-models/base": "^5.0.0",
73
73
  "@kubernetes/client-node": "1.0.0-rc7",
@@ -85,9 +85,9 @@
85
85
  "xterm-addon-fit": "^0.8.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@backstage/cli": "^0.31.0",
89
- "@backstage/core-app-api": "^1.16.0",
90
- "@backstage/test-utils": "^1.7.6",
88
+ "@backstage/cli": "0.32.0-next.2",
89
+ "@backstage/core-app-api": "1.16.1-next.0",
90
+ "@backstage/test-utils": "1.7.7-next.0",
91
91
  "@testing-library/jest-dom": "^6.0.0",
92
92
  "@testing-library/react": "^16.0.0",
93
93
  "@types/react": "^18.0.0",