@kyverno/backstage-plugin-policy-reporter 2.6.0 → 2.8.0

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 (57) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/alpha/plugin.esm.js +70 -0
  3. package/dist/alpha/plugin.esm.js.map +1 -0
  4. package/dist/alpha.d.ts +129 -0
  5. package/dist/alpha.esm.js +2 -0
  6. package/dist/alpha.esm.js.map +1 -0
  7. package/dist/api/PolicyReporterClient.esm.js.map +1 -1
  8. package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js +48 -80
  9. package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js.map +1 -1
  10. package/dist/components/EntityCustomPoliciesContent/index.esm.js +5 -1
  11. package/dist/components/EntityCustomPoliciesContent/index.esm.js.map +1 -1
  12. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js +48 -80
  13. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js.map +1 -1
  14. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js +5 -1
  15. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js.map +1 -1
  16. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js +1 -1
  17. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js.map +1 -1
  18. package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js +1 -1
  19. package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js.map +1 -1
  20. package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js +41 -64
  21. package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js.map +1 -1
  22. package/dist/components/PolicyReportsPage/index.esm.js +5 -1
  23. package/dist/components/PolicyReportsPage/index.esm.js.map +1 -1
  24. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js +85 -111
  25. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js.map +1 -1
  26. package/dist/components/SearchField/SearchField.esm.js +33 -0
  27. package/dist/components/SearchField/SearchField.esm.js.map +1 -0
  28. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js +22 -41
  29. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js.map +1 -1
  30. package/dist/components/SelectNamespace/SelectNamespace.esm.js +35 -45
  31. package/dist/components/SelectNamespace/SelectNamespace.esm.js.map +1 -1
  32. package/dist/components/SelectSeverity/SelectSeverity.esm.js +40 -51
  33. package/dist/components/SelectSeverity/SelectSeverity.esm.js.map +1 -1
  34. package/dist/components/SelectStatus/SelectStatus.esm.js +40 -51
  35. package/dist/components/SelectStatus/SelectStatus.esm.js.map +1 -1
  36. package/dist/components/SeverityComponent/SeverityComponent.esm.js +11 -35
  37. package/dist/components/SeverityComponent/SeverityComponent.esm.js.map +1 -1
  38. package/dist/components/StatusComponent/StatusComponent.esm.js.map +1 -1
  39. package/dist/hooks/useEntityEnvironment.esm.js +1 -9
  40. package/dist/hooks/useEntityEnvironment.esm.js.map +1 -1
  41. package/dist/hooks/useEnvironments.esm.js +17 -30
  42. package/dist/hooks/useEnvironments.esm.js.map +1 -1
  43. package/dist/hooks/useNamespaces.esm.js +4 -4
  44. package/dist/hooks/useNamespaces.esm.js.map +1 -1
  45. package/dist/hooks/usePolicyReportsFilters.esm.js +90 -0
  46. package/dist/hooks/usePolicyReportsFilters.esm.js.map +1 -0
  47. package/dist/index.d.ts +1 -1
  48. package/dist/package.json.esm.js +110 -0
  49. package/dist/package.json.esm.js.map +1 -0
  50. package/dist/plugin.esm.js +1 -1
  51. package/dist/plugin.esm.js.map +1 -1
  52. package/dist/routes.esm.js.map +1 -1
  53. package/dist/utils/annotations.esm.js +1 -1
  54. package/dist/utils/annotations.esm.js.map +1 -1
  55. package/package.json +46 -21
  56. package/dist/hooks/usePaginatedPolicies.esm.js +0 -51
  57. package/dist/hooks/usePaginatedPolicies.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @kyverno/backstage-plugin-policy-reporter
2
2
 
3
+ ## 2.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d9f5bd3: Filter state (search, namespace, severity, and status) is now managed via URL query params, making filter selections shareable and persistent across page refreshes.
8
+ - ba911d8: Entity content pages (`EntityKyvernoPoliciesContent`, `EntityCustomPoliciesContent`) now show filters for status and severity, consistent with the `PolicyReportsPage`.
9
+ - d058bc7: Migrated several components to the new Backstage UI (BUI) components, replacing legacy MUI-based implementations:
10
+
11
+ - `PolicyReportsPage`, `EntityKyvernoPoliciesContent`, and `EntityCustomPoliciesContent` now use BUI `Grid`, `Container`, and `HeaderPage` for layout.
12
+ - Filter selectors (`SelectEnvironment`, `SelectNamespace`, `SelectSeverity`, `SelectStatus`) now use the BUI `Select` component.
13
+ - Severity badges now use the BUI `Tag` and `TagGroup` components instead of MUI chips.
14
+
15
+ - be6bff2: Entity content pages (`EntityKyvernoPoliciesContent`, `EntityCustomPoliciesContent`) now display a single unified table instead of separate tables for failing/passing/skipped policies, aligning with the `PolicyReportsPage`.
16
+
17
+ Search state is now managed via URL query params, making search results shareable and persistent across page refreshes.
18
+
19
+ Migrated table component to the new Backstage UI (BUI) components.
20
+
21
+ - e0e8462: Backstage verion bump to v1.50.4
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [e0e8462]
26
+ - @kyverno/backstage-plugin-policy-reporter-common@2.4.0
27
+
28
+ ## 2.7.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 4b09f8c: Backstage verion bump to v1.48.5
33
+ - c4e5ae4: Add initial support for the new Frontend System, this will be available under a `/alpha` route when importing packages.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [4b09f8c]
38
+ - @kyverno/backstage-plugin-policy-reporter-common@2.3.0
39
+
3
40
  ## 2.6.0
