@kyverno/backstage-plugin-policy-reporter 2.0.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 (33) hide show
  1. package/LICENSE +201 -0
  2. package/dist/api/PolicyReporterApi.esm.js +8 -0
  3. package/dist/api/PolicyReporterApi.esm.js.map +1 -0
  4. package/dist/api/PolicyReporterClient.esm.js +46 -0
  5. package/dist/api/PolicyReporterClient.esm.js.map +1 -0
  6. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js +96 -0
  7. package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js.map +1 -0
  8. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js +2 -0
  9. package/dist/components/EntityKyvernoPoliciesContent/index.esm.js.map +1 -0
  10. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js +65 -0
  11. package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js.map +1 -0
  12. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js +121 -0
  13. package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js.map +1 -0
  14. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js +44 -0
  15. package/dist/components/SelectEnvironment/SelectEnvironment.esm.js.map +1 -0
  16. package/dist/components/SeverityComponent/SeverityComponent.esm.js +42 -0
  17. package/dist/components/SeverityComponent/SeverityComponent.esm.js.map +1 -0
  18. package/dist/components/StatusComponent/StatusComponent.esm.js +22 -0
  19. package/dist/components/StatusComponent/StatusComponent.esm.js.map +1 -0
  20. package/dist/hooks/useEntityEnvironment.esm.js +44 -0
  21. package/dist/hooks/useEntityEnvironment.esm.js.map +1 -0
  22. package/dist/hooks/usePaginatedPolicies.esm.js +47 -0
  23. package/dist/hooks/usePaginatedPolicies.esm.js.map +1 -0
  24. package/dist/index.d.ts +11 -0
  25. package/dist/index.esm.js +2 -0
  26. package/dist/index.esm.js.map +1 -0
  27. package/dist/plugin.esm.js +27 -0
  28. package/dist/plugin.esm.js.map +1 -0
  29. package/dist/routes.esm.js +8 -0
  30. package/dist/routes.esm.js.map +1 -0
  31. package/dist/utils/annotations.esm.js +13 -0
  32. package/dist/utils/annotations.esm.js.map +1 -0
  33. package/package.json +74 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ const policyReporterApiRef = createApiRef({
4
+ id: "plugin.policy-reporter.service"
5
+ });
6
+
7
+ export { policyReporterApiRef };
8
+ //# sourceMappingURL=PolicyReporterApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyReporterApi.esm.js","sources":["../../src/api/PolicyReporterApi.ts"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\nimport {\n Filter,\n Pagination,\n ResultList,\n} from '@kyverno/backstage-plugin-policy-reporter-common';\n\nexport const policyReporterApiRef = createApiRef<PolicyReporterApi>({\n id: 'plugin.policy-reporter.service',\n});\n\nexport type PolicyReporterApi = {\n namespacedResults: (\n environment: string,\n filter?: Filter,\n pagination?: Pagination,\n ) => Promise<ResultList>;\n};\n"],"names":[],"mappings":";;AAOO,MAAM,uBAAuB,YAAgC,CAAA;AAAA,EAClE,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -0,0 +1,46 @@
1
+ class PolicyReporterApiClient {
2
+ discoveryApi;
3
+ fetchApi;
4
+ constructor(options) {
5
+ this.discoveryApi = options.discoveryApi;
6
+ this.fetchApi = options.fetchApi;
7
+ }
8
+ /**
9
+ * Creates a URL query string from a given parameters object.
10
+ *
11
+ * This function takes an optional object of key-value pairs and converts it into a URL query string.
12
+ * If the value of a key is an array, each element of the array will be added as a separate query parameter.
13
+ * If the value is not undefined or null, it will be converted to a string and added as a query parameter.
14
+ *
15
+ * @param {Record<string, any>} [params] - An optional object containing key-value pairs to be converted into URL parameters.
16
+ * @returns {string} - A URL query string generated from the provided parameters.
17
+ */
18
+ createUrlParams(params) {
19
+ const urlParams = new URLSearchParams();
20
+ if (params) {
21
+ for (const [key, value] of Object.entries(params)) {
22
+ if (Array.isArray(value)) {
23
+ value.forEach((val) => urlParams.append(key, val));
24
+ } else if (value !== void 0 && value !== null) {
25
+ urlParams.append(key, value.toString());
26
+ }
27
+ }
28
+ }
29
+ return urlParams.toString();
30
+ }
31
+ async namespacedResults(environment, filter, pagination) {
32
+ const baseUrl = await this.discoveryApi.getBaseUrl("policy-reporter");
33
+ const urlParams = this.createUrlParams({ ...filter, ...pagination });
34
+ const url = `${baseUrl}/namespaced-resources/${encodeURIComponent(
35
+ environment
36
+ )}/results?${urlParams}`;
37
+ const response = await this.fetchApi.fetch(url);
38
+ if (!response.ok) {
39
+ throw new Error("failed to fetch policies");
40
+ }
41
+ return await response.json();
42
+ }
43
+ }
44
+
45
+ export { PolicyReporterApiClient };
46
+ //# sourceMappingURL=PolicyReporterClient.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyReporterClient.esm.js","sources":["../../src/api/PolicyReporterClient.ts"],"sourcesContent":["import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { PolicyReporterApi } from './PolicyReporterApi';\nimport {\n Filter,\n Pagination,\n ResultList,\n} from '@kyverno/backstage-plugin-policy-reporter-common';\n\nexport class PolicyReporterApiClient implements PolicyReporterApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { fetchApi: FetchApi; discoveryApi: DiscoveryApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n /**\n * Creates a URL query string from a given parameters object.\n *\n * This function takes an optional object of key-value pairs and converts it into a URL query string.\n * If the value of a key is an array, each element of the array will be added as a separate query parameter.\n * If the value is not undefined or null, it will be converted to a string and added as a query parameter.\n *\n * @param {Record<string, any>} [params] - An optional object containing key-value pairs to be converted into URL parameters.\n * @returns {string} - A URL query string generated from the provided parameters.\n */\n private createUrlParams(params?: Record<string, any>): string {\n const urlParams = new URLSearchParams();\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (Array.isArray(value)) {\n value.forEach(val => urlParams.append(key, val));\n } else if (value !== undefined && value !== null) {\n urlParams.append(key, value.toString());\n }\n }\n }\n return urlParams.toString();\n }\n\n async namespacedResults(\n environment: string,\n filter?: Filter,\n pagination?: Pagination,\n ): Promise<ResultList> {\n const baseUrl = await this.discoveryApi.getBaseUrl('policy-reporter');\n\n const urlParams = this.createUrlParams({ ...filter, ...pagination });\n\n const url = `${baseUrl}/namespaced-resources/${encodeURIComponent(\n environment,\n )}/results?${urlParams}`;\n\n const response = await this.fetchApi.fetch(url);\n if (!response.ok) {\n throw new Error('failed to fetch policies');\n }\n return await response.json();\n }\n}\n"],"names":[],"mappings":"AAQO,MAAM,uBAAqD,CAAA;AAAA,EAC/C,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYQ,gBAAgB,MAAsC,EAAA;AAC5D,IAAM,MAAA,SAAA,GAAY,IAAI,eAAgB,EAAA;AAEtC,IAAA,IAAI,MAAQ,EAAA;AACV,MAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,MAAM,CAAG,EAAA;AACjD,QAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,UAAA,KAAA,CAAM,QAAQ,CAAO,GAAA,KAAA,SAAA,CAAU,MAAO,CAAA,GAAA,EAAK,GAAG,CAAC,CAAA;AAAA,SACtC,MAAA,IAAA,KAAA,KAAU,KAAa,CAAA,IAAA,KAAA,KAAU,IAAM,EAAA;AAChD,UAAA,SAAA,CAAU,MAAO,CAAA,GAAA,EAAK,KAAM,CAAA,QAAA,EAAU,CAAA;AAAA;AACxC;AACF;AAEF,IAAA,OAAO,UAAU,QAAS,EAAA;AAAA;AAC5B,EAEA,MAAM,iBAAA,CACJ,WACA,EAAA,MAAA,EACA,UACqB,EAAA;AACrB,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,iBAAiB,CAAA;AAEpE,IAAM,MAAA,SAAA,GAAY,KAAK,eAAgB,CAAA,EAAE,GAAG,MAAQ,EAAA,GAAG,YAAY,CAAA;AAEnE,IAAM,MAAA,GAAA,GAAM,CAAG,EAAA,OAAO,CAAyB,sBAAA,EAAA,kBAAA;AAAA,MAC7C;AAAA,KACD,YAAY,SAAS,CAAA,CAAA;AAEtB,IAAA,MAAM,QAAW,GAAA,MAAM,IAAK,CAAA,QAAA,CAAS,MAAM,GAAG,CAAA;AAC9C,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,IAAI,MAAM,0BAA0B,CAAA;AAAA;AAE5C,IAAO,OAAA,MAAM,SAAS,IAAK,EAAA;AAAA;AAE/B;;;;"}
@@ -0,0 +1,96 @@
1
+ import { Progress, ContentHeader, Page, Content } from '@backstage/core-components';
2
+ import React from 'react';
3
+ import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
4
+ import { Grid } from '@material-ui/core';
5
+ import { PolicyReportsTable } from '../PolicyReportsTable/PolicyReportsTable.esm.js';
6
+ import { SelectEnvironment } from '../SelectEnvironment/SelectEnvironment.esm.js';
7
+ import { annotationsRequired, containsRequiredAnnotations } from '../../utils/annotations.esm.js';
8
+ import { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js';
9
+ import { useEntityEnvironment } from '../../hooks/useEntityEnvironment.esm.js';
10
+ import { KYVERNO_NAMESPACE_ANNOTATION, KYVERNO_KIND_ANNOTATION, KYVERNO_RESOURCE_NAME_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';
11
+
12
+ const PageContent = ({ children }) => /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, children));
13
+ const EntityKyvernoPoliciesContent = ({
14
+ annotationsDocumentationUrl,
15
+ policyDocumentationUrl
16
+ }) => {
17
+ const { entity } = useEntity();
18
+ const annotations = entity.metadata.annotations;
19
+ const annotationsState = containsRequiredAnnotations(annotations);
20
+ const {
21
+ environments,
22
+ environmentsLoading,
23
+ setCurrentEnvironment,
24
+ currentEnvironment
25
+ } = useEntityEnvironment(entity, annotationsState);
26
+ if (!annotationsState)
27
+ return /* @__PURE__ */ React.createElement(PageContent, null, /* @__PURE__ */ React.createElement(
28
+ MissingAnnotationEmptyState,
29
+ {
30
+ readMoreUrl: annotationsDocumentationUrl,
31
+ annotation: annotationsRequired
32
+ }
33
+ ));
34
+ if (environmentsLoading) return /* @__PURE__ */ React.createElement(Progress, null);
35
+ if (environments === void 0 || !currentEnvironment)
36
+ return /* @__PURE__ */ React.createElement(PageContent, null, /* @__PURE__ */ React.createElement(MissingEnvironmentsEmptyState, { entity }));
37
+ const namespaces = annotations[KYVERNO_NAMESPACE_ANNOTATION].split(",");
38
+ const kinds = annotations[KYVERNO_KIND_ANNOTATION].split(",");
39
+ const resourceName = annotations[KYVERNO_RESOURCE_NAME_ANNOTATION];
40
+ return /* @__PURE__ */ React.createElement(PageContent, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Kyverno Policy Reports" }, /* @__PURE__ */ React.createElement(
41
+ SelectEnvironment,
42
+ {
43
+ environments,
44
+ currentEnvironment,
45
+ setCurrentEnvironment
46
+ }
47
+ )), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
48
+ PolicyReportsTable,
49
+ {
50
+ currentEnvironment,
51
+ filter: {
52
+ namespaces,
53
+ sources: ["kyverno"],
54
+ kinds,
55
+ status: ["fail"],
56
+ search: resourceName
57
+ },
58
+ title: "Failing Policy Results",
59
+ emptyContentText: "No failing policies",
60
+ policyDocumentationUrl
61
+ }
62
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
63
+ PolicyReportsTable,
64
+ {
65
+ currentEnvironment,
66
+ filter: {
67
+ namespaces,
68
+ sources: ["kyverno"],
69
+ kinds,
70
+ status: ["pass"],
71
+ search: resourceName
72
+ },
73
+ title: "Passing Policy Results",
74
+ emptyContentText: "No passing policies",
75
+ policyDocumentationUrl
76
+ }
77
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
78
+ PolicyReportsTable,
79
+ {
80
+ currentEnvironment,
81
+ filter: {
82
+ namespaces,
83
+ sources: ["kyverno"],
84
+ kinds,
85
+ status: ["skip"],
86
+ search: resourceName
87
+ },
88
+ title: "Skipped Policy Results",
89
+ emptyContentText: "No skipped policies",
90
+ policyDocumentationUrl
91
+ }
92
+ ))));
93
+ };
94
+
95
+ export { EntityKyvernoPoliciesContent };
96
+ //# sourceMappingURL=EntityKyvernoPoliciesContent.esm.js.map
@@ -0,0 +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 React from 'react';\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 containsRequiredAnnotations,\n annotationsRequired,\n} from '../../utils/annotations';\nimport { MissingEnvironmentsEmptyState } from '../MissingEnvironmentsEmptyState';\nimport { useEntityEnvironment } from '../../hooks/useEntityEnvironment';\nimport {\n KYVERNO_KIND_ANNOTATION,\n KYVERNO_NAMESPACE_ANNOTATION,\n KYVERNO_RESOURCE_NAME_ANNOTATION,\n} 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: boolean = containsRequiredAnnotations(annotations);\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={annotationsRequired}\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 = annotations![KYVERNO_NAMESPACE_ANNOTATION].split(',');\n const kinds = annotations![KYVERNO_KIND_ANNOTATION].split(',');\n const resourceName = annotations![KYVERNO_RESOURCE_NAME_ANNOTATION];\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'],\n search: resourceName,\n }}\n title=\"Failing Policy Results\"\n emptyContentText=\"No failing policies\"\n policyDocumentationUrl={policyDocumentationUrl}\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 />\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={policyDocumentationUrl}\n />\n </Grid>\n </Grid>\n </PageContent>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAmCA,MAAM,WAAc,GAAA,CAAC,EAAE,QAAA,EACrB,qBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,IAAA,EAAA,QAAS,CACrB,CAAA;AAGK,MAAM,+BAA+B,CAAC;AAAA,EAC3C,2BAAA;AAAA,EACA;AACF,CAAmC,KAAA;AACjC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,WAAA,GAAc,OAAO,QAAS,CAAA,WAAA;AAGpC,EAAM,MAAA,gBAAA,GAA4B,4BAA4B,WAAW,CAAA;AAEzE,EAAM,MAAA;AAAA,IACJ,YAAA;AAAA,IACA,mBAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF,GAAI,oBAAqB,CAAA,MAAA,EAAQ,gBAAgB,CAAA;AAGjD,EAAA,IAAI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
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import Box from '@material-ui/core/Box';
2
+ import Button from '@material-ui/core/Button';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import Typography from '@material-ui/core/Typography';
5
+ import React from 'react';
6
+ import { EmptyState, CodeSnippet, Link } from '@backstage/core-components';
7
+
8
+ const useStyles = makeStyles(
9
+ (theme) => ({
10
+ code: {
11
+ borderRadius: 6,
12
+ margin: theme.spacing(2, 0),
13
+ background: theme.palette.type === "dark" ? "#444" : theme.palette.common.white
14
+ }
15
+ }),
16
+ { name: "BackstageMissingAnnotationEmptyState" }
17
+ );
18
+ function generateYamlExample(entity) {
19
+ const kind = entity?.kind || "Component";
20
+ const name = entity?.metadata.name || "example";
21
+ const type = entity?.spec?.type || "website";
22
+ const owner = entity?.spec?.owner || "user:default/guest";
23
+ const yamlText = `apiVersion: backstage.io/v1alpha1
24
+ kind: ${kind}
25
+ metadata:
26
+ name: ${name}
27
+ spec:
28
+ type: ${type}
29
+ owner: ${owner}
30
+ dependsOn:
31
+ - value`;
32
+ const lineNumbers = [9];
33
+ return {
34
+ yamlText,
35
+ lineNumbers
36
+ };
37
+ }
38
+ const MissingEnvironmentsEmptyState = (props) => {
39
+ const { entity, readMoreUrl } = props;
40
+ const url = readMoreUrl || "https://backstage.io/docs/features/software-catalog/descriptor-format#specdependson-optional";
41
+ const classes = useStyles();
42
+ const entityKind = entity?.kind || "Component";
43
+ const { yamlText, lineNumbers } = generateYamlExample(entity);
44
+ return /* @__PURE__ */ React.createElement(
45
+ EmptyState,
46
+ {
47
+ missing: "field",
48
+ title: "Missing Valid Environment Dependency",
49
+ description: /* @__PURE__ */ React.createElement(React.Fragment, null, "You need to add a dependency to a kubernetes-cluster Resource with a kyverno.io/endpoint annotation defined if you want to use this plugin."),
50
+ action: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "Add the resource dependency to your ", entityKind, " YAML as shown in the highlighted example below:"), /* @__PURE__ */ React.createElement(Box, { className: classes.code }, /* @__PURE__ */ React.createElement(
51
+ CodeSnippet,
52
+ {
53
+ text: yamlText,
54
+ language: "yaml",
55
+ showLineNumbers: true,
56
+ highlightedNumbers: lineNumbers,
57
+ customStyle: { background: "inherit", fontSize: "115%" }
58
+ }
59
+ )), /* @__PURE__ */ React.createElement(Button, { color: "primary", component: Link, to: url }, "Read more"))
60
+ }
61
+ );
62
+ };
63
+
64
+ export { MissingEnvironmentsEmptyState };
65
+ //# sourceMappingURL=MissingEnvironmentsEmptyState.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingEnvironmentsEmptyState.esm.js","sources":["../../../src/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.tsx"],"sourcesContent":["import Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { CodeSnippet, Link, EmptyState } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'BackstageMissingAnnotationEmptyState' },\n);\n\nfunction generateYamlExample(entity?: Entity): {\n yamlText: string;\n lineNumbers: number[];\n} {\n const kind = entity?.kind || 'Component';\n const name = entity?.metadata.name || 'example';\n const type = entity?.spec?.type || 'website';\n const owner = entity?.spec?.owner || 'user:default/guest';\n\n const yamlText = `apiVersion: backstage.io/v1alpha1\nkind: ${kind}\nmetadata:\n name: ${name}\nspec:\n type: ${type}\n owner: ${owner}\n dependsOn: \n - value`;\n\n const lineNumbers: number[] = [9];\n\n return {\n yamlText,\n lineNumbers,\n };\n}\n\nexport const MissingEnvironmentsEmptyState = (props: {\n readMoreUrl?: string;\n entity?: Entity;\n}) => {\n const { entity, readMoreUrl } = props;\n const url =\n readMoreUrl ||\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#specdependson-optional';\n\n const classes = useStyles();\n\n const entityKind = entity?.kind || 'Component';\n const { yamlText, lineNumbers } = generateYamlExample(entity);\n return (\n <EmptyState\n missing=\"field\"\n title=\"Missing Valid Environment Dependency\"\n description={\n <>\n You need to add a dependency to a kubernetes-cluster Resource with a\n kyverno.io/endpoint annotation defined if you want to use this plugin.\n </>\n }\n action={\n <>\n <Typography variant=\"body1\">\n Add the resource dependency to your {entityKind} YAML as shown in\n the highlighted example below:\n </Typography>\n <Box className={classes.code}>\n <CodeSnippet\n text={yamlText}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={lineNumbers}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </Box>\n <Button color=\"primary\" component={Link} to={url}>\n Read more\n </Button>\n </>\n }\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,CAAA;AAAA,MACd,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,MAC1B,UAAA,EACE,MAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,MAAS,GAAA,KAAA,CAAM,QAAQ,MAAO,CAAA;AAAA;AAClE,GACF,CAAA;AAAA,EACA,EAAE,MAAM,sCAAuC;AACjD,CAAA;AAEA,SAAS,oBAAoB,MAG3B,EAAA;AACA,EAAM,MAAA,IAAA,GAAO,QAAQ,IAAQ,IAAA,WAAA;AAC7B,EAAM,MAAA,IAAA,GAAO,MAAQ,EAAA,QAAA,CAAS,IAAQ,IAAA,SAAA;AACtC,EAAM,MAAA,IAAA,GAAO,MAAQ,EAAA,IAAA,EAAM,IAAQ,IAAA,SAAA;AACnC,EAAM,MAAA,KAAA,GAAQ,M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B,EAAA,WAAA;AAAA,UACpB,WAAa,EAAA,EAAE,UAAY,EAAA,SAAA,EAAW,UAAU,MAAO;AAAA;AAAA,OAE3D,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,SAAA,EAAW,IAAM,EAAA,EAAA,EAAI,GAAK,EAAA,EAAA,WAElD,CACF;AAAA;AAAA,GAEJ;AAEJ;;;;"}
@@ -0,0 +1,121 @@
1
+ import { ResponseErrorPanel, Table } from '@backstage/core-components';
2
+ import React from 'react';
3
+ import { makeStyles } from '@material-ui/core';
4
+ import Chip from '@material-ui/core/Chip';
5
+ import { StatusComponent } from '../StatusComponent/StatusComponent.esm.js';
6
+ import { SeverityComponent } from '../SeverityComponent/SeverityComponent.esm.js';
7
+ import Launch from '@material-ui/icons/Launch';
8
+ import { usePaginatedPolicies } from '../../hooks/usePaginatedPolicies.esm.js';
9
+
10
+ const PolicyReportsTable = ({
11
+ title,
12
+ emptyContentText,
13
+ currentEnvironment,
14
+ filter,
15
+ policyDocumentationUrl
16
+ }) => {
17
+ const useStyles = makeStyles((theme) => ({
18
+ empty: {
19
+ padding: theme.spacing(2),
20
+ display: "flex",
21
+ justifyContent: "center"
22
+ }
23
+ }));
24
+ const classes = useStyles();
25
+ const columns = [
26
+ {
27
+ title: "name",
28
+ field: "name"
29
+ },
30
+ {
31
+ title: "namespace",
32
+ field: "namespace"
33
+ },
34
+ {
35
+ title: "kind",
36
+ field: "kind"
37
+ },
38
+ {
39
+ title: "policy",
40
+ field: "policy",
41
+ render: (listResult) => {
42
+ if (policyDocumentationUrl)
43
+ return /* @__PURE__ */ React.createElement(
44
+ Chip,
45
+ {
46
+ label: listResult.policy,
47
+ component: "a",
48
+ target: "_blank",
49
+ href: `${policyDocumentationUrl}#${listResult.policy}`,
50
+ clickable: true,
51
+ icon: /* @__PURE__ */ React.createElement(Launch, { fontSize: "small" })
52
+ }
53
+ );
54
+ return /* @__PURE__ */ React.createElement(Chip, { label: listResult.policy });
55
+ }
56
+ },
57
+ {
58
+ title: "rule",
59
+ field: "rule",
60
+ render: (listResult) => {
61
+ return /* @__PURE__ */ React.createElement(Chip, { label: listResult.rule });
62
+ }
63
+ },
64
+ {
65
+ title: "status",
66
+ field: "status",
67
+ width: "30",
68
+ render: (listResult) => {
69
+ return /* @__PURE__ */ React.createElement(StatusComponent, { status: listResult.status });
70
+ }
71
+ },
72
+ {
73
+ title: "severity",
74
+ field: "severity",
75
+ width: "30",
76
+ render: (listResult) => {
77
+ return /* @__PURE__ */ React.createElement(SeverityComponent, { severity: listResult.severity });
78
+ }
79
+ }
80
+ ];
81
+ const {
82
+ policies,
83
+ policiesError,
84
+ currentPage,
85
+ setCurrentPage,
86
+ setCurrentOffset,
87
+ initialLoading
88
+ } = usePaginatedPolicies(currentEnvironment, filter);
89
+ if (policiesError) return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error: policiesError });
90
+ if (initialLoading)
91
+ return /* @__PURE__ */ React.createElement(
92
+ Table,
93
+ {
94
+ options: { paging: false, padding: "dense" },
95
+ data: [],
96
+ columns,
97
+ isLoading: true,
98
+ title
99
+ }
100
+ );
101
+ return /* @__PURE__ */ React.createElement(
102
+ Table,
103
+ {
104
+ options: {
105
+ sorting: true,
106
+ padding: "dense"
107
+ },
108
+ data: policies?.items ?? [],
109
+ columns,
110
+ title,
111
+ totalCount: policies?.count,
112
+ page: currentPage,
113
+ onRowsPerPageChange: (page) => setCurrentOffset(page),
114
+ onPageChange: (page) => setCurrentPage(page),
115
+ emptyContent: /* @__PURE__ */ React.createElement("div", { className: classes.empty }, emptyContentText)
116
+ }
117
+ );
118
+ };
119
+
120
+ export { PolicyReportsTable };
121
+ //# sourceMappingURL=PolicyReportsTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyReportsTable.esm.js","sources":["../../../src/components/PolicyReportsTable/PolicyReportsTable.tsx"],"sourcesContent":["import {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport React from 'react';\nimport {\n Filter,\n ListResult,\n} from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { makeStyles } from '@material-ui/core';\nimport Chip from '@material-ui/core/Chip';\nimport { StatusComponent } from '../StatusComponent';\nimport { SeverityComponent } from '../SeverityComponent';\nimport Launch from '@material-ui/icons/Launch';\nimport { Environment } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { usePaginatedPolicies } from '../../hooks/usePaginatedPolicies';\n\ninterface PolicyReportsTableProps {\n currentEnvironment: Environment;\n filter: Filter;\n title: string;\n emptyContentText: string;\n policyDocumentationUrl?: string;\n}\n\nexport const PolicyReportsTable = ({\n title,\n emptyContentText,\n currentEnvironment,\n filter,\n policyDocumentationUrl,\n}: PolicyReportsTableProps) => {\n const useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n }));\n\n const classes = useStyles();\n\n const columns: TableColumn<ListResult>[] = [\n {\n title: 'name',\n field: 'name',\n },\n {\n title: 'namespace',\n field: 'namespace',\n },\n {\n title: 'kind',\n field: 'kind',\n },\n {\n title: 'policy',\n field: 'policy',\n render: (listResult: ListResult) => {\n // When policyDocumentationUrl is provided create link to the Policy section\n if (policyDocumentationUrl)\n return (\n <Chip\n label={listResult.policy}\n component=\"a\"\n target=\"_blank\"\n href={`${policyDocumentationUrl}#${listResult.policy}`}\n clickable\n icon={<Launch fontSize=\"small\" />}\n />\n );\n\n return <Chip label={listResult.policy} />;\n },\n },\n {\n title: 'rule',\n field: 'rule',\n render: (listResult: ListResult) => {\n return <Chip label={listResult.rule} />;\n },\n },\n {\n title: 'status',\n field: 'status',\n width: '30',\n render: (listResult: ListResult) => {\n return <StatusComponent status={listResult.status} />;\n },\n },\n {\n title: 'severity',\n field: 'severity',\n width: '30',\n render: (listResult: ListResult) => {\n return <SeverityComponent severity={listResult.severity} />;\n },\n },\n ];\n\n const {\n policies,\n policiesError,\n currentPage,\n setCurrentPage,\n setCurrentOffset,\n initialLoading,\n } = usePaginatedPolicies(currentEnvironment, filter);\n\n if (policiesError) return <ResponseErrorPanel error={policiesError} />;\n\n // Return loading table\n if (initialLoading)\n return (\n <Table\n options={{ paging: false, padding: 'dense' }}\n data={[]}\n columns={columns}\n isLoading\n title={title}\n />\n );\n\n return (\n <Table\n options={{\n sorting: true,\n padding: 'dense',\n }}\n data={policies?.items ?? []}\n columns={columns}\n title={title}\n totalCount={policies?.count}\n page={currentPage}\n onRowsPerPageChange={page => setCurrentOffset(page)}\n onPageChange={page => setCurrentPage(page)}\n emptyContent={<div className={classes.empty}>{emptyContentText}</div>}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BO,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,IACrC,KAAO,EAAA;AAAA,MACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACxB,OAAS,EAAA,MAAA;AAAA,MACT,cAAgB,EAAA;AAAA;AAClB,GACA,CAAA,CAAA;AAEF,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,MAAM,OAAqC,GAAA;AAAA,IACzC;AAAA,MACE,KAAO,EAAA,MAAA;AAAA,MACP,KAAO,EAAA;AAAA,KACT;AAAA,IACA;AAAA,MACE,KAAO,EAAA,WAAA;AAAA,MACP,KAAO,EAAA;AAAA,KACT;AAAA,IACA;AAAA,MACE,KAAO,EAAA,MAAA;AAAA,MACP,KAAO,EAAA;AAAA,KACT;AAAA,IACA;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,MAAA,EAAQ,CAAC,UAA2B,KAAA;AAElC,QAAI,IAAA,sBAAA;AACF,UACE,uBAAA,KAA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-ui/core/InputLabel';
4
+ import FormControl from '@material-ui/core/FormControl';
5
+ import Select from '@material-ui/core/Select';
6
+ import { makeStyles } from '@material-ui/core/styles';
7
+
8
+ const useStyles = makeStyles({
9
+ formControl: {
10
+ margin: 8,
11
+ minWidth: 150
12
+ },
13
+ hideDropdownArrow: {
14
+ "& .MuiSelect-icon-196.Mui-disabled": {
15
+ display: "none"
16
+ }
17
+ }
18
+ });
19
+ const SelectEnvironment = ({
20
+ environments,
21
+ currentEnvironment,
22
+ setCurrentEnvironment
23
+ }) => {
24
+ const classes = useStyles();
25
+ const handleChange = (event) => {
26
+ setCurrentEnvironment(environments[Number(event.target.value)]);
27
+ };
28
+ const isSingleEnvironment = environments.length === 1;
29
+ return /* @__PURE__ */ React.createElement(FormControl, { className: classes.formControl }, /* @__PURE__ */ React.createElement(InputLabel, { id: "select-environment-label" }, "Environment"), /* @__PURE__ */ React.createElement(
30
+ Select,
31
+ {
32
+ labelId: "select-environment-label",
33
+ id: "select-environment",
34
+ value: String(currentEnvironment.id),
35
+ onChange: handleChange,
36
+ disabled: isSingleEnvironment,
37
+ className: isSingleEnvironment ? classes.hideDropdownArrow : ""
38
+ },
39
+ environments.map((env) => /* @__PURE__ */ React.createElement(MenuItem, { key: env.name, value: env.id }, env.name))
40
+ ));
41
+ };
42
+
43
+ export { SelectEnvironment };
44
+ //# sourceMappingURL=SelectEnvironment.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectEnvironment.esm.js","sources":["../../../src/components/SelectEnvironment/SelectEnvironment.tsx"],"sourcesContent":["import React from 'react';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport FormControl from '@material-ui/core/FormControl';\nimport Select from '@material-ui/core/Select';\nimport { Environment } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles({\n formControl: {\n margin: 8,\n minWidth: 150,\n },\n hideDropdownArrow: {\n '& .MuiSelect-icon-196.Mui-disabled': {\n display: 'none',\n },\n },\n});\n\ntype SelectEnvironmentProps = {\n environments: Environment[];\n currentEnvironment: Environment;\n setCurrentEnvironment: (environment: Environment) => void;\n};\n\nexport const SelectEnvironment = ({\n environments,\n currentEnvironment,\n setCurrentEnvironment,\n}: SelectEnvironmentProps) => {\n const classes = useStyles();\n\n const handleChange = (event: any) => {\n setCurrentEnvironment(environments[Number(event.target.value)]);\n };\n\n // Check if there is more then 1 environment\n const isSingleEnvironment = environments.length === 1;\n\n return (\n <FormControl className={classes.formControl}>\n <InputLabel id=\"select-environment-label\">Environment</InputLabel>\n <Select\n labelId=\"select-environment-label\"\n id=\"select-environment\"\n value={String(currentEnvironment.id)}\n onChange={handleChange}\n disabled={isSingleEnvironment}\n className={isSingleEnvironment ? classes.hideDropdownArrow : ''}\n >\n {environments.map(env => (\n <MenuItem key={env.name} value={env.id}>\n {env.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,WAAa,EAAA;AAAA,IACX,MAAQ,EAAA,CAAA;AAAA,IACR,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,iBAAmB,EAAA;AAAA,IACjB,oCAAsC,EAAA;AAAA,MACpC,OAAS,EAAA;AAAA;AACX;AAEJ,CAAC,CAAA;AAQM,MAAM,oBAAoB,CAAC;AAAA,EAChC,YAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAM,MAAA,YAAA,GAAe,CAAC,KAAe,KAAA;AACnC,IAAA,qBAAA,CAAsB,aAAa,MAAO,CAAA,KAAA,CAAM,MAAO,CAAA,KAAK,CAAC,CAAC,CAAA;AAAA,GAChE;AAGA,EAAM,MAAA,mBAAA,GAAsB,aAAa,MAAW,KAAA,CAAA;AAEpD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,WAAA,EAAA,sCAC7B,UAAW,EAAA,EAAA,EAAA,EAAG,0BAA2B,EAAA,EAAA,aAAW,CACrD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,0BAAA;AAAA,MACR,EAAG,EAAA,oBAAA;AAAA,MACH,KAAA,EAAO,MAAO,CAAA,kBAAA,CAAmB,EAAE,CAAA;AAAA,MACnC,QAAU,EAAA,YAAA;AAAA,MACV,QAAU,EAAA,mBAAA;AAAA,MACV,SAAA,EAAW,mBAAsB,GAAA,OAAA,CAAQ,iBAAoB,GAAA;AAAA,KAAA;AAAA,IAE5D,YAAa,CAAA,GAAA,CAAI,CAChB,GAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,GAAI,CAAA,IAAA,EAAM,KAAO,EAAA,GAAA,CAAI,EACjC,EAAA,EAAA,GAAA,CAAI,IACP,CACD;AAAA,GAEL,CAAA;AAEJ;;;;"}
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import Chip from '@material-ui/core/Chip';
3
+ import makeStyles from '@material-ui/core/styles/makeStyles';
4
+
5
+ const useStyles = makeStyles((theme) => ({
6
+ error: {
7
+ backgroundColor: theme.palette.error.main,
8
+ color: theme.palette.error.contrastText
9
+ },
10
+ success: {
11
+ backgroundColor: theme.palette.success.main,
12
+ color: theme.palette.success.contrastText
13
+ },
14
+ warning: {
15
+ backgroundColor: theme.palette.warning.main,
16
+ color: theme.palette.warning.contrastText
17
+ },
18
+ info: {
19
+ backgroundColor: theme.palette.info.main,
20
+ color: theme.palette.info.contrastText
21
+ }
22
+ }));
23
+ const SeverityComponent = ({ severity }) => {
24
+ const classes = useStyles();
25
+ switch (severity) {
26
+ case "high":
27
+ return /* @__PURE__ */ React.createElement(Chip, { label: severity, className: classes.error });
28
+ case "low":
29
+ return /* @__PURE__ */ React.createElement(Chip, { label: severity, className: classes.success });
30
+ case "medium":
31
+ return /* @__PURE__ */ React.createElement(Chip, { label: severity, className: classes.warning });
32
+ case "info":
33
+ return /* @__PURE__ */ React.createElement(Chip, { label: severity, className: classes.info });
34
+ case "critical":
35
+ return /* @__PURE__ */ React.createElement(Chip, { label: severity, className: classes.error });
36
+ default:
37
+ return null;
38
+ }
39
+ };
40
+
41
+ export { SeverityComponent };
42
+ //# sourceMappingURL=SeverityComponent.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeverityComponent.esm.js","sources":["../../../src/components/SeverityComponent/SeverityComponent.tsx"],"sourcesContent":["import React from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { Severity } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\n\nconst useStyles = makeStyles((theme: any) => ({\n error: {\n backgroundColor: theme.palette.error.main,\n color: theme.palette.error.contrastText,\n },\n success: {\n backgroundColor: theme.palette.success.main,\n color: theme.palette.success.contrastText,\n },\n warning: {\n backgroundColor: theme.palette.warning.main,\n color: theme.palette.warning.contrastText,\n },\n info: {\n backgroundColor: theme.palette.info.main,\n color: theme.palette.info.contrastText,\n },\n}));\n\ntype SeverityComponentProps = {\n severity: Severity | null;\n};\n\nexport const SeverityComponent = ({ severity }: SeverityComponentProps) => {\n const classes = useStyles();\n switch (severity) {\n case 'high':\n return <Chip label={severity} className={classes.error} />;\n case 'low':\n return <Chip label={severity} className={classes.success} />;\n case 'medium':\n return <Chip label={severity} className={classes.warning} />;\n case 'info':\n return <Chip label={severity} className={classes.info} />;\n case 'critical':\n return <Chip label={severity} className={classes.error} />;\n default:\n return null;\n }\n};\n"],"names":[],"mappings":";;;;AAKA,MAAM,SAAA,GAAY,UAAW,CAAA,CAAC,KAAgB,MAAA;AAAA,EAC5C,KAAO,EAAA;AAAA,IACL,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA,IAAA;AAAA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MAAA,2CAAQ,IAAK,EAAA,EAAA,KAAA,EAAO,QAAU,EAAA,SAAA,EAAW,QAAQ,KAAO,EAAA,CAAA;AAAA,IAC1D;AACE,MAAO,OAAA,IAAA;AAAA;AAEb;;;;"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { StatusWarning, StatusAborted, StatusError, StatusOK } from '@backstage/core-components';
3
+
4
+ const StatusComponent = ({ status }) => {
5
+ switch (status) {
6
+ case "pass":
7
+ return /* @__PURE__ */ React.createElement(StatusOK, null, "PASS");
8
+ case "error":
9
+ return /* @__PURE__ */ React.createElement(StatusError, null, "ERROR");
10
+ case "fail":
11
+ return /* @__PURE__ */ React.createElement(StatusError, null, "FAIL");
12
+ case "skip":
13
+ return /* @__PURE__ */ React.createElement(StatusAborted, null, "SKIP");
14
+ case "warn":
15
+ return /* @__PURE__ */ React.createElement(StatusWarning, null, "WARN");
16
+ default:
17
+ return null;
18
+ }
19
+ };
20
+
21
+ export { StatusComponent };
22
+ //# sourceMappingURL=StatusComponent.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusComponent.esm.js","sources":["../../../src/components/StatusComponent/StatusComponent.tsx"],"sourcesContent":["import React from 'react';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n StatusWarning,\n} from '@backstage/core-components';\nimport type { Status } from '@kyverno/backstage-plugin-policy-reporter-common';\n\ntype StatusComponentProps = {\n status: Status;\n};\n\nexport const StatusComponent = ({ status }: StatusComponentProps) => {\n switch (status) {\n case 'pass':\n return <StatusOK>PASS</StatusOK>;\n case 'error':\n return <StatusError>ERROR</StatusError>;\n case 'fail':\n return <StatusError>FAIL</StatusError>;\n case 'skip':\n return <StatusAborted>SKIP</StatusAborted>;\n case 'warn':\n return <StatusWarning>WARN</StatusWarning>;\n default:\n return null;\n }\n};\n"],"names":[],"mappings":";;;AAaO,MAAM,eAAkB,GAAA,CAAC,EAAE,MAAA,EAAmC,KAAA;AACnE,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,MAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,gBAAS,MAAI,CAAA;AAAA,IACvB,KAAK,OAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,mBAAY,OAAK,CAAA;AAAA,IAC3B,KAAK,MAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,mBAAY,MAAI,CAAA;AAAA,IAC1B,KAAK,MAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAc,MAAI,CAAA;AAAA,IAC5B,KAAK,MAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAc,MAAI,CAAA;AAAA,IAC5B;AACE,MAAO,OAAA,IAAA;AAAA;AAEb;;;;"}
@@ -0,0 +1,44 @@
1
+ import { useState } from 'react';
2
+ import { useAsync } from 'react-use';
3
+ import { catalogApiRef, CATALOG_FILTER_EXISTS } from '@backstage/plugin-catalog-react';
4
+ import { useApi } from '@backstage/core-plugin-api';
5
+
6
+ const useEntityEnvironment = (entity, annotationsState) => {
7
+ const catalogApi = useApi(catalogApiRef);
8
+ const [currentEnvironment, setCurrentEnvironment] = useState(void 0);
9
+ const { value: environments, loading: environmentsLoading } = useAsync(async () => {
10
+ if (!annotationsState) return void 0;
11
+ const dependencies = entity.spec?.dependsOn;
12
+ if (!dependencies) return void 0;
13
+ const entities = await catalogApi.getEntitiesByRefs({
14
+ entityRefs: dependencies,
15
+ fields: ["metadata.name"],
16
+ filter: {
17
+ kind: "Resource",
18
+ "spec.type": "kubernetes-cluster",
19
+ "metadata.annotations.kyverno.io/endpoint": CATALOG_FILTER_EXISTS
20
+ }
21
+ });
22
+ const environmentList = [];
23
+ dependencies.forEach((dependency, index) => {
24
+ if (entities.items[index]) {
25
+ environmentList.push({
26
+ id: environmentList.length,
27
+ entityRef: dependency,
28
+ name: entities.items[index]?.metadata.name
29
+ });
30
+ }
31
+ });
32
+ setCurrentEnvironment(environmentList[0]);
33
+ return environmentList;
34
+ }, [entity]);
35
+ return {
36
+ environments,
37
+ environmentsLoading,
38
+ currentEnvironment,
39
+ setCurrentEnvironment
40
+ };
41
+ };
42
+
43
+ export { useEntityEnvironment };
44
+ //# sourceMappingURL=useEntityEnvironment.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEntityEnvironment.esm.js","sources":["../../src/hooks/useEntityEnvironment.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useAsync } from 'react-use';\nimport { Environment } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\n\nexport const useEntityEnvironment = (\n entity: Entity,\n annotationsState: boolean,\n) => {\n const catalogApi = useApi(catalogApiRef);\n const [currentEnvironment, setCurrentEnvironment] = useState<\n Environment | undefined\n >(undefined);\n\n const { value: environments, loading: environmentsLoading } =\n useAsync(async (): Promise<Environment[] | undefined> => {\n if (!annotationsState) return undefined;\n\n const dependencies = entity.spec?.dependsOn as string[];\n if (!dependencies) return undefined;\n\n const entities = await catalogApi.getEntitiesByRefs({\n entityRefs: dependencies as string[],\n fields: ['metadata.name'],\n filter: {\n kind: 'Resource',\n 'spec.type': 'kubernetes-cluster',\n 'metadata.annotations.kyverno.io/endpoint': CATALOG_FILTER_EXISTS,\n },\n });\n\n const environmentList: Environment[] = [];\n\n dependencies.forEach((dependency, index) => {\n if (entities.items[index]) {\n environmentList.push({\n id: environmentList.length,\n entityRef: dependency,\n name: entities.items[index]?.metadata.name as string,\n });\n }\n });\n\n setCurrentEnvironment(environmentList[0]);\n\n return environmentList;\n }, [entity]);\n\n return {\n environments,\n environmentsLoading,\n currentEnvironment,\n setCurrentEnvironment,\n };\n};\n"],"names":[],"mappings":";;;;;AAUa,MAAA,oBAAA,GAAuB,CAClC,MAAA,EACA,gBACG,KAAA;AACH,EAAM,MAAA,UAA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0 +1,47 @@
1
+ import { useAsync } from 'react-use';
2
+ import { useApi } from '@backstage/core-plugin-api';
3
+ import { policyReporterApiRef } from '../api/PolicyReporterApi.esm.js';
4
+ import { useState, useEffect } from 'react';
5
+
6
+ const DEFAULT_OFFSET = 5;
7
+ const DEFAULT_PAGE = 0;
8
+ const usePaginatedPolicies = (currentEnvironment, filter) => {
9
+ const policyReporterApi = useApi(policyReporterApiRef);
10
+ const [currentPage, setCurrentPage] = useState(DEFAULT_PAGE);
11
+ const [currentOffset, setCurrentOffset] = useState(DEFAULT_OFFSET);
12
+ const [initialLoading, setInitialLoading] = useState(true);
13
+ useEffect(() => {
14
+ setInitialLoading(true);
15
+ }, [currentEnvironment]);
16
+ const {
17
+ value: policies,
18
+ loading: policiesLoading,
19
+ error: policiesError
20
+ } = useAsync(async () => {
21
+ const data = await policyReporterApi.namespacedResults(
22
+ currentEnvironment.entityRef,
23
+ filter,
24
+ {
25
+ // Material UI expects the first page to be 0. But the Policy Reporter API expects the first page to be 1
26
+ // This increments the currentPage with 1 to match the expected page by the Policy Reporter API
27
+ page: currentPage + 1,
28
+ offset: currentOffset
29
+ }
30
+ );
31
+ setInitialLoading(false);
32
+ return data;
33
+ }, [currentEnvironment, currentPage, currentOffset]);
34
+ return {
35
+ policies,
36
+ policiesLoading,
37
+ policiesError,
38
+ currentPage,
39
+ setCurrentPage,
40
+ currentOffset,
41
+ setCurrentOffset,
42
+ initialLoading
43
+ };
44
+ };
45
+
46
+ export { usePaginatedPolicies };
47
+ //# sourceMappingURL=usePaginatedPolicies.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePaginatedPolicies.esm.js","sources":["../../src/hooks/usePaginatedPolicies.ts"],"sourcesContent":["import { useAsync } from 'react-use';\nimport { Environment } from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { policyReporterApiRef } from '../api';\nimport {\n Filter,\n ResultList,\n} from '@kyverno/backstage-plugin-policy-reporter-common';\nimport { useEffect, useState } from 'react';\n\nconst DEFAULT_OFFSET = 5;\nconst DEFAULT_PAGE = 0;\n\nexport const usePaginatedPolicies = (\n currentEnvironment: Environment,\n filter: Filter,\n) => {\n const policyReporterApi = useApi(policyReporterApiRef);\n const [currentPage, setCurrentPage] = useState<number>(DEFAULT_PAGE);\n const [currentOffset, setCurrentOffset] = useState<number>(DEFAULT_OFFSET);\n const [initialLoading, setInitialLoading] = useState<boolean>(true);\n\n useEffect(() => {\n setInitialLoading(true);\n }, [currentEnvironment]);\n\n const {\n value: policies,\n loading: policiesLoading,\n error: policiesError,\n } = useAsync(async (): Promise<ResultList> => {\n const data = await policyReporterApi.namespacedResults(\n currentEnvironment.entityRef,\n filter,\n {\n // Material UI expects the first page to be 0. But the Policy Reporter API expects the first page to be 1\n // This increments the currentPage with 1 to match the expected page by the Policy Reporter API\n page: currentPage + 1,\n offset: currentOffset,\n },\n );\n setInitialLoading(false);\n return data;\n }, [currentEnvironment, currentPage, currentOffset]);\n\n return {\n policies,\n policiesLoading,\n policiesError,\n currentPage,\n setCurrentPage,\n currentOffset,\n setCurrentOffset,\n initialLoading,\n };\n};\n"],"names":[],"mappings":";;;;;AAUA,MAAM,cAAiB,GAAA,CAAA;AACvB,MAAM,YAAe,GAAA,CAAA;AAER,MAAA,oBAAA,GAAuB,CAClC,kBAAA,EACA,MACG,KAAA;AACH,EAAM,MAAA,iBAAA,GAAoB,OAAO,oBAAoB,CAAA;AACrD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAiB,YAAY,CAAA;AACnE,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAiB,cAAc,CAAA;AACzE,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAkB,IAAI,CAAA;AAElE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,iBAAA,CAAkB,IAAI,CAAA;AAAA,GACxB,EAAG,CAAC,kBAAkB,CAAC,CAAA;AAEvB,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAS,EAAA,eAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACT,GAAI,SAAS,YAAiC;AAC5C,IAAM,MAAA,IAAA,GAAO,MAAM,iBAAkB,CAAA,iBAAA;AAAA,MACnC,kBAAmB,CAAA,SAAA;AAAA,MACnB,MAAA;AAAA,MACA;AAAA;AAAA;AAAA,QAGE,MAAM,WAAc,GAAA,CAAA;AAAA,QACpB,MAAQ,EAAA;AAAA;AACV,KACF;AACA,IAAA,iBAAA,CAAkB,KAAK,CAAA;AACvB,IAAO,OAAA,IAAA;AAAA,GACN,EAAA,CAAC,kBAAoB,EAAA,WAAA,EAAa,aAAa,CAAC,CAAA;AAEnD,EAAO,OAAA;AAAA,IACL,QAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import * as react from 'react';
3
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
+
5
+ declare const kyvernoPolicyReportsPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
6
+ declare const EntityKyvernoPolicyReportsContent: ({ annotationsDocumentationUrl, policyDocumentationUrl, }: {
7
+ annotationsDocumentationUrl?: string | undefined;
8
+ policyDocumentationUrl?: string | undefined;
9
+ }) => react.JSX.Element;
10
+
11
+ export { EntityKyvernoPolicyReportsContent, kyvernoPolicyReportsPlugin };
@@ -0,0 +1,2 @@
1
+ export { EntityKyvernoPolicyReportsContent, kyvernoPolicyReportsPlugin } from './plugin.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import { createPlugin, createApiFactory, fetchApiRef, discoveryApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
2
+ import { policyReporterApiRef } from './api/PolicyReporterApi.esm.js';
3
+ import { PolicyReporterApiClient } from './api/PolicyReporterClient.esm.js';
4
+ import { rootRouteRef } from './routes.esm.js';
5
+
6
+ const kyvernoPolicyReportsPlugin = createPlugin({
7
+ id: "policy-reporter",
8
+ apis: [
9
+ createApiFactory({
10
+ api: policyReporterApiRef,
11
+ deps: { fetchApi: fetchApiRef, discoveryApi: discoveryApiRef },
12
+ factory: ({ discoveryApi, fetchApi }) => new PolicyReporterApiClient({ discoveryApi, fetchApi })
13
+ })
14
+ ]
15
+ });
16
+ const EntityKyvernoPolicyReportsContent = kyvernoPolicyReportsPlugin.provide(
17
+ createRoutableExtension({
18
+ name: "EntityKyvernoPoliciesContent",
19
+ component: () => import('./components/EntityKyvernoPoliciesContent/index.esm.js').then(
20
+ (m) => m.EntityKyvernoPoliciesContent
21
+ ),
22
+ mountPoint: rootRouteRef
23
+ })
24
+ );
25
+
26
+ export { EntityKyvernoPolicyReportsContent, kyvernoPolicyReportsPlugin };
27
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { policyReporterApiRef } from './api/PolicyReporterApi';\nimport { PolicyReporterApiClient } from './api/PolicyReporterClient';\n\nimport { rootRouteRef } from './routes';\n\nexport const kyvernoPolicyReportsPlugin = createPlugin({\n id: 'policy-reporter',\n apis: [\n createApiFactory({\n api: policyReporterApiRef,\n deps: { fetchApi: fetchApiRef, discoveryApi: discoveryApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new PolicyReporterApiClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\nexport const EntityKyvernoPolicyReportsContent =\n kyvernoPolicyReportsPlugin.provide(\n createRoutableExtension({\n name: 'EntityKyvernoPoliciesContent',\n component: () =>\n import('./components/EntityKyvernoPoliciesContent').then(\n m => m.EntityKyvernoPoliciesContent,\n ),\n mountPoint: rootRouteRef,\n }),\n );\n"],"names":[],"mappings":";;;;;AAYO,MAAM,6BAA6B,YAAa,CAAA;AAAA,EACrD,EAAI,EAAA,iBAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,oBAAA;AAAA,MACL,IAAM,EAAA,EAAE,QAAU,EAAA,WAAA,EAAa,cAAc,eAAgB,EAAA;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,uBAAwB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KACzD;AAAA;AAEL,CAAC;AAEM,MAAM,oCACX,0BAA2B,CAAA,OAAA;AAAA,EACzB,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,8BAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,wDAA2C,CAAE,CAAA,IAAA;AAAA,MAClD,OAAK,CAAE,CAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createRouteRef } from '@backstage/core-plugin-api';
2
+
3
+ const rootRouteRef = createRouteRef({
4
+ id: "policy-reporter"
5
+ });
6
+
7
+ export { rootRouteRef };
8
+ //# sourceMappingURL=routes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["import { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'policy-reporter',\n});\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -0,0 +1,13 @@
1
+ import { KYVERNO_RESOURCE_NAME_ANNOTATION, KYVERNO_KIND_ANNOTATION, KYVERNO_NAMESPACE_ANNOTATION } from '@kyverno/backstage-plugin-policy-reporter-common';
2
+
3
+ const annotationsRequired = [
4
+ KYVERNO_RESOURCE_NAME_ANNOTATION,
5
+ KYVERNO_KIND_ANNOTATION,
6
+ KYVERNO_NAMESPACE_ANNOTATION
7
+ ];
8
+ const containsRequiredAnnotations = (annotations) => {
9
+ return annotations ? annotationsRequired.every((key) => key in annotations) : false;
10
+ };
11
+
12
+ export { annotationsRequired, containsRequiredAnnotations };
13
+ //# sourceMappingURL=annotations.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.esm.js","sources":["../../src/utils/annotations.ts"],"sourcesContent":["import {\n KYVERNO_KIND_ANNOTATION,\n KYVERNO_NAMESPACE_ANNOTATION,\n KYVERNO_RESOURCE_NAME_ANNOTATION,\n} from '@kyverno/backstage-plugin-policy-reporter-common';\n\n// Define all annotations required for the component to work\nexport const annotationsRequired: string[] = [\n KYVERNO_RESOURCE_NAME_ANNOTATION,\n KYVERNO_KIND_ANNOTATION,\n KYVERNO_NAMESPACE_ANNOTATION,\n];\n\n// Check annotations object for all required annotations\nexport const containsRequiredAnnotations = (\n annotations: Record<string, string> | undefined,\n): boolean => {\n return annotations\n ? annotationsRequired.every(key => key in annotations)\n : false;\n};\n"],"names":[],"mappings":";;AAOO,MAAM,mBAAgC,GAAA;AAAA,EAC3C,gCAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF;AAGa,MAAA,2BAAA,GAA8B,CACzC,WACY,KAAA;AACZ,EAAA,OAAO,cACH,mBAAoB,CAAA,KAAA,CAAM,CAAO,GAAA,KAAA,GAAA,IAAO,WAAW,CACnD,GAAA,KAAA;AACN;;;;"}
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@kyverno/backstage-plugin-policy-reporter",
3
+ "version": "2.0.0",
4
+ "main": "dist/index.esm.js",
5
+ "types": "dist/index.d.ts",
6
+ "license": "Apache-2.0",
7
+ "backstage": {
8
+ "role": "frontend-plugin",
9
+ "pluginId": "policy-reporter",
10
+ "pluginPackages": [
11
+ "@kyverno/backstage-plugin-policy-reporter",
12
+ "@kyverno/backstage-plugin-policy-reporter-backend",
13
+ "@kyverno/backstage-plugin-policy-reporter-common"
14
+ ]
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "main": "dist/index.esm.js",
19
+ "types": "dist/index.d.ts"
20
+ },
21
+ "sideEffects": false,
22
+ "scripts": {
23
+ "start": "backstage-cli package start",
24
+ "build": "backstage-cli package build",
25
+ "lint": "backstage-cli package lint",
26
+ "test": "backstage-cli package test",
27
+ "clean": "backstage-cli package clean",
28
+ "prepack": "backstage-cli package prepack",
29
+ "postpack": "backstage-cli package postpack"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/kyverno/backstage-policy-reporter-plugin",
34
+ "directory": "plugins/policy-reporter"
35
+ },
36
+ "dependencies": {
37
+ "@backstage/catalog-client": "^1.8.0",
38
+ "@backstage/catalog-model": "^1.7.1",
39
+ "@backstage/core-components": "^0.16.1",
40
+ "@backstage/core-plugin-api": "^1.10.1",
41
+ "@backstage/plugin-catalog-react": "^1.14.2",
42
+ "@backstage/theme": "^0.6.2",
43
+ "@kyverno/backstage-plugin-policy-reporter-common": "^2.0.0",
44
+ "@material-ui/core": "^4.9.13",
45
+ "@material-ui/icons": "^4.9.1",
46
+ "@material-ui/lab": "4.0.0-alpha.61",
47
+ "react-use": "^17.2.4"
48
+ },
49
+ "peerDependencies": {
50
+ "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "@backstage/cli": "^0.29.2",
54
+ "@backstage/core-app-api": "^1.15.2",
55
+ "@backstage/dev-utils": "^1.1.4",
56
+ "@backstage/test-utils": "^1.7.2",
57
+ "@testing-library/jest-dom": "^6.0.0",
58
+ "@testing-library/react": "^14.0.0",
59
+ "@testing-library/user-event": "^14.0.0",
60
+ "msw": "^1.0.0"
61
+ },
62
+ "files": [
63
+ "dist"
64
+ ],
65
+ "gitHead": "9a769119bd77bb807670baefffeb37510e5c61c9",
66
+ "typesVersions": {
67
+ "*": {
68
+ "index": [
69
+ "dist/index.d.ts"
70
+ ]
71
+ }
72
+ },
73
+ "module": "./dist/index.esm.js"
74
+ }