@backstage/plugin-catalog-unprocessed-entities 0.1.0 → 0.1.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @backstage/plugin-catalog-unprocessed-entities
2
2
 
3
+ ## 0.1.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 267396f45bd0: Corrected the installation instructions.
8
+ - 7a9c8a9cd0ce: Fixed spacing for success message
9
+ - 77b408fad872: install command points to correct package name
10
+ - Updated dependencies
11
+ - @backstage/theme@0.4.1-next.0
12
+ - @backstage/core-components@0.13.3-next.1
13
+ - @backstage/core-plugin-api@1.5.3-next.0
14
+
15
+ ## 0.1.1-next.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 2c4869473155: The Catalog Unprocessed Entities plugin can now be integrated as a tab within the DevTools plugin
20
+
21
+ - Added an export for `UnprocessedEntitiesContent`
22
+ - Updated the `README` with images of the features
23
+ - Adjusted the styles to fill in the available space
24
+ - Set the table page size to 20 as 40 was causing errors in the browser console
25
+
26
+ - 57585d89f926: Export some types and API items. This allows people to call the API from different places with the ApiRef, as well
27
+ as completely customize the client if required. Check the [README.md](https://github.com/backstage/backstage/blob/master/plugins/catalog-unprocessed-entities/README.md) to
28
+ note what needs to be added in order to use the new `catalogUnprocessedEntitiesApiRef` exported function.
29
+ - a8fa79ccc105: Fix and improve documentation for the unprocessed entities modules.
30
+ - Updated dependencies
31
+ - @backstage/errors@1.2.1-next.0
32
+ - @backstage/core-components@0.13.3-next.0
33
+ - @backstage/catalog-model@1.4.1-next.0
34
+ - @backstage/core-plugin-api@1.5.2
35
+ - @backstage/theme@0.4.0
36
+
3
37
  ## 0.1.0
4
38
 
5
39
  ### Minor Changes
package/README.md CHANGED
@@ -1,16 +1,40 @@
1
- # catalog-unprocessed-entities
1
+ # Catalog Unprocessed Entities
2
+
3
+ ## Features
2
4
 
3
5
  Frontend plugin to view unprocessed entities.
4
6
 
7
+ ### Failed Entities
8
+
9
+ You can see entities that are in a failed state:
10
+
11
+ ![Example of failed entities tab](./docs/catalog-unprocessed-entities-failed.png)
12
+
13
+ ### Pending Entities
14
+
15
+ You can see entities that are in a pending state:
16
+
17
+ ![Example of pending entities tab](./docs/catalog-unprocessed-entities-pending.png)
18
+
19
+ ### Raw View
20
+
21
+ In either of the failed or pending tabs you have the option to see the raw entity as JSON:
22
+
23
+ ![Example of raw entity](./docs/catalog-unprocessed-entities-raw.png)
24
+
5
25
  ## Requirements
6
26
 
7
27
  Requires the `@backstage/plugin-catalog-backend-module-unprocessed` module to be installed.
8
28
 
9
29
  ## Installation
10
30
 
11
- Import into your App.tsx and include into the `<FlatRoutes>` component:
31
+ ```shell
32
+ yarn add --cwd packages/app @backstage/plugin-catalog-unprocessed-entities
33
+ ```
34
+
35
+ Import into your `App.tsx` and include into the `<FlatRoutes>` component:
12
36
 
13
- ```tsx
37
+ ```tsx title="packages/app/src/App.tsx"
14
38
  import { CatalogUnprocessedEntitiesPage } from '@backstage/plugin-catalog-unprocessed-entities';
15
39
  //...
16
40
 
@@ -20,9 +44,44 @@ import { CatalogUnprocessedEntitiesPage } from '@backstage/plugin-catalog-unproc
20
44
  />;
21
45
  ```
22
46
 
47
+ ## Customization
48
+
49
+ If you want to use the provided endpoints in a different way, you can use the ApiRef doing the following:
50
+
51
+ ```typescript
52
+ import { catalogUnprocessedEntitiesApiRef } from '@backstage/plugin-catalog-unprocessed-entities';
53
+ import { useApi } from '@backstage/core-plugin-api';
54
+
55
+ const catalogUnprocessedEntitiesApi = useApi(catalogUnprocessedEntitiesApiRef);
56
+ ```
57
+
58
+ Note that if you are not rendering the `CatalogUnprocessedEntitiesPage` in the `App.tsx` tree, you will need to export the `catalogUnproccessedEntitiesPlugin` from your `plugins.ts` file to setup the plugin otherwise you will receive an error like `No implementation available for apiRef{plugin.catalog-unprocessed-entities.service}`
59
+
60
+ ```typescript
61
+ // In packages/app/src/plugins.ts
62
+ ...
63
+ export { catalogUnprocessedEntitiesPlugin } from '@backstage/plugin-catalog-unprocessed-entities';
64
+ ```
65
+
66
+ If you don't have a `plugins.ts` file, you can create it with the path `packages/app/src/plugins.ts` and then import it into your `App.tsx`:
67
+
68
+ ```diff
69
+ + import * as plugins from './plugins';
70
+
71
+ const app = createApp({
72
+ apis,
73
+ + plugins: Object.values(plugins),
74
+ bindRoutes({ bind }) {
75
+ /* ... */
76
+ },
77
+ });
78
+ ```
79
+
23
80
  ## Getting started
24
81
 
25
- Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/catalog-unprocessed-entities](http://localhost:3000/catalog-unprocessed-entities).
82
+ Your plugin has been added to the example app in this repository,
83
+ meaning you'll be able to access it by running `yarn start` in the root directory,
84
+ and then navigating to [/catalog-unprocessed-entities](http://localhost:3000/catalog-unprocessed-entities).
26
85
 
27
86
  You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
28
87
  This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
+ import { Entity } from '@backstage/catalog-model';
3
4
 
4
5
  /**
5
6
  * Plugin entry point
@@ -16,4 +17,76 @@ declare const catalogUnprocessedEntitiesPlugin: _backstage_core_plugin_api.Backs
16
17
  */
17
18
  declare const CatalogUnprocessedEntitiesPage: () => JSX.Element;
18
19
 
19
- export { CatalogUnprocessedEntitiesPage, catalogUnprocessedEntitiesPlugin };
20
+ /** @public */
21
+ declare const UnprocessedEntitiesContent: () => JSX.Element;
22
+
23
+ /**
24
+ * Unprocessed entity data stored in the database.
25
+ * @public
26
+ */
27
+ type UnprocessedEntity = {
28
+ entity_id: string;
29
+ entity_ref: string;
30
+ unprocessed_entity: Entity;
31
+ unprocessed_hash?: string;
32
+ processed_entity?: Entity;
33
+ result_hash?: string;
34
+ cache?: UnprocessedEntityCache;
35
+ next_update_at: string | Date;
36
+ last_discovery_at: string | Date;
37
+ errors?: UnprocessedEntityError[];
38
+ location_key?: string;
39
+ };
40
+ /**
41
+ * Unprocessed entity cache stored in the database.
42
+ * @public
43
+ */
44
+ type UnprocessedEntityCache = {
45
+ ttl: number;
46
+ cache: object;
47
+ };
48
+ /**
49
+ * Unprocessed entity error information stored in the database.
50
+ * @public
51
+ */
52
+ type UnprocessedEntityError = {
53
+ name: string;
54
+ message: string;
55
+ cause: {
56
+ name: string;
57
+ message: string;
58
+ stack: string;
59
+ };
60
+ };
61
+
62
+ /**
63
+ * {@link @backstage/core-plugin-api#ApiRef} for the {@link CatalogUnprocessedEntitiesApi}
64
+ *
65
+ * @public
66
+ */
67
+ declare const catalogUnprocessedEntitiesApiRef: _backstage_core_plugin_api.ApiRef<CatalogUnprocessedEntitiesApi>;
68
+ /**
69
+ * Response expected by the {@link CatalogUnprocessedEntitiesApi}
70
+ *
71
+ * @public
72
+ */
73
+ type CatalogUnprocessedEntitiesApiResponse = {
74
+ entities: UnprocessedEntity[];
75
+ };
76
+ /**
77
+ * Interface for the CatalogUnprocessedEntitiesApi.
78
+ *
79
+ * @public
80
+ */
81
+ interface CatalogUnprocessedEntitiesApi {
82
+ /**
83
+ * Returns a list of entities with state 'pending'
84
+ */
85
+ pending(): Promise<CatalogUnprocessedEntitiesApiResponse>;
86
+ /**
87
+ * Returns a list of entities with state 'failed'
88
+ */
89
+ failed(): Promise<CatalogUnprocessedEntitiesApiResponse>;
90
+ }
91
+
92
+ export { CatalogUnprocessedEntitiesApi, CatalogUnprocessedEntitiesApiResponse, CatalogUnprocessedEntitiesPage, UnprocessedEntitiesContent, UnprocessedEntity, UnprocessedEntityCache, UnprocessedEntityError, catalogUnprocessedEntitiesApiRef, catalogUnprocessedEntitiesPlugin };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,282 @@
1
- export { C as CatalogUnprocessedEntitiesPage, a as catalogUnprocessedEntitiesPlugin } from './esm/index-afbab918.esm.js';
2
- import '@backstage/core-plugin-api';
3
- import '@backstage/errors';
1
+ import { createRouteRef, createApiRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension, useApi } from '@backstage/core-plugin-api';
2
+ import { ResponseError } from '@backstage/errors';
3
+ import React, { useState } from 'react';
4
+ import { CodeSnippet, Progress, ErrorPanel, Table, MarkdownContent, Page, Header, Content } from '@backstage/core-components';
5
+ import { makeStyles as makeStyles$1, Typography, Box, Tab } from '@material-ui/core';
6
+ import { TabContext, TabList, TabPanel } from '@material-ui/lab';
7
+ import Dialog from '@material-ui/core/Dialog';
8
+ import DialogContent from '@material-ui/core/DialogContent';
9
+ import DialogTitle from '@material-ui/core/DialogTitle';
10
+ import IconButton from '@material-ui/core/IconButton';
11
+ import { makeStyles, createStyles } from '@material-ui/core/styles';
12
+ import CloseIcon from '@material-ui/icons/Close';
13
+ import DescriptionIcon from '@material-ui/icons/Description';
14
+ import useAsync from 'react-use/lib/useAsync';
15
+
16
+ const rootRouteRef = createRouteRef({
17
+ id: "catalog-unprocessed-entities"
18
+ });
19
+
20
+ const catalogUnprocessedEntitiesApiRef = createApiRef({
21
+ id: "plugin.catalog-unprocessed-entities.service"
22
+ });
23
+ class CatalogUnprocessedEntitiesClient {
24
+ constructor(discovery, fetchApi) {
25
+ this.discovery = discovery;
26
+ this.fetchApi = fetchApi;
27
+ }
28
+ async fetch(path, init) {
29
+ const url = await this.discovery.getBaseUrl("catalog");
30
+ const resp = await this.fetchApi.fetch(`${url}/${path}`, init);
31
+ if (!resp.ok) {
32
+ throw await ResponseError.fromResponse(resp);
33
+ }
34
+ return await resp.json();
35
+ }
36
+ async pending() {
37
+ return await this.fetch("entities/unprocessed/pending");
38
+ }
39
+ async failed() {
40
+ return await this.fetch("entities/unprocessed/failed");
41
+ }
42
+ }
43
+
44
+ const catalogUnprocessedEntitiesPlugin = createPlugin({
45
+ id: "catalog-unprocessed-entities",
46
+ routes: {
47
+ root: rootRouteRef
48
+ },
49
+ apis: [
50
+ createApiFactory({
51
+ api: catalogUnprocessedEntitiesApiRef,
52
+ deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },
53
+ factory: ({ discoveryApi, fetchApi }) => new CatalogUnprocessedEntitiesClient(discoveryApi, fetchApi)
54
+ })
55
+ ]
56
+ });
57
+ const CatalogUnprocessedEntitiesPage = catalogUnprocessedEntitiesPlugin.provide(
58
+ createRoutableExtension({
59
+ name: "CatalogUnprocessedEntitiesPage",
60
+ component: () => Promise.resolve().then(function () { return UnprocessedEntities$1; }).then(
61
+ (m) => m.UnprocessedEntities
62
+ ),
63
+ mountPoint: rootRouteRef
64
+ })
65
+ );
66
+
67
+ const useStyles$3 = makeStyles(
68
+ (theme) => createStyles({
69
+ closeButton: {
70
+ position: "absolute",
71
+ right: theme.spacing(1),
72
+ top: theme.spacing(1),
73
+ color: theme.palette.grey[500]
74
+ },
75
+ entity: {
76
+ overflow: "scroll",
77
+ width: "100%"
78
+ },
79
+ codeBox: {
80
+ border: "1px solid black",
81
+ padding: "1em"
82
+ }
83
+ })
84
+ );
85
+ const EntityDialog = ({ entity }) => {
86
+ const [open, setOpen] = useState(false);
87
+ const classes = useStyles$3();
88
+ const openDialog = () => {
89
+ setOpen(true);
90
+ };
91
+ const closeDialog = () => {
92
+ setOpen(false);
93
+ };
94
+ const dialogContent = () => {
95
+ return /* @__PURE__ */ React.createElement(
96
+ CodeSnippet,
97
+ {
98
+ language: "json",
99
+ showLineNumbers: true,
100
+ text: JSON.stringify(entity, null, 4)
101
+ }
102
+ );
103
+ };
104
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton, { color: "primary", onClick: openDialog }, /* @__PURE__ */ React.createElement(DescriptionIcon, null)), /* @__PURE__ */ React.createElement(Dialog, { fullWidth: true, open, onClose: closeDialog }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "dialog-title" }, /* @__PURE__ */ React.createElement(
105
+ IconButton,
106
+ {
107
+ "aria-label": "close",
108
+ className: classes.closeButton,
109
+ onClick: closeDialog
110
+ },
111
+ /* @__PURE__ */ React.createElement(CloseIcon, null)
112
+ )), /* @__PURE__ */ React.createElement(DialogContent, null, dialogContent())));
113
+ };
114
+
115
+ const useStyles$2 = makeStyles$1((theme) => ({
116
+ errorBox: {
117
+ color: theme.palette.status.error,
118
+ backgroundColor: theme.palette.errorBackground,
119
+ padding: "1em",
120
+ margin: "1em",
121
+ border: `1px solid ${theme.palette.status.error}`
122
+ },
123
+ errorTitle: {
124
+ width: "100%",
125
+ fontWeight: "bold"
126
+ },
127
+ successMessage: {
128
+ background: theme.palette.infoBackground,
129
+ color: theme.palette.infoText,
130
+ padding: theme.spacing(2)
131
+ }
132
+ }));
133
+ const RenderErrorContext = ({
134
+ error,
135
+ rowData
136
+ }) => {
137
+ var _a;
138
+ if (error.message.includes("tags.")) {
139
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, null, "Tags"), /* @__PURE__ */ React.createElement("ul", null, (_a = rowData.unprocessed_entity.metadata.tags) == null ? void 0 : _a.map((t) => /* @__PURE__ */ React.createElement("li", null, t))));
140
+ }
141
+ if (error.message.includes("metadata.name")) {
142
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, null, "Name"), /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, rowData.unprocessed_entity.metadata.name));
143
+ }
144
+ return null;
145
+ };
146
+ const FailedEntities = () => {
147
+ const classes = useStyles$2();
148
+ const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);
149
+ const {
150
+ loading,
151
+ error,
152
+ value: data
153
+ } = useAsync(async () => await unprocessedApi.failed());
154
+ if (loading) {
155
+ return /* @__PURE__ */ React.createElement(Progress, null);
156
+ }
157
+ if (error) {
158
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
159
+ }
160
+ const columns = [
161
+ {
162
+ title: /* @__PURE__ */ React.createElement(Typography, null, "entityRef"),
163
+ render: (rowData) => rowData.entity_ref
164
+ },
165
+ {
166
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Kind"),
167
+ render: (rowData) => rowData.unprocessed_entity.kind
168
+ },
169
+ {
170
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Owner"),
171
+ render: (rowData) => {
172
+ var _a;
173
+ return ((_a = rowData.unprocessed_entity.spec) == null ? void 0 : _a.owner) || "unknown";
174
+ }
175
+ },
176
+ {
177
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Raw"),
178
+ render: (rowData) => /* @__PURE__ */ React.createElement(EntityDialog, { entity: rowData })
179
+ }
180
+ ];
181
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
182
+ Table,
183
+ {
184
+ options: { pageSize: 20, search: true },
185
+ columns,
186
+ data: (data == null ? void 0 : data.entities) || [],
187
+ emptyContent: /* @__PURE__ */ React.createElement(Typography, { className: classes.successMessage }, "No failed entities found"),
188
+ detailPanel: ({ rowData }) => {
189
+ const errors = rowData.errors;
190
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, errors == null ? void 0 : errors.map((e) => {
191
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.errorBox }, /* @__PURE__ */ React.createElement(Typography, { className: classes.errorTitle }, e.name), /* @__PURE__ */ React.createElement(MarkdownContent, { content: e.message }), /* @__PURE__ */ React.createElement(
192
+ RenderErrorContext,
193
+ {
194
+ error: e,
195
+ rowData
196
+ }
197
+ ));
198
+ }));
199
+ }
200
+ }
201
+ ));
202
+ };
203
+
204
+ const useStyles$1 = makeStyles$1((theme) => ({
205
+ successMessage: {
206
+ background: theme.palette.infoBackground,
207
+ color: theme.palette.infoText,
208
+ padding: theme.spacing(2)
209
+ }
210
+ }));
211
+ const PendingEntities = () => {
212
+ const classes = useStyles$1();
213
+ const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);
214
+ const {
215
+ loading,
216
+ error,
217
+ value: data
218
+ } = useAsync(async () => await unprocessedApi.pending());
219
+ if (loading) {
220
+ return /* @__PURE__ */ React.createElement(Progress, null);
221
+ }
222
+ if (error) {
223
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
224
+ }
225
+ const columns = [
226
+ {
227
+ title: /* @__PURE__ */ React.createElement(Typography, null, "entityRef"),
228
+ render: (rowData) => rowData.entity_ref
229
+ },
230
+ {
231
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Kind"),
232
+ render: (rowData) => rowData.unprocessed_entity.kind
233
+ },
234
+ {
235
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Owner"),
236
+ render: (rowData) => {
237
+ var _a;
238
+ return ((_a = rowData.unprocessed_entity.spec) == null ? void 0 : _a.owner) || "unknown";
239
+ }
240
+ },
241
+ {
242
+ title: /* @__PURE__ */ React.createElement(Typography, null, "Raw"),
243
+ render: (rowData) => /* @__PURE__ */ React.createElement(EntityDialog, { entity: rowData })
244
+ }
245
+ ];
246
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
247
+ Table,
248
+ {
249
+ options: { pageSize: 20 },
250
+ columns,
251
+ data: (data == null ? void 0 : data.entities) || [],
252
+ emptyContent: /* @__PURE__ */ React.createElement(Typography, { className: classes.successMessage }, "No pending entities found")
253
+ }
254
+ ));
255
+ };
256
+
257
+ const useStyles = makeStyles$1(() => ({
258
+ tabPanel: {
259
+ paddingLeft: "0px",
260
+ paddingRight: "0px"
261
+ }
262
+ }));
263
+ const UnprocessedEntitiesContent = () => {
264
+ const classes = useStyles();
265
+ const [tab, setTab] = useState("failed");
266
+ const handleChange = (_event, tabValue) => {
267
+ setTab(tabValue);
268
+ };
269
+ return /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(TabList, { onChange: handleChange }, /* @__PURE__ */ React.createElement(Tab, { label: "Failed", value: "failed" }), /* @__PURE__ */ React.createElement(Tab, { label: "Pending", value: "pending" })), /* @__PURE__ */ React.createElement(TabPanel, { value: "failed", className: classes.tabPanel }, /* @__PURE__ */ React.createElement(FailedEntities, null)), /* @__PURE__ */ React.createElement(TabPanel, { value: "pending", className: classes.tabPanel }, /* @__PURE__ */ React.createElement(PendingEntities, null)));
270
+ };
271
+ const UnprocessedEntities = () => {
272
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Unprocessed Entities" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(UnprocessedEntitiesContent, null)));
273
+ };
274
+
275
+ var UnprocessedEntities$1 = /*#__PURE__*/Object.freeze({
276
+ __proto__: null,
277
+ UnprocessedEntitiesContent: UnprocessedEntitiesContent,
278
+ UnprocessedEntities: UnprocessedEntities
279
+ });
280
+
281
+ export { CatalogUnprocessedEntitiesPage, UnprocessedEntitiesContent, catalogUnprocessedEntitiesApiRef, catalogUnprocessedEntitiesPlugin };
4
282
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/api/index.ts","../src/plugin.ts","../src/components/EntityDialog.tsx","../src/components/FailedEntities.tsx","../src/components/PendingEntities.tsx","../src/components/UnprocessedEntities.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'catalog-unprocessed-entities',\n});\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n DiscoveryApi,\n createApiRef,\n FetchApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { UnprocessedEntity } from '../types';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link CatalogUnprocessedEntitiesApi}\n *\n * @public\n */\nexport const catalogUnprocessedEntitiesApiRef =\n createApiRef<CatalogUnprocessedEntitiesApi>({\n id: 'plugin.catalog-unprocessed-entities.service',\n });\n\n/**\n * Response expected by the {@link CatalogUnprocessedEntitiesApi}\n *\n * @public\n */\nexport type CatalogUnprocessedEntitiesApiResponse = {\n entities: UnprocessedEntity[];\n};\n\n/**\n * Interface for the CatalogUnprocessedEntitiesApi.\n *\n * @public\n */\nexport interface CatalogUnprocessedEntitiesApi {\n /**\n * Returns a list of entities with state 'pending'\n */\n pending(): Promise<CatalogUnprocessedEntitiesApiResponse>;\n /**\n * Returns a list of entities with state 'failed'\n */\n failed(): Promise<CatalogUnprocessedEntitiesApiResponse>;\n}\n\n/**\n * Default API implementation for the Catalog Unprocessed Entities plugin\n *\n * @public\n */\nexport class CatalogUnprocessedEntitiesClient\n implements CatalogUnprocessedEntitiesApi\n{\n constructor(public discovery: DiscoveryApi, public fetchApi: FetchApi) {}\n\n private async fetch<T>(path: string, init?: RequestInit): Promise<T> {\n const url = await this.discovery.getBaseUrl('catalog');\n const resp = await this.fetchApi.fetch(`${url}/${path}`, init);\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return await resp.json();\n }\n\n async pending(): Promise<CatalogUnprocessedEntitiesApiResponse> {\n return await this.fetch('entities/unprocessed/pending');\n }\n\n async failed(): Promise<CatalogUnprocessedEntitiesApiResponse> {\n return await this.fetch('entities/unprocessed/failed');\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport {\n CatalogUnprocessedEntitiesClient,\n catalogUnprocessedEntitiesApiRef,\n} from './api';\n\n/**\n * Plugin entry point\n *\n * @public\n */\nexport const catalogUnprocessedEntitiesPlugin = createPlugin({\n id: 'catalog-unprocessed-entities',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: catalogUnprocessedEntitiesApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new CatalogUnprocessedEntitiesClient(discoveryApi, fetchApi),\n }),\n ],\n});\n\n/**\n * Tool page for the Catalog Unprocessed Entities Plugin\n *\n * @public\n */\nexport const CatalogUnprocessedEntitiesPage =\n catalogUnprocessedEntitiesPlugin.provide(\n createRoutableExtension({\n name: 'CatalogUnprocessedEntitiesPage',\n component: () =>\n import('./components/UnprocessedEntities').then(\n m => m.UnprocessedEntities,\n ),\n mountPoint: rootRouteRef,\n }),\n );\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\n\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport DescriptionIcon from '@material-ui/icons/Description';\n\nimport { UnprocessedEntity } from './../types';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n entity: {\n overflow: 'scroll',\n width: '100%',\n },\n codeBox: {\n border: '1px solid black',\n padding: '1em',\n },\n }),\n);\n\nexport const EntityDialog = ({ entity }: { entity: UnprocessedEntity }) => {\n const [open, setOpen] = useState(false);\n const classes = useStyles();\n\n const openDialog = () => {\n setOpen(true);\n };\n\n const closeDialog = () => {\n setOpen(false);\n };\n\n const dialogContent = () => {\n return (\n <CodeSnippet\n language=\"json\"\n showLineNumbers\n text={JSON.stringify(entity, null, 4)}\n />\n );\n };\n\n return (\n <>\n <IconButton color=\"primary\" onClick={openDialog}>\n <DescriptionIcon />\n </IconButton>\n <Dialog fullWidth open={open} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n <IconButton\n aria-label=\"close\"\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent>{dialogContent()}</DialogContent>\n </Dialog>\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n ErrorPanel,\n MarkdownContent,\n Progress,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Box, Theme, Typography, makeStyles } from '@material-ui/core';\n\nimport { UnprocessedEntity } from '../types';\nimport { EntityDialog } from './EntityDialog';\nimport { catalogUnprocessedEntitiesApiRef } from '../api';\nimport useAsync from 'react-use/lib/useAsync';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n errorBox: {\n color: theme.palette.status.error,\n backgroundColor: theme.palette.errorBackground,\n padding: '1em',\n margin: '1em',\n border: `1px solid ${theme.palette.status.error}`,\n },\n errorTitle: {\n width: '100%',\n fontWeight: 'bold',\n },\n successMessage: {\n background: theme.palette.infoBackground,\n color: theme.palette.infoText,\n padding: theme.spacing(2),\n },\n}));\n\nconst RenderErrorContext = ({\n error,\n rowData,\n}: {\n error: { message: string };\n rowData: UnprocessedEntity;\n}) => {\n if (error.message.includes('tags.')) {\n return (\n <>\n <Typography>Tags</Typography>\n <ul>\n {rowData.unprocessed_entity.metadata.tags?.map(t => (\n <li>{t}</li>\n ))}\n </ul>\n </>\n );\n }\n\n if (error.message.includes('metadata.name')) {\n return (\n <>\n <Typography>Name</Typography>\n <Typography variant=\"caption\">\n {rowData.unprocessed_entity.metadata.name}\n </Typography>\n </>\n );\n }\n\n return null;\n};\n\nexport const FailedEntities = () => {\n const classes = useStyles();\n const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);\n const {\n loading,\n error,\n value: data,\n } = useAsync(async () => await unprocessedApi.failed());\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const columns: TableColumn[] = [\n {\n title: <Typography>entityRef</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).entity_ref,\n },\n {\n title: <Typography>Kind</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.kind,\n },\n {\n title: <Typography>Owner</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.spec?.owner ||\n 'unknown',\n },\n {\n title: <Typography>Raw</Typography>,\n render: (rowData: UnprocessedEntity | {}) => (\n <EntityDialog entity={rowData as UnprocessedEntity} />\n ),\n },\n ];\n return (\n <>\n <Table\n options={{ pageSize: 20, search: true }}\n columns={columns}\n data={data?.entities || []}\n emptyContent={\n <Typography className={classes.successMessage}>\n No failed entities found\n </Typography>\n }\n detailPanel={({ rowData }) => {\n const errors = (rowData as UnprocessedEntity).errors;\n return (\n <>\n {errors?.map(e => {\n return (\n <Box className={classes.errorBox}>\n <Typography className={classes.errorTitle}>\n {e.name}\n </Typography>\n <MarkdownContent content={e.message} />\n <RenderErrorContext\n error={e}\n rowData={rowData as UnprocessedEntity}\n />\n </Box>\n );\n })}\n </>\n );\n }}\n />\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n ErrorPanel,\n Progress,\n TableColumn,\n Table,\n} from '@backstage/core-components';\nimport { Theme, Typography, makeStyles } from '@material-ui/core';\n\nimport { UnprocessedEntity } from '../types';\n\nimport { EntityDialog } from './EntityDialog';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { catalogUnprocessedEntitiesApiRef } from '../api';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n successMessage: {\n background: theme.palette.infoBackground,\n color: theme.palette.infoText,\n padding: theme.spacing(2),\n },\n}));\n\nexport const PendingEntities = () => {\n const classes = useStyles();\n const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);\n const {\n loading,\n error,\n value: data,\n } = useAsync(async () => await unprocessedApi.pending());\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const columns: TableColumn[] = [\n {\n title: <Typography>entityRef</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).entity_ref,\n },\n {\n title: <Typography>Kind</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.kind,\n },\n {\n title: <Typography>Owner</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.spec?.owner ||\n 'unknown',\n },\n {\n title: <Typography>Raw</Typography>,\n render: (rowData: UnprocessedEntity | {}) => (\n <EntityDialog entity={rowData as UnprocessedEntity} />\n ),\n },\n ];\n return (\n <>\n <Table\n options={{ pageSize: 20 }}\n columns={columns}\n data={data?.entities || []}\n emptyContent={\n <Typography className={classes.successMessage}>\n No pending entities found\n </Typography>\n }\n />\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\n\nimport { Page, Header, Content } from '@backstage/core-components';\nimport { Tab, makeStyles } from '@material-ui/core';\nimport { TabContext, TabList, TabPanel } from '@material-ui/lab';\n\nimport { FailedEntities } from './FailedEntities';\nimport { PendingEntities } from './PendingEntities';\n\nconst useStyles = makeStyles(() => ({\n tabPanel: {\n paddingLeft: '0px',\n paddingRight: '0px',\n },\n}));\n\n/** @public */\nexport const UnprocessedEntitiesContent = () => {\n const classes = useStyles();\n const [tab, setTab] = useState('failed');\n const handleChange = (_event: React.ChangeEvent<{}>, tabValue: string) => {\n setTab(tabValue);\n };\n\n return (\n <TabContext value={tab}>\n <TabList onChange={handleChange}>\n <Tab label=\"Failed\" value=\"failed\" />\n <Tab label=\"Pending\" value=\"pending\" />\n </TabList>\n <TabPanel value=\"failed\" className={classes.tabPanel}>\n <FailedEntities />\n </TabPanel>\n <TabPanel value=\"pending\" className={classes.tabPanel}>\n <PendingEntities />\n </TabPanel>\n </TabContext>\n );\n};\n\nexport const UnprocessedEntities = () => {\n return (\n <Page themeId=\"tool\">\n <Header title=\"Unprocessed Entities\" />\n <Content>\n <UnprocessedEntitiesContent />\n </Content>\n </Page>\n );\n};\n"],"names":["useStyles","makeStyles"],"mappings":";;;;;;;;;;;;;;;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,8BAAA;AACN,CAAC,CAAA;;ACSM,MAAM,mCACX,YAA4C,CAAA;AAAA,EAC1C,EAAI,EAAA,6CAAA;AACN,CAAC,EAAA;AAgCI,MAAM,gCAEb,CAAA;AAAA,EACE,WAAA,CAAmB,WAAgC,QAAoB,EAAA;AAApD,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAgC,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AAAA,GAAqB;AAAA,EAExE,MAAc,KAAS,CAAA,IAAA,EAAc,IAAgC,EAAA;AACnE,IAAA,MAAM,GAAM,GAAA,MAAM,IAAK,CAAA,SAAA,CAAU,WAAW,SAAS,CAAA,CAAA;AACrD,IAAM,MAAA,IAAA,GA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AAAA,GACjB,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAO,EAAA,GAAA,EAAA,sCAChB,OAAQ,EAAA,EAAA,QAAA,EAAU,gCAChB,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,OAAM,QAAS,EAAA,KAAA,EAAM,UAAS,CACnC,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,KAAM,EAAA,SAAA,EAAU,OAAM,SAAU,EAAA,CACvC,mBACC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAM,QAAS,EAAA,SAAA,EAAW,QAAQ,QAC1C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAe,CAClB,CAAA,sCACC,QAAS,EAAA,EAAA,KAAA,EAAM,WAAU,SAAW,EAAA,OAAA,CAAQ,4BAC1C,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,IAAgB,CACnB,CACF,CAAA,CAAA;AAEJ,EAAA;AAEO,MAAM,sBAAsB,MAAM;AACvC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,MAAO,EAAA,EAAA,KAAA,EAAM,sBAAuB,EAAA,CAAA,kBACpC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,0BAAA,EAAA,IAA2B,CAC9B,CACF,CAAA,CAAA;AAEJ,CAAA;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-unprocessed-entities",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-next.1",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -12,6 +12,12 @@
12
12
  "backstage": {
13
13
  "role": "frontend-plugin"
14
14
  },
15
+ "homepage": "https://backstage.io",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/backstage/backstage",
19
+ "directory": "plugins/catalog-unprocessed-entities"
20
+ },
15
21
  "scripts": {
16
22
  "start": "backstage-cli package start",
17
23
  "build": "backstage-cli package build",
@@ -22,11 +28,11 @@
22
28
  "postpack": "backstage-cli package postpack"
23
29
  },
24
30
  "dependencies": {
25
- "@backstage/catalog-model": "^1.4.0",
26
- "@backstage/core-components": "^0.13.2",
27
- "@backstage/core-plugin-api": "^1.5.2",
28
- "@backstage/errors": "^1.2.0",
29
- "@backstage/theme": "^0.4.0",
31
+ "@backstage/catalog-model": "^1.4.1-next.0",
32
+ "@backstage/core-components": "^0.13.3-next.1",
33
+ "@backstage/core-plugin-api": "^1.5.3-next.0",
34
+ "@backstage/errors": "^1.2.1-next.0",
35
+ "@backstage/theme": "^0.4.1-next.0",
30
36
  "@material-ui/core": "^4.9.13",
31
37
  "@material-ui/icons": "^4.9.1",
32
38
  "@material-ui/lab": "^4.0.0-alpha.60",
@@ -36,10 +42,10 @@
36
42
  "react": "^16.13.1 || ^17.0.0"
37
43
  },
38
44
  "devDependencies": {
39
- "@backstage/cli": "^0.22.8",
40
- "@backstage/core-app-api": "^1.8.1",
41
- "@backstage/dev-utils": "^1.0.16",
42
- "@backstage/test-utils": "^1.4.0",
45
+ "@backstage/cli": "^0.22.9-next.0",
46
+ "@backstage/core-app-api": "^1.8.2-next.0",
47
+ "@backstage/dev-utils": "^1.0.17-next.1",
48
+ "@backstage/test-utils": "^1.4.1-next.1",
43
49
  "@testing-library/jest-dom": "^5.10.1",
44
50
  "@testing-library/react": "^12.1.3",
45
51
  "@testing-library/user-event": "^14.0.0",
@@ -1,218 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { CodeSnippet, Progress, ErrorPanel, Table, MarkdownContent, Content, Page, Header } from '@backstage/core-components';
3
- import { makeStyles as makeStyles$1, Typography, Box, Tab } from '@material-ui/core';
4
- import { TabContext, TabList, TabPanel } from '@material-ui/lab';
5
- import { useApi } from '@backstage/core-plugin-api';
6
- import Dialog from '@material-ui/core/Dialog';
7
- import DialogContent from '@material-ui/core/DialogContent';
8
- import DialogTitle from '@material-ui/core/DialogTitle';
9
- import IconButton from '@material-ui/core/IconButton';
10
- import { makeStyles, createStyles } from '@material-ui/core/styles';
11
- import CloseIcon from '@material-ui/icons/Close';
12
- import DescriptionIcon from '@material-ui/icons/Description';
13
- import { c as catalogUnprocessedEntitiesApiRef } from './index-afbab918.esm.js';
14
- import useAsync from 'react-use/lib/useAsync';
15
- import '@backstage/errors';
16
-
17
- const useStyles$2 = makeStyles(
18
- (theme) => createStyles({
19
- closeButton: {
20
- position: "absolute",
21
- right: theme.spacing(1),
22
- top: theme.spacing(1),
23
- color: theme.palette.grey[500]
24
- },
25
- entity: {
26
- overflow: "scroll",
27
- width: "100%"
28
- },
29
- codeBox: {
30
- border: "1px solid black",
31
- padding: "1em"
32
- }
33
- })
34
- );
35
- const EntityDialog = ({ entity }) => {
36
- const [open, setOpen] = useState(false);
37
- const classes = useStyles$2();
38
- const openDialog = () => {
39
- setOpen(true);
40
- };
41
- const closeDialog = () => {
42
- setOpen(false);
43
- };
44
- const dialogContent = () => {
45
- return /* @__PURE__ */ React.createElement(
46
- CodeSnippet,
47
- {
48
- language: "json",
49
- showLineNumbers: true,
50
- text: JSON.stringify(entity, null, 4)
51
- }
52
- );
53
- };
54
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton, { color: "primary", onClick: openDialog }, /* @__PURE__ */ React.createElement(DescriptionIcon, null)), /* @__PURE__ */ React.createElement(Dialog, { fullWidth: true, open, onClose: closeDialog }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "dialog-title" }, /* @__PURE__ */ React.createElement(
55
- IconButton,
56
- {
57
- "aria-label": "close",
58
- className: classes.closeButton,
59
- onClick: closeDialog
60
- },
61
- /* @__PURE__ */ React.createElement(CloseIcon, null)
62
- )), /* @__PURE__ */ React.createElement(DialogContent, null, dialogContent())));
63
- };
64
-
65
- const useStyles$1 = makeStyles$1((theme) => ({
66
- errorBox: {
67
- color: theme.palette.status.error,
68
- backgroundColor: theme.palette.errorBackground,
69
- padding: "1em",
70
- margin: "1em",
71
- border: `1px solid ${theme.palette.status.error}`
72
- },
73
- errorTitle: {
74
- width: "100%",
75
- fontWeight: "bold"
76
- },
77
- successMessage: {
78
- background: theme.palette.infoBackground,
79
- color: theme.palette.infoText
80
- }
81
- }));
82
- const RenderErrorContext = ({
83
- error,
84
- rowData
85
- }) => {
86
- var _a;
87
- if (error.message.includes("tags.")) {
88
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, null, "Tags"), /* @__PURE__ */ React.createElement("ul", null, (_a = rowData.unprocessed_entity.metadata.tags) == null ? void 0 : _a.map((t) => /* @__PURE__ */ React.createElement("li", null, t))));
89
- }
90
- if (error.message.includes("metadata.name")) {
91
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, null, "Name"), /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, rowData.unprocessed_entity.metadata.name));
92
- }
93
- return null;
94
- };
95
- const FailedEntities = () => {
96
- const classes = useStyles$1();
97
- const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);
98
- const {
99
- loading,
100
- error,
101
- value: data
102
- } = useAsync(async () => await unprocessedApi.failed());
103
- if (loading) {
104
- return /* @__PURE__ */ React.createElement(Progress, null);
105
- }
106
- if (error) {
107
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
108
- }
109
- const columns = [
110
- {
111
- title: /* @__PURE__ */ React.createElement(Typography, null, "entityRef"),
112
- render: (rowData) => rowData.entity_ref
113
- },
114
- {
115
- title: /* @__PURE__ */ React.createElement(Typography, null, "Kind"),
116
- render: (rowData) => rowData.unprocessed_entity.kind
117
- },
118
- {
119
- title: /* @__PURE__ */ React.createElement(Typography, null, "Owner"),
120
- render: (rowData) => {
121
- var _a;
122
- return ((_a = rowData.unprocessed_entity.spec) == null ? void 0 : _a.owner) || "unknown";
123
- }
124
- },
125
- {
126
- title: /* @__PURE__ */ React.createElement(Typography, null, "Raw"),
127
- render: (rowData) => /* @__PURE__ */ React.createElement(EntityDialog, { entity: rowData })
128
- }
129
- ];
130
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
131
- Table,
132
- {
133
- options: { pageSize: 40, search: true },
134
- columns,
135
- data: (data == null ? void 0 : data.entities) || [],
136
- emptyContent: /* @__PURE__ */ React.createElement(Typography, { className: classes.successMessage }, "No failed entities found"),
137
- detailPanel: ({ rowData }) => {
138
- const errors = rowData.errors;
139
- return /* @__PURE__ */ React.createElement(React.Fragment, null, errors == null ? void 0 : errors.map((e) => {
140
- return /* @__PURE__ */ React.createElement(Box, { className: classes.errorBox }, /* @__PURE__ */ React.createElement(Typography, { className: classes.errorTitle }, e.name), /* @__PURE__ */ React.createElement(MarkdownContent, { content: e.message }), /* @__PURE__ */ React.createElement(
141
- RenderErrorContext,
142
- {
143
- error: e,
144
- rowData
145
- }
146
- ));
147
- }));
148
- }
149
- }
150
- ));
151
- };
152
-
153
- const useStyles = makeStyles$1((theme) => ({
154
- successMessage: {
155
- background: theme.palette.infoBackground,
156
- color: theme.palette.infoText,
157
- padding: theme.spacing(2)
158
- }
159
- }));
160
- const PendingEntities = () => {
161
- const classes = useStyles();
162
- const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);
163
- const {
164
- loading,
165
- error,
166
- value: data
167
- } = useAsync(async () => await unprocessedApi.pending());
168
- if (loading) {
169
- return /* @__PURE__ */ React.createElement(Progress, null);
170
- }
171
- if (error) {
172
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
173
- }
174
- const columns = [
175
- {
176
- title: /* @__PURE__ */ React.createElement(Typography, null, "entityRef"),
177
- render: (rowData) => rowData.entity_ref
178
- },
179
- {
180
- title: /* @__PURE__ */ React.createElement(Typography, null, "Kind"),
181
- render: (rowData) => rowData.unprocessed_entity.kind
182
- },
183
- {
184
- title: /* @__PURE__ */ React.createElement(Typography, null, "Owner"),
185
- render: (rowData) => {
186
- var _a;
187
- return ((_a = rowData.unprocessed_entity.spec) == null ? void 0 : _a.owner) || "unknown";
188
- }
189
- },
190
- {
191
- title: /* @__PURE__ */ React.createElement(Typography, null, "Raw"),
192
- render: (rowData) => /* @__PURE__ */ React.createElement(EntityDialog, { entity: rowData })
193
- }
194
- ];
195
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
196
- Table,
197
- {
198
- options: { pageSize: 40 },
199
- columns,
200
- data: (data == null ? void 0 : data.entities) || [],
201
- emptyContent: /* @__PURE__ */ React.createElement(Typography, { className: classes.successMessage }, "No pending entities found")
202
- }
203
- ));
204
- };
205
-
206
- const UnprocessedEntitiesContent = () => {
207
- const [tab, setTab] = useState("failed");
208
- const handleChange = (_event, tabValue) => {
209
- setTab(tabValue);
210
- };
211
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(TabList, { onChange: handleChange }, /* @__PURE__ */ React.createElement(Tab, { label: "Failed", value: "failed" }), /* @__PURE__ */ React.createElement(Tab, { label: "Pending", value: "pending" })), /* @__PURE__ */ React.createElement(TabPanel, { value: "failed" }, /* @__PURE__ */ React.createElement(FailedEntities, null)), /* @__PURE__ */ React.createElement(TabPanel, { value: "pending" }, /* @__PURE__ */ React.createElement(PendingEntities, null))));
212
- };
213
- const UnprocessedEntities = () => {
214
- return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Unprocessed Entitites" }), /* @__PURE__ */ React.createElement(UnprocessedEntitiesContent, null));
215
- };
216
-
217
- export { UnprocessedEntities, UnprocessedEntitiesContent };
218
- //# sourceMappingURL=UnprocessedEntities-1031f5ca.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnprocessedEntities-1031f5ca.esm.js","sources":["../../src/components/EntityDialog.tsx","../../src/components/FailedEntities.tsx","../../src/components/PendingEntities.tsx","../../src/components/UnprocessedEntities.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\n\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport DescriptionIcon from '@material-ui/icons/Description';\n\nimport { UnprocessedEntity } from './../types';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n entity: {\n overflow: 'scroll',\n width: '100%',\n },\n codeBox: {\n border: '1px solid black',\n padding: '1em',\n },\n }),\n);\n\nexport const EntityDialog = ({ entity }: { entity: UnprocessedEntity }) => {\n const [open, setOpen] = useState(false);\n const classes = useStyles();\n\n const openDialog = () => {\n setOpen(true);\n };\n\n const closeDialog = () => {\n setOpen(false);\n };\n\n const dialogContent = () => {\n return (\n <CodeSnippet\n language=\"json\"\n showLineNumbers\n text={JSON.stringify(entity, null, 4)}\n />\n );\n };\n\n return (\n <>\n <IconButton color=\"primary\" onClick={openDialog}>\n <DescriptionIcon />\n </IconButton>\n <Dialog fullWidth open={open} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n <IconButton\n aria-label=\"close\"\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent>{dialogContent()}</DialogContent>\n </Dialog>\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n ErrorPanel,\n MarkdownContent,\n Progress,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { BackstageThemeOptions } from '@backstage/theme';\nimport { Box, Typography, makeStyles } from '@material-ui/core';\n\nimport { UnprocessedEntity } from '../types';\nimport { EntityDialog } from './EntityDialog';\nimport { catalogUnprocessedEntitiesApiRef } from '../api';\nimport useAsync from 'react-use/lib/useAsync';\n\nconst useStyles = makeStyles((theme: BackstageThemeOptions) => ({\n errorBox: {\n color: theme.palette.status.error,\n backgroundColor: theme.palette.errorBackground,\n padding: '1em',\n margin: '1em',\n border: `1px solid ${theme.palette.status.error}`,\n },\n errorTitle: {\n width: '100%',\n fontWeight: 'bold',\n },\n successMessage: {\n background: theme.palette.infoBackground,\n color: theme.palette.infoText,\n },\n}));\n\nconst RenderErrorContext = ({\n error,\n rowData,\n}: {\n error: { message: string };\n rowData: UnprocessedEntity;\n}) => {\n if (error.message.includes('tags.')) {\n return (\n <>\n <Typography>Tags</Typography>\n <ul>\n {rowData.unprocessed_entity.metadata.tags?.map(t => (\n <li>{t}</li>\n ))}\n </ul>\n </>\n );\n }\n\n if (error.message.includes('metadata.name')) {\n return (\n <>\n <Typography>Name</Typography>\n <Typography variant=\"caption\">\n {rowData.unprocessed_entity.metadata.name}\n </Typography>\n </>\n );\n }\n\n return null;\n};\n\nexport const FailedEntities = () => {\n const classes = useStyles();\n const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);\n const {\n loading,\n error,\n value: data,\n } = useAsync(async () => await unprocessedApi.failed());\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const columns: TableColumn[] = [\n {\n title: <Typography>entityRef</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).entity_ref,\n },\n {\n title: <Typography>Kind</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.kind,\n },\n {\n title: <Typography>Owner</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.spec?.owner ||\n 'unknown',\n },\n {\n title: <Typography>Raw</Typography>,\n render: (rowData: UnprocessedEntity | {}) => (\n <EntityDialog entity={rowData as UnprocessedEntity} />\n ),\n },\n ];\n return (\n <>\n <Table\n options={{ pageSize: 40, search: true }}\n columns={columns}\n data={data?.entities || []}\n emptyContent={\n <Typography className={classes.successMessage}>\n No failed entities found\n </Typography>\n }\n detailPanel={({ rowData }) => {\n const errors = (rowData as UnprocessedEntity).errors;\n return (\n <>\n {errors?.map(e => {\n return (\n <Box className={classes.errorBox}>\n <Typography className={classes.errorTitle}>\n {e.name}\n </Typography>\n <MarkdownContent content={e.message} />\n <RenderErrorContext\n error={e}\n rowData={rowData as UnprocessedEntity}\n />\n </Box>\n );\n })}\n </>\n );\n }}\n />\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport {\n ErrorPanel,\n Progress,\n TableColumn,\n Table,\n} from '@backstage/core-components';\nimport { Typography, makeStyles } from '@material-ui/core';\n\nimport { UnprocessedEntity } from '../types';\n\nimport { EntityDialog } from './EntityDialog';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { catalogUnprocessedEntitiesApiRef } from '../api';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles((theme: BackstageTheme) => ({\n successMessage: {\n background: theme.palette.infoBackground,\n color: theme.palette.infoText,\n padding: theme.spacing(2),\n },\n}));\n\nexport const PendingEntities = () => {\n const classes = useStyles();\n const unprocessedApi = useApi(catalogUnprocessedEntitiesApiRef);\n const {\n loading,\n error,\n value: data,\n } = useAsync(async () => await unprocessedApi.pending());\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const columns: TableColumn[] = [\n {\n title: <Typography>entityRef</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).entity_ref,\n },\n {\n title: <Typography>Kind</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.kind,\n },\n {\n title: <Typography>Owner</Typography>,\n render: (rowData: UnprocessedEntity | {}) =>\n (rowData as UnprocessedEntity).unprocessed_entity.spec?.owner ||\n 'unknown',\n },\n {\n title: <Typography>Raw</Typography>,\n render: (rowData: UnprocessedEntity | {}) => (\n <EntityDialog entity={rowData as UnprocessedEntity} />\n ),\n },\n ];\n return (\n <>\n <Table\n options={{ pageSize: 40 }}\n columns={columns}\n data={data?.entities || []}\n emptyContent={\n <Typography className={classes.successMessage}>\n No pending entities found\n </Typography>\n }\n />\n </>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\n\nimport { Page, Header, Content } from '@backstage/core-components';\nimport { Tab } from '@material-ui/core';\nimport { TabContext, TabList, TabPanel } from '@material-ui/lab';\n\nimport { FailedEntities } from './FailedEntities';\nimport { PendingEntities } from './PendingEntities';\n\nexport const UnprocessedEntitiesContent = () => {\n const [tab, setTab] = useState('failed');\n const handleChange = (_event: React.ChangeEvent<{}>, tabValue: string) => {\n setTab(tabValue);\n };\n\n return (\n <Content>\n <TabContext value={tab}>\n <TabList onChange={handleChange}>\n <Tab label=\"Failed\" value=\"failed\" />\n <Tab label=\"Pending\" value=\"pending\" />\n </TabList>\n <TabPanel value=\"failed\">\n <FailedEntities />\n </TabPanel>\n <TabPanel value=\"pending\">\n <PendingEntities />\n </TabPanel>\n </TabContext>\n </Content>\n );\n};\n\nexport const UnprocessedEntities = () => {\n return (\n <Page themeId=\"tool\">\n <Header title=\"Unprocessed Entitites\" />\n <UnprocessedEntitiesContent />\n </Page>\n );\n};\n"],"names":["useStyles","makeStyles"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MAAMA,WAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,WAAa,EAAA;AAAA,MACX,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA,KAC/B;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,QAAU,EAA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,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,uBAAwB,EAAA,CAAA,kBACrC,KAAA,CAAA,aAAA,CAAA,0BAAA,EAAA,IAA2B,CAC9B,CAAA,CAAA;AAEJ;;;;"}
@@ -1,59 +0,0 @@
1
- import { createRouteRef, createApiRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
2
- import { ResponseError } from '@backstage/errors';
3
-
4
- const rootRouteRef = createRouteRef({
5
- id: "catalog-unprocessed-entities"
6
- });
7
-
8
- const catalogUnprocessedEntitiesApiRef = createApiRef({
9
- id: "plugin.catalog-unprocessed-entities.service"
10
- });
11
- class CatalogUnprocessedEntitiesApi {
12
- constructor(discovery, fetchApi) {
13
- this.discovery = discovery;
14
- this.fetchApi = fetchApi;
15
- this.url = "";
16
- }
17
- async fetch(path, init) {
18
- if (!this.url) {
19
- this.url = await this.discovery.getBaseUrl("catalog");
20
- }
21
- const resp = await this.fetchApi.fetch(`${this.url}/${path}`, init);
22
- if (!resp.ok) {
23
- throw await ResponseError.fromResponse(resp);
24
- }
25
- return await resp.json();
26
- }
27
- async pending() {
28
- return await this.fetch("entities/unprocessed/pending");
29
- }
30
- async failed() {
31
- return await this.fetch("entities/unprocessed/failed");
32
- }
33
- }
34
-
35
- const catalogUnprocessedEntitiesPlugin = createPlugin({
36
- id: "catalog-unprocessed-entities",
37
- routes: {
38
- root: rootRouteRef
39
- },
40
- apis: [
41
- createApiFactory({
42
- api: catalogUnprocessedEntitiesApiRef,
43
- deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },
44
- factory: ({ discoveryApi, fetchApi }) => new CatalogUnprocessedEntitiesApi(discoveryApi, fetchApi)
45
- })
46
- ]
47
- });
48
- const CatalogUnprocessedEntitiesPage = catalogUnprocessedEntitiesPlugin.provide(
49
- createRoutableExtension({
50
- name: "CatalogUnprocessedEntitiesPage",
51
- component: () => import('./UnprocessedEntities-1031f5ca.esm.js').then(
52
- (m) => m.UnprocessedEntities
53
- ),
54
- mountPoint: rootRouteRef
55
- })
56
- );
57
-
58
- export { CatalogUnprocessedEntitiesPage as C, catalogUnprocessedEntitiesPlugin as a, catalogUnprocessedEntitiesApiRef as c };
59
- //# sourceMappingURL=index-afbab918.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-afbab918.esm.js","sources":["../../src/routes.ts","../../src/api/index.ts","../../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'catalog-unprocessed-entities',\n});\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n DiscoveryApi,\n createApiRef,\n FetchApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { UnprocessedEntity } from '../types';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link CatalogUnprocessedEntitiesApi}\n *\n * @public\n */\nexport const catalogUnprocessedEntitiesApiRef =\n createApiRef<CatalogUnprocessedEntitiesApi>({\n id: 'plugin.catalog-unprocessed-entities.service',\n });\n\n/**\n * API client for the Catalog Unprocessed Entities plugin\n *\n * @public\n */\nexport class CatalogUnprocessedEntitiesApi {\n url: string = '';\n\n constructor(public discovery: DiscoveryApi, public fetchApi: FetchApi) {}\n\n private async fetch<T>(path: string, init?: RequestInit): Promise<T> {\n if (!this.url) {\n this.url = await this.discovery.getBaseUrl('catalog');\n }\n const resp = await this.fetchApi.fetch(`${this.url}/${path}`, init);\n if (!resp.ok) {\n throw await ResponseError.fromResponse(resp);\n }\n\n return await resp.json();\n }\n\n async pending(): Promise<{ entities: UnprocessedEntity[] }> {\n return await this.fetch('entities/unprocessed/pending');\n }\n\n async failed(): Promise<{ entities: UnprocessedEntity[] }> {\n return await this.fetch('entities/unprocessed/failed');\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport {\n CatalogUnprocessedEntitiesApi,\n catalogUnprocessedEntitiesApiRef,\n} from './api';\n\n/**\n * Plugin entry point\n *\n * @public\n */\nexport const catalogUnprocessedEntitiesPlugin = createPlugin({\n id: 'catalog-unprocessed-entities',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: catalogUnprocessedEntitiesApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new CatalogUnprocessedEntitiesApi(discoveryApi, fetchApi),\n }),\n ],\n});\n\n/**\n * Tool page for the Catalog Unprocessed Entities Plugin\n *\n * @public\n */\nexport const CatalogUnprocessedEntitiesPage =\n catalogUnprocessedEntitiesPlugin.provide(\n createRoutableExtension({\n name: 'CatalogUnprocessedEntitiesPage',\n component: () =>\n import('./components/UnprocessedEntities').then(\n m => m.UnprocessedEntities,\n ),\n mountPoint: rootRouteRef,\n }),\n );\n"],"names":[],"mappings":";;;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,8BAAA;AACN,CAAC,CAAA;;ACSM,MAAM,mCACX,YAA4C,CAAA;AAAA,EAC1C,EAAI,EAAA,6CAAA;AACN,CAAC,EAAA;AAOI,MAAM,6BAA8B,CAAA;AAAA,EAGzC,WAAA,CAAmB,WAAgC,QAAoB,EAAA;AAApD,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAgC,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AAFnD,IAAc,IAAA,CAAA,GAAA,GAAA,EAAA,CAAA;AAAA,GAE0D;AAAA,EAExE,MAAc,KAAS,CAAA,IAAA,EAAc,IAAgC,EAAA;AACnE,IAAI,IAAA,CAAC,KAAK,GAAK,EAAA;AACb,MAAA,IAAA,CAAK,GAAM,GAAA,MAAM,IAAK,CAAA,SAAA,CAAU,WAAW,SAAS,CAAA,CAAA;AAAA,KACtD;AACA,IAAM,MAAA,IAAA,GAAO,MAAM,IAAK,CAAA,QAAA,CAAS,MAAM,CAAG,EAAA,IAAA,CAAK,GAAO,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA,EAAQ,IAAI,CAAA,CAAA;AAClE,IAAI,IAAA,CAAC,KAAK,EAAI,EAAA;AACZ,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,IAAI,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAO,OAAA,MAAM,KAAK,IAAK,EAAA,CAAA;AAAA,GACzB;AAAA,EA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