4
41
 
5
42
  ### Minor Changes
@@ -0,0 +1,70 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { ApiBlueprint, fetchApiRef, discoveryApiRef, PageBlueprint, SubPageBlueprint, createRouteRef, createFrontendPlugin } from '@backstage/frontend-plugin-api';
3
+ import { rootRouteRef } from '../routes.esm.js';
4
+ import { policyReporterApiRef } from '../api/PolicyReporterClient.esm.js';
5
+ import { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';
6
+ import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
7
+ import { isPolicyReporterAvailable } from '../utils/annotations.esm.js';
8
+ import PolicyIcon from '@material-ui/icons/Policy';
9
+
10
+ const policyReporterApi = ApiBlueprint.make({
11
+ params: (defineParams) => defineParams({
12
+ api: policyReporterApiRef,
13
+ deps: {
14
+ discoveryApi: discoveryApiRef,
15
+ fetchApi: fetchApiRef
16
+ },
17
+ factory: ({ discoveryApi, fetchApi }) => new DefaultApiClient({ discoveryApi, fetchApi })
18
+ })
19
+ });
20
+ const policyReporterPage = PageBlueprint.make({
21
+ params: {
22
+ path: "/policy-reporter",
23
+ routeRef: rootRouteRef,
24
+ title: "Policy Reporter",
25
+ icon: /* @__PURE__ */ jsx(PolicyIcon, {})
26
+ }
27
+ });
28
+ const policyReporterNamespacedPoliciesPage = SubPageBlueprint.make({
29
+ name: "namespaced-policy",
30
+ params: {
31
+ path: "namespaced-policies",
32
+ routeRef: createRouteRef(),
33
+ // TODO: Support configuration of the actual component
34
+ title: "Namespaced Policies",
35
+ loader: () => (
36
+ // TODO: Create dedicated PolicyReporterNamespacedPoliciesPage Component
37
+ import('../components/PolicyReportsPage/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.PolicyReportsPage, {}))
38
+ )
39
+ }
40
+ });
41
+ const policyReporterEntityContent = EntityContentBlueprint.make({
42
+ name: "policy-reporter",
43
+ params: {
44
+ path: "/policy-reporter",
45
+ title: "Policy Reporter",
46
+ // TODO: Support configuration of the actual component
47
+ filter: isPolicyReporterAvailable,
48
+ loader: () => (
49
+ // TODO: Create dedicated EntityPolicyReporterContent component as replacement for Kyverno and Custom content components
50
+ import('../components/EntityKyvernoPoliciesContent/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.EntityKyvernoPoliciesContent, {}))
51
+ )
52
+ }
53
+ });
54
+ var plugin = createFrontendPlugin({
55
+ pluginId: "policy-reporter",
56
+ title: "Policy Reporter",
57
+ info: { packageJson: () => import('../package.json.esm.js') },
58
+ routes: {
59
+ root: rootRouteRef
60
+ },
61
+ extensions: [
62
+ policyReporterApi,
63
+ policyReporterEntityContent,
64
+ policyReporterPage,
65
+ policyReporterNamespacedPoliciesPage
66
+ ]
67
+ });
68
+
69
+ export { plugin as default, policyReporterApi };
70
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["import {\n ApiBlueprint,\n createFrontendPlugin,\n createRouteRef,\n discoveryApiRef,\n fetchApiRef,\n PageBlueprint,\n SubPageBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport { rootRouteRef } from '../routes';\nimport { policyReporterApiRef } from '../api';\nimport { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';\n\nimport { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isPolicyReporterAvailable } from '../utils/annotations';\nimport PolicyIcon from '@material-ui/icons/Policy';\n\n/** @alpha */\nexport const policyReporterApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: policyReporterApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new DefaultApiClient({ discoveryApi, fetchApi }),\n }),\n});\n\n/** @alpha */\nconst policyReporterPage = PageBlueprint.make({\n params: {\n path: '/policy-reporter',\n routeRef: rootRouteRef,\n title: 'Policy Reporter',\n icon: <PolicyIcon />,\n },\n});\n\n/** @alpha */\nconst policyReporterNamespacedPoliciesPage = SubPageBlueprint.make({\n name: 'namespaced-policy',\n params: {\n path: 'namespaced-policies',\n routeRef: createRouteRef(),\n // TODO: Support configuration of the actual component\n title: 'Namespaced Policies',\n loader: () =>\n // TODO: Create dedicated PolicyReporterNamespacedPoliciesPage Component\n import('../components/PolicyReportsPage/').then(m => (\n <m.PolicyReportsPage /> // TODO: Update the PolicyReportsPage to be only used for old frontend system to mimic PageBlueprint from NFS\n )),\n },\n});\n\n/** @alpha */\nconst policyReporterEntityContent = EntityContentBlueprint.make({\n name: 'policy-reporter',\n params: {\n path: '/policy-reporter',\n title: 'Policy Reporter',\n // TODO: Support configuration of the actual component\n filter: isPolicyReporterAvailable,\n loader: () =>\n // TODO: Create dedicated EntityPolicyReporterContent component as replacement for Kyverno and Custom content components\n import('../components/EntityKyvernoPoliciesContent/').then(m => (\n <m.EntityKyvernoPoliciesContent />\n )),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'policy-reporter',\n title: 'Policy Reporter',\n info: { packageJson: () => import('../../package.json') },\n routes: {\n root: rootRouteRef,\n },\n extensions: [\n policyReporterApi,\n policyReporterEntityContent,\n policyReporterPage,\n policyReporterNamespacedPoliciesPage,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;AAmBO,MAAM,iBAAA,GAAoB,aAAa,IAAA,CAAK;AAAA,EACjD,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,oBAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,gBAAA,CAAiB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,GAClD;AACL,CAAC;AAGD,MAAM,kBAAA,GAAqB,cAAc,IAAA,CAAK;AAAA,EAC5C,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,kBAAA;AAAA,IACN,QAAA,EAAU,YAAA;AAAA,IACV,KAAA,EAAO,iBAAA;AAAA,IACP,IAAA,sBAAO,UAAA,EAAA,EAAW;AAAA;AAEtB,CAAC,CAAA;AAGD,MAAM,oCAAA,GAAuC,iBAAiB,IAAA,CAAK;AAAA,EACjE,IAAA,EAAM,mBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,qBAAA;AAAA,IACN,UAAU,cAAA,EAAe;AAAA;AAAA,IAEzB,KAAA,EAAO,qBAAA;AAAA,IACP,MAAA,EAAQ;AAAA;AAAA,MAEN,OAAO,8CAAkC,CAAA,CAAE,IAAA,CAAK,uBAC9C,GAAA,CAAC,CAAA,CAAE,iBAAA,EAAF,EAAoB,CACtB;AAAA;AAAA;AAEP,CAAC,CAAA;AAGD,MAAM,2BAAA,GAA8B,uBAAuB,IAAA,CAAK;AAAA,EAC9D,IAAA,EAAM,iBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,kBAAA;AAAA,IACN,KAAA,EAAO,iBAAA;AAAA;AAAA,IAEP,MAAA,EAAQ,yBAAA;AAAA,IACR,MAAA,EAAQ;AAAA;AAAA,MAEN,OAAO,yDAA6C,CAAA,CAAE,IAAA,CAAK,uBACzD,GAAA,CAAC,CAAA,CAAE,4BAAA,EAAF,EAA+B,CACjC;AAAA;AAAA;AAEP,CAAC,CAAA;AAGD,aAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,iBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,wBAAoB,CAAA,EAAE;AAAA,EACxD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,UAAA,EAAY;AAAA,IACV,iBAAA;AAAA,IACA,2BAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
@@ -0,0 +1,129 @@
1
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
2
+ import * as react from 'react';
3
+ import * as _backstage_filter_predicates from '@backstage/filter-predicates';
4
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
5
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
+
7
+ /** @alpha */
8
+ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{
9
+ root: _backstage_core_plugin_api.RouteRef<undefined>;
10
+ }, {}, {
11
+ "api:policy-reporter": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
12
+ kind: "api";
13
+ name: undefined;
14
+ config: {};
15
+ configInput: {};
16
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
17
+ inputs: {};
18
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
19
+ }>;
20
+ "entity-content:policy-reporter/policy-reporter": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
21
+ kind: "entity-content";
22
+ name: "policy-reporter";
23
+ config: {
24
+ path: string | undefined;
25
+ title: string | undefined;
26
+ filter: _backstage_filter_predicates.FilterPredicate | undefined;
27
+ group: string | false | undefined;
28
+ icon: string | undefined;
29
+ };
30
+ configInput: {
31
+ path?: string | undefined;
32
+ title?: string | undefined;
33
+ filter?: _backstage_filter_predicates.FilterPredicate | undefined;
34
+ group?: string | false | undefined;
35
+ icon?: string | undefined;
36
+ };
37
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
38
+ optional: true;
39
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
40
+ optional: true;
41
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
42
+ optional: true;
43
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-group", {
44
+ optional: true;
45
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string | react.ReactElement<any, string | react.JSXElementConstructor<any>>, "catalog.entity-content-icon", {
46
+ optional: true;
47
+ }>;
48
+ inputs: {};
49
+ params: {
50
+ defaultPath?: [Error: `Use the 'path' param instead`];
51
+ path: string;
52
+ defaultTitle?: [Error: `Use the 'title' param instead`];
53
+ title: string;
54
+ defaultGroup?: [Error: `Use the 'group' param instead`];
55
+ group?: ("overview" | "documentation" | "development" | "deployment" | "operation" | "observability") | (string & {});
56
+ icon?: string | react.ReactElement;
57
+ loader: () => Promise<JSX.Element>;
58
+ routeRef?: _backstage_frontend_plugin_api.RouteRef;
59
+ filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
60
+ };
61
+ }>;
62
+ "page:policy-reporter": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
63
+ kind: "page";
64
+ name: undefined;
65
+ config: {
66
+ path: string | undefined;
67
+ title: string | undefined;
68
+ };
69
+ configInput: {
70
+ path?: string | undefined;
71
+ title?: string | undefined;
72
+ };
73
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
74
+ optional: true;
75
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {
76
+ optional: true;
77
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
78
+ optional: true;
79
+ }>;
80
+ inputs: {
81
+ pages: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
82
+ optional: true;
83
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.title", {
84
+ optional: true;
85
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
86
+ optional: true;
87
+ }>, {
88
+ singleton: false;
89
+ optional: false;
90
+ internal: false;
91
+ }>;
92
+ };
93
+ params: {
94
+ path: string;
95
+ title?: string;
96
+ icon?: _backstage_frontend_plugin_api.IconElement;
97
+ loader?: () => Promise<react.JSX.Element>;
98
+ routeRef?: _backstage_frontend_plugin_api.RouteRef;
99
+ noHeader?: boolean;
100
+ };
101
+ }>;
102
+ "sub-page:policy-reporter/namespaced-policy": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
103
+ kind: "sub-page";
104
+ name: "namespaced-policy";
105
+ config: {
106
+ path: string | undefined;
107
+ title: string | undefined;
108
+ };
109
+ configInput: {
110
+ path?: string | undefined;
111
+ title?: string | undefined;
112
+ };
113
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
114
+ optional: true;
115
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
116
+ optional: true;
117
+ }>;
118
+ inputs: {};
119
+ params: {
120
+ path: string;
121
+ title: string;
122
+ icon?: _backstage_frontend_plugin_api.IconElement;
123
+ loader: () => Promise<JSX.Element>;
124
+ routeRef?: _backstage_frontend_plugin_api.RouteRef;
125
+ };
126
+ }>;
127
+ }>;
128
+
129
+ export { _default as default };
@@ -0,0 +1,2 @@
1
+ export { default } from './alpha/plugin.esm.js';
2
+ //# sourceMappingURL=alpha.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"PolicyReporterClient.esm.js","sources":["../../src/api/PolicyReporterClient.ts"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\nimport { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';\n\nexport const policyReporterApiRef = createApiRef<DefaultApiClient>({\n id: 'plugin.policy-reporter.service',\n});\n"],"names":[],"mappings":";;AAGO,MAAM,uBAAuB,YAA+B,CAAA;AAAA,EACjE,EAAI,EAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"PolicyReporterClient.esm.js","sources":["../../src/api/PolicyReporterClient.ts"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\nimport { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';\n\nexport const policyReporterApiRef = createApiRef<DefaultApiClient>({\n id: 'plugin.policy-reporter.service',\n});\n"],"names":[],"mappings":";;AAGO,MAAM,uBAAuB,YAAA,CAA+B;AAAA,EACjE,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -1,15 +1,17 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Progress, ContentHeader, Page, Content } from '@backstage/core-components';
2
+ import { Content, Progress } from '@backstage/core-components';
3
3
  import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
