@kyverno/backstage-plugin-policy-reporter 2.7.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 (55) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/alpha/plugin.esm.js +5 -12
  3. package/dist/alpha/plugin.esm.js.map +1 -1
  4. package/dist/alpha.d.ts +8 -26
  5. package/dist/api/PolicyReporterClient.esm.js.map +1 -1
  6. package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js +48 -80
  7. package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js.map +1 -1
  8. package/dist/components/EntityCustomPoliciesContent/index.esm.js +5 -1
  9. package/dist/components/EntityCustomPoliciesContent/index.esm.js.map +1 -1
  10. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js +48 -80
  11. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js.map +1 -1
  12. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js +5 -1
  13. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js.map +1 -1
  14. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js +1 -1
  15. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js.map +1 -1
  16. package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js +1 -1
  17. package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js.map +1 -1
  18. package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js +41 -64
  19. package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js.map +1 -1
  20. package/dist/components/PolicyReportsPage/index.esm.js +5 -1
  21. package/dist/components/PolicyReportsPage/index.esm.js.map +1 -1
  22. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js +85 -111
  23. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js.map +1 -1
  24. package/dist/components/SearchField/SearchField.esm.js +33 -0
  25. package/dist/components/SearchField/SearchField.esm.js.map +1 -0
  26. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js +22 -41
  27. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js.map +1 -1
  28. package/dist/components/SelectNamespace/SelectNamespace.esm.js +35 -45
  29. package/dist/components/SelectNamespace/SelectNamespace.esm.js.map +1 -1
  30. package/dist/components/SelectSeverity/SelectSeverity.esm.js +40 -51
  31. package/dist/components/SelectSeverity/SelectSeverity.esm.js.map +1 -1
  32. package/dist/components/SelectStatus/SelectStatus.esm.js +40 -51
  33. package/dist/components/SelectStatus/SelectStatus.esm.js.map +1 -1
  34. package/dist/components/SeverityComponent/SeverityComponent.esm.js +11 -35
  35. package/dist/components/SeverityComponent/SeverityComponent.esm.js.map +1 -1
  36. package/dist/components/StatusComponent/StatusComponent.esm.js.map +1 -1
  37. package/dist/hooks/useEntityEnvironment.esm.js +1 -9
  38. package/dist/hooks/useEntityEnvironment.esm.js.map +1 -1
  39. package/dist/hooks/useEnvironments.esm.js +17 -30
  40. package/dist/hooks/useEnvironments.esm.js.map +1 -1
  41. package/dist/hooks/useNamespaces.esm.js +4 -4
  42. package/dist/hooks/useNamespaces.esm.js.map +1 -1
  43. package/dist/hooks/usePolicyReportsFilters.esm.js +90 -0
  44. package/dist/hooks/usePolicyReportsFilters.esm.js.map +1 -0
  45. package/dist/index.d.ts +1 -1
  46. package/dist/package.json.esm.js +9 -5
  47. package/dist/package.json.esm.js.map +1 -1
  48. package/dist/plugin.esm.js +1 -1
  49. package/dist/plugin.esm.js.map +1 -1
  50. package/dist/routes.esm.js.map +1 -1
  51. package/dist/utils/annotations.esm.js +1 -1
  52. package/dist/utils/annotations.esm.js.map +1 -1
  53. package/package.json +18 -14
  54. package/dist/hooks/usePaginatedPolicies.esm.js +0 -51
  55. package/dist/hooks/usePaginatedPolicies.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
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
+
3
28
  ## 2.7.0
4
29
 
