@backstage-community/plugin-newrelic-dashboard 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/Router.esm.js +25 -0
  3. package/dist/Router.esm.js.map +1 -0
  4. package/dist/api/NewRelicDashboardApi.esm.js +8 -0
  5. package/dist/api/NewRelicDashboardApi.esm.js.map +1 -0
  6. package/dist/api/NewRelicDashboardClient.esm.js +72 -0
  7. package/dist/api/NewRelicDashboardClient.esm.js.map +1 -0
  8. package/dist/components/NewRelicDashboard/DashboardEntityList.esm.js +48 -0
  9. package/dist/components/NewRelicDashboard/DashboardEntityList.esm.js.map +1 -0
  10. package/dist/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.esm.js +90 -0
  11. package/dist/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.esm.js.map +1 -0
  12. package/dist/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.esm.js +130 -0
  13. package/dist/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.esm.js.map +1 -0
  14. package/dist/components/NewRelicDashboard/NewRelicDashboard.esm.js +23 -0
  15. package/dist/components/NewRelicDashboard/NewRelicDashboard.esm.js.map +1 -0
  16. package/dist/constants.esm.js +4 -0
  17. package/dist/constants.esm.js.map +1 -0
  18. package/dist/index.esm.js +2 -446
  19. package/dist/index.esm.js.map +1 -1
  20. package/dist/plugin.esm.js +64 -0
  21. package/dist/plugin.esm.js.map +1 -0
  22. package/dist/queries/getDashboardParentGuidQuery.esm.js +4 -0
  23. package/dist/queries/getDashboardParentGuidQuery.esm.js.map +1 -0
  24. package/dist/queries/getDashboardSnapshotQuery.esm.js +4 -0
  25. package/dist/queries/getDashboardSnapshotQuery.esm.js.map +1 -0
  26. package/dist/routes.esm.js +8 -0
  27. package/dist/routes.esm.js.map +1 -0
  28. package/package.json +13 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage-community/plugin-newrelic-dashboard
2
2
 