4
- import { Grid } from '@material-ui/core';
4
+ import { Container, Header, Grid, Flex } from '@backstage/ui';
5
5
  import { PolicyReportsTable } from '../PolicyReportsTable/PolicyReportsTable.esm.js';
6
6
  import { SelectEnvironment } from '../SelectEnvironment/SelectEnvironment.esm.js';
7
- import { isPolicyReporterAvailable, getNamespaces, getKinds, getResourceName } from '../../utils/annotations.esm.js';
7
+ import { isPolicyReporterAvailable, getResourceName, getKinds, getNamespaces } from '../../utils/annotations.esm.js';
8
8
  import { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js';
9
9
  import { useEntityEnvironment } from '../../hooks/useEntityEnvironment.esm.js';
10
+ import { PolicyReportsFiltersProvider } from '../../hooks/usePolicyReportsFilters.esm.js';
10
11
  import { KYVERNO_RESOURCE_NAME_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';
12
+ import { SelectStatus } from '../SelectStatus/SelectStatus.esm.js';
13
+ import { SelectSeverity } from '../SelectSeverity/SelectSeverity.esm.js';
11
14
 
12
- const PageContent = ({ children }) => /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children }) });
13
15
  const EntityCustomPoliciesContent = ({
14
16
  annotationsDocumentationUrl,
15
17
  policyDocumentationUrl,
@@ -19,89 +21,55 @@ const EntityCustomPoliciesContent = ({
19
21
  const { entity } = useEntity();
20
22
  const annotations = entity.metadata.annotations;
21
23
  const annotationsState = isPolicyReporterAvailable(entity);
22
- const {
23
- environments,
24
- environmentsLoading,
25
- setCurrentEnvironment,
26
- currentEnvironment
27
- } = useEntityEnvironment(entity, annotationsState);
24
+ const { environments, environmentsLoading } = useEntityEnvironment(
25
+ entity,
26
+ annotationsState
27
+ );
28
28
  if (!annotationsState)
29
- return /* @__PURE__ */ jsx(PageContent, { children: /* @__PURE__ */ jsx(
29
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
30
30
  MissingAnnotationEmptyState,
31
31
  {
32
32
  readMoreUrl: annotationsDocumentationUrl,
33
33
  annotation: KYVERNO_RESOURCE_NAME_ANNOTATION
34
34
  }
35
- ) });
35
+ ) }) });
36
36
  if (environmentsLoading) return /* @__PURE__ */ jsx(Progress, {});