5
30
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { ApiBlueprint, discoveryApiRef, fetchApiRef, PageBlueprint, SubPageBlueprint, createRouteRef, NavItemBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
2
+ import { ApiBlueprint, fetchApiRef, discoveryApiRef, PageBlueprint, SubPageBlueprint, createRouteRef, createFrontendPlugin } from '@backstage/frontend-plugin-api';
3
3
  import { rootRouteRef } from '../routes.esm.js';
4
4
  import { policyReporterApiRef } from '../api/PolicyReporterClient.esm.js';
5
5
  import { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';
@@ -21,7 +21,8 @@ const policyReporterPage = PageBlueprint.make({
21
21
  params: {
22
22
  path: "/policy-reporter",
23
23
  routeRef: rootRouteRef,
24
- title: "Policy Reporter"
24
+ title: "Policy Reporter",
25
+ icon: /* @__PURE__ */ jsx(PolicyIcon, {})
25
26
  }
26
27
  });
27
28
  const policyReporterNamespacedPoliciesPage = SubPageBlueprint.make({
@@ -50,13 +51,6 @@ const policyReporterEntityContent = EntityContentBlueprint.make({
50
51
  )
51
52
  }
52
53
  });
53
- const policyReporterNavItem = NavItemBlueprint.make({
54
- params: {
55
- title: "Policy Reporter",
56
- icon: () => /* @__PURE__ */ jsx(PolicyIcon, {}),
57
- routeRef: rootRouteRef
58
- }
59
- });
60
54
  var plugin = createFrontendPlugin({
61
55
  pluginId: "policy-reporter",
62
56
  title: "Policy Reporter",
@@ -68,10 +62,9 @@ var plugin = createFrontendPlugin({
68
62
  policyReporterApi,
69
63
  policyReporterEntityContent,
70
64
  policyReporterPage,
71
- policyReporterNamespacedPoliciesPage,
72
- policyReporterNavItem
65
+ policyReporterNamespacedPoliciesPage
73
66
  ]
74
67
  });
75
68
 
76
- export { plugin as default, policyReporterApi, policyReporterNavItem };
69
+ export { plugin as default, policyReporterApi };
77
70
  //# sourceMappingURL=plugin.esm.js.map
@@ -1 +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 NavItemBlueprint,\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 },\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 const policyReporterNavItem = NavItemBlueprint.make({\n params: {\n title: 'Policy Reporter',\n icon: () => <PolicyIcon />,\n routeRef: rootRouteRef,\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,\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6C,CAAE,CAAA,IAAA,CAAK,uBACxD,GAAA,CAAA,CAAA,CAAE,4BAAF,EAAA,EAA+B,CACjC;AAAA;AAAA;AAEP,CAAC,CAAA;AAGY,MAAA,qBAAA,GAAwB,iBAAiB,IAAK,CAAA;AAAA,EACzD,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,iBAAA;AAAA,IACP,IAAA,EAAM,sBAAM,GAAA,CAAC,UAAW,EAAA,EAAA,CAAA;AAAA,IACxB,QAAU,EAAA;AAAA;AAEd,CAAC;AAGD,aAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,iBAAA;AAAA,EACV,KAAO,EAAA,iBAAA;AAAA,EACP,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,wBAAoB,CAAE,EAAA;AAAA,EACxD,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,iBAAA;AAAA,IACA,2BAAA;AAAA,IACA,kBAAA;AAAA,IACA,oCAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
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,EA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AAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,UAAA,EAAY;AAAA,IACV,iBAAA;AAAA,IACA,2BAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -28,15 +28,15 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
28
28
  icon: string | undefined;
29
29
  };
30
30
  configInput: {
31
- filter?: _backstage_filter_predicates.FilterPredicate | undefined;
32
- title?: string | undefined;
33
31
  path?: string | undefined;
32
+ title?: string | undefined;
33
+ filter?: _backstage_filter_predicates.FilterPredicate | undefined;
34
34
  group?: string | false | undefined;
35
35
  icon?: string | undefined;
36
36
  };
37
- 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", {
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
38
  optional: true;
39
- }> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
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
40
  optional: true;
41
41
  }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
42
42
  optional: true;
@@ -59,23 +59,6 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
59
59
  filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
60
60
  };
61
61
  }>;
62
- "nav-item:policy-reporter": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
63
- kind: "nav-item";
64
- name: undefined;
65
- config: {};
66
- configInput: {};
67
- output: _backstage_frontend_plugin_api.ExtensionDataRef<{
68
- title: string;
69
- icon: _backstage_frontend_plugin_api.IconComponent;
70
- routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
71
- }, "core.nav-item.target", {}>;
72
- inputs: {};
73
- params: {
74
- title: string;
75
- icon: _backstage_frontend_plugin_api.IconComponent;
76
- routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
77
- };
78
- }>;
79
62
  "page:policy-reporter": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
80
63
  kind: "page";
81
64
  name: undefined;
@@ -84,8 +67,8 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
84
67
  title: string | undefined;
85
68
  };
86
69
  configInput: {
87
- title?: string | undefined;
88
70
  path?: string | undefined;
71
+ title?: string | undefined;
89
72
  };
90
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", {
91
74
  optional: true;
@@ -108,7 +91,6 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
108
91
  }>;
109
92
  };
110
93
  params: {
111
- defaultPath?: [Error: `Use the 'path' param instead`];
112
94
  path: string;
113
95
  title?: string;
114
96
  icon?: _backstage_frontend_plugin_api.IconElement;
@@ -125,12 +107,12 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
125
107
  title: string | undefined;
126
108
  };