3
+ ## 0.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - bed3488: Backstage version bump to v1.29.2
8
+
3
9
  ## 0.3.10
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import Button from '@material-ui/core/Button';
3
+ import { NewRelicDashboard } from './components/NewRelicDashboard/NewRelicDashboard.esm.js';
4
+ import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
5
+ import { NEWRELIC_GUID_ANNOTATION } from './constants.esm.js';
6
+
7
+ const isNewRelicDashboardAvailable = (entity) => Boolean(entity?.metadata?.annotations?.[NEWRELIC_GUID_ANNOTATION]);
8
+ const Router = () => {
9
+ const { entity } = useEntity();
10
+ if (isNewRelicDashboardAvailable(entity)) {
11
+ return /* @__PURE__ */ React.createElement(NewRelicDashboard, null);
12
+ }
13
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: NEWRELIC_GUID_ANNOTATION }), /* @__PURE__ */ React.createElement(
14
+ Button,
15
+ {
16
+ variant: "contained",
17
+ color: "primary",
18
+ href: "https://github.com/backstage/backstage/tree/master/plugins/newrelic-dashboard"
19
+ },
20
+ "Read New Relic Dashboard Plugin Docs"
21
+ ));
22
+ };
23
+
24
+ export { Router, isNewRelicDashboardAvailable };
25
+ //# sourceMappingURL=Router.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Router.esm.js","sources":["../src/Router.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { Entity } from '@backstage/catalog-model';\nimport React from 'react';\nimport Button from '@material-ui/core/Button';\nimport { NewRelicDashboard } from './components/NewRelicDashboard';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from './constants';\n\n/** @public */\nexport const isNewRelicDashboardAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[NEWRELIC_GUID_ANNOTATION]);\n\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (isNewRelicDashboardAvailable(entity)) {\n return <NewRelicDashboard />;\n }\n\n return (\n <>\n <MissingAnnotationEmptyState annotation={NEWRELIC_GUID_ANNOTATION} />\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://github.com/backstage/backstage/tree/master/plugins/newrelic-dashboard\"\n >\n Read New Relic Dashboard Plugin Docs\n </Button>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0Ba,MAAA,4BAAA,GAA+B,CAAC,MAC3C,KAAA,OAAA,CAAQ,QAAQ,QAAU,EAAA,WAAA,GAAc,wBAAwB,CAAC,EAAA;AAE5D,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAI,IAAA,4BAAA,CAA6B,MAAM,CAAG,EAAA;AACxC,IAAA,2CAAQ,iBAAkB,EAAA,IAAA,CAAA,CAAA;AAAA,GAC5B;AAEA,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,0BAA0B,CACnE,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,WAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,IAAK,EAAA,+EAAA;AAAA,KAAA;AAAA,IACN,sCAAA;AAAA,GAGH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ const newRelicDashboardApiRef = createApiRef({
4
+ id: "plugin.newrelicdashboard.service"
5
+ });
6
+
7
+ export { newRelicDashboardApiRef };
8
+ //# sourceMappingURL=NewRelicDashboardApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewRelicDashboardApi.esm.js","sources":["../../src/api/NewRelicDashboardApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createApiRef } from '@backstage/core-plugin-api';\nimport { DashboardEntity } from '../types/DashboardEntity';\nimport { DashboardSnapshot } from '../types/DashboardSnapshot';\nimport { SnapshotDetails } from '../types/SnapshotDetails';\n\nexport interface DashboardEntitySummary {\n getDashboardEntity: DashboardEntity;\n}\n\nexport interface DashboardSnapshotSummary {\n getDashboardSnapshot: DashboardSnapshot;\n}\n\nexport interface SnapshotDetailsSummary {\n getSnapshotDetails: SnapshotDetails[];\n}\nexport const newRelicDashboardApiRef = createApiRef<NewRelicDashboardApi>({\n id: 'plugin.newrelicdashboard.service',\n});\n\nexport type NewRelicDashboardApi = {\n getDashboardEntity(guid: string): Promise<DashboardEntitySummary | undefined>;\n getDashboardSnapshot(\n guid: string,\n duration: number,\n ): Promise<DashboardSnapshotSummary | undefined>;\n};\n"],"names":[],"mappings":";;AA+BO,MAAM,0BAA0B,YAAmC,CAAA;AAAA,EACxE,EAAI,EAAA,kCAAA;AACN,CAAC;;;;"}
@@ -0,0 +1,72 @@
1
+ import { getDashboardParentGuidQuery } from '../queries/getDashboardParentGuidQuery.esm.js';
2
+ import { getDashboardSnapshotQuery } from '../queries/getDashboardSnapshotQuery.esm.js';
3
+ import { ResponseError } from '@backstage/errors';
4
+
5
+ class NewRelicDashboardClient {
6
+ discoveryApi;
7
+ fetchApi;
8
+ constructor({
9
+ discoveryApi,
10
+ fetchApi
11
+ }) {
12
+ this.discoveryApi = discoveryApi;
13
+ this.fetchApi = fetchApi;
14
+ }
15
+ async callApi(query, variables) {
16
+ const myHeaders = new Headers();
17
+ myHeaders.append("Content-Type", "application/json");
18
+ const graphql = JSON.stringify({
19
+ query,
20
+ variables
21
+ });
22
+ const requestOptions = {
23
+ method: "POST",
24
+ headers: myHeaders,
25
+ body: graphql,
26
+ redirect: "follow"
27
+ };
28
+ const apiUrl = `${await this.discoveryApi.getBaseUrl(
29
+ "proxy"
30
+ )}/newrelic/api/graphql`;
31
+ const response = await this.fetchApi.fetch(apiUrl, requestOptions);
32
+ if (response.status === 200) {
33
+ return await response.json();
34
+ }
35
+ if (!response.ok) {
36
+ throw await ResponseError.fromResponse(response);
37
+ } else {
38
+ return void 0;
39
+ }
40
+ }
41
+ async getDashboardEntity(guid) {
42
+ const DashboardEntityList = await this.callApi(
43
+ getDashboardParentGuidQuery,
44
+ {
45
+ query: `id ='${guid}' OR parentId ='${guid}'`
46
+ }
47
+ );
48
+ if (DashboardEntityList && DashboardEntityList?.data?.actor.entitySearch.results.entities?.length > 1) {
49
+ DashboardEntityList.data.actor.entitySearch.results.entities = DashboardEntityList?.data.actor.entitySearch.results.entities.filter(
50
+ (entity) => entity?.dashboardParentGuid !== null
51
+ );
52
+ }
53
+ return {
54
+ getDashboardEntity: DashboardEntityList
55
+ };
56
+ }
57
+ async getDashboardSnapshot(guid, duration) {
58
+ const DashboardSnapshotValue = await this.callApi(
59
+ getDashboardSnapshotQuery,
60
+ {
61
+ guid,
62
+ duration
63
+ }
64
+ );
65
+ return {
66
+ getDashboardSnapshot: DashboardSnapshotValue
67
+ };
68
+ }
69
+ }
70
+
71
+ export { NewRelicDashboardClient };
72
+ //# sourceMappingURL=NewRelicDashboardClient.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewRelicDashboardClient.esm.js","sources":["../../src/api/NewRelicDashboardClient.ts"],"sourcesContent":["/*\n * Copyright 2021 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 DashboardEntitySummary,\n DashboardSnapshotSummary,\n NewRelicDashboardApi,\n} from './NewRelicDashboardApi';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { DashboardEntity } from '../types/DashboardEntity';\nimport { DashboardSnapshot } from '../types/DashboardSnapshot';\nimport { getDashboardParentGuidQuery } from '../queries/getDashboardParentGuidQuery';\nimport { getDashboardSnapshotQuery } from '../queries/getDashboardSnapshotQuery';\nimport { ResponseError } from '@backstage/errors';\n\nexport class NewRelicDashboardClient implements NewRelicDashboardApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor({\n discoveryApi,\n fetchApi,\n }: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n baseUrl?: string;\n }) {\n this.discoveryApi = discoveryApi;\n this.fetchApi = fetchApi;\n }\n\n private async callApi<T>(\n query: string,\n variables: { [key in string]: string | number },\n ): Promise<T | undefined> {\n const myHeaders = new Headers();\n myHeaders.append('Content-Type', 'application/json');\n const graphql = JSON.stringify({\n query: query,\n variables: variables,\n });\n const requestOptions: RequestInit = {\n method: 'POST',\n headers: myHeaders,\n body: graphql,\n redirect: 'follow',\n };\n\n const apiUrl = `${await this.discoveryApi.getBaseUrl(\n 'proxy',\n )}/newrelic/api/graphql`;\n const response = await this.fetchApi.fetch(apiUrl, requestOptions);\n if (response.status === 200) {\n return (await response.json()) as T;\n }\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n } else {\n return undefined;\n }\n }\n\n async getDashboardEntity(\n guid: string,\n ): Promise<DashboardEntitySummary | undefined> {\n const DashboardEntityList = await this.callApi<DashboardEntity>(\n getDashboardParentGuidQuery,\n {\n query: `id ='${guid}' OR parentId ='${guid}'`,\n },\n );\n if (\n DashboardEntityList &&\n DashboardEntityList?.data?.actor.entitySearch.results.entities?.length > 1\n ) {\n DashboardEntityList.data.actor.entitySearch.results.entities =\n DashboardEntityList?.data.actor.entitySearch.results.entities.filter(\n entity => entity?.dashboardParentGuid !== null,\n );\n }\n return {\n getDashboardEntity: DashboardEntityList!,\n };\n }\n\n async getDashboardSnapshot(\n guid: string,\n duration: number,\n ): Promise<DashboardSnapshotSummary | undefined> {\n const DashboardSnapshotValue = await this.callApi<DashboardSnapshot>(\n getDashboardSnapshotQuery,\n {\n guid: guid,\n duration: duration,\n },\n );\n return {\n getDashboardSnapshot: DashboardSnapshotValue!,\n };\n }\n}\n"],"names":[],"mappings":";;;;AA2BO,MAAM,uBAAwD,CAAA;AAAA,EAClD,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEjB,WAAY,CAAA;AAAA,IACV,YAAA;AAAA,IACA,QAAA;AAAA,GAKC,EAAA;AACD,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA,CAAA;AACpB,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA,CAAA;AAAA,GAClB;AAAA,EAEA,MAAc,OACZ,CAAA,KAAA,EACA,SACwB,EAAA;AACxB,IAAM,MAAA,SAAA,GAAY,IAAI,OAAQ,EAAA,CAAA;AAC9B,IAAU,SAAA,CAAA,MAAA,CAAO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AA,CAAa,OAAQ,CAAA,QAAA,GAClD,qBAAqB,IAAK,CAAA,KAAA,CAAM,YAAa,CAAA,OAAA,CAAQ,QAAS,CAAA,MAAA;AAAA,QAC5D,CAAA,MAAA,KAAU,QAAQ,mBAAwB,KAAA,IAAA;AAAA,OAC5C,CAAA;AAAA,KACJ;AACA,IAAO,OAAA;AAAA,MACL,kBAAoB,EAAA,mBAAA;AAAA,KACtB,CAAA;AAAA,GACF;AAAA,EAEA,MAAM,oBACJ,CAAA,IAAA,EACA,QAC+C,EAAA;AAC/C,IAAM,MAAA,sBAAA,GAAyB,MAAM,IAAK,CAAA,OAAA;AAAA,MACxC,yBAAA;AAAA,MACA;AAAA,QACE,IAAA;AAAA,QACA,QAAA;AAAA,OACF;AAAA,KACF,CAAA;AACA,IAAO,OAAA;AAAA,MACL,oBAAsB,EAAA,sBAAA;AAAA,KACxB,CAAA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import Box from '@material-ui/core/Box';
3
+ import makeStyles from '@material-ui/core/styles/makeStyles';
4
+ import Typography from '@material-ui/core/Typography';
5
+ import { newRelicDashboardApiRef } from '../../api/NewRelicDashboardApi.esm.js';
6
+ import '@backstage/errors';
7
+ import { useApi } from '@backstage/core-plugin-api';
8
+ import useAsync from 'react-use/esm/useAsync';
9
+ import { Progress, ErrorPanel, InfoCard, Link } from '@backstage/core-components';
10
+ import DesktopMac from '@material-ui/icons/DesktopMac';
11
+ import { useEntity } from '@backstage/plugin-catalog-react';
12
+ import { NEWRELIC_GUID_ANNOTATION } from '../../constants.esm.js';
13
+
14
+ const useStyles = makeStyles({
15
+ svgIcon: {
16
+ display: "inline-block",
17
+ "& svg": {
18
+ display: "inline-block",
19
+ fontSize: "inherit",
20
+ verticalAlign: "baseline"
21
+ }
22
+ }
23
+ });
24
+ const DashboardEntityList = () => {
25
+ const { entity } = useEntity();
26
+ const classes = useStyles();
27
+ const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
28
+ const { value, loading, error } = useAsync(async () => {
29
+ const dashboardObject = newRelicDashboardAPI.getDashboardEntity(
30
+ String(entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION])
31
+ );
32
+ return dashboardObject;
33
+ }, [entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]]);
34
+ if (loading) {
35
+ return /* @__PURE__ */ React.createElement(Progress, null);
36
+ }
37
+ if (error) {
38
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
39
+ }
40
+ return /* @__PURE__ */ React.createElement(InfoCard, { title: "New Relic Dashboard Pages", variant: "gridItem" }, value?.getDashboardEntity === void 0 && "Unauthorized Request , please check API Key", value?.getDashboardEntity !== void 0 && value?.getDashboardEntity?.data.actor.entitySearch.results?.entities?.length <= 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, "No Dashboard Pages found with the specified Dashboard GUID"), value?.getDashboardEntity?.data.actor.entitySearch.results.entities?.map(
41
+ (entityResult, index) => {
42
+ return /* @__PURE__ */ React.createElement(Box, { style: { margin: "10px" }, display: "flex", key: index }, /* @__PURE__ */ React.createElement(Box, { mr: 1, className: classes.svgIcon }, /* @__PURE__ */ React.createElement(Typography, { component: "div" }, /* @__PURE__ */ React.createElement(DesktopMac, null))), /* @__PURE__ */ React.createElement(Box, { flexGrow: "1" }, /* @__PURE__ */ React.createElement(Link, { to: entityResult.permalink }, entityResult.name)));
43
+ }
44
+ ));
45
+ };
46
+
47
+ export { DashboardEntityList };
48
+ //# sourceMappingURL=DashboardEntityList.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardEntityList.esm.js","sources":["../../../src/components/NewRelicDashboard/DashboardEntityList.tsx"],"sourcesContent":["/*\n * Copyright 2021 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';\nimport Box from '@material-ui/core/Box';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport Typography from '@material-ui/core/Typography';\nimport { newRelicDashboardApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n Progress,\n InfoCard,\n Link,\n ErrorPanel,\n} from '@backstage/core-components';\nimport DesktopMac from '@material-ui/icons/DesktopMac';\nimport { DashboardEntitySummary } from '../../api/NewRelicDashboardApi';\nimport { ResultEntity } from '../../types/DashboardEntity';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from '../../constants';\n\nconst useStyles = makeStyles({\n svgIcon: {\n display: 'inline-block',\n '& svg': {\n display: 'inline-block',\n fontSize: 'inherit',\n verticalAlign: 'baseline',\n },\n },\n});\nexport const DashboardEntityList = () => {\n const { entity } = useEntity();\n const classes = useStyles();\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardEntitySummary | undefined\n > => {\n const dashboardObject: Promise<DashboardEntitySummary | undefined> =\n newRelicDashboardAPI.getDashboardEntity(\n String(entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]),\n );\n return dashboardObject;\n }, [entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]]);\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n return (\n <InfoCard title=\"New Relic Dashboard Pages\" variant=\"gridItem\">\n {value?.getDashboardEntity === undefined &&\n 'Unauthorized Request , please check API Key'}\n {value?.getDashboardEntity !== undefined &&\n value?.getDashboardEntity?.data.actor.entitySearch.results?.entities\n ?.length <= 0 && (\n <>No Dashboard Pages found with the specified Dashboard GUID</>\n )}\n {value?.getDashboardEntity?.data.actor.entitySearch.results.entities?.map(\n (entityResult: ResultEntity, index: number) => {\n return (\n <Box style={{ margin: '10px' }} display=\"flex\" key={index}>\n <Box mr={1} className={classes.svgIcon}>\n <Typography component=\"div\">\n <DesktopMac />\n </Typography>\n </Box>\n <Box flexGrow=\"1\">\n <Link to={entityResult.permalink}>{entityResult.name}</Link>\n </Box>\n </Box>\n );\n },\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,cAAA;AAAA,IACT,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,cAAA;AAAA,MACT,QAAU,EAAA,SAAA;AAAA,MACV,aAAe,EAAA,UAAA;AAAA,KACjB;AAAA,GACF;AACF,CAAC,CAAA,CAAA;AACM,MAAM,sBAAsB,MAAM;AACvC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,oBAAA,GAAuB,OAAO,uBAAuB,CAAA,CAAA;AAC3D,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAEtC;AACH,IAAA,MAAM,kBACJ,oBAAqB,CAAA,kBAAA;AAAA,MACnB,MAAO,CAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,wBAAwB,CAAC,CAAA;AAAA,KAChE,CAAA;AACF,IAAO,OAAA,eAAA,CAAA;AAAA,KACN,CAAC,MAAA,CAAO,SAAS,WAAc,GAAA,wBAAwB,CAAC,CAAC,CAAA,CAAA;AAC5D,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AACA,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,2CA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/core/Box';
3
+ import makeStyles from '@material-ui/core/styles/makeStyles';
4
+ import MenuItem from '@material-ui/core/MenuItem';
5
+ import Select from '@material-ui/core/Select';
6
+ import { useApi, storageApiRef } from '@backstage/core-plugin-api';
7
+ import useAsync from 'react-use/esm/useAsync';
8
+ import { Progress, ErrorPanel, InfoCard, Link } from '@backstage/core-components';
9
+ import { newRelicDashboardApiRef } from '../../../api/NewRelicDashboardApi.esm.js';
10
+ import '@backstage/errors';
11
+ import useObservable from 'react-use/esm/useObservable';
12
+
13
+ const useStyles = makeStyles(
14
+ (theme) => ({
15
+ cardSelect: {
16
+ margin: theme.spacing(2, 1, 0, 0)
17
+ },
18
+ img: {
19
+ width: "100%",
20
+ height: "auto",
21
+ border: `solid 1px ${theme.palette.common.black}`
22
+ }
23
+ }),
24
+ { name: "BackstageNewRelicDashboardSnapshot" }
25
+ );
26
+ const DashboardSnapshot = (props) => {
27
+ const classes = useStyles();
28
+ const { guid, name, permalink } = props;
29
+ const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
30
+ const storageApi = useApi(storageApiRef).forBucket("newrelic-dashboard");
31
+ const setStorageValue = (value2) => {
32
+ storageApi.set(guid, value2);
33
+ };
34
+ const storageSnapshot = useObservable(
35
+ storageApi.observe$(guid),
36
+ storageApi.snapshot(guid)
37
+ );
38
+ const { value, loading, error } = useAsync(async () => {
39
+ const dashboardObject = newRelicDashboardAPI.getDashboardSnapshot(
40
+ guid,
41
+ storageSnapshot.value || 2592e6
42
+ );
43
+ return dashboardObject;
44
+ }, [guid, storageSnapshot.value]);
45
+ if (loading) {
46
+ return /* @__PURE__ */ React.createElement(Progress, null);
47
+ }
48
+ if (error) {
49
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
50
+ }
51
+ const url = value?.getDashboardSnapshot?.data?.dashboardCreateSnapshotUrl?.replace(
52
+ /\pdf$/i,
53
+ "png"
54
+ );
55
+ return /* @__PURE__ */ React.createElement(
56
+ InfoCard,
57
+ {
58
+ variant: "gridItem",
59
+ title: name,
60
+ action: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
61
+ Select,
62
+ {
63
+ className: classes.cardSelect,
64
+ defaultValue: 2592e6,
65
+ value: storageSnapshot.value,
66
+ onChange: (event) => {
67
+ setStorageValue(Number(event.target.value));
68
+ }
69
+ },
70
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 36e5 }, "1 Hour"),
71
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 432e5 }, "12 Hours"),
72
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 864e5 }, "1 Day"),
73
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 2592e5 }, "3 Days"),
74
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 6048e5 }, "1 Week"),
75
+ /* @__PURE__ */ React.createElement(MenuItem, { value: 2592e6 }, "1 Month")
76
+ ))
77
+ },
78
+ /* @__PURE__ */ React.createElement(Box, { display: "flex" }, /* @__PURE__ */ React.createElement(Box, { flexGrow: "1" }, /* @__PURE__ */ React.createElement(Link, { to: permalink }, url ? /* @__PURE__ */ React.createElement(
79
+ "img",
80
+ {
81
+ alt: `${name} Dashboard`,
82
+ className: classes.img,
83
+ src: url
84
+ }
85
+ ) : "Dashboard loading... , click here to open if it did not render correctly")))
86
+ );
87
+ };
88
+
89
+ export { DashboardSnapshot };
90
+ //# sourceMappingURL=DashboardSnapshot.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardSnapshot.esm.js","sources":["../../../../src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\n\nimport React from 'react';\nimport Box from '@material-ui/core/Box';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { useApi, storageApiRef } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n InfoCard,\n Progress,\n ErrorPanel,\n Link,\n} from '@backstage/core-components';\nimport { newRelicDashboardApiRef } from '../../../api';\nimport { DashboardSnapshotSummary } from '../../../api/NewRelicDashboardApi';\nimport useObservable from 'react-use/esm/useObservable';\n\nconst useStyles = makeStyles(\n theme => ({\n cardSelect: {\n margin: theme.spacing(2, 1, 0, 0),\n },\n img: {\n width: '100%',\n height: 'auto',\n border: `solid 1px ${theme.palette.common.black}`,\n },\n }),\n { name: 'BackstageNewRelicDashboardSnapshot' },\n);\n\n/**\n * @public\n */\nexport const DashboardSnapshot = (props: {\n guid: string;\n name: string;\n permalink: string;\n}) => {\n const classes = useStyles();\n const { guid, name, permalink } = props;\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const storageApi = useApi(storageApiRef).forBucket('newrelic-dashboard');\n const setStorageValue = (value: number) => {\n storageApi.set(guid, value);\n };\n const storageSnapshot = useObservable(\n storageApi.observe$<number>(guid),\n storageApi.snapshot(guid),\n );\n\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardSnapshotSummary | undefined\n > => {\n const dashboardObject: Promise<DashboardSnapshotSummary | undefined> =\n newRelicDashboardAPI.getDashboardSnapshot(\n guid,\n storageSnapshot.value || 2592000000,\n );\n return dashboardObject;\n }, [guid, storageSnapshot.value]);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n\n const url =\n value?.getDashboardSnapshot?.data?.dashboardCreateSnapshotUrl?.replace(\n /\\pdf$/i,\n 'png',\n );\n\n return (\n <InfoCard\n variant=\"gridItem\"\n title={name}\n action={\n <div>\n <Select\n className={classes.cardSelect}\n defaultValue={2592000000}\n value={storageSnapshot.value}\n onChange={event => {\n setStorageValue(Number(event.target.value));\n }}\n >\n <MenuItem value={3600000}>1 Hour</MenuItem>\n <MenuItem value={43200000}>12 Hours</MenuItem>\n <MenuItem value={86400000}>1 Day</MenuItem>\n <MenuItem value={259200000}>3 Days</MenuItem>\n <MenuItem value={604800000}>1 Week</MenuItem>\n <MenuItem value={2592000000}>1 Month</MenuItem>\n </Select>\n </div>\n }\n >\n <Box display=\"flex\">\n <Box flexGrow=\"1\">\n <Link to={permalink}>\n {url ? (\n <img\n alt={`${name} Dashboard`}\n className={classes.img}\n src={url}\n />\n ) : (\n 'Dashboard loading... , click here to open if it did not render correctly'\n )}\n </Link>\n </Box>\n </Box>\n </InfoCard>\n );\n};\n"],"names":["value"],"mappings":";;;;;;;;;;;;AAiCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,UAAY,EAAA;AAAA,MACV,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,KAClC;AAAA,IACA,GAAK,EAAA;AAAA,MACH,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA,MAAA;AAAA,MACR,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,OAAO,KAAK,CAAA,CAAA;AAAA,KACjD;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,oCAAqC,EAAA;AAC/C,CAAA,CAAA;AAKa,MAAA,iBAAA,GAAoB,CAAC,KAI5B,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,IAAA,EAAM,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAClC,EAAM,MAAA,oBAAA,GAAuB,OAAO,uBAAuB,CAAA,CAA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A,UAAA,CAAA;AAAA,QACZ,WAAW,OAAQ,CAAA,GAAA;AAAA,QACnB,GAAK,EAAA,GAAA;AAAA,OAAA;AAAA,KACP,GAEA,0EAEJ,CACF,CACF,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,130 @@
1
+ import React, { useState } from 'react';
2
+ import Tab from '@material-ui/core/Tab';
3
+ import Tabs from '@material-ui/core/Tabs';
4
+ import makeStyles from '@material-ui/core/styles/makeStyles';
5
+ import Box from '@material-ui/core/Box';
6
+ import { newRelicDashboardApiRef } from '../../../api/NewRelicDashboardApi.esm.js';
7
+ import '@backstage/errors';
8
+ import { useApi } from '@backstage/core-plugin-api';
9
+ import useAsync from 'react-use/esm/useAsync';
10
+ import { Progress, ErrorPanel } from '@backstage/core-components';
11
+ import { DashboardSnapshot } from './DashboardSnapshot.esm.js';
12
+
13
+ const tabPanelStyles = makeStyles(
14
+ (theme) => ({
15
+ tabPanel: {
16
+ marginTop: theme.spacing(0.5)
17
+ }
18
+ }),
19
+ { name: "BackstageNewRelicDashboardTabPanel" }
20
+ );
21
+ function TabPanel(props) {
22
+ const { children, value1, index, ...other } = props;
23
+ const classes = tabPanelStyles(tabPanelStyles);
24
+ return /* @__PURE__ */ React.createElement(
25
+ "div",
26
+ {
27
+ className: classes.tabPanel,
28
+ role: "tabpanel",
29
+ hidden: value1 !== index,
30
+ id: `simple-tabpanel-${index}`,
31
+ "aria-labelledby": `simple-tab-${index}`,
32
+ ...other
33
+ },
34
+ children
35
+ );
36
+ }
37
+ function a11yProps(index) {
38
+ return {
39
+ id: `simple-tab-${index}`,
40
+ "aria-controls": `simple-tabpanel-${index}`
41
+ };
42
+ }
43
+ const useStyles = makeStyles(
44
+ (theme) => ({
45
+ tabsWrapper: {
46
+ gridArea: "pageSubheader",
47
+ backgroundColor: theme.palette.background.paper,
48
+ paddingLeft: theme.spacing(3)
49
+ },
50
+ defaultTab: {
51
+ padding: theme.spacing(3, 3),
52
+ ...theme.typography.caption,
53
+ textTransform: "uppercase",
54
+ fontWeight: "bold",
55
+ color: theme.palette.text.secondary
56
+ },
57
+ selected: {
58
+ color: theme.palette.text.primary
59
+ },
60
+ tabRoot: {
61
+ "&:hover": {
62
+ backgroundColor: theme.palette.background.default,
63
+ color: theme.palette.text.primary
64
+ }
65
+ }
66
+ }),
67
+ { name: "DashboardHeaderTabs" }
68
+ );
69
+ const DashboardSnapshotList = (props) => {
70
+ const { guid } = props;
71
+ const styles = useStyles();
72
+ const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
73
+ const { value, loading, error } = useAsync(async () => {
74
+ const dashboardObject = newRelicDashboardAPI.getDashboardEntity(guid);
75
+ return dashboardObject;
76
+ }, [guid]);
77
+ const [value1, setValue1] = useState(0);
78
+ const handleChange = ({}, newValue) => {
79
+ setValue1(newValue);
80
+ };
81
+ if (loading) {
82
+ return /* @__PURE__ */ React.createElement(Progress, null);
83
+ }
84
+ if (error) {
85
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
86
+ }
87
+ return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
88
+ Tabs,
89
+ {
90
+ selectionFollowsFocus: true,
91
+ indicatorColor: "primary",
92
+ textColor: "inherit",
93
+ variant: "scrollable",
94
+ scrollButtons: "auto",
95
+ "aria-label": "scrollable auto tabs example",
96
+ onChange: handleChange,
97
+ value: value1
98
+ },
99
+ value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(
100
+ (Entity, index) => {
101
+ return /* @__PURE__ */ React.createElement(
102
+ Tab,
103
+ {
104
+ label: Entity.name,
105
+ className: styles.defaultTab,
106
+ classes: {
107
+ selected: styles.selected,
108
+ root: styles.tabRoot
109
+ },
110
+ ...a11yProps(index)
111
+ }
112
+ );
113
+ }
114
+ )
115
+ ), value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(
116
+ (Entity, index) => {
117
+ return /* @__PURE__ */ React.createElement(TabPanel, { value1, index }, /* @__PURE__ */ React.createElement(
118
+ DashboardSnapshot,
119
+ {
120
+ name: Entity.name,
121
+ permalink: Entity.permalink,
122
+ guid: Entity.guid
123
+ }
124
+ ));
125
+ }
126
+ ));
127
+ };
128
+
129
+ export { DashboardSnapshotList };
130
+ //# sourceMappingURL=DashboardSnapshotList.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardSnapshotList.esm.js","sources":["../../../../src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx"],"sourcesContent":["/*\n * Copyright 2021 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';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport Box from '@material-ui/core/Box';\nimport { newRelicDashboardApiRef } from '../../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Progress, ErrorPanel } from '@backstage/core-components';\nimport { DashboardSnapshot } from './DashboardSnapshot';\nimport { DashboardEntitySummary } from '../../../api/NewRelicDashboardApi';\nimport { ResultEntity } from '../../../types/DashboardEntity';\n\ninterface TabPanelProps {\n children?: React.ReactNode;\n index: number;\n value1: number;\n}\n\nconst tabPanelStyles = makeStyles(\n theme => ({\n tabPanel: {\n marginTop: theme.spacing(0.5),\n },\n }),\n { name: 'BackstageNewRelicDashboardTabPanel' },\n);\n\nfunction TabPanel(props: TabPanelProps) {\n const { children, value1, index, ...other } = props;\n const classes = tabPanelStyles(tabPanelStyles);\n\n return (\n <div\n className={classes.tabPanel}\n role=\"tabpanel\"\n hidden={value1 !== index}\n id={`simple-tabpanel-${index}`}\n aria-labelledby={`simple-tab-${index}`}\n {...other}\n >\n {children}\n </div>\n );\n}\n\nfunction a11yProps(index: number) {\n return {\n id: `simple-tab-${index}`,\n 'aria-controls': `simple-tabpanel-${index}`,\n };\n}\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n },\n defaultTab: {\n padding: theme.spacing(3, 3),\n ...theme.typography.caption,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'DashboardHeaderTabs' },\n);\n\nexport const DashboardSnapshotList = (props: { guid: string }) => {\n const { guid } = props;\n const styles = useStyles();\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardEntitySummary | undefined\n > => {\n const dashboardObject: Promise<DashboardEntitySummary | undefined> =\n newRelicDashboardAPI.getDashboardEntity(guid);\n return dashboardObject;\n }, [guid]);\n const [value1, setValue1] = useState<number>(0);\n const handleChange = ({}: React.ChangeEvent<{}>, newValue: number) => {\n setValue1(newValue);\n };\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n return (\n <Box>\n <Tabs\n selectionFollowsFocus\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"scrollable auto tabs example\"\n onChange={handleChange}\n value={value1}\n >\n {value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(\n (Entity: ResultEntity, index: number) => {\n return (\n <Tab\n label={Entity.name}\n className={styles.defaultTab}\n classes={{\n selected: styles.selected,\n root: styles.tabRoot,\n }}\n {...a11yProps(index)}\n />\n );\n },\n )}\n </Tabs>\n {value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(\n (Entity: ResultEntity, index: number) => {\n return (\n <TabPanel value1={value1} index={index}>\n <DashboardSnapshot\n name={Entity.name}\n permalink={Entity.permalink}\n guid={Entity.guid}\n />\n </TabPanel>\n );\n },\n )}\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCA,MAAM,cAAiB,GAAA,UAAA;AAAA,EACrB,CAAU,KAAA,MAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,KAC9B;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,oCAAqC,EAAA;AAC/C,CAAA,CAAA;AAEA,SAAS,SAAS,KAAsB,EAAA;AACtC,EAAA,MAAM,EAAE,QAAU,EAAA,MAAA,EAAQ,KAAO,EAAA,GAAG,OAAU,GAAA,KAAA,CAAA;AAC9C,EAAM,MAAA,OAAA,GAAU,eAAe,cAAc,CAAA,CAAA;AAE7C,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,QAAA;AAAA,MACnB,IAAK,EAAA,UAAA;AAAA,MACL,QAAQ,MAAW,KAAA,KAAA;AAAA,MACnB,EAAA,EAAI,mBAAmB,KAAK,CAAA,CAAA;AAAA,MAC5B,iBAAA,EAAiB,cAAc,KAAK,CAAA,CAAA;AAAA,MACnC,GAAG,KAAA;AAAA,KAAA;AAAA,IAEH,QAAA;AAAA,GACH,CAAA;AAEJ,CAAA;AAEA,SAAS,UAAU,KAAe,EAAA;AAChC,EAAO,OAAA;AAAA,IACL,EAAA,EAAI,cAAc,KAAK,CAAA,CAAA;AAAA,IACvB,eAAA,EAAiB,mBAAmB,KAAK,CAAA,CAAA;AAAA,GAC3C,CAAA;AACF,CAAA;AAEA,MA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MAAO,CAAA,OAAA;AAAA,aACf;AAAA,YACC,GAAG,UAAU,KAAK,CAAA;AAAA,WAAA;AAAA,SACrB,CAAA;AAAA,OAEJ;AAAA,KACF;AAAA,KAED,KAAO,EAAA,kBAAA,EAAoB,MAAM,KAAM,CAAA,YAAA,CAAa,QAAQ,QAAU,EAAA,GAAA;AAAA,IACrE,CAAC,QAAsB,KAAkB,KAAA;AACvC,MACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,MAAA,EAAgB,KACxB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,MAAM,MAAO,CAAA,IAAA;AAAA,UACb,WAAW,MAAO,CAAA,SAAA;AAAA,UAClB,MAAM,MAAO,CAAA,IAAA;AAAA,SAAA;AAAA,OAEjB,CAAA,CAAA;AAAA,KAEJ;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import { Page, Content } from '@backstage/core-components';
4
+ import { DashboardEntityList } from './DashboardEntityList.esm.js';
5
+ import './DashboardSnapshotList/DashboardSnapshot.esm.js';
6
+ import { DashboardSnapshotList } from './DashboardSnapshotList/DashboardSnapshotList.esm.js';
7
+ import { useEntity } from '@backstage/plugin-catalog-react';
8
+ import { NEWRELIC_GUID_ANNOTATION } from '../../constants.esm.js';
9
+
10
+ const NewRelicDashboard = () => {
11
+ const { entity } = useEntity();
12
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 6, direction: "row", alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(DashboardEntityList, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
13
+ DashboardSnapshotList,
14
+ {
15
+ guid: String(
16
+ entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]
17
+ )
18
+ }
19
+ )))));
20
+ };
21
+
22
+ export { NewRelicDashboard };
23
+ //# sourceMappingURL=NewRelicDashboard.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewRelicDashboard.esm.js","sources":["../../../src/components/NewRelicDashboard/NewRelicDashboard.tsx"],"sourcesContent":["/*\n * Copyright 2021 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';\nimport Grid from '@material-ui/core/Grid';\nimport { Page, Content } from '@backstage/core-components';\nimport { DashboardEntityList } from './DashboardEntityList';\nimport { DashboardSnapshotList } from './DashboardSnapshotList';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from '../../constants';\n\nexport const NewRelicDashboard = () => {\n const { entity } = useEntity();\n return (\n <Page themeId=\"home\">\n <Content>\n <Grid container spacing={6} direction=\"row\" alignItems=\"stretch\">\n <Grid item xs={12}>\n <DashboardEntityList />\n </Grid>\n <Grid item xs={12}>\n <DashboardSnapshotList\n guid={String(\n entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION],\n )}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAuBO,MAAM,oBAAoB,MAAM;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,kBACX,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAG,WAAU,KAAM,EAAA,UAAA,EAAW,SACrD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,sBACZ,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,IAAoB,CACvB,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,MAAA;AAAA,QACJ,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,wBAAwB,CAAA;AAAA,OACxD;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,4 @@
1
+ const NEWRELIC_GUID_ANNOTATION = "newrelic.com/dashboard-guid";
2
+
3
+ export { NEWRELIC_GUID_ANNOTATION };
4
+ //# sourceMappingURL=constants.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.esm.js","sources":["../src/constants.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport const NEWRELIC_GUID_ANNOTATION = 'newrelic.com/dashboard-guid';\n"],"names":[],"mappings":"AAeO,MAAM,wBAA2B,GAAA;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,447 +1,3 @@
1
- import { createApiRef, createRouteRef, createPlugin, createApiFactory, configApiRef, discoveryApiRef, fetchApiRef, createComponentExtension, useApi, storageApiRef } from '@backstage/core-plugin-api';
2
- import { ResponseError } from '@backstage/errors';
3
- import React, { useState } from 'react';
4
- import Button from '@material-ui/core/Button';
5
- import Grid from '@material-ui/core/Grid';
6
- import { Progress, ErrorPanel, InfoCard, Link, Page, Content } from '@backstage/core-components';
7
- import Box from '@material-ui/core/Box';
8
- import makeStyles from '@material-ui/core/styles/makeStyles';
9
- import Typography from '@material-ui/core/Typography';
10
- import useAsync from 'react-use/esm/useAsync';
11
- import DesktopMac from '@material-ui/icons/DesktopMac';
12
- import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
13
- import MenuItem from '@material-ui/core/MenuItem';
14
- import Select from '@material-ui/core/Select';
15
- import useObservable from 'react-use/esm/useObservable';
16
- import Tab from '@material-ui/core/Tab';
17
- import Tabs from '@material-ui/core/Tabs';
18
-
19
- const newRelicDashboardApiRef = createApiRef({
20
- id: "plugin.newrelicdashboard.service"
21
- });
22
-
23
- const getDashboardParentGuidQuery = "query ($query: String) {\n actor {\n entitySearch(query: $query) {\n results {\n entities {\n name\n ... on DashboardEntityOutline {\n name\n dashboardParentGuid\n guid\n }\n permalink\n }\n }\n }\n }\n}\n";
24
-
25
- const getDashboardSnapshotQuery = "mutation($guid: EntityGuid! , ,$duration: Milliseconds) {\n dashboardCreateSnapshotUrl(guid: $guid , params: {timeWindow: {duration: $duration}})\n}";
26
-
27
- var __defProp = Object.defineProperty;
28
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29
- var __publicField = (obj, key, value) => {
30
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
- return value;
32
- };
33
- class NewRelicDashboardClient {
34
- constructor({
35
- discoveryApi,
36
- fetchApi
37
- }) {
38
- __publicField(this, "discoveryApi");
39
- __publicField(this, "fetchApi");
40
- this.discoveryApi = discoveryApi;
41
- this.fetchApi = fetchApi;
42
- }
43
- async callApi(query, variables) {
44
- const myHeaders = new Headers();
45
- myHeaders.append("Content-Type", "application/json");
46
- const graphql = JSON.stringify({
47
- query,
48
- variables
49
- });
50
- const requestOptions = {
51
- method: "POST",
52
- headers: myHeaders,
53
- body: graphql,
54
- redirect: "follow"
55
- };
56
- const apiUrl = `${await this.discoveryApi.getBaseUrl(
57
- "proxy"
58
- )}/newrelic/api/graphql`;
59
- const response = await this.fetchApi.fetch(apiUrl, requestOptions);
60
- if (response.status === 200) {
61
- return await response.json();
62
- }
63
- if (!response.ok) {
64
- throw await ResponseError.fromResponse(response);
65
- } else {
66
- return void 0;
67
- }
68
- }
69
- async getDashboardEntity(guid) {
70
- var _a, _b;
71
- const DashboardEntityList = await this.callApi(
72
- getDashboardParentGuidQuery,
73
- {
74
- query: `id ='${guid}' OR parentId ='${guid}'`
75
- }
76
- );
77
- if (DashboardEntityList && ((_b = (_a = DashboardEntityList == null ? void 0 : DashboardEntityList.data) == null ? void 0 : _a.actor.entitySearch.results.entities) == null ? void 0 : _b.length) > 1) {
78
- DashboardEntityList.data.actor.entitySearch.results.entities = DashboardEntityList == null ? void 0 : DashboardEntityList.data.actor.entitySearch.results.entities.filter(
79
- (entity) => (entity == null ? void 0 : entity.dashboardParentGuid) !== null
80
- );
81
- }
82
- return {
83
- getDashboardEntity: DashboardEntityList
84
- };
85
- }
86
- async getDashboardSnapshot(guid, duration) {
87
- const DashboardSnapshotValue = await this.callApi(
88
- getDashboardSnapshotQuery,
89
- {
90
- guid,
91
- duration
92
- }
93
- );
94
- return {
95
- getDashboardSnapshot: DashboardSnapshotValue
96
- };
97
- }
98
- }
99
-
100
- const rootRouteRef = createRouteRef({
101
- id: "new-relic-dashboard"
102
- });
103
-
104
- const newRelicDashboardPlugin = createPlugin({
105
- id: "new-relic-dashboard",
106
- routes: {
107
- root: rootRouteRef
108
- },
109
- apis: [
110
- createApiFactory({
111
- api: newRelicDashboardApiRef,
112
- deps: {
113
- configApi: configApiRef,
114
- discoveryApi: discoveryApiRef,
115
- fetchApi: fetchApiRef
116
- },
117
- factory: ({ configApi, discoveryApi, fetchApi }) => new NewRelicDashboardClient({
118
- discoveryApi,
119
- fetchApi,
120
- baseUrl: configApi.getOptionalString("newrelicdashboard.baseUrl")
121
- })
122
- })
123
- ]
124
- });
125
- const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide(
126
- createComponentExtension({
127
- name: "EntityNewRelicDashboardContent",
128
- component: {
129
- lazy: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router)
130
- }
131
- })
132
- );
133
- const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide(
134
- createComponentExtension({
135
- name: "EntityNewRelicDashboardCard",
136
- component: {
137
- lazy: () => Promise.resolve().then(function () { return DashboardEntityList$1; }).then(
138
- (m) => m.DashboardEntityList
139
- )
140
- }
141
- })
142
- );
143
- const DashboardSnapshot$2 = newRelicDashboardPlugin.provide(
144
- createComponentExtension({
145
- name: "DashboardSnapshot",
146
- component: {
147
- lazy: () => Promise.resolve().then(function () { return DashboardSnapshot$1; }).then((m) => m.DashboardSnapshot)
148
- }
149
- })
150
- );
151
- const DashboardSnapshotComponent = DashboardSnapshot$2;
152
- const DashboardSnapshotList$2 = newRelicDashboardPlugin.provide(
153
- createComponentExtension({
154
- name: "DashboardSnapshotList",
155
- component: {
156
- lazy: () => Promise.resolve().then(function () { return DashboardSnapshotList$1; }).then((m) => m.DashboardSnapshotList)
157
- }
158
- })
159
- );
160
-
161
- const NEWRELIC_GUID_ANNOTATION = "newrelic.com/dashboard-guid";
162
-
163
- const useStyles$2 = makeStyles({
164
- svgIcon: {
165
- display: "inline-block",
166
- "& svg": {
167
- display: "inline-block",
168
- fontSize: "inherit",
169
- verticalAlign: "baseline"
170
- }
171
- }
172
- });
173
- const DashboardEntityList = () => {
174
- var _a, _b, _c, _d, _e, _f;
175
- const { entity } = useEntity();
176
- const classes = useStyles$2();
177
- const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
178
- const { value, loading, error } = useAsync(async () => {
179
- var _a2;
180
- const dashboardObject = newRelicDashboardAPI.getDashboardEntity(
181
- String((_a2 = entity.metadata.annotations) == null ? void 0 : _a2[NEWRELIC_GUID_ANNOTATION])
182
- );
183
- return dashboardObject;
184
- }, [(_a = entity.metadata.annotations) == null ? void 0 : _a[NEWRELIC_GUID_ANNOTATION]]);
185
- if (loading) {
186
- return /* @__PURE__ */ React.createElement(Progress, null);
187
- }
188
- if (error) {
189
- return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
190
- }
191
- return /* @__PURE__ */ React.createElement(InfoCard, { title: "New Relic Dashboard Pages", variant: "gridItem" }, (value == null ? void 0 : value.getDashboardEntity) === void 0 && "Unauthorized Request , please check API Key", (value == null ? void 0 : value.getDashboardEntity) !== void 0 && ((_d = (_c = (_b = value == null ? void 0 : value.getDashboardEntity) == null ? void 0 : _b.data.actor.entitySearch.results) == null ? void 0 : _c.entities) == null ? void 0 : _d.length) <= 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, "No Dashboard Pages found with the specified Dashboard GUID"), (_f = (_e = value == null ? void 0 : value.getDashboardEntity) == null ? void 0 : _e.data.actor.entitySearch.results.entities) == null ? void 0 : _f.map(
192
- (entityResult, index) => {
193
- return /* @__PURE__ */ React.createElement(Box, { style: { margin: "10px" }, display: "flex", key: index }, /* @__PURE__ */ React.createElement(Box, { mr: 1, className: classes.svgIcon }, /* @__PURE__ */ React.createElement(Typography, { component: "div" }, /* @__PURE__ */ React.createElement(DesktopMac, null))), /* @__PURE__ */ React.createElement(Box, { flexGrow: "1" }, /* @__PURE__ */ React.createElement(Link, { to: entityResult.permalink }, entityResult.name)));
194
- }
195
- ));
196
- };
197
-
198
- var DashboardEntityList$1 = /*#__PURE__*/Object.freeze({
199
- __proto__: null,
200
- DashboardEntityList: DashboardEntityList
201
- });
202
-
203
- const useStyles$1 = makeStyles(
204
- (theme) => ({
205
- cardSelect: {
206
- margin: theme.spacing(2, 1, 0, 0)
207
- },
208
- img: {
209
- width: "100%",
210
- height: "auto",
211
- border: `solid 1px ${theme.palette.common.black}`
212
- }
213
- }),
214
- { name: "BackstageNewRelicDashboardSnapshot" }
215
- );
216
- const DashboardSnapshot = (props) => {
217
- var _a, _b, _c;
218
- const classes = useStyles$1();
219
- const { guid, name, permalink } = props;
220
- const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
221
- const storageApi = useApi(storageApiRef).forBucket("newrelic-dashboard");
222
- const setStorageValue = (value2) => {
223
- storageApi.set(guid, value2);
224
- };
225
- const storageSnapshot = useObservable(
226
- storageApi.observe$(guid),
227
- storageApi.snapshot(guid)
228
- );
229
- const { value, loading, error } = useAsync(async () => {
230
- const dashboardObject = newRelicDashboardAPI.getDashboardSnapshot(
231
- guid,
232
- storageSnapshot.value || 2592e6
233
- );
234
- return dashboardObject;
235
- }, [guid, storageSnapshot.value]);
236
- if (loading) {
237
- return /* @__PURE__ */ React.createElement(Progress, null);
238
- }
239
- if (error) {
240
- return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
241
- }
242
- const url = (_c = (_b = (_a = value == null ? void 0 : value.getDashboardSnapshot) == null ? void 0 : _a.data) == null ? void 0 : _b.dashboardCreateSnapshotUrl) == null ? void 0 : _c.replace(
243
- /\pdf$/i,
244
- "png"
245
- );
246
- return /* @__PURE__ */ React.createElement(
247
- InfoCard,
248
- {
249
- variant: "gridItem",
250
- title: name,
251
- action: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
252
- Select,
253
- {
254
- className: classes.cardSelect,
255
- defaultValue: 2592e6,
256
- value: storageSnapshot.value,
257
- onChange: (event) => {
258
- setStorageValue(Number(event.target.value));
259
- }
260
- },
261
- /* @__PURE__ */ React.createElement(MenuItem, { value: 36e5 }, "1 Hour"),
262
- /* @__PURE__ */ React.createElement(MenuItem, { value: 432e5 }, "12 Hours"),
263
- /* @__PURE__ */ React.createElement(MenuItem, { value: 864e5 }, "1 Day"),
264
- /* @__PURE__ */ React.createElement(MenuItem, { value: 2592e5 }, "3 Days"),
265
- /* @__PURE__ */ React.createElement(MenuItem, { value: 6048e5 }, "1 Week"),
266
- /* @__PURE__ */ React.createElement(MenuItem, { value: 2592e6 }, "1 Month")
267
- ))
268
- },
269
- /* @__PURE__ */ React.createElement(Box, { display: "flex" }, /* @__PURE__ */ React.createElement(Box, { flexGrow: "1" }, /* @__PURE__ */ React.createElement(Link, { to: permalink }, url ? /* @__PURE__ */ React.createElement(
270
- "img",
271
- {
272
- alt: `${name} Dashboard`,
273
- className: classes.img,
274
- src: url
275
- }
276
- ) : "Dashboard loading... , click here to open if it did not render correctly")))
277
- );
278
- };
279
-
280
- var DashboardSnapshot$1 = /*#__PURE__*/Object.freeze({
281
- __proto__: null,
282
- DashboardSnapshot: DashboardSnapshot
283
- });
284
-
285
- const tabPanelStyles = makeStyles(
286
- (theme) => ({
287
- tabPanel: {
288
- marginTop: theme.spacing(0.5)
289
- }
290
- }),
291
- { name: "BackstageNewRelicDashboardTabPanel" }
292
- );
293
- function TabPanel(props) {
294
- const { children, value1, index, ...other } = props;
295
- const classes = tabPanelStyles(tabPanelStyles);
296
- return /* @__PURE__ */ React.createElement(
297
- "div",
298
- {
299
- className: classes.tabPanel,
300
- role: "tabpanel",
301
- hidden: value1 !== index,
302
- id: `simple-tabpanel-${index}`,
303
- "aria-labelledby": `simple-tab-${index}`,
304
- ...other
305
- },
306
- children
307
- );
308
- }
309
- function a11yProps(index) {
310
- return {
311
- id: `simple-tab-${index}`,
312
- "aria-controls": `simple-tabpanel-${index}`
313
- };
314
- }
315
- const useStyles = makeStyles(
316
- (theme) => ({
317
- tabsWrapper: {
318
- gridArea: "pageSubheader",
319
- backgroundColor: theme.palette.background.paper,
320
- paddingLeft: theme.spacing(3)
321
- },
322
- defaultTab: {
323
- padding: theme.spacing(3, 3),
324
- ...theme.typography.caption,
325
- textTransform: "uppercase",
326
- fontWeight: "bold",
327
- color: theme.palette.text.secondary
328
- },
329
- selected: {
330
- color: theme.palette.text.primary
331
- },
332
- tabRoot: {
333
- "&:hover": {
334
- backgroundColor: theme.palette.background.default,
335
- color: theme.palette.text.primary
336
- }
337
- }
338
- }),
339
- { name: "DashboardHeaderTabs" }
340
- );
341
- const DashboardSnapshotList = (props) => {
342
- var _a, _b, _c, _d, _e, _f;
343
- const { guid } = props;
344
- const styles = useStyles();
345
- const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);
346
- const { value, loading, error } = useAsync(async () => {
347
- const dashboardObject = newRelicDashboardAPI.getDashboardEntity(guid);
348
- return dashboardObject;
349
- }, [guid]);
350
- const [value1, setValue1] = useState(0);
351
- const handleChange = ({}, newValue) => {
352
- setValue1(newValue);
353
- };
354
- if (loading) {
355
- return /* @__PURE__ */ React.createElement(Progress, null);
356
- }
357
- if (error) {
358
- return /* @__PURE__ */ React.createElement(ErrorPanel, { title: error.name, defaultExpanded: true, error });
359
- }
360
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
361
- Tabs,
362
- {
363
- selectionFollowsFocus: true,
364
- indicatorColor: "primary",
365
- textColor: "inherit",
366
- variant: "scrollable",
367
- scrollButtons: "auto",
368
- "aria-label": "scrollable auto tabs example",
369
- onChange: handleChange,
370
- value: value1
371
- },
372
- (_c = (_b = (_a = value == null ? void 0 : value.getDashboardEntity) == null ? void 0 : _a.data) == null ? void 0 : _b.actor.entitySearch.results.entities) == null ? void 0 : _c.map(
373
- (Entity, index) => {
374
- return /* @__PURE__ */ React.createElement(
375
- Tab,
376
- {
377
- label: Entity.name,
378
- className: styles.defaultTab,
379
- classes: {
380
- selected: styles.selected,
381
- root: styles.tabRoot
382
- },
383
- ...a11yProps(index)
384
- }
385
- );
386
- }
387
- )
388
- ), (_f = (_e = (_d = value == null ? void 0 : value.getDashboardEntity) == null ? void 0 : _d.data) == null ? void 0 : _e.actor.entitySearch.results.entities) == null ? void 0 : _f.map(
389
- (Entity, index) => {
390
- return /* @__PURE__ */ React.createElement(TabPanel, { value1, index }, /* @__PURE__ */ React.createElement(
391
- DashboardSnapshot,
392
- {
393
- name: Entity.name,
394
- permalink: Entity.permalink,
395
- guid: Entity.guid
396
- }
397
- ));
398
- }
399
- ));
400
- };
401
-
402
- var DashboardSnapshotList$1 = /*#__PURE__*/Object.freeze({
403
- __proto__: null,
404
- DashboardSnapshotList: DashboardSnapshotList
405
- });
406
-
407
- const NewRelicDashboard = () => {
408
- var _a;
409
- const { entity } = useEntity();
410
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 6, direction: "row", alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(DashboardEntityList, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
411
- DashboardSnapshotList,
412
- {
413
- guid: String(
414
- (_a = entity.metadata.annotations) == null ? void 0 : _a[NEWRELIC_GUID_ANNOTATION]
415
- )
416
- }
417
- )))));
418
- };
419
-
420
- const isNewRelicDashboardAvailable = (entity) => {
421
- var _a, _b;
422
- return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[NEWRELIC_GUID_ANNOTATION]);
423
- };
424
- const Router = () => {
425
- const { entity } = useEntity();
426
- if (isNewRelicDashboardAvailable(entity)) {
427
- return /* @__PURE__ */ React.createElement(NewRelicDashboard, null);
428
- }
429
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: NEWRELIC_GUID_ANNOTATION }), /* @__PURE__ */ React.createElement(
430
- Button,
431
- {
432
- variant: "contained",
433
- color: "primary",
434
- href: "https://github.com/backstage/backstage/tree/master/plugins/newrelic-dashboard"
435
- },
436
- "Read New Relic Dashboard Plugin Docs"
437
- ));
438
- };
439
-
440
- var Router$1 = /*#__PURE__*/Object.freeze({
441
- __proto__: null,
442
- Router: Router,
443
- isNewRelicDashboardAvailable: isNewRelicDashboardAvailable
444
- });
445
-
446
- export { DashboardSnapshot$2 as DashboardSnapshot, DashboardSnapshotComponent, DashboardSnapshotList$2 as DashboardSnapshotList, EntityNewRelicDashboardCard, EntityNewRelicDashboardContent, isNewRelicDashboardAvailable, newRelicDashboardPlugin };
1
+ export { DashboardSnapshot, DashboardSnapshotComponent, DashboardSnapshotList, EntityNewRelicDashboardCard, EntityNewRelicDashboardContent, newRelicDashboardPlugin } from './plugin.esm.js';
2
+ export { isNewRelicDashboardAvailable } from './Router.esm.js';
447
3
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/api/NewRelicDashboardApi.ts","../src/queries/getDashboardParentGuidQuery.ts","../src/queries/getDashboardSnapshotQuery.ts","../src/api/NewRelicDashboardClient.ts","../src/routes.ts","../src/plugin.ts","../src/constants.ts","../src/components/NewRelicDashboard/DashboardEntityList.tsx","../src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx","../src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx","../src/components/NewRelicDashboard/NewRelicDashboard.tsx","../src/Router.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { createApiRef } from '@backstage/core-plugin-api';\nimport { DashboardEntity } from '../types/DashboardEntity';\nimport { DashboardSnapshot } from '../types/DashboardSnapshot';\nimport { SnapshotDetails } from '../types/SnapshotDetails';\n\nexport interface DashboardEntitySummary {\n getDashboardEntity: DashboardEntity;\n}\n\nexport interface DashboardSnapshotSummary {\n getDashboardSnapshot: DashboardSnapshot;\n}\n\nexport interface SnapshotDetailsSummary {\n getSnapshotDetails: SnapshotDetails[];\n}\nexport const newRelicDashboardApiRef = createApiRef<NewRelicDashboardApi>({\n id: 'plugin.newrelicdashboard.service',\n});\n\nexport type NewRelicDashboardApi = {\n getDashboardEntity(guid: string): Promise<DashboardEntitySummary | undefined>;\n getDashboardSnapshot(\n guid: string,\n duration: number,\n ): Promise<DashboardSnapshotSummary | undefined>;\n};\n","/*\n * Copyright 2021 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 */\nexport const getDashboardParentGuidQuery =\n 'query ($query: String) {\\n actor {\\n entitySearch(query: $query) {\\n results {\\n entities {\\n name\\n ... on DashboardEntityOutline {\\n name\\n dashboardParentGuid\\n guid\\n }\\n permalink\\n }\\n }\\n }\\n }\\n}\\n';\n","/*\n * Copyright 2021 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 */\nexport const getDashboardSnapshotQuery =\n 'mutation($guid: EntityGuid! , ,$duration: Milliseconds) {\\n dashboardCreateSnapshotUrl(guid: $guid , params: {timeWindow: {duration: $duration}})\\n}';\n","/*\n * Copyright 2021 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 DashboardEntitySummary,\n DashboardSnapshotSummary,\n NewRelicDashboardApi,\n} from './NewRelicDashboardApi';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { DashboardEntity } from '../types/DashboardEntity';\nimport { DashboardSnapshot } from '../types/DashboardSnapshot';\nimport { getDashboardParentGuidQuery } from '../queries/getDashboardParentGuidQuery';\nimport { getDashboardSnapshotQuery } from '../queries/getDashboardSnapshotQuery';\nimport { ResponseError } from '@backstage/errors';\n\nexport class NewRelicDashboardClient implements NewRelicDashboardApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor({\n discoveryApi,\n fetchApi,\n }: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n baseUrl?: string;\n }) {\n this.discoveryApi = discoveryApi;\n this.fetchApi = fetchApi;\n }\n\n private async callApi<T>(\n query: string,\n variables: { [key in string]: string | number },\n ): Promise<T | undefined> {\n const myHeaders = new Headers();\n myHeaders.append('Content-Type', 'application/json');\n const graphql = JSON.stringify({\n query: query,\n variables: variables,\n });\n const requestOptions: RequestInit = {\n method: 'POST',\n headers: myHeaders,\n body: graphql,\n redirect: 'follow',\n };\n\n const apiUrl = `${await this.discoveryApi.getBaseUrl(\n 'proxy',\n )}/newrelic/api/graphql`;\n const response = await this.fetchApi.fetch(apiUrl, requestOptions);\n if (response.status === 200) {\n return (await response.json()) as T;\n }\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n } else {\n return undefined;\n }\n }\n\n async getDashboardEntity(\n guid: string,\n ): Promise<DashboardEntitySummary | undefined> {\n const DashboardEntityList = await this.callApi<DashboardEntity>(\n getDashboardParentGuidQuery,\n {\n query: `id ='${guid}' OR parentId ='${guid}'`,\n },\n );\n if (\n DashboardEntityList &&\n DashboardEntityList?.data?.actor.entitySearch.results.entities?.length > 1\n ) {\n DashboardEntityList.data.actor.entitySearch.results.entities =\n DashboardEntityList?.data.actor.entitySearch.results.entities.filter(\n entity => entity?.dashboardParentGuid !== null,\n );\n }\n return {\n getDashboardEntity: DashboardEntityList!,\n };\n }\n\n async getDashboardSnapshot(\n guid: string,\n duration: number,\n ): Promise<DashboardSnapshotSummary | undefined> {\n const DashboardSnapshotValue = await this.callApi<DashboardSnapshot>(\n getDashboardSnapshotQuery,\n {\n guid: guid,\n duration: duration,\n },\n );\n return {\n getDashboardSnapshot: DashboardSnapshotValue!,\n };\n }\n}\n","/*\n * Copyright 2021 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: 'new-relic-dashboard',\n});\n","/*\n * Copyright 2021 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 */\n\nimport {\n createPlugin,\n configApiRef,\n createApiFactory,\n discoveryApiRef,\n createComponentExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { newRelicDashboardApiRef, NewRelicDashboardClient } from './api';\nimport { rootRouteRef } from './routes';\n\n/** @public */\nexport const newRelicDashboardPlugin = createPlugin({\n id: 'new-relic-dashboard',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: newRelicDashboardApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new NewRelicDashboardClient({\n discoveryApi,\n fetchApi,\n baseUrl: configApi.getOptionalString('newrelicdashboard.baseUrl'),\n }),\n }),\n ],\n});\n\n/** @public */\nexport const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'EntityNewRelicDashboardContent',\n component: {\n lazy: () => import('./Router').then(m => m.Router),\n },\n }),\n);\n\n/** @public */\nexport const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'EntityNewRelicDashboardCard',\n component: {\n lazy: () =>\n import('./components/NewRelicDashboard/DashboardEntityList').then(\n m => m.DashboardEntityList,\n ),\n },\n }),\n);\n\n/**\n * Render dashboard snapshots from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @remarks\n * This can be helpful for rendering dashboards outside of Entity Catalog.\n *\n * @public\n */\nexport const DashboardSnapshot = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'DashboardSnapshot',\n component: {\n lazy: () =>\n import(\n './components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot'\n ).then(m => m.DashboardSnapshot),\n },\n }),\n);\n\n/**\n * Render dashboard snapshots from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @deprecated\n * Use DashboardSnapshot export name instead\n *\n * @public\n */\nexport const DashboardSnapshotComponent = DashboardSnapshot;\n\n/**\n * Render a dashboard snapshots list from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @remarks\n * This can be helpful for rendering dashboards outside of Entity Catalog.\n *\n * @public\n */\nexport const DashboardSnapshotList = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'DashboardSnapshotList',\n component: {\n lazy: () =>\n import(\n './components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList'\n ).then(m => m.DashboardSnapshotList),\n },\n }),\n);\n","/*\n * Copyright 2021 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 */\nexport const NEWRELIC_GUID_ANNOTATION = 'newrelic.com/dashboard-guid';\n","/*\n * Copyright 2021 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';\nimport Box from '@material-ui/core/Box';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport Typography from '@material-ui/core/Typography';\nimport { newRelicDashboardApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n Progress,\n InfoCard,\n Link,\n ErrorPanel,\n} from '@backstage/core-components';\nimport DesktopMac from '@material-ui/icons/DesktopMac';\nimport { DashboardEntitySummary } from '../../api/NewRelicDashboardApi';\nimport { ResultEntity } from '../../types/DashboardEntity';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from '../../constants';\n\nconst useStyles = makeStyles({\n svgIcon: {\n display: 'inline-block',\n '& svg': {\n display: 'inline-block',\n fontSize: 'inherit',\n verticalAlign: 'baseline',\n },\n },\n});\nexport const DashboardEntityList = () => {\n const { entity } = useEntity();\n const classes = useStyles();\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardEntitySummary | undefined\n > => {\n const dashboardObject: Promise<DashboardEntitySummary | undefined> =\n newRelicDashboardAPI.getDashboardEntity(\n String(entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]),\n );\n return dashboardObject;\n }, [entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION]]);\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n return (\n <InfoCard title=\"New Relic Dashboard Pages\" variant=\"gridItem\">\n {value?.getDashboardEntity === undefined &&\n 'Unauthorized Request , please check API Key'}\n {value?.getDashboardEntity !== undefined &&\n value?.getDashboardEntity?.data.actor.entitySearch.results?.entities\n ?.length <= 0 && (\n <>No Dashboard Pages found with the specified Dashboard GUID</>\n )}\n {value?.getDashboardEntity?.data.actor.entitySearch.results.entities?.map(\n (entityResult: ResultEntity, index: number) => {\n return (\n <Box style={{ margin: '10px' }} display=\"flex\" key={index}>\n <Box mr={1} className={classes.svgIcon}>\n <Typography component=\"div\">\n <DesktopMac />\n </Typography>\n </Box>\n <Box flexGrow=\"1\">\n <Link to={entityResult.permalink}>{entityResult.name}</Link>\n </Box>\n </Box>\n );\n },\n )}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 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 */\n\nimport React from 'react';\nimport Box from '@material-ui/core/Box';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { useApi, storageApiRef } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n InfoCard,\n Progress,\n ErrorPanel,\n Link,\n} from '@backstage/core-components';\nimport { newRelicDashboardApiRef } from '../../../api';\nimport { DashboardSnapshotSummary } from '../../../api/NewRelicDashboardApi';\nimport useObservable from 'react-use/esm/useObservable';\n\nconst useStyles = makeStyles(\n theme => ({\n cardSelect: {\n margin: theme.spacing(2, 1, 0, 0),\n },\n img: {\n width: '100%',\n height: 'auto',\n border: `solid 1px ${theme.palette.common.black}`,\n },\n }),\n { name: 'BackstageNewRelicDashboardSnapshot' },\n);\n\n/**\n * @public\n */\nexport const DashboardSnapshot = (props: {\n guid: string;\n name: string;\n permalink: string;\n}) => {\n const classes = useStyles();\n const { guid, name, permalink } = props;\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const storageApi = useApi(storageApiRef).forBucket('newrelic-dashboard');\n const setStorageValue = (value: number) => {\n storageApi.set(guid, value);\n };\n const storageSnapshot = useObservable(\n storageApi.observe$<number>(guid),\n storageApi.snapshot(guid),\n );\n\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardSnapshotSummary | undefined\n > => {\n const dashboardObject: Promise<DashboardSnapshotSummary | undefined> =\n newRelicDashboardAPI.getDashboardSnapshot(\n guid,\n storageSnapshot.value || 2592000000,\n );\n return dashboardObject;\n }, [guid, storageSnapshot.value]);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n\n const url =\n value?.getDashboardSnapshot?.data?.dashboardCreateSnapshotUrl?.replace(\n /\\pdf$/i,\n 'png',\n );\n\n return (\n <InfoCard\n variant=\"gridItem\"\n title={name}\n action={\n <div>\n <Select\n className={classes.cardSelect}\n defaultValue={2592000000}\n value={storageSnapshot.value}\n onChange={event => {\n setStorageValue(Number(event.target.value));\n }}\n >\n <MenuItem value={3600000}>1 Hour</MenuItem>\n <MenuItem value={43200000}>12 Hours</MenuItem>\n <MenuItem value={86400000}>1 Day</MenuItem>\n <MenuItem value={259200000}>3 Days</MenuItem>\n <MenuItem value={604800000}>1 Week</MenuItem>\n <MenuItem value={2592000000}>1 Month</MenuItem>\n </Select>\n </div>\n }\n >\n <Box display=\"flex\">\n <Box flexGrow=\"1\">\n <Link to={permalink}>\n {url ? (\n <img\n alt={`${name} Dashboard`}\n className={classes.img}\n src={url}\n />\n ) : (\n 'Dashboard loading... , click here to open if it did not render correctly'\n )}\n </Link>\n </Box>\n </Box>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 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';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport Box from '@material-ui/core/Box';\nimport { newRelicDashboardApiRef } from '../../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Progress, ErrorPanel } from '@backstage/core-components';\nimport { DashboardSnapshot } from './DashboardSnapshot';\nimport { DashboardEntitySummary } from '../../../api/NewRelicDashboardApi';\nimport { ResultEntity } from '../../../types/DashboardEntity';\n\ninterface TabPanelProps {\n children?: React.ReactNode;\n index: number;\n value1: number;\n}\n\nconst tabPanelStyles = makeStyles(\n theme => ({\n tabPanel: {\n marginTop: theme.spacing(0.5),\n },\n }),\n { name: 'BackstageNewRelicDashboardTabPanel' },\n);\n\nfunction TabPanel(props: TabPanelProps) {\n const { children, value1, index, ...other } = props;\n const classes = tabPanelStyles(tabPanelStyles);\n\n return (\n <div\n className={classes.tabPanel}\n role=\"tabpanel\"\n hidden={value1 !== index}\n id={`simple-tabpanel-${index}`}\n aria-labelledby={`simple-tab-${index}`}\n {...other}\n >\n {children}\n </div>\n );\n}\n\nfunction a11yProps(index: number) {\n return {\n id: `simple-tab-${index}`,\n 'aria-controls': `simple-tabpanel-${index}`,\n };\n}\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n },\n defaultTab: {\n padding: theme.spacing(3, 3),\n ...theme.typography.caption,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'DashboardHeaderTabs' },\n);\n\nexport const DashboardSnapshotList = (props: { guid: string }) => {\n const { guid } = props;\n const styles = useStyles();\n const newRelicDashboardAPI = useApi(newRelicDashboardApiRef);\n const { value, loading, error } = useAsync(async (): Promise<\n DashboardEntitySummary | undefined\n > => {\n const dashboardObject: Promise<DashboardEntitySummary | undefined> =\n newRelicDashboardAPI.getDashboardEntity(guid);\n return dashboardObject;\n }, [guid]);\n const [value1, setValue1] = useState<number>(0);\n const handleChange = ({}: React.ChangeEvent<{}>, newValue: number) => {\n setValue1(newValue);\n };\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel title={error.name} defaultExpanded error={error} />;\n }\n return (\n <Box>\n <Tabs\n selectionFollowsFocus\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"scrollable auto tabs example\"\n onChange={handleChange}\n value={value1}\n >\n {value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(\n (Entity: ResultEntity, index: number) => {\n return (\n <Tab\n label={Entity.name}\n className={styles.defaultTab}\n classes={{\n selected: styles.selected,\n root: styles.tabRoot,\n }}\n {...a11yProps(index)}\n />\n );\n },\n )}\n </Tabs>\n {value?.getDashboardEntity?.data?.actor.entitySearch.results.entities?.map(\n (Entity: ResultEntity, index: number) => {\n return (\n <TabPanel value1={value1} index={index}>\n <DashboardSnapshot\n name={Entity.name}\n permalink={Entity.permalink}\n guid={Entity.guid}\n />\n </TabPanel>\n );\n },\n )}\n </Box>\n );\n};\n","/*\n * Copyright 2021 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';\nimport Grid from '@material-ui/core/Grid';\nimport { Page, Content } from '@backstage/core-components';\nimport { DashboardEntityList } from './DashboardEntityList';\nimport { DashboardSnapshotList } from './DashboardSnapshotList';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from '../../constants';\n\nexport const NewRelicDashboard = () => {\n const { entity } = useEntity();\n return (\n <Page themeId=\"home\">\n <Content>\n <Grid container spacing={6} direction=\"row\" alignItems=\"stretch\">\n <Grid item xs={12}>\n <DashboardEntityList />\n </Grid>\n <Grid item xs={12}>\n <DashboardSnapshotList\n guid={String(\n entity.metadata.annotations?.[NEWRELIC_GUID_ANNOTATION],\n )}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n","/*\n * Copyright 2021 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 { Entity } from '@backstage/catalog-model';\nimport React from 'react';\nimport Button from '@material-ui/core/Button';\nimport { NewRelicDashboard } from './components/NewRelicDashboard';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { NEWRELIC_GUID_ANNOTATION } from './constants';\n\n/** @public */\nexport const isNewRelicDashboardAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[NEWRELIC_GUID_ANNOTATION]);\n\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (isNewRelicDashboardAvailable(entity)) {\n return <NewRelicDashboard />;\n }\n\n return (\n <>\n <MissingAnnotationEmptyState annotation={NEWRELIC_GUID_ANNOTATION} />\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://github.com/backstage/backstage/tree/master/plugins/newrelic-dashboard\"\n >\n Read New Relic Dashboard Plugin Docs\n </Button>\n </>\n );\n};\n"],"names":["DashboardSnapshot","DashboardSnapshotList","useStyles","_a","value"],"mappings":";;;;;;;;;;;;;;;;;;AA+BO,MAAM,0BAA0B,YAAmC,CAAA;AAAA,EACxE,EAAI,EAAA,kCAAA;AACN,CAAC,CAAA;;AClBM,MAAM,2BACX,GAAA,kTAAA;;ACDK,MAAM,yBACX,GAAA,uJAAA;;;;;;;;ACWK,MAAM,uBAAw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CAAA,GAAA,EAAA,CAAA,WAAA,KAAlB,mBAAgC,wBAAyB,CAAA,CAAA,CAAA;AAAA,EAAA;AAE5D,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAI,IAAA,4BAAA,CAA6B,MAAM,CAAG,EAAA;AACxC,IAAA,2CAAQ,iBAAkB,EAAA,IAAA,CAAA,CAAA;AAAA,GAC5B;AAEA,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,0BAA0B,CACnE,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,WAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,IAAK,EAAA,+EAAA;AAAA,KAAA;AAAA,IACN,sCAAA;AAAA,GAGH,CAAA,CAAA;AAEJ,CAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,64 @@
1
+ import { createPlugin, createApiFactory, configApiRef, discoveryApiRef, fetchApiRef, createComponentExtension } from '@backstage/core-plugin-api';
2
+ import { newRelicDashboardApiRef } from './api/NewRelicDashboardApi.esm.js';
3
+ import { NewRelicDashboardClient } from './api/NewRelicDashboardClient.esm.js';
4
+ import { rootRouteRef } from './routes.esm.js';
5
+
6
+ const newRelicDashboardPlugin = createPlugin({
7
+ id: "new-relic-dashboard",
8
+ routes: {
9
+ root: rootRouteRef
10
+ },
11
+ apis: [
12
+ createApiFactory({
13
+ api: newRelicDashboardApiRef,
14
+ deps: {
15
+ configApi: configApiRef,
16
+ discoveryApi: discoveryApiRef,
17
+ fetchApi: fetchApiRef
18
+ },
19
+ factory: ({ configApi, discoveryApi, fetchApi }) => new NewRelicDashboardClient({
20
+ discoveryApi,
21
+ fetchApi,
22
+ baseUrl: configApi.getOptionalString("newrelicdashboard.baseUrl")
23
+ })
24
+ })
25
+ ]
26
+ });
27
+ const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide(
28
+ createComponentExtension({
29
+ name: "EntityNewRelicDashboardContent",
30
+ component: {
31
+ lazy: () => import('./Router.esm.js').then((m) => m.Router)
32
+ }
33
+ })
34
+ );
35
+ const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide(
36
+ createComponentExtension({
37
+ name: "EntityNewRelicDashboardCard",
38
+ component: {
39
+ lazy: () => import('./components/NewRelicDashboard/DashboardEntityList.esm.js').then(
40
+ (m) => m.DashboardEntityList
41
+ )
42
+ }
43
+ })
44
+ );
45
+ const DashboardSnapshot = newRelicDashboardPlugin.provide(
46
+ createComponentExtension({
47
+ name: "DashboardSnapshot",
48
+ component: {
49
+ lazy: () => import('./components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.esm.js').then((m) => m.DashboardSnapshot)
50
+ }
51
+ })
52
+ );
53
+ const DashboardSnapshotComponent = DashboardSnapshot;
54
+ const DashboardSnapshotList = newRelicDashboardPlugin.provide(
55
+ createComponentExtension({
56
+ name: "DashboardSnapshotList",
57
+ component: {
58
+ lazy: () => import('./components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.esm.js').then((m) => m.DashboardSnapshotList)
59
+ }
60
+ })
61
+ );
62
+
63
+ export { DashboardSnapshot, DashboardSnapshotComponent, DashboardSnapshotList, EntityNewRelicDashboardCard, EntityNewRelicDashboardContent, newRelicDashboardPlugin };
64
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\n\nimport {\n createPlugin,\n configApiRef,\n createApiFactory,\n discoveryApiRef,\n createComponentExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { newRelicDashboardApiRef, NewRelicDashboardClient } from './api';\nimport { rootRouteRef } from './routes';\n\n/** @public */\nexport const newRelicDashboardPlugin = createPlugin({\n id: 'new-relic-dashboard',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: newRelicDashboardApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new NewRelicDashboardClient({\n discoveryApi,\n fetchApi,\n baseUrl: configApi.getOptionalString('newrelicdashboard.baseUrl'),\n }),\n }),\n ],\n});\n\n/** @public */\nexport const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'EntityNewRelicDashboardContent',\n component: {\n lazy: () => import('./Router').then(m => m.Router),\n },\n }),\n);\n\n/** @public */\nexport const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'EntityNewRelicDashboardCard',\n component: {\n lazy: () =>\n import('./components/NewRelicDashboard/DashboardEntityList').then(\n m => m.DashboardEntityList,\n ),\n },\n }),\n);\n\n/**\n * Render dashboard snapshots from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @remarks\n * This can be helpful for rendering dashboards outside of Entity Catalog.\n *\n * @public\n */\nexport const DashboardSnapshot = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'DashboardSnapshot',\n component: {\n lazy: () =>\n import(\n './components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot'\n ).then(m => m.DashboardSnapshot),\n },\n }),\n);\n\n/**\n * Render dashboard snapshots from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @deprecated\n * Use DashboardSnapshot export name instead\n *\n * @public\n */\nexport const DashboardSnapshotComponent = DashboardSnapshot;\n\n/**\n * Render a dashboard snapshots list from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true`\n *\n * @remarks\n * This can be helpful for rendering dashboards outside of Entity Catalog.\n *\n * @public\n */\nexport const DashboardSnapshotList = newRelicDashboardPlugin.provide(\n createComponentExtension({\n name: 'DashboardSnapshotList',\n component: {\n lazy: () =>\n import(\n './components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList'\n ).then(m => m.DashboardSnapshotList),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,0BAA0B,YAAa,CAAA;AAAA,EAClD,EAAI,EAAA,qBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,uBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,SAAW,EAAA,YAAA;AAAA,QACX,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAS,EAAA,KAC5C,IAAI,uBAAwB,CAAA;AAAA,QAC1B,YAAA;AAAA,QACA,QAAA;AAAA,QACA,OAAA,EAAS,SAAU,CAAA,iBAAA,CAAkB,2BAA2B,CAAA;AAAA,OACjE,CAAA;AAAA,KACJ,CAAA;AAAA,GACH;AACF,CAAC,EAAA;AAGM,MAAM,iCAAiC,uBAAwB,CAAA,OAAA;AAAA,EACpE,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,gCAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MAAM,OAAO,iBAAU,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,KACnD;AAAA,GACD,CAAA;AACH,EAAA;AAGO,MAAM,8BAA8B,uBAAwB,CAAA,OAAA;AAAA,EACjE,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,6BAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,2DAAoD,CAAE,CAAA,IAAA;AAAA,QAC3D,OAAK,CAAE,CAAA,mBAAA;AAAA,OACT;AAAA,KACJ;AAAA,GACD,CAAA;AACH,EAAA;AAUO,MAAM,oBAAoB,uBAAwB,CAAA,OAAA;AAAA,EACvD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,mBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OACE,+EACF,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,iBAAiB,CAAA;AAAA,KACnC;AAAA,GACD,CAAA;AACH,EAAA;AAUO,MAAM,0BAA6B,GAAA,kBAAA;AAUnC,MAAM,wBAAwB,uBAAwB,CAAA,OAAA;AAAA,EAC3D,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OACE,mFACF,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,qBAAqB,CAAA;AAAA,KACvC;AAAA,GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,4 @@
1
+ const getDashboardParentGuidQuery = "query ($query: String) {\n actor {\n entitySearch(query: $query) {\n results {\n entities {\n name\n ... on DashboardEntityOutline {\n name\n dashboardParentGuid\n guid\n }\n permalink\n }\n }\n }\n }\n}\n";
2
+
3
+ export { getDashboardParentGuidQuery };
4
+ //# sourceMappingURL=getDashboardParentGuidQuery.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDashboardParentGuidQuery.esm.js","sources":["../../src/queries/getDashboardParentGuidQuery.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport const getDashboardParentGuidQuery =\n 'query ($query: String) {\\n actor {\\n entitySearch(query: $query) {\\n results {\\n entities {\\n name\\n ... on DashboardEntityOutline {\\n name\\n dashboardParentGuid\\n guid\\n }\\n permalink\\n }\\n }\\n }\\n }\\n}\\n';\n"],"names":[],"mappings":"AAeO,MAAM,2BACX,GAAA;;;;"}
@@ -0,0 +1,4 @@
1
+ const getDashboardSnapshotQuery = "mutation($guid: EntityGuid! , ,$duration: Milliseconds) {\n dashboardCreateSnapshotUrl(guid: $guid , params: {timeWindow: {duration: $duration}})\n}";
2
+
3
+ export { getDashboardSnapshotQuery };
4
+ //# sourceMappingURL=getDashboardSnapshotQuery.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDashboardSnapshotQuery.esm.js","sources":["../../src/queries/getDashboardSnapshotQuery.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport const getDashboardSnapshotQuery =\n 'mutation($guid: EntityGuid! , ,$duration: Milliseconds) {\\n dashboardCreateSnapshotUrl(guid: $guid , params: {timeWindow: {duration: $duration}})\\n}';\n"],"names":[],"mappings":"AAeO,MAAM,yBACX,GAAA;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createRouteRef } from '@backstage/core-plugin-api';
2
+
3
+ const rootRouteRef = createRouteRef({
4
+ id: "new-relic-dashboard"
5
+ });
6
+
7
+ export { rootRouteRef };
8
+ //# sourceMappingURL=routes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2021 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: 'new-relic-dashboard',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,qBAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-newrelic-dashboard",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "backstage": {
5
- "role": "frontend-plugin"
5
+ "role": "frontend-plugin",
6
+ "pluginId": "newrelic-dashboard",
7
+ "pluginPackages": [
8
+ "@backstage-community/plugin-newrelic-dashboard"
9
+ ]
6
10
  },
7
11
  "publishConfig": {
8
12
  "access": "public",
@@ -32,20 +36,20 @@
32
36
  "test": "backstage-cli package test"
33
37
  },
34
38
  "dependencies": {
35
- "@backstage/catalog-model": "^1.4.5",
36
- "@backstage/core-components": "^0.14.4",
37
- "@backstage/core-plugin-api": "^1.9.2",
39
+ "@backstage/catalog-model": "^1.5.0",
40
+ "@backstage/core-components": "^0.14.9",
41
+ "@backstage/core-plugin-api": "^1.9.3",
38
42
  "@backstage/errors": "^1.2.4",
39
- "@backstage/plugin-catalog-react": "^1.11.3",
43
+ "@backstage/plugin-catalog-react": "^1.12.2",
40
44
  "@material-ui/core": "^4.12.2",
41
45
  "@material-ui/icons": "^4.9.1",
42
46
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
43
47
  "react-use": "^17.2.4"
44
48
  },
45
49
  "devDependencies": {
46
- "@backstage/cli": "^0.26.3",
47
- "@backstage/dev-utils": "^1.0.31",
48
- "@backstage/test-utils": "^1.5.4",
50
+ "@backstage/cli": "^0.26.11",
51
+ "@backstage/dev-utils": "^1.0.36",
52
+ "@backstage/test-utils": "^1.5.9",
49
53
  "@testing-library/dom": "^10.0.0",
50
54
  "@testing-library/jest-dom": "^6.0.0",
51
55
  "@testing-library/react": "^15.0.0",