37
- if (environments === void 0 || !currentEnvironment)
38
- return /* @__PURE__ */ jsx(PageContent, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) });
39
- const namespaces = getNamespaces(annotations);
40
- const kinds = getKinds(annotations);
41
- const resourceName = getResourceName(annotations);
42
- return /* @__PURE__ */ jsxs(PageContent, { children: [
43
- /* @__PURE__ */ jsx(ContentHeader, { title, children: /* @__PURE__ */ jsx(
44
- SelectEnvironment,
45
- {
46
- environments,
47
- currentEnvironment,
48
- setCurrentEnvironment
49
- }
50
- ) }),
51
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
52
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
53
- PolicyReportsTable,
54
- {
55
- currentEnvironment,
56
- filter: {
57
- namespaces,
58
- sources,
59
- kinds,
60
- status: ["fail", "warn", "error"],
61
- search: resourceName
62
- },
63
- title: "Failing Policy Results",
64
- emptyContentText: "No failing policies",
65
- policyDocumentationUrl,
66
- enableSearch: false
67
- }
68
- ) }),
69
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
70
- PolicyReportsTable,
71
- {
72
- currentEnvironment,
73
- filter: {
74
- namespaces,
75
- sources,
76
- kinds,
77
- status: ["pass"],
78
- search: resourceName
79
- },
80
- title: "Passing Policy Results",
81
- emptyContentText: "No passing policies",
82
- policyDocumentationUrl,
83
- enableSearch: false
84
- }
85
- ) }),
86
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
87
- PolicyReportsTable,
88
- {
89
- currentEnvironment,
90
- filter: {
91
- namespaces,
92
- sources,
93
- kinds,
94
- status: ["skip"],
95
- search: resourceName
96
- },
97
- title: "Skipped Policy Results",
98
- emptyContentText: "No skipped policies",
99
- policyDocumentationUrl,
100
- enableSearch: false
101
- }
102
- ) })
103
- ] })
104
- ] });
37
+ if (!environments?.length)
38
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) }) });
39
+ return /* @__PURE__ */ jsx(
40
+ PolicyReportsFiltersProvider,
41
+ {
42
+ defaultFilters: {
43
+ namespaces: getNamespaces(annotations),
44
+ kinds: getKinds(annotations),
45
+ sources,
46
+ search: getResourceName(annotations)
47
+ },
48
+ defaultEnvironment: environments[0].entityRef,
49
+ children: /* @__PURE__ */ jsxs(Container, { children: [
50
+ /* @__PURE__ */ jsx(
51
+ Header,
52
+ {
53
+ title,
54
+ customActions: /* @__PURE__ */ jsx(SelectEnvironment, { environments })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Grid.Root, { columns: "1", gap: "4", children: [
58
+ /* @__PURE__ */ jsxs(Flex, { align: "end", gap: "4", children: [
59
+ /* @__PURE__ */ jsx(SelectStatus, {}),
60
+ /* @__PURE__ */ jsx(SelectSeverity, {})
61
+ ] }),
62
+ /* @__PURE__ */ jsx(
63
+ PolicyReportsTable,
64
+ {
65
+ emptyContentText: "No policies",
66
+ policyDocumentationUrl
67
+ }
68
+ )
69
+ ] }) })
70
+ ] })
71
+ }
72
+ );
105
73
  };