127
109
  configInput: {
128
- title?: string | undefined;
129
110
  path?: string | undefined;
111
+ title?: string | undefined;
130
112
  };
131
- 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", {
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", {
132
114
  optional: true;
133
- }> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
115
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
134
116
  optional: true;
135
117
  }>;
136
118
  inputs: {};
@@ -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":";;;;;;;;;;;AAkCA,MAAM,WAAc,GAAA,CAAC,EAAE,QAAA,EACrB,qBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,kBAAA,GAAA,CAAC,OAAS,EAAA,EAAA,QAAA,EAAS,CACrB,EAAA,CAAA;AAGK,MAAM,8BAA8B,CAAC;AAAA,EAC1C,2BAAA;AAAA,EACA,sBAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAwC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wBAAA;AAAA,UACN,gBAAiB,EAAA,qBAAA;AAAA,UACjB,sBAAA;AAAA,UACA,YAAc,EAAA;AAAA;AAAA,OAElB,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
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,IA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,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 };
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKyvernoPoliciesContent.esm.js","sources":["../../../src/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.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 KyvernoPoliciesContentProps = {\n annotationsDocumentationUrl?: string;\n policyDocumentationUrl?: 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 EntityKyvernoPoliciesContent = ({\n annotationsDocumentationUrl,\n policyDocumentationUrl,\n}: KyvernoPoliciesContentProps) => {\n const { entity } = useEntity();\n const annotations = entity.metadata.annotations;\n\n // Boolean variable to validate that entity have required annotations\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=\"Kyverno Policy Reports\">\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: ['kyverno'],\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: ['kyverno'],\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: ['kyverno'],\n kinds,\n status: ['skip'],\n search: resourceName,\n }}\n title=\"Skipped Policy Results\"\n emptyContentText=\"No skipped policies\"\n policyDocumentationUrl={policyDocument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AA,qBAAA;AAAA,UACjB,sBAAA;AAAA,UACA,YAAc,EAAA;AAAA;AAAA,OAElB,EAAA,CAAA;AAAA,sBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,kBAAA;AAAA,UACA,MAAQ,EAAA;AAAA,YACN,UAAA;AAAA,YACA,OAAA,EAAS,CAAC,SAAS,CAAA;AAAA,YACnB,KAAA;AAAA,YACA,MAAA,EAAQ,CAAC,MAAM,CAAA;AAAA,YACf,MAAQ,EAAA;AAAA,WACV;AAAA,UACA,KAAM,EAAA,wBAAA;AAAA,UACN,gBAAiB,EAAA,qBAAA;AAAA,UACjB,sBAAA;AAAA,UACA,YAAc,EAAA;AAAA;AAAA,OAElB,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityKyvernoPoliciesContent.esm.js","sources":["../../../src/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.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 { SelectSeverity } from '../SelectSeverity';\nimport { SelectStatus } from '../SelectStatus';\n\ntype KyvernoPoliciesContentProps = {\n annotationsDocumentationUrl?: string;\n policyDocumentationUrl?: string;\n};\n\nexport const EntityKyvernoPoliciesContent = ({\n annotationsDocumentationUrl,\n policyDocumentationUrl,\n}: KyvernoPoliciesContentProps) => {\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: ['kyverno'],\n search: getResourceName(annotations),\n }}\n defaultEnvironment={environments[0].entityRef}\n >\n <Container>\n <Header\n title=\"Kyverno Policy Reports\"\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 found\"\n policyDocumentationUrl={policyDocumentationUrl}\n />\n </Grid.Root>\n </Content>\n </Container>\n </PolicyReportsFiltersProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA0BO,MAAM,+BAA+B,CAAC;AAAA,EAC3C,2BAAA;AAAA,EACA;AACF,CAAA,KAAmC;AACjC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,WAAA,GAAc,OAAO,QAAA,CAAS,WAAA;AAEpC,EAAA,MAAM,gBAAA,GAAmB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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,mBAAA;AAAA,cACjB;AAAA;AAAA;AACF,SAAA,EACF,CAAA,EACF;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,2 +1,6 @@
1
- export { EntityKyvernoPoliciesContent } from './EntityKyvernoPoliciesContent.esm.js';
1
+ import { EntityKyvernoPoliciesContent } from './EntityKyvernoPoliciesContent.esm.js';
2
+
3
+
4
+
5
+ export { EntityKyvernoPoliciesContent };
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,4 +1,4 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import Box from '@material-ui/core/Box';
3
3
  import Button from '@material-ui/core/Button';
4
4
  import { makeStyles } from '@material-ui/core/styles';