@kyverno/backstage-plugin-policy-reporter 2.7.0 → 2.9.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.
- package/CHANGELOG.md +31 -0
- package/dist/alpha/plugin.esm.js +5 -12
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +8 -26
- package/dist/api/PolicyReporterClient.esm.js.map +1 -1
- package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js +49 -80
- package/dist/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.esm.js.map +1 -1
- package/dist/components/EntityCustomPoliciesContent/index.esm.js +5 -1
- package/dist/components/EntityCustomPoliciesContent/index.esm.js.map +1 -1
- package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js +49 -80
- package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js.map +1 -1
- package/dist/components/EntityKyvernoPoliciesContent/index.esm.js +5 -1
- package/dist/components/EntityKyvernoPoliciesContent/index.esm.js.map +1 -1
- package/dist/components/FilterLayout/FilterLayout.esm.js +44 -0
- package/dist/components/FilterLayout/FilterLayout.esm.js.map +1 -0
- package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js +1 -1
- package/dist/components/MissingEnvironmentsEmptyState/MissingEnvironmentsEmptyState.esm.js.map +1 -1
- package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js +1 -1
- package/dist/components/PolicyReportsDrawerComponent/PolicyReportsDrawerComponent.esm.js.map +1 -1
- package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js +44 -64
- package/dist/components/PolicyReportsPage/PolicyReportsPage.esm.js.map +1 -1
- package/dist/components/PolicyReportsPage/index.esm.js +5 -1
- package/dist/components/PolicyReportsPage/index.esm.js.map +1 -1
- package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js +85 -111
- package/dist/components/PolicyReportsTable/PolicyReportsTable.esm.js.map +1 -1
- package/dist/components/SearchField/SearchField.esm.js +33 -0
- package/dist/components/SearchField/SearchField.esm.js.map +1 -0
- package/dist/components/SelectEnvironment/SelectEnvironment.esm.js +22 -41
- package/dist/components/SelectEnvironment/SelectEnvironment.esm.js.map +1 -1
- package/dist/components/SelectNamespace/SelectNamespace.esm.js +34 -45
- package/dist/components/SelectNamespace/SelectNamespace.esm.js.map +1 -1
- package/dist/components/SelectSeverity/SelectSeverity.esm.js +39 -51
- package/dist/components/SelectSeverity/SelectSeverity.esm.js.map +1 -1
- package/dist/components/SelectStatus/SelectStatus.esm.js +39 -51
- package/dist/components/SelectStatus/SelectStatus.esm.js.map +1 -1
- package/dist/components/SeverityComponent/SeverityComponent.esm.js +11 -35
- package/dist/components/SeverityComponent/SeverityComponent.esm.js.map +1 -1
- package/dist/components/StatusComponent/StatusComponent.esm.js.map +1 -1
- package/dist/hooks/useEntityEnvironment.esm.js +1 -9
- package/dist/hooks/useEntityEnvironment.esm.js.map +1 -1
- package/dist/hooks/useEnvironments.esm.js +17 -30
- package/dist/hooks/useEnvironments.esm.js.map +1 -1
- package/dist/hooks/useNamespaces.esm.js +4 -4
- package/dist/hooks/useNamespaces.esm.js.map +1 -1
- package/dist/hooks/usePolicyReportsFilters.esm.js +90 -0
- package/dist/hooks/usePolicyReportsFilters.esm.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/package.json.esm.js +12 -6
- package/dist/package.json.esm.js.map +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/utils/annotations.esm.js +1 -1
- package/dist/utils/annotations.esm.js.map +1 -1
- package/package.json +23 -16
- package/dist/hooks/usePaginatedPolicies.esm.js +0 -51
- package/dist/hooks/usePaginatedPolicies.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @kyverno/backstage-plugin-policy-reporter
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 836f939: Add `FilterLayout` component with responsive sidebar filters. On large screens filters render as a sidebar, on smaller screens they collapse into a dialog triggered by a filter icon button. Updated `EntityCustomPoliciesContent`, `EntityKyvernoPoliciesContent`, and `PolicyReportsPage` to use the new layout.
|
|
8
|
+
|
|
9
|
+
## 2.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- d9f5bd3: Filter state (search, namespace, severity, and status) is now managed via URL query params, making filter selections shareable and persistent across page refreshes.
|
|
14
|
+
- ba911d8: Entity content pages (`EntityKyvernoPoliciesContent`, `EntityCustomPoliciesContent`) now show filters for status and severity, consistent with the `PolicyReportsPage`.
|
|
15
|
+
- d058bc7: Migrated several components to the new Backstage UI (BUI) components, replacing legacy MUI-based implementations:
|
|
16
|
+
|
|
17
|
+
- `PolicyReportsPage`, `EntityKyvernoPoliciesContent`, and `EntityCustomPoliciesContent` now use BUI `Grid`, `Container`, and `HeaderPage` for layout.
|
|
18
|
+
- Filter selectors (`SelectEnvironment`, `SelectNamespace`, `SelectSeverity`, `SelectStatus`) now use the BUI `Select` component.
|
|
19
|
+
- Severity badges now use the BUI `Tag` and `TagGroup` components instead of MUI chips.
|
|
20
|
+
|
|
21
|
+
- 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`.
|
|
22
|
+
|
|
23
|
+
Search state is now managed via URL query params, making search results shareable and persistent across page refreshes.
|
|
24
|
+
|
|
25
|
+
Migrated table component to the new Backstage UI (BUI) components.
|
|
26
|
+
|
|
27
|
+
- e0e8462: Backstage verion bump to v1.50.4
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [e0e8462]
|
|
32
|
+
- @kyverno/backstage-plugin-policy-reporter-common@2.4.0
|
|
33
|
+
|
|
3
34
|
## 2.7.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { ApiBlueprint,
|
|
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
|
|
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
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["import {\n ApiBlueprint,\n createFrontendPlugin,\n createRouteRef,\n discoveryApiRef,\n fetchApiRef,\n PageBlueprint,\n SubPageBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport { rootRouteRef } from '../routes';\nimport { policyReporterApiRef } from '../api';\nimport { DefaultApiClient } from '@kyverno/backstage-plugin-policy-reporter-common';\n\nimport { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isPolicyReporterAvailable } from '../utils/annotations';\nimport PolicyIcon from '@material-ui/icons/Policy';\n\n/** @alpha */\nexport const policyReporterApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: policyReporterApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new DefaultApiClient({ discoveryApi, fetchApi }),\n }),\n});\n\n/** @alpha */\nconst policyReporterPage = PageBlueprint.make({\n params: {\n path: '/policy-reporter',\n routeRef: rootRouteRef,\n title: 'Policy Reporter',\n icon: <PolicyIcon />,\n },\n});\n\n/** @alpha */\nconst policyReporterNamespacedPoliciesPage = SubPageBlueprint.make({\n name: 'namespaced-policy',\n params: {\n path: 'namespaced-policies',\n routeRef: createRouteRef(),\n // TODO: Support configuration of the actual component\n title: 'Namespaced Policies',\n loader: () =>\n // TODO: Create dedicated PolicyReporterNamespacedPoliciesPage Component\n import('../components/PolicyReportsPage/').then(m => (\n <m.PolicyReportsPage /> // TODO: Update the PolicyReportsPage to be only used for old frontend system to mimic PageBlueprint from NFS\n )),\n },\n});\n\n/** @alpha */\nconst policyReporterEntityContent = EntityContentBlueprint.make({\n name: 'policy-reporter',\n params: {\n path: '/policy-reporter',\n title: 'Policy Reporter',\n // TODO: Support configuration of the actual component\n filter: isPolicyReporterAvailable,\n loader: () =>\n // TODO: Create dedicated EntityPolicyReporterContent component as replacement for Kyverno and Custom content components\n import('../components/EntityKyvernoPoliciesContent/').then(m => (\n <m.EntityKyvernoPoliciesContent />\n )),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'policy-reporter',\n title: 'Policy Reporter',\n info: { packageJson: () => import('../../package.json') },\n routes: {\n root: rootRouteRef,\n },\n extensions: [\n policyReporterApi,\n policyReporterEntityContent,\n policyReporterPage,\n policyReporterNamespacedPoliciesPage,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;AAmBO,MAAM,iBAAA,GAAoB,aAAa,IAAA,CAAK;AAAA,EACjD,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,oBAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,gBAAA,CAAiB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,GAClD;AACL,CAAC;AAGD,MAAM,kBAAA,GAAqB,cAAc,IAAA,CAAK;AAAA,EAC5C,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,kBAAA;AAAA,IACN,QAAA,EAAU,YAAA;AAAA,IACV,KAAA,EAAO,iBAAA;AAAA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
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<
|
|
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<
|
|
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,
|
|
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,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Content, Progress } from '@backstage/core-components';
|
|
3
3
|
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import {
|
|
4
|
+
import { Container, Header } from '@backstage/ui';
|
|
5
5
|
import { PolicyReportsTable } from '../PolicyReportsTable/PolicyReportsTable.esm.js';
|
|
6
6
|
import { SelectEnvironment } from '../SelectEnvironment/SelectEnvironment.esm.js';
|
|
7
|
-
import { isPolicyReporterAvailable,
|
|
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';
|
|
14
|
+
import { FilterLayout } from '../FilterLayout/FilterLayout.esm.js';
|
|
11
15
|
|
|
12
|
-
const PageContent = ({ children }) => /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children }) });
|
|
13
16
|
const EntityCustomPoliciesContent = ({
|
|
14
17
|
annotationsDocumentationUrl,
|
|
15
18
|
policyDocumentationUrl,
|
|
@@ -19,89 +22,55 @@ const EntityCustomPoliciesContent = ({
|
|
|
19
22
|
const { entity } = useEntity();
|
|
20
23
|
const annotations = entity.metadata.annotations;
|
|
21
24
|
const annotationsState = isPolicyReporterAvailable(entity);
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
currentEnvironment
|
|
27
|
-
} = useEntityEnvironment(entity, annotationsState);
|
|
25
|
+
const { environments, environmentsLoading } = useEntityEnvironment(
|
|
26
|
+
entity,
|
|
27
|
+
annotationsState
|
|
28
|
+
);
|
|
28
29
|
if (!annotationsState)
|
|
29
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
|
|
30
31
|
MissingAnnotationEmptyState,
|
|
31
32
|
{
|
|
32
33
|
readMoreUrl: annotationsDocumentationUrl,
|
|
33
34
|
annotation: KYVERNO_RESOURCE_NAME_ANNOTATION
|
|
34
35
|
}
|
|
35
|
-
) });
|
|
36
|
+
) }) });
|
|
36
37
|
if (environmentsLoading) return /* @__PURE__ */ jsx(Progress, {});
|
|
37
|
-
if (environments
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
] });
|
|
38
|
+
if (!environments?.length)
|
|
39
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) }) });
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
PolicyReportsFiltersProvider,
|
|
42
|
+
{
|
|
43
|
+
defaultFilters: {
|
|
44
|
+
namespaces: getNamespaces(annotations),
|
|
45
|
+
kinds: getKinds(annotations),
|
|
46
|
+
sources,
|
|
47
|
+
search: getResourceName(annotations)
|
|
48
|
+
},
|
|
49
|
+
defaultEnvironment: environments[0].entityRef,
|
|
50
|
+
children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Header,
|
|
53
|
+
{
|
|
54
|
+
title,
|
|
55
|
+
customActions: /* @__PURE__ */ jsx(SelectEnvironment, { environments })
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(FilterLayout, { children: [
|
|
59
|
+
/* @__PURE__ */ jsxs(FilterLayout.Filters, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(SelectStatus, {}),
|
|
61
|
+
/* @__PURE__ */ jsx(SelectSeverity, {})
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx(FilterLayout.Content, { children: /* @__PURE__ */ jsx(
|
|
64
|
+
PolicyReportsTable,
|
|
65
|
+
{
|
|
66
|
+
emptyContentText: "No policies",
|
|
67
|
+
policyDocumentationUrl
|
|
68
|
+
}
|
|
69
|
+
) })
|
|
70
|
+
] }) })
|
|
71
|
+
] })
|
|
72
|
+
}
|
|
73
|
+
);
|
|
105
74
|
};
|
|
106
75
|
|
|
107
76
|
export { EntityCustomPoliciesContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCustomPoliciesContent.esm.js","sources":["../../../src/components/EntityCustomPoliciesContent/EntityCustomPoliciesContent.tsx"],"sourcesContent":["import {
|
|
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, 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';\nimport { FilterLayout } from '../FilterLayout';\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 <FilterLayout>\n <FilterLayout.Filters>\n <SelectStatus />\n <SelectSeverity />\n </FilterLayout.Filters>\n <FilterLayout.Content>\n <PolicyReportsTable\n emptyContentText=\"No policies\"\n policyDocumentationUrl={policyDocumentationUrl}\n />\n </FilterLayout.Content>\n </FilterLayout>\n </Content>\n </Container>\n </PolicyReportsFiltersProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6BO,MAAM,8BAA8B,CAAC;AAAA,EAC1C,2BAAA;AAAA,EACA,sBAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,KAAwC;AACtC,EA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A,EAAA,EAAkB,YAAA,EAA4B;AAAA;AAAA,SAChE;AAAA,wBACA,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,YAAA,EAAA,EACC,QAAA,EAAA;AAAA,0BAAA,IAAA,CAAC,YAAA,CAAa,SAAb,EACC,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EAAa,CAAA;AAAA,gCACb,cAAA,EAAA,EAAe;AAAA,WAAA,EAClB,CAAA;AAAA,0BACA,GAAA,CAAC,YAAA,CAAa,OAAA,EAAb,EACC,QAAA,kBAAA,GAAA;AAAA,YAAC,kBAAA;AAAA,YAAA;AAAA,cACC,gBAAA,EAAiB,aAAA;AAAA,cACjB;AAAA;AAAA,WACF,EACF;AAAA,SAAA,EACF,CAAA,EACF;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -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,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Content, Progress } from '@backstage/core-components';
|
|
3
3
|
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import {
|
|
4
|
+
import { Container, Header } from '@backstage/ui';
|
|
5
5
|
import { PolicyReportsTable } from '../PolicyReportsTable/PolicyReportsTable.esm.js';
|
|
6
6
|
import { SelectEnvironment } from '../SelectEnvironment/SelectEnvironment.esm.js';
|
|
7
|
-
import { isPolicyReporterAvailable,
|
|
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';
|
|
14
|
+
import { FilterLayout } from '../FilterLayout/FilterLayout.esm.js';
|
|
11
15
|
|
|
12
|
-
const PageContent = ({ children }) => /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children }) });
|
|
13
16
|
const EntityKyvernoPoliciesContent = ({
|
|
14
17
|
annotationsDocumentationUrl,
|
|
15
18
|
policyDocumentationUrl
|
|
@@ -17,89 +20,55 @@ const EntityKyvernoPoliciesContent = ({
|
|
|
17
20
|
const { entity } = useEntity();
|
|
18
21
|
const annotations = entity.metadata.annotations;
|
|
19
22
|
const annotationsState = isPolicyReporterAvailable(entity);
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
currentEnvironment
|
|
25
|
-
} = useEntityEnvironment(entity, annotationsState);
|
|
23
|
+
const { environments, environmentsLoading } = useEntityEnvironment(
|
|
24
|
+
entity,
|
|
25
|
+
annotationsState
|
|
26
|
+
);
|
|
26
27
|
if (!annotationsState)
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
28
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
|
|
28
29
|
MissingAnnotationEmptyState,
|
|
29
30
|
{
|
|
30
31
|
readMoreUrl: annotationsDocumentationUrl,
|
|
31
32
|
annotation: KYVERNO_RESOURCE_NAME_ANNOTATION
|
|
32
33
|
}
|
|
33
|
-
) });
|
|
34
|
+
) }) });
|
|
34
35
|
if (environmentsLoading) return /* @__PURE__ */ jsx(Progress, {});
|
|
35
|
-
if (environments
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
] });
|
|
36
|
+
if (!environments?.length)
|
|
37
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingEnvironmentsEmptyState, { entity }) }) });
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
PolicyReportsFiltersProvider,
|
|
40
|
+
{
|
|
41
|
+
defaultFilters: {
|
|
42
|
+
namespaces: getNamespaces(annotations),
|
|
43
|
+
kinds: getKinds(annotations),
|
|
44
|
+
sources: ["kyverno"],
|
|
45
|
+
search: getResourceName(annotations)
|
|
46
|
+
},
|
|
47
|
+
defaultEnvironment: environments[0].entityRef,
|
|
48
|
+
children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
Header,
|
|
51
|
+
{
|
|
52
|
+
title: "Kyverno Policy Reports",
|
|
53
|
+
customActions: /* @__PURE__ */ jsx(SelectEnvironment, { environments })
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(FilterLayout, { children: [
|
|
57
|
+
/* @__PURE__ */ jsxs(FilterLayout.Filters, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(SelectStatus, {}),
|
|
59
|
+
/* @__PURE__ */ jsx(SelectSeverity, {})
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx(FilterLayout.Content, { children: /* @__PURE__ */ jsx(
|
|
62
|
+
PolicyReportsTable,
|
|
63
|
+
{
|
|
64
|
+
emptyContentText: "No policies found",
|
|
65
|
+
policyDocumentationUrl
|
|
66
|
+
}
|
|
67
|
+
) })
|
|
68
|
+
] }) })
|
|
69
|
+
] })
|
|
70
|
+
}
|
|
71
|
+
);
|
|
103
72
|
};
|
|
104
73
|
|
|
105
74
|
export { EntityKyvernoPoliciesContent };
|
package/dist/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityKyvernoPoliciesContent.esm.js","sources":["../../../src/components/EntityKyvernoPoliciesContent/EntityKyvernoPoliciesContent.tsx"],"sourcesContent":["import {
|
|
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, 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';\nimport { FilterLayout } from '../FilterLayout';\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 <FilterLayout>\n <FilterLayout.Filters>\n <SelectStatus />\n <SelectSeverity />\n </FilterLayout.Filters>\n <FilterLayout.Content>\n <PolicyReportsTable\n emptyContentText=\"No policies found\"\n policyDocumentationUrl={policyDocumentationUrl}\n />\n </FilterLayout.Content>\n </FilterLayout>\n </Content>\n </Container>\n </PolicyReportsFiltersProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2BO,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,0BAA0B,MAAM,CAAA;AAEzD,EAAA,MAAM,EAAE,YAAA,EAAc,mBAAA,EAAoB,GAAI,oBAAA;AAAA,IAC5C,MAAA;AAAA,IACA;AAAA,GACF;AAGA,EAAA,IAAI,CAAC,gBAAA;AACH,IAAA,uBACE,GAAA,CAAC,SAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,MAAC,2BAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAa,2BAAA;AAAA,QACb,UAAA,EAAY;AAAA;AAAA,OAEhB,CAAA,EACF,CAAA;AAIJ,EAAA,IAAI,mBAAA,EAAqB,uBAAO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AAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|