106
74
 
107
75
  export { EntityCustomPoliciesContent };
@@ -1 +1 @@
1
- {"version":3,"file":"EntityCustomPoliciesContent.esm.js","sources":["../../../src/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.tsx"],"sourcesContent":["import {\n Content,\n ContentHeader,\n Page,\n Progress,\n} from '@backstage/core-components';\nimport {\n MissingAnnotationEmptyState,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { Grid } from '@material-ui/core';\nimport { PolicyReportsTable } from '../PolicyReportsTable';\nimport { SelectEnvironment } from '../SelectEnvironment';\nimport {\n getKinds,\n getNamespaces,\n getResourceName,\n isPolicyReporterAvailable,\n} from '../../utils/annotations';\nimport { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState';\nimport { useEntityEnvironment } from '../../hooks/useEntityEnvironment';\nimport { KYVERNO_RESOURCE_NAME_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';\n\ntype EntityCustomPoliciesContentProps = {\n annotationsDocumentationUrl?: string;\n policyDocumentationUrl?: string;\n sources: string[];\n title: string;\n};\n\ntype PageContentProps = {\n children: React.ReactNode;\n};\n\nconst PageContent = ({ children }: PageContentProps) => (\n <Page themeId=\"tool\">\n <Content>{children}</Content>\n </Page>\n);\n\nexport const EntityCustomPoliciesContent = ({\n annotationsDocumentationUrl,\n policyDocumentationUrl,\n sources,\n title,\n}: EntityCustomPoliciesContentProps) => {\n const { entity } = useEntity();\n const annotations = entity.metadata.annotations;\n\n const annotationsState = isPolicyReporterAvailable(entity);\n\n const {\n environments,\n environmentsLoading,\n setCurrentEnvironment,\n currentEnvironment,\n } = useEntityEnvironment(entity, annotationsState);\n\n // Annotations missing\n if (!annotationsState)\n return (\n <PageContent>\n <MissingAnnotationEmptyState\n readMoreUrl={annotationsDocumentationUrl}\n annotation={KYVERNO_RESOURCE_NAME_ANNOTATION}\n />\n </PageContent>\n );\n\n // Fetching environments\n if (environmentsLoading) return <Progress />;\n\n // Environments missing\n if (environments === undefined || !currentEnvironment)\n return (\n <PageContent>\n <MissingEnvironmentsEmptyState entity={entity} />\n </PageContent>\n );\n\n const namespaces = getNamespaces(annotations);\n const kinds = getKinds(annotations);\n const resourceName = getResourceName(annotations);\n\n return (\n <PageContent>\n <ContentHeader title={title}>\n <SelectEnvironment\n environments={environments}\n currentEnvironment={currentEnvironment}\n setCurrentEnvironment={setCurrentEnvironment}\n />\n </ContentHeader>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <PolicyReportsTable\n currentEnvironment={currentEnvironment}\n filter={{\n namespaces,\n sources,\n kinds,\n status: ['fail', 'warn', 'error'],\n search: resourceName,\n }}\n title=\"Failing Policy Results\"\n emptyContentText=\"No failing policies\"\n policyDocumentationUrl={policyDocumentationUrl}\n enableSearch={false}\n />\n </Grid>\n <Grid item xs={12}>\n <PolicyReportsTable\n currentEnvironment={currentEnvironment}\n filter={{\n namespaces,\n sources,\n kinds,\n status: ['pass'],\n search: resourceName,\n }}\n title=\"Passing Policy Results\"\n emptyContentText=\"No passing policies\"\n policyDocumentationUrl={policyDocumentationUrl}\n enableSearch={false}\n />\n </Grid>\n <Grid item xs={12}>\n <PolicyReportsTable\n currentEnvironment={currentEnvironment}\n filter={{\n namespaces,\n sources,\n kinds,\n status: ['skip'],\n search: resourceName,\n }}\n title=\"Skipped Policy Results\"\n emptyContentText=\"No skipped policies\"\n policyDocumentationUrl={policyDocumentationUrl}\n enableSearch={false}\n />\n </Grid>\n </Grid>\n </PageContent>\n );\n};\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"EntityCustomPoliciesContent.esm.js","sources":["../../../src/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.tsx"],"sourcesContent":["import { Content, Progress } from '@backstage/core-components';\nimport {\n MissingAnnotationEmptyState,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { Container, Flex, Grid, Header } from '@backstage/ui';\nimport { PolicyReportsTable } from '../PolicyReportsTable';\nimport { SelectEnvironment } from '../SelectEnvironment';\nimport {\n getKinds,\n getNamespaces,\n getResourceName,\n isPolicyReporterAvailable,\n} from '../../utils/annotations';\nimport { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState';\nimport { useEntityEnvironment } from '../../hooks/useEntityEnvironment';\nimport { PolicyReportsFiltersProvider } from '../../hooks/usePolicyReportsFilters';\nimport { KYVERNO_RESOURCE_NAME_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { SelectStatus } from '../SelectStatus';\nimport { SelectSeverity } from '../SelectSeverity';\n\ntype EntityCustomPoliciesContentProps = {\n annotationsDocumentationUrl?: string;\n policyDocumentationUrl?: string;\n sources: string[];\n title: string;\n};\n\nexport const EntityCustomPoliciesContent = ({\n annotationsDocumentationUrl,\n policyDocumentationUrl,\n sources,\n title,\n}: EntityCustomPoliciesContentProps) => {\n const { entity } = useEntity();\n const annotations = entity.metadata.annotations;\n\n const annotationsState = isPolicyReporterAvailable(entity);\n\n const { environments, environmentsLoading } = useEntityEnvironment(\n entity,\n annotationsState,\n );\n\n // Annotations missing\n if (!annotationsState)\n return (\n <Container>\n <Content>\n <MissingAnnotationEmptyState\n readMoreUrl={annotationsDocumentationUrl}\n annotation={KYVERNO_RESOURCE_NAME_ANNOTATION}\n />\n </Content>\n </Container>\n );\n\n // Fetching environments\n if (environmentsLoading) return <Progress />;\n\n // Environments missing\n if (!environments?.length)\n return (\n <Container>\n <Content>\n <MissingEnvironmentsEmptyState entity={entity} />\n </Content>\n </Container>\n );\n\n return (\n <PolicyReportsFiltersProvider\n defaultFilters={{\n namespaces: getNamespaces(annotations),\n kinds: getKinds(annotations),\n sources: sources,\n search: getResourceName(annotations),\n }}\n defaultEnvironment={environments[0].entityRef}\n >\n <Container>\n <Header\n title={title}\n customActions={<SelectEnvironment environments={environments} />}\n />\n <Content>\n <Grid.Root columns=\"1\" gap=\"4\">\n <Flex align=\"end\" gap=\"4\">\n <SelectStatus />\n <SelectSeverity />\n </Flex>\n <PolicyReportsTable\n emptyContentText=\"No policies\"\n policyDocumentationUrl={policyDocumentationUrl}\n />\n </Grid.Root>\n </Content>\n </Container>\n </PolicyReportsFiltersProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA4BO,MAAM,8BAA8B,CAAC;AAAA,EAC1C,2BAAA;AAAA,EACA,sBAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,KAAwC;AACtC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,WAAA,GAAc,OAAO,QAAA,CAAS,WAAA;AAEpC,EAAA,MAAM,gBAAA,GAAmB,0BAA0B,MAAM,CAAA;AAEzD,EAAA,MAAM,EAAE,YAAA,EAAc,mBAAA,EAAoB,GAAI,oBAAA;AAAA,IAC5C,MAAA;AAAA,IACA;AAAA,GACF;AAGA,EAAA,IAAI,CAAC,gBAAA;AACH,IAAA,uBACE,GAAA,CAAC,SAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,MAAC,2BAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAa,2BAAA;AAAA,QACb,UAAA,EAAY;AAAA;AAAA,OAEhB,CAAA,EACF,CAAA;AAIJ,EAAA,IAAI,mBAAA,EAAqB,uBAAO,GAAA,CAAC,QAAA,EAAA,EAAS,CAAA;AAG1C,EAAA,IAAI,CAAC,YAAA,EAAc,MAAA;AACjB,IAAA,uBACE,GAAA,CAAC,aACC,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EACC,8BAAC,6BAAA,EAAA,EAA8B,MAAA,EAAgB,GACjD,CAAA,EACF,CAAA;AAGJ,EAAA,uBACE,GAAA;AAAA,IAAC,4BAAA;AAAA,IAAA;AAAA,MACC,cAAA,EAAgB;AAAA,QACd,UAAA,EAAY,cAAc,WAAW,CAAA;AAAA,QACrC,KAAA,EAAO,SAAS,WAAW,CAAA;AAAA,QAC3B,OAAA;AAAA,QACA,MAAA,EAAQ,gBAAgB,WAAW;AAAA,OACrC;AAAA,MACA,kBAAA,EAAoB,YAAA,CAAa,CAAC,CAAA,CAAE,SAAA;AAAA,MAEpC,+BAAC,SAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,KAAA;AAAA,YACA,aAAA,kBAAe,GAAA,CAAC,iBAAA,EAAA,EAAkB,YAAA,EAA4B;AAAA;AAAA,SAChE;AAAA,wBACA,GAAA,CAAC,WACC,QAAA,kBAAA,IAAA,CAAC,IAAA,CAAK,MAAL,EAAU,OAAA,EAAQ,GAAA,EAAI,GAAA,EAAI,GAAA,EACzB,QAAA,EAAA;AAAA,0BAAA,IAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAM,KAAA,EAAM,GAAA,EAAI,GAAA,EACpB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EAAa,CAAA;AAAA,gCACb,cAAA,EAAA,EAAe;AAAA,WAAA,EAClB,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,kBAAA;AAAA,YAAA;AAAA,cACC,gBAAA,EAAiB,aAAA;AAAA,cACjB;AAAA;AAAA;AACF,SAAA,EACF,CAAA,EACF;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,2 +1,6 @@
1
- export { EntityCustomPoliciesContent } from './EntityCustomPoliciesContent.esm.js';
1
+ import { EntityCustomPoliciesContent } from './EntityCustomPoliciesContent.esm.js';
2
+
3
+
4
+
5
+ export { EntityCustomPoliciesContent };
2
6
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,15 +1,17 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Progress, ContentHeader, Page, Content } from '@backstage/core-components';
2
+ import { Content, Progress } from '@backstage/core-components';
3
3
  import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
4
- import { Grid } from '@material-ui/core';
4
+ import { Container, Header, Grid, Flex } from '@backstage/ui';
5
5
  import { PolicyReportsTable } from '../PolicyReportsTable/PolicyReportsTable.esm.js';
6
6
  import { SelectEnvironment } from '../SelectEnvironment/SelectEnvironment.esm.js';
7
- import { isPolicyReporterAvailable, getNamespaces, getKinds, getResourceName } from '../../utils/annotations.esm.js';
7
+ import { isPolicyReporterAvailable, getResourceName, getKinds, getNamespaces } from '../../utils/annotations.esm.js';
8
8
  import { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js';
9
9
  import { useEntityEnvironment } from '../../hooks/useEntityEnvironment.esm.js';
10
+ import { PolicyReportsFiltersProvider } from '../../hooks/usePolicyReportsFilters.esm.js';
10
11
  import { KYVERNO_RESOURCE_NAME_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';
12
+ import { SelectSeverity } from '../SelectSeverity/SelectSeverity.esm.js';
13
+ import { SelectStatus } from '../SelectStatus/SelectStatus.esm.js';
11
14
 
12
- const PageContent = ({ children }) => /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children }) });
13
15
  const EntityKyvernoPoliciesContent = ({
14
16
  annotationsDocumentationUrl,
15
17
  policyDocumentationUrl
@@ -17,89 +19,55 @@ const EntityKyvernoPoliciesContent = ({
17
19
  const { entity } = useEntity();
18
20
  const annotations = entity.metadata.annotations;
19
21
  const annotationsState = isPolicyReporterAvailable(entity);
20
- const {
21
- environments,
22
- environmentsLoading,
23
- setCurrentEnvironment,
24
- currentEnvironment
25
- } = useEntityEnvironment(entity, annotationsState);
22
+ const { environments, environmentsLoading } = useEntityEnvironment(
23
+ entity,
24
+ annotationsState
25
+ );
26
26
  if (!annotationsState)
27
- return /* @__PURE__ */ jsx(PageContent, { children: /* @__PURE__ */ jsx(
27
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
28
28
  MissingAnnotationEmptyState,
29
29
  {
30
30
  readMoreUrl: annotationsDocumentationUrl,
31
31
  annotation: KYVERNO_RESOURCE_NAME_ANNOTATION
32
32
  }
33
- ) });
33
+ ) }) });
34
34
  if (environmentsLoading) return /* @__PURE__ */ jsx(Progress, {});
35
- if (environments === void 0 || !currentEnvironment)
36
- return /* @__PURE__ */ jsx(PageContent, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) });
37
- const namespaces = getNamespaces(annotations);
38
- const kinds = getKinds(annotations);
39
- const resourceName = getResourceName(annotations);
40
- return /* @__PURE__ */ jsxs(PageContent, { children: [
41
- /* @__PURE__ */ jsx(ContentHeader, { title: "Kyverno Policy Reports", children: /* @__PURE__ */ jsx(
42
- SelectEnvironment,
43
- {
44
- environments,
45
- currentEnvironment,
46
- setCurrentEnvironment
47
- }
48
- ) }),
49
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
50
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
51
- PolicyReportsTable,
52
- {
53
- currentEnvironment,
54
- filter: {
55
- namespaces,
56
- sources: ["kyverno"],
57
- kinds,
58
- status: ["fail", "warn", "error"],
59
- search: resourceName
60
- },
61
- title: "Failing Policy Results",
62
- emptyContentText: "No failing policies",
63
- policyDocumentationUrl,
64
- enableSearch: false
65
- }
66
- ) }),
67
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
68
- PolicyReportsTable,
69
- {
70
- currentEnvironment,
71
- filter: {
72
- namespaces,
73
- sources: ["kyverno"],
74
- kinds,
75
- status: ["pass"],
76
- search: resourceName
77
- },
78
- title: "Passing Policy Results",
79
- emptyContentText: "No passing policies",
80
- policyDocumentationUrl,
81
- enableSearch: false
82
- }
83
- ) }),
84
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
85
- PolicyReportsTable,
86
- {
87
- currentEnvironment,
88
- filter: {
89
- namespaces,
90
- sources: ["kyverno"],
91
- kinds,
92
- status: ["skip"],
93
- search: resourceName
94
- },
95
- title: "Skipped Policy Results",
96
- emptyContentText: "No skipped policies",
97
- policyDocumentationUrl,
98
- enableSearch: false
99
- }
100
- ) })
101
- ] })
102
- ] });
35
+ if (!environments?.length)
36
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) }) });
37
+ return /* @__PURE__ */ jsx(
38
+ PolicyReportsFiltersProvider,
39
+ {
40
+ defaultFilters: {
41
+ namespaces: getNamespaces(annotations),
42
+ kinds: getKinds(annotations),
43
+ sources: ["kyverno"],
44
+ search: getResourceName(annotations)
45
+ },
46
+ defaultEnvironment: environments[0].entityRef,
47
+ children: /* @__PURE__ */ jsxs(Container, { children: [
48
+ /* @__PURE__ */ jsx(
49
+ Header,
50
+ {
51
+ title: "Kyverno Policy Reports",
52
+ customActions: /* @__PURE__ */ jsx(SelectEnvironment, { environments })
53
+ }
54
+ ),
55
+ /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Grid.Root, { columns: "1", gap: "4", children: [
56
+ /* @__PURE__ */ jsxs(Flex, { align: "end", gap: "4", children: [
57
+ /* @__PURE__ */ jsx(SelectStatus, {}),
58
+ /* @__PURE__ */ jsx(SelectSeverity, {})
59
+ ] }),
60
+ /* @__PURE__ */ jsx(
61
+ PolicyReportsTable,
62
+ {
63
+ emptyContentText: "No policies found",
64
+ policyDocumentationUrl
65
+ }
66
+ )
67
+ ] }) })
68
+ ] })
69
+ }
70
+ );
103
71
  };
104
72
 
105
73
  export { EntityKyvernoPoliciesContent };