@backstage-community/plugin-dynatrace 10.4.1 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage-community/plugin-dynatrace
2
2
 
3
+ ## 10.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f4c0154: Backstage version bump to v1.38.1
8
+
3
9
  ## 10.4.1
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { Page, Content } from '@backstage/core-components';
4
4
  import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
@@ -10,13 +10,16 @@ import { DYNATRACE_ID_ANNOTATION, DYNATRACE_SYNTHETICS_ANNOTATION } from '../../
10
10
  const DynatraceTab = () => {
11
11
  const { entity } = useEntity();
12
12
  if (!isDynatraceAvailable(entity)) {
13
- return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: DYNATRACE_ID_ANNOTATION });
13
+ return /* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: DYNATRACE_ID_ANNOTATION });
14
14
  }
15
15
  const dynatraceEntityId = entity?.metadata.annotations?.[DYNATRACE_ID_ANNOTATION];
16
16
  const syntheticsIds = entity?.metadata.annotations?.[DYNATRACE_SYNTHETICS_ANNOTATION];
17
- return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, dynatraceEntityId ? /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, lg: 12 }, /* @__PURE__ */ React.createElement(ProblemsList, { dynatraceEntityId })) : "", syntheticsIds?.split(/[ ,]/).filter(Boolean).map((id) => {
18
- return /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, lg: 12 }, /* @__PURE__ */ React.createElement(SyntheticsCard, { syntheticsId: id }));
19
- }))));
17
+ return /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
18
+ dynatraceEntityId ? /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, lg: 12, children: /* @__PURE__ */ jsx(ProblemsList, { dynatraceEntityId }) }) : "",
19
+ syntheticsIds?.split(/[ ,]/).filter(Boolean).map((id) => {
20
+ return /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, lg: 12, children: /* @__PURE__ */ jsx(SyntheticsCard, { syntheticsId: id }) });
21
+ })
22
+ ] }) }) });
20
23
  };
21
24
 
22
25
  export { DynatraceTab };
@@ -1 +1 @@
1
- {"version":3,"file":"DynatraceTab.esm.js","sources":["../../../src/components/DynatraceTab/DynatraceTab.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { ProblemsList } from '../Problems/ProblemsList';\nimport { SyntheticsCard } from '../Synthetics/SyntheticsCard';\nimport { isDynatraceAvailable } from '../../plugin';\nimport {\n DYNATRACE_ID_ANNOTATION,\n DYNATRACE_SYNTHETICS_ANNOTATION,\n} from '../../constants';\n\nexport const DynatraceTab = () => {\n const { entity } = useEntity();\n\n if (!isDynatraceAvailable(entity)) {\n return <MissingAnnotationEmptyState annotation={DYNATRACE_ID_ANNOTATION} />;\n }\n\n const dynatraceEntityId: string =\n entity?.metadata.annotations?.[DYNATRACE_ID_ANNOTATION]!;\n\n const syntheticsIds: string =\n entity?.metadata.annotations?.[DYNATRACE_SYNTHETICS_ANNOTATION]!;\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <Grid container spacing={2}>\n {dynatraceEntityId ? (\n <Grid item xs={12} lg={12}>\n <ProblemsList dynatraceEntityId={dynatraceEntityId} />\n </Grid>\n ) : (\n ''\n )}\n {syntheticsIds\n ?.split(/[ ,]/)\n .filter(Boolean)\n .map(id => {\n return (\n <Grid item xs={12} lg={12}>\n <SyntheticsCard syntheticsId={id} />\n </Grid>\n );\n })}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA8BO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAI,IAAA,CAAC,oBAAqB,CAAA,MAAM,CAAG,EAAA;AACjC,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,uBAAyB,EAAA,CAAA;AAAA;AAG3E,EAAA,MAAM,iBACJ,GAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,uBAAuB,CAAA;AAExD,EAAA,MAAM,aACJ,GAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAEhE,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAA,EACtB,iBACC,mBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,IAAI,EACrB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,iBAAA,EAAsC,CACtD,CAEA,GAAA,EAAA,EAED,aACG,EAAA,KAAA,CAAM,MAAM,CACb,CAAA,MAAA,CAAO,OAAO,CAAA,CACd,IAAI,CAAM,EAAA,KAAA;AACT,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,EAAI,EAAA,EAAA,EAAA,kBACpB,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,YAAc,EAAA,EAAA,EAAI,CACpC,CAAA;AAAA,GAEH,CACL,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DynatraceTab.esm.js","sources":["../../../src/components/DynatraceTab/DynatraceTab.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 Grid from '@material-ui/core/Grid';\nimport { Page, Content } from '@backstage/core-components';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { ProblemsList } from '../Problems/ProblemsList';\nimport { SyntheticsCard } from '../Synthetics/SyntheticsCard';\nimport { isDynatraceAvailable } from '../../plugin';\nimport {\n DYNATRACE_ID_ANNOTATION,\n DYNATRACE_SYNTHETICS_ANNOTATION,\n} from '../../constants';\n\nexport const DynatraceTab = () => {\n const { entity } = useEntity();\n\n if (!isDynatraceAvailable(entity)) {\n return <MissingAnnotationEmptyState annotation={DYNATRACE_ID_ANNOTATION} />;\n }\n\n const dynatraceEntityId: string =\n entity?.metadata.annotations?.[DYNATRACE_ID_ANNOTATION]!;\n\n const syntheticsIds: string =\n entity?.metadata.annotations?.[DYNATRACE_SYNTHETICS_ANNOTATION]!;\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <Grid container spacing={2}>\n {dynatraceEntityId ? (\n <Grid item xs={12} lg={12}>\n <ProblemsList dynatraceEntityId={dynatraceEntityId} />\n </Grid>\n ) : (\n ''\n )}\n {syntheticsIds\n ?.split(/[ ,]/)\n .filter(Boolean)\n .map(id => {\n return (\n <Grid item xs={12} lg={12}>\n <SyntheticsCard syntheticsId={id} />\n </Grid>\n );\n })}\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA6BO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAI,IAAA,CAAC,oBAAqB,CAAA,MAAM,CAAG,EAAA;AACjC,IAAO,uBAAA,GAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,uBAAyB,EAAA,CAAA;AAAA;AAG3E,EAAA,MAAM,iBACJ,GAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,uBAAuB,CAAA;AAExD,EAAA,MAAM,aACJ,GAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAEhE,EACE,uBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,kBAAA,GAAA,CAAC,OACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,OAAA,EAAS,CACtB,EAAA,QAAA,EAAA;AAAA,IAAA,iBAAA,mBACE,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,EAAI,EAAA,EAAA,EACrB,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,iBAAsC,EAAA,CAAA,EACtD,CAEA,GAAA,EAAA;AAAA,IAED,aAAA,EACG,MAAM,MAAM,CAAA,CACb,OAAO,OAAO,CAAA,CACd,IAAI,CAAM,EAAA,KAAA;AACT,MAAA,uBACG,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,EAAI,EAAA,EAAA,EACrB,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,YAAc,EAAA,EAAA,EAAI,CACpC,EAAA,CAAA;AAAA,KAEH;AAAA,GAAA,EACL,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,14 +1,20 @@
1
- import React from 'react';
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { StatusOK, StatusError } from '@backstage/core-components';
3
3
 
4
4
  const ProblemStatus = ({ status }) => {
5
5
  switch (status?.toLocaleLowerCase()) {
6
6
  case "open":
7
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusError, null), "Open");
7
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8
+ /* @__PURE__ */ jsx(StatusError, {}),
9
+ "Open"
10
+ ] });
8
11
  case "closed":
9
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusOK, null), "Closed");
12
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13
+ /* @__PURE__ */ jsx(StatusOK, {}),
14
+ "Closed"
15
+ ] });
10
16
  default:
11
- return /* @__PURE__ */ React.createElement(React.Fragment, null);
17
+ return /* @__PURE__ */ jsx(Fragment, {});
12
18
  }
13
19
  };
14
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"ProblemStatus.esm.js","sources":["../../../../src/components/Problems/ProblemStatus/ProblemStatus.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { DynatraceProblem } from '../../../api/DynatraceApi';\nimport { StatusError, StatusOK } from '@backstage/core-components';\n\nexport const ProblemStatus = ({ status }: Partial<DynatraceProblem>) => {\n switch (status?.toLocaleLowerCase()) {\n case 'open':\n return (\n <>\n <StatusError />\n Open\n </>\n );\n case 'closed':\n return (\n <>\n <StatusOK />\n Closed\n </>\n );\n default:\n return <></>;\n }\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,aAAgB,GAAA,CAAC,EAAE,MAAA,EAAwC,KAAA;AACtE,EAAQ,QAAA,MAAA,EAAQ,mBAAqB;AAAA,IACnC,KAAK,MAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EAAE,MAEjB,CAAA;AAAA,IAEJ,KAAK,QAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EAAE,QAEd,CAAA;AAAA,IAEJ;AACE,MAAA,uBAAS,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA;AAAA;AAEf;;;;"}
1
+ {"version":3,"file":"ProblemStatus.esm.js","sources":["../../../../src/components/Problems/ProblemStatus/ProblemStatus.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { DynatraceProblem } from '../../../api/DynatraceApi';\nimport { StatusError, StatusOK } from '@backstage/core-components';\n\nexport const ProblemStatus = ({ status }: Partial<DynatraceProblem>) => {\n switch (status?.toLocaleLowerCase()) {\n case 'open':\n return (\n <>\n <StatusError />\n Open\n </>\n );\n case 'closed':\n return (\n <>\n <StatusOK />\n Closed\n </>\n );\n default:\n return <></>;\n }\n};\n"],"names":[],"mappings":";;;AAkBO,MAAM,aAAgB,GAAA,CAAC,EAAE,MAAA,EAAwC,KAAA;AACtE,EAAQ,QAAA,MAAA,EAAQ,mBAAqB;AAAA,IACnC,KAAK,MAAA;AACH,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,CAAA;AAAA,QAAE;AAAA,OAEjB,EAAA,CAAA;AAAA,IAEJ,KAAK,QAAA;AACH,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,CAAA;AAAA,QAAE;AAAA,OAEd,EAAA,CAAA;AAAA,IAEJ;AACE,MAAA,uBAAS,GAAA,CAAA,QAAA,EAAA,EAAA,CAAA;AAAA;AAEf;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import useAsync from 'react-use/esm/useAsync';
3
3
  import { Progress, ResponseErrorPanel, InfoCard, EmptyState } from '@backstage/core-components';
4
4
  import { useApi, configApiRef } from '@backstage/core-plugin-api';
@@ -6,13 +6,13 @@ import { ProblemsTable } from '../ProblemsTable/ProblemsTable.esm.js';
6
6
  import { dynatraceApiRef } from '../../../api/DynatraceApi.esm.js';
7
7
 
8
8
  const cardContents = (problems, dynatraceBaseUrl) => {
9
- return problems.length ? /* @__PURE__ */ React.createElement(
9
+ return problems.length ? /* @__PURE__ */ jsx(
10
10
  ProblemsTable,
11
11
  {
12
12
  problems: problems || [],
13
13
  dynatraceBaseUrl
14
14
  }
15
- ) : /* @__PURE__ */ React.createElement(EmptyState, { title: "No Problems to Report!", missing: "data" });
15
+ ) : /* @__PURE__ */ jsx(EmptyState, { title: "No Problems to Report!", missing: "data" });
16
16
  };
17
17
  const dynatraceEntityPrefixes = (idPrefix) => {
18
18
  switch (idPrefix) {
@@ -45,11 +45,11 @@ const ProblemsList = (props) => {
45
45
  `${dynatraceEntityId.split("-")[0]}`
46
46
  );
47
47
  if (loading) {
48
- return /* @__PURE__ */ React.createElement(Progress, null);
48
+ return /* @__PURE__ */ jsx(Progress, {});
49
49
  } else if (error) {
50
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
50
+ return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
51
51
  }
52
- return /* @__PURE__ */ React.createElement(
52
+ return /* @__PURE__ */ jsx(
53
53
  InfoCard,
54
54
  {
55
55
  title: "Problems",
@@ -57,9 +57,9 @@ const ProblemsList = (props) => {
57
57
  deepLink: {
58
58
  title: "View Entity in Dynatrace",
59
59
  link: `${dynatraceBaseUrl}/${deepLinkPrefix}${dynatraceEntityId}`
60
- }
61
- },
62
- cardContents(problems || [], dynatraceBaseUrl)
60
+ },
61
+ children: cardContents(problems || [], dynatraceBaseUrl)
62
+ }
63
63
  );
64
64
  };
65
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"ProblemsList.esm.js","sources":["../../../../src/components/Problems/ProblemsList/ProblemsList.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport {\n Progress,\n ResponseErrorPanel,\n EmptyState,\n} from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { ProblemsTable } from '../ProblemsTable';\nimport { dynatraceApiRef, DynatraceProblem } from '../../../api';\nimport { InfoCard } from '@backstage/core-components';\n\ntype ProblemsListProps = {\n dynatraceEntityId: string;\n};\n\nconst cardContents = (\n problems: DynatraceProblem[],\n dynatraceBaseUrl: string,\n) => {\n return problems.length ? (\n <ProblemsTable\n problems={problems || []}\n dynatraceBaseUrl={dynatraceBaseUrl}\n />\n ) : (\n <EmptyState title=\"No Problems to Report!\" missing=\"data\" />\n );\n};\n\nconst dynatraceEntityPrefixes = (idPrefix: string): string => {\n switch (idPrefix) {\n case 'APPLICATION':\n return '#uemapplications/uemappmetrics;uemapplicationId=';\n\n case 'SERVICE':\n return '#services/serviceOverview;id=';\n\n case `MOBILE_APPLICATION`:\n return '#mobileappoverview;appID=';\n\n case 'SYNTHETIC_TEST':\n return 'ui/browser-monitor/';\n\n case 'KUBERNETES_CLUSTER':\n return 'ui/kubernetes/';\n\n case 'PROCESS_GROUP_INSTANCE':\n return '#processdetails;id=';\n\n default:\n return 'ui/entity/';\n }\n};\n\nexport const ProblemsList = (props: ProblemsListProps) => {\n const { dynatraceEntityId } = props;\n const configApi = useApi(configApiRef);\n const dynatraceApi = useApi(dynatraceApiRef);\n const dynatraceBaseUrl = configApi.getString('dynatrace.baseUrl');\n\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceProblems(dynatraceEntityId);\n }, [dynatraceApi, dynatraceEntityId]);\n const problems = value?.problems;\n\n const deepLinkPrefix = dynatraceEntityPrefixes(\n `${dynatraceEntityId.split('-')[0]}`,\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n return (\n <InfoCard\n title=\"Problems\"\n subheader={`Last 2 hours - ${dynatraceEntityId}`}\n deepLink={{\n title: 'View Entity in Dynatrace',\n link: `${dynatraceBaseUrl}/${deepLinkPrefix}${dynatraceEntityId}`,\n }}\n >\n {cardContents(problems || [], dynatraceBaseUrl)}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA+BA,MAAM,YAAA,GAAe,CACnB,QAAA,EACA,gBACG,KAAA;AACH,EAAA,OAAO,SAAS,MACd,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,YAAY,EAAC;AAAA,MACvB;AAAA;AAAA,sBAGD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAM,EAAA,wBAAA,EAAyB,SAAQ,MAAO,EAAA,CAAA;AAE9D,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,QAA6B,KAAA;AAC5D,EAAA,QAAQ,QAAU;AAAA,IAChB,KAAK,aAAA;AACH,MAAO,OAAA,kDAAA;AAAA,IAET,KAAK,SAAA;AACH,MAAO,OAAA,+BAAA;AAAA,IAET,KAAK,CAAA,kBAAA,CAAA;AACH,MAAO,OAAA,2BAAA;AAAA,IAET,KAAK,gBAAA;AACH,MAAO,OAAA,qBAAA;AAAA,IAET,KAAK,oBAAA;AACH,MAAO,OAAA,gBAAA;AAAA,IAET,KAAK,wBAAA;AACH,MAAO,OAAA,qBAAA;AAAA,IAET;AACE,MAAO,OAAA,YAAA;AAAA;AAEb,CAAA;AAEa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,mBAAsB,GAAA,KAAA;AAC9B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAM,MAAA,gBAAA,GAAmB,SAAU,CAAA,SAAA,CAAU,mBAAmB,CAAA;AAEhE,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA,YAAA,CAAa,qBAAqB,iBAAiB,CAAA;AAAA,GACzD,EAAA,CAAC,YAAc,EAAA,iBAAiB,CAAC,CAAA;AACpC,EAAA,MAAM,WAAW,KAAO,EAAA,QAAA;AAExB,EAAA,MAAM,cAAiB,GAAA,uBAAA;AAAA,IACrB,GAAG,iBAAkB,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA;AAAA,GACpC;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAE3C,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,UAAA;AAAA,MACN,SAAA,EAAW,kBAAkB,iBAAiB,CAAA,CAAA;AAAA,MAC9C,QAAU,EAAA;AAAA,QACR,KAAO,EAAA,0BAAA;AAAA,QACP,MAAM,CAAG,EAAA,gBAAgB,CAAI,CAAA,EAAA,cAAc,GAAG,iBAAiB,CAAA;AAAA;AACjE,KAAA;AAAA,IAEC,YAAa,CAAA,QAAA,IAAY,EAAC,EAAG,gBAAgB;AAAA,GAChD;AAEJ;;;;"}
1
+ {"version":3,"file":"ProblemsList.esm.js","sources":["../../../../src/components/Problems/ProblemsList/ProblemsList.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport {\n Progress,\n ResponseErrorPanel,\n EmptyState,\n} from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { ProblemsTable } from '../ProblemsTable';\nimport { dynatraceApiRef, DynatraceProblem } from '../../../api';\nimport { InfoCard } from '@backstage/core-components';\n\ntype ProblemsListProps = {\n dynatraceEntityId: string;\n};\n\nconst cardContents = (\n problems: DynatraceProblem[],\n dynatraceBaseUrl: string,\n) => {\n return problems.length ? (\n <ProblemsTable\n problems={problems || []}\n dynatraceBaseUrl={dynatraceBaseUrl}\n />\n ) : (\n <EmptyState title=\"No Problems to Report!\" missing=\"data\" />\n );\n};\n\nconst dynatraceEntityPrefixes = (idPrefix: string): string => {\n switch (idPrefix) {\n case 'APPLICATION':\n return '#uemapplications/uemappmetrics;uemapplicationId=';\n\n case 'SERVICE':\n return '#services/serviceOverview;id=';\n\n case `MOBILE_APPLICATION`:\n return '#mobileappoverview;appID=';\n\n case 'SYNTHETIC_TEST':\n return 'ui/browser-monitor/';\n\n case 'KUBERNETES_CLUSTER':\n return 'ui/kubernetes/';\n\n case 'PROCESS_GROUP_INSTANCE':\n return '#processdetails;id=';\n\n default:\n return 'ui/entity/';\n }\n};\n\nexport const ProblemsList = (props: ProblemsListProps) => {\n const { dynatraceEntityId } = props;\n const configApi = useApi(configApiRef);\n const dynatraceApi = useApi(dynatraceApiRef);\n const dynatraceBaseUrl = configApi.getString('dynatrace.baseUrl');\n\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceProblems(dynatraceEntityId);\n }, [dynatraceApi, dynatraceEntityId]);\n const problems = value?.problems;\n\n const deepLinkPrefix = dynatraceEntityPrefixes(\n `${dynatraceEntityId.split('-')[0]}`,\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n return (\n <InfoCard\n title=\"Problems\"\n subheader={`Last 2 hours - ${dynatraceEntityId}`}\n deepLink={{\n title: 'View Entity in Dynatrace',\n link: `${dynatraceBaseUrl}/${deepLinkPrefix}${dynatraceEntityId}`,\n }}\n >\n {cardContents(problems || [], dynatraceBaseUrl)}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8BA,MAAM,YAAA,GAAe,CACnB,QAAA,EACA,gBACG,KAAA;AACH,EAAA,OAAO,SAAS,MACd,mBAAA,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,YAAY,EAAC;AAAA,MACvB;AAAA;AAAA,sBAGD,GAAA,CAAA,UAAA,EAAA,EAAW,KAAM,EAAA,wBAAA,EAAyB,SAAQ,MAAO,EAAA,CAAA;AAE9D,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,QAA6B,KAAA;AAC5D,EAAA,QAAQ,QAAU;AAAA,IAChB,KAAK,aAAA;AACH,MAAO,OAAA,kDAAA;AAAA,IAET,KAAK,SAAA;AACH,MAAO,OAAA,+BAAA;AAAA,IAET,KAAK,CAAA,kBAAA,CAAA;AACH,MAAO,OAAA,2BAAA;AAAA,IAET,KAAK,gBAAA;AACH,MAAO,OAAA,qBAAA;AAAA,IAET,KAAK,oBAAA;AACH,MAAO,OAAA,gBAAA;AAAA,IAET,KAAK,wBAAA;AACH,MAAO,OAAA,qBAAA;AAAA,IAET;AACE,MAAO,OAAA,YAAA;AAAA;AAEb,CAAA;AAEa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,mBAAsB,GAAA,KAAA;AAC9B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAM,MAAA,gBAAA,GAAmB,SAAU,CAAA,SAAA,CAAU,mBAAmB,CAAA;AAEhE,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA,YAAA,CAAa,qBAAqB,iBAAiB,CAAA;AAAA,GACzD,EAAA,CAAC,YAAc,EAAA,iBAAiB,CAAC,CAAA;AACpC,EAAA,MAAM,WAAW,KAAO,EAAA,QAAA;AAExB,EAAA,MAAM,cAAiB,GAAA,uBAAA;AAAA,IACrB,GAAG,iBAAkB,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA;AAAA,GACpC;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAE3C,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,UAAA;AAAA,MACN,SAAA,EAAW,kBAAkB,iBAAiB,CAAA,CAAA;AAAA,MAC9C,QAAU,EAAA;AAAA,QACR,KAAO,EAAA,0BAAA;AAAA,QACP,MAAM,CAAG,EAAA,gBAAgB,CAAI,CAAA,EAAA,cAAc,GAAG,iBAAiB,CAAA;AAAA,OACjE;AAAA,MAEC,QAAa,EAAA,YAAA,CAAA,QAAA,IAAY,EAAC,EAAG,gBAAgB;AAAA;AAAA,GAChD;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { Table, Link } from '@backstage/core-components';
3
3
  import { ProblemStatus } from '../ProblemStatus/ProblemStatus.esm.js';
4
4
 
@@ -11,18 +11,18 @@ const ProblemsTable = (props) => {
11
11
  {
12
12
  title: "Title",
13
13
  field: "title",
14
- render: (row) => /* @__PURE__ */ React.createElement(
14
+ render: (row) => /* @__PURE__ */ jsx(
15
15
  Link,
16
16
  {
17
- to: `${dynatraceBaseUrl}/#problems/problemdetails;pid=${row.problemId}`
18
- },
19
- row.title
17
+ to: `${dynatraceBaseUrl}/#problems/problemdetails;pid=${row.problemId}`,
18
+ children: row.title
19
+ }
20
20
  )
21
21
  },
22
22
  {
23
23
  title: "Status",
24
24
  field: "status",
25
- render: (row) => /* @__PURE__ */ React.createElement(ProblemStatus, { status: row.status })
25
+ render: (row) => /* @__PURE__ */ jsx(ProblemStatus, { status: row.status })
26
26
  },
27
27
  { title: "Severity", field: "severityLevel" },
28
28
  {
@@ -46,7 +46,7 @@ const ProblemsTable = (props) => {
46
46
  render: (row) => row.endTime === -1 ? "ongoing" : parseTimestamp(row.endTime)
47
47
  }
48
48
  ];
49
- return /* @__PURE__ */ React.createElement(
49
+ return /* @__PURE__ */ jsx(
50
50
  Table,
51
51
  {
52
52
  options: { search: true, paging: true },
@@ -1 +1 @@
1
- {"version":3,"file":"ProblemsTable.esm.js","sources":["../../../../src/components/Problems/ProblemsTable/ProblemsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { Table, TableColumn } from '@backstage/core-components';\nimport { DynatraceProblem } from '../../../api/DynatraceApi';\nimport { ProblemStatus } from '../ProblemStatus';\nimport { Link } from '@backstage/core-components';\n\ntype ProblemsTableProps = {\n problems: DynatraceProblem[];\n dynatraceBaseUrl: string;\n};\n\nconst parseTimestamp = (timestamp: number | undefined) => {\n return timestamp ? new Date(timestamp).toLocaleString() : 'N/A';\n};\n\nexport const ProblemsTable = (props: ProblemsTableProps) => {\n const { problems, dynatraceBaseUrl } = props;\n const columns: TableColumn[] = [\n {\n title: 'Title',\n field: 'title',\n render: (row: Partial<DynatraceProblem>) => (\n <Link\n to={`${dynatraceBaseUrl}/#problems/problemdetails;pid=${row.problemId}`}\n >\n {row.title}\n </Link>\n ),\n },\n {\n title: 'Status',\n field: 'status',\n render: (row: Partial<DynatraceProblem>) => (\n <ProblemStatus status={row.status} />\n ),\n },\n { title: 'Severity', field: 'severityLevel' },\n {\n title: 'Root Cause',\n field: 'rootCauseEntity',\n render: (row: Partial<DynatraceProblem>) => row.rootCauseEntity?.name,\n },\n {\n title: 'Affected',\n field: 'affectedEntities',\n render: (row: Partial<DynatraceProblem>) =>\n row.affectedEntities?.map(e => e.name),\n },\n {\n title: 'Start Time',\n field: 'startTime',\n render: (row: Partial<DynatraceProblem>) => parseTimestamp(row.startTime),\n },\n {\n title: 'End Time',\n field: 'endTime',\n render: (row: Partial<DynatraceProblem>) =>\n row.endTime === -1 ? 'ongoing' : parseTimestamp(row.endTime),\n },\n ];\n\n return (\n <Table\n options={{ search: true, paging: true }}\n columns={columns}\n data={problems.map(p => {\n return { ...p, id: p.problemId };\n })}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA0BA,MAAM,cAAA,GAAiB,CAAC,SAAkC,KAAA;AACxD,EAAA,OAAO,YAAY,IAAI,IAAA,CAAK,SAAS,CAAA,CAAE,gBAAmB,GAAA,KAAA;AAC5D,CAAA;AAEa,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAM,MAAA,EAAE,QAAU,EAAA,gBAAA,EAAqB,GAAA,KAAA;AACvC,EAAA,MAAM,OAAyB,GAAA;AAAA,IAC7B;AAAA,MACE,KAAO,EAAA,OAAA;AAAA,MACP,KAAO,EAAA,OAAA;AAAA,MACP,MAAA,EAAQ,CAAC,GACP,qBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA,CAAA,EAAG,gBAAgB,CAAA,8BAAA,EAAiC,IAAI,S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O,EAAE,GAAG,CAAG,EAAA,EAAA,EAAI,EAAE,SAAU,EAAA;AAAA,OAChC;AAAA;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"ProblemsTable.esm.js","sources":["../../../../src/components/Problems/ProblemsTable/ProblemsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { Table, TableColumn } from '@backstage/core-components';\nimport { DynatraceProblem } from '../../../api/DynatraceApi';\nimport { ProblemStatus } from '../ProblemStatus';\nimport { Link } from '@backstage/core-components';\n\ntype ProblemsTableProps = {\n problems: DynatraceProblem[];\n dynatraceBaseUrl: string;\n};\n\nconst parseTimestamp = (timestamp: number | undefined) => {\n return timestamp ? new Date(timestamp).toLocaleString() : 'N/A';\n};\n\nexport const ProblemsTable = (props: ProblemsTableProps) => {\n const { problems, dynatraceBaseUrl } = props;\n const columns: TableColumn[] = [\n {\n title: 'Title',\n field: 'title',\n render: (row: Partial<DynatraceProblem>) => (\n <Link\n to={`${dynatraceBaseUrl}/#problems/problemdetails;pid=${row.problemId}`}\n >\n {row.title}\n </Link>\n ),\n },\n {\n title: 'Status',\n field: 'status',\n render: (row: Partial<DynatraceProblem>) => (\n <ProblemStatus status={row.status} />\n ),\n },\n { title: 'Severity', field: 'severityLevel' },\n {\n title: 'Root Cause',\n field: 'rootCauseEntity',\n render: (row: Partial<DynatraceProblem>) => row.rootCauseEntity?.name,\n },\n {\n title: 'Affected',\n field: 'affectedEntities',\n render: (row: Partial<DynatraceProblem>) =>\n row.affectedEntities?.map(e => e.name),\n },\n {\n title: 'Start Time',\n field: 'startTime',\n render: (row: Partial<DynatraceProblem>) => parseTimestamp(row.startTime),\n },\n {\n title: 'End Time',\n field: 'endTime',\n render: (row: Partial<DynatraceProblem>) =>\n row.endTime === -1 ? 'ongoing' : parseTimestamp(row.endTime),\n },\n ];\n\n return (\n <Table\n options={{ search: true, paging: true }}\n columns={columns}\n data={problems.map(p => {\n return { ...p, id: p.problemId };\n })}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,cAAA,GAAiB,CAAC,SAAkC,KAAA;AACxD,EAAA,OAAO,YAAY,IAAI,IAAA,CAAK,SAAS,CAAA,CAAE,gBAAmB,GAAA,KAAA;AAC5D,CAAA;AAEa,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAM,MAAA,EAAE,QAAU,EAAA,gBAAA,EAAqB,GAAA,KAAA;AACvC,EAAA,MAAM,OAAyB,GAAA;AAAA,IAC7B;AAAA,MACE,KAAO,EAAA,OAAA;AAAA,MACP,KAAO,EAAA,OAAA;AAAA,MACP,MAAA,EAAQ,CAAC,GACP,qBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA,CAAA,EAAG,gBAAgB,CAAA,8BAAA,EAAiC,IAAI,SAAS,CAAA,CAAA;AAAA,UAEpE,QAAI,EAAA,GAAA,CAAA;AAAA;AAAA;AACP,KAEJ;AAAA,IACA;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,QAAQ,CAAC,GAAA,yBACN,aAAc,EAAA,EAAA,MAAA,EAAQ,IAAI,MAAQ,EAAA;AAAA,KAEvC;AAAA,IACA,EAAE,KAAA,EAAO,UAAY,EAAA,KAAA,EAAO,eAAgB,EAAA;AAAA,IAC5C;AAAA,MACE,KAAO,EAAA,YAAA;AAAA,MACP,KAAO,EAAA,iBAAA;AAAA,MACP,MAAQ,EAAA,CAAC,GAAmC,KAAA,GAAA,CAAI,eAAiB,EAAA;AAAA,KACnE;AAAA,IACA;AAAA,MACE,KAAO,EAAA,UAAA;AAAA,MACP,KAAO,EAAA,kBAAA;AAAA,MACP,MAAA,EAAQ,CAAC,GACP,KAAA,GAAA,CAAI,kBAAkB,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,IAAI;AAAA,KACzC;AAAA,IACA;AAAA,MACE,KAAO,EAAA,YAAA;AAAA,MACP,KAAO,EAAA,WAAA;AAAA,MACP,MAAQ,EAAA,CAAC,GAAmC,KAAA,cAAA,CAAe,IAAI,SAAS;AAAA,KAC1E;AAAA,IACA;AAAA,MACE,KAAO,EAAA,UAAA;AAAA,MACP,KAAO,EAAA,SAAA;AAAA,MACP,MAAA,EAAQ,CAAC,GACP,KAAA,GAAA,CAAI,YAAY,CAAK,CAAA,GAAA,SAAA,GAAY,cAAe,CAAA,GAAA,CAAI,OAAO;AAAA;AAC/D,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,EAAE,MAAQ,EAAA,IAAA,EAAM,QAAQ,IAAK,EAAA;AAAA,MACtC,OAAA;AAAA,MACA,IAAA,EAAM,QAAS,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA;AACtB,QAAA,OAAO,EAAE,GAAG,CAAG,EAAA,EAAA,EAAI,EAAE,SAAU,EAAA;AAAA,OAChC;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import useAsync from 'react-use/esm/useAsync';
3
3
  import { Progress, ResponseErrorPanel, InfoCard } from '@backstage/core-components';
4
4
  import { useApi, configApiRef } from '@backstage/core-plugin-api';
@@ -26,9 +26,9 @@ const SyntheticsCard = (props) => {
26
26
  return dynatraceApi.getDynatraceSyntheticFailures(syntheticsId);
27
27
  }, [dynatraceApi, syntheticsId]);
28
28
  if (loading) {
29
- return /* @__PURE__ */ React.createElement(Progress, null);
29
+ return /* @__PURE__ */ jsx(Progress, {});
30
30
  } else if (error) {
31
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
31
+ return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
32
32
  }
33
33
  const deepLinkPrefix = dynatraceMonitorPrefixes(
34
34
  `${syntheticsId.split("-")[0]}`
@@ -39,7 +39,7 @@ const SyntheticsCard = (props) => {
39
39
  location: Number(l.locationId).toString(16)
40
40
  };
41
41
  });
42
- return /* @__PURE__ */ React.createElement(
42
+ return /* @__PURE__ */ jsx(
43
43
  InfoCard,
44
44
  {
45
45
  title: "Synthetics",
@@ -47,18 +47,18 @@ const SyntheticsCard = (props) => {
47
47
  deepLink: {
48
48
  title: "View this Synthetic in Dynatrace",
49
49
  link: `${dynatraceBaseUrl}/${deepLinkPrefix}/${syntheticsId}`
50
- }
51
- },
52
- lastFailed?.map((l) => {
53
- return /* @__PURE__ */ React.createElement(
54
- SyntheticsLocation,
55
- {
56
- key: l.location,
57
- lastFailedTimestamp: new Date(l.timestamp),
58
- locationId: l.location
59
- }
60
- );
61
- })
50
+ },
51
+ children: lastFailed?.map((l) => {
52
+ return /* @__PURE__ */ jsx(
53
+ SyntheticsLocation,
54
+ {
55
+ lastFailedTimestamp: new Date(l.timestamp),
56
+ locationId: l.location
57
+ },
58
+ l.location
59
+ );
60
+ })
61
+ }
62
62
  );
63
63
  };
64
64
 
@@ -1 +1 @@
1
- {"version":3,"file":"SyntheticsCard.esm.js","sources":["../../../../src/components/Synthetics/SyntheticsCard/SyntheticsCard.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { InfoCard } from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { dynatraceApiRef } from '../../../api';\nimport { SyntheticsLocation } from '../SyntheticsLocation';\n\ntype SyntheticsCardProps = {\n syntheticsId: string;\n};\n\nconst dynatraceMonitorPrefixes = (idPrefix: string): string => {\n switch (idPrefix) {\n case 'HTTP_CHECK':\n return 'ui/http-monitor';\n case 'BROWSER_MONITOR':\n return 'ui/browser-monitor';\n case 'SYNTHETIC_TEST':\n return 'ui/browser-monitor';\n default:\n throw new Error('Invalid synthetic Id');\n }\n};\n\nexport const SyntheticsCard = (props: SyntheticsCardProps) => {\n const { syntheticsId } = props;\n const configApi = useApi(configApiRef);\n const dynatraceApi = useApi(dynatraceApiRef);\n const dynatraceBaseUrl = configApi.getString('dynatrace.baseUrl');\n\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceSyntheticFailures(syntheticsId);\n }, [dynatraceApi, syntheticsId]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const deepLinkPrefix = dynatraceMonitorPrefixes(\n `${syntheticsId.split('-')[0]}`,\n );\n\n const lastFailed = value?.locationsExecutionResults.map(l => {\n return {\n timestamp: l.requestResults[0].startTimestamp,\n location: Number(l.locationId).toString(16),\n };\n });\n\n return (\n <InfoCard\n title=\"Synthetics\"\n subheader={`Recent Activity for Monitor ${syntheticsId}`}\n deepLink={{\n title: 'View this Synthetic in Dynatrace',\n link: `${dynatraceBaseUrl}/${deepLinkPrefix}/${syntheticsId}`,\n }}\n >\n {lastFailed?.map(l => {\n return (\n <SyntheticsLocation\n key={l.location}\n lastFailedTimestamp={new Date(l.timestamp)}\n locationId={l.location}\n />\n );\n })}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BA,MAA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AA,CAAA,CAAE,UAAU,CAAA,CAAE,SAAS,EAAE;AAAA,KAC5C;AAAA,GACD,CAAA;AAED,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,YAAA;AAAA,MACN,SAAA,EAAW,+BAA+B,YAAY,CAAA,CAAA;AAAA,MACtD,QAAU,EAAA;AAAA,QACR,KAAO,EAAA,kCAAA;AAAA,QACP,MAAM,CAAG,EAAA,gBAAgB,CAAI,CAAA,EAAA,cAAc,IAAI,YAAY,CAAA;AAAA;AAC7D,KAAA;AAAA,IAEC,UAAA,EAAY,IAAI,CAAK,CAAA,KAAA;AACpB,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,KAAK,CAAE,CAAA,QAAA;AAAA,UACP,mBAAqB,EAAA,IAAI,IAAK,CAAA,CAAA,CAAE,SAAS,CAAA;AAAA,UACzC,YAAY,CAAE,CAAA;AAAA;AAAA,OAChB;AAAA,KAEH;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"SyntheticsCard.esm.js","sources":["../../../../src/components/Synthetics/SyntheticsCard/SyntheticsCard.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { InfoCard } from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport { dynatraceApiRef } from '../../../api';\nimport { SyntheticsLocation } from '../SyntheticsLocation';\n\ntype SyntheticsCardProps = {\n syntheticsId: string;\n};\n\nconst dynatraceMonitorPrefixes = (idPrefix: string): string => {\n switch (idPrefix) {\n case 'HTTP_CHECK':\n return 'ui/http-monitor';\n case 'BROWSER_MONITOR':\n return 'ui/browser-monitor';\n case 'SYNTHETIC_TEST':\n return 'ui/browser-monitor';\n default:\n throw new Error('Invalid synthetic Id');\n }\n};\n\nexport const SyntheticsCard = (props: SyntheticsCardProps) => {\n const { syntheticsId } = props;\n const configApi = useApi(configApiRef);\n const dynatraceApi = useApi(dynatraceApiRef);\n const dynatraceBaseUrl = configApi.getString('dynatrace.baseUrl');\n\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceSyntheticFailures(syntheticsId);\n }, [dynatraceApi, syntheticsId]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const deepLinkPrefix = dynatraceMonitorPrefixes(\n `${syntheticsId.split('-')[0]}`,\n );\n\n const lastFailed = value?.locationsExecutionResults.map(l => {\n return {\n timestamp: l.requestResults[0].startTimestamp,\n location: Number(l.locationId).toString(16),\n };\n });\n\n return (\n <InfoCard\n title=\"Synthetics\"\n subheader={`Recent Activity for Monitor ${syntheticsId}`}\n deepLink={{\n title: 'View this Synthetic in Dynatrace',\n link: `${dynatraceBaseUrl}/${deepLinkPrefix}/${syntheticsId}`,\n }}\n >\n {lastFailed?.map(l => {\n return (\n <SyntheticsLocation\n key={l.location}\n lastFailedTimestamp={new Date(l.timestamp)}\n locationId={l.location}\n />\n );\n })}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,wBAAA,GAA2B,CAAC,QAA6B,KAAA;AAC7D,EAAA,QAAQ,QAAU;AAAA,IAChB,KAAK,YAAA;AACH,MAAO,OAAA,iBAAA;AAAA,IACT,KAAK,iBAAA;AACH,MAAO,OAAA,oBAAA;AAAA,IACT,KAAK,gBAAA;AACH,MAAO,OAAA,oBAAA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,QAAU,EAAA;AAAA,QACR,KAAO,EAAA,kCAAA;AAAA,QACP,MAAM,CAAG,EAAA,gBAAgB,CAAI,CAAA,EAAA,cAAc,IAAI,YAAY,CAAA;AAAA,OAC7D;AAAA,MAEC,QAAA,EAAA,UAAA,EAAY,IAAI,CAAK,CAAA,KAAA;AACpB,QACE,uBAAA,GAAA;AAAA,UAAC,kBAAA;AAAA,UAAA;AAAA,YAEC,mBAAqB,EAAA,IAAI,IAAK,CAAA,CAAA,CAAE,SAAS,CAAA;AAAA,YACzC,YAAY,CAAE,CAAA;AAAA,WAAA;AAAA,UAFT,CAAE,CAAA;AAAA,SAGT;AAAA,OAEH;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import useAsync from 'react-use/esm/useAsync';
3
3
  import { Progress, ResponseErrorPanel } from '@backstage/core-components';
4
4
  import { useApi } from '@backstage/core-plugin-api';
@@ -31,11 +31,11 @@ const SyntheticsLocation = (props) => {
31
31
  );
32
32
  });
33
33
  if (loading) {
34
- return /* @__PURE__ */ React.createElement(Progress, null);
34
+ return /* @__PURE__ */ jsx(Progress, {});
35
35
  } else if (error) {
36
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
36
+ return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
37
37
  }
38
- return /* @__PURE__ */ React.createElement(
38
+ return /* @__PURE__ */ jsx(
39
39
  Chip,
40
40
  {
41
41
  label: `${value?.name}${failedInLastXHours(new Date(lastFailedTimestamp), 24) ? `: failed @ ${lastFailedTimestamp.toLocaleTimeString()}` : ""}`,
@@ -1 +1 @@
1
- {"version":3,"file":"SyntheticsLocation.esm.js","sources":["../../../../src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Chip from '@material-ui/core/Chip';\nimport { dynatraceApiRef } from '../../../api';\n\ntype SyntheticsLocationProps = {\n lastFailedTimestamp: Date;\n locationId: string;\n key: string;\n};\n\nconst failedInLastXHours = (timestamp: Date, offset: number): boolean => {\n if (offset < 0 || offset > 24)\n throw new Error('offset must be between 0 and 24');\n return timestamp > new Date(new Date().getTime() - 1000 * 60 * 60 * offset);\n};\n\nconst chipColor = (timestamp: Date): string => {\n if (failedInLastXHours(timestamp, 1)) {\n return 'salmon';\n }\n if (failedInLastXHours(timestamp, 6)) {\n return 'sandybrown';\n }\n if (failedInLastXHours(timestamp, 24)) {\n return 'palegoldenrod';\n }\n return 'lightgreen';\n};\n\nexport const SyntheticsLocation = (props: SyntheticsLocationProps) => {\n const { lastFailedTimestamp, locationId } = props;\n const dynatraceApi = useApi(dynatraceApiRef);\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceSyntheticLocationInfo(\n `SYNTHETIC_LOCATION-00000000000000${locationId}`,\n );\n });\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <Chip\n label={`${value?.name}${\n failedInLastXHours(new Date(lastFailedTimestamp), 24)\n ? `: failed @ ${lastFailedTimestamp.toLocaleTimeString()}`\n : ''\n }`}\n size=\"medium\"\n style={{ backgroundColor: chipColor(lastFailedTimestamp) }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA6BA,MAAM,kBAAA,GAAqB,CAAC,SAAA,EAAi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AA,EAAO,IAAI,CAAA,EACnB,mBAAmB,IAAI,IAAA,CAAK,mBAAmB,CAAA,EAAG,EAAE,CAChD,GAAA,CAAA,WAAA,EAAc,oBAAoB,kBAAmB,EAAC,KACtD,EACN,CAAA,CAAA;AAAA,MACA,IAAK,EAAA,QAAA;AAAA,MACL,KAAO,EAAA,EAAE,eAAiB,EAAA,SAAA,CAAU,mBAAmB,CAAE;AAAA;AAAA,GAC3D;AAEJ;;;;"}
1
+ {"version":3,"file":"SyntheticsLocation.esm.js","sources":["../../../../src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 useAsync from 'react-use/esm/useAsync';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Chip from '@material-ui/core/Chip';\nimport { dynatraceApiRef } from '../../../api';\n\ntype SyntheticsLocationProps = {\n lastFailedTimestamp: Date;\n locationId: string;\n key: string;\n};\n\nconst failedInLastXHours = (timestamp: Date, offset: number): boolean => {\n if (offset < 0 || offset > 24)\n throw new Error('offset must be between 0 and 24');\n return timestamp > new Date(new Date().getTime() - 1000 * 60 * 60 * offset);\n};\n\nconst chipColor = (timestamp: Date): string => {\n if (failedInLastXHours(timestamp, 1)) {\n return 'salmon';\n }\n if (failedInLastXHours(timestamp, 6)) {\n return 'sandybrown';\n }\n if (failedInLastXHours(timestamp, 24)) {\n return 'palegoldenrod';\n }\n return 'lightgreen';\n};\n\nexport const SyntheticsLocation = (props: SyntheticsLocationProps) => {\n const { lastFailedTimestamp, locationId } = props;\n const dynatraceApi = useApi(dynatraceApiRef);\n const { value, loading, error } = useAsync(async () => {\n return dynatraceApi.getDynatraceSyntheticLocationInfo(\n `SYNTHETIC_LOCATION-00000000000000${locationId}`,\n );\n });\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <Chip\n label={`${value?.name}${\n failedInLastXHours(new Date(lastFailedTimestamp), 24)\n ? `: failed @ ${lastFailedTimestamp.toLocaleTimeString()}`\n : ''\n }`}\n size=\"medium\"\n style={{ backgroundColor: chipColor(lastFailedTimestamp) }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,kBAAA,GAAqB,CAAC,SAAA,EAAiB,MAA4B,KAAA;AACvE,EAAI,IAAA,MAAA,GAAS,KAAK,MAAS,GAAA,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AACnD,EAAO,OAAA,SAAA,GAAY,IAAI,IAAA,CAAA,iBAAS,IAAA,IAAA,EAAO,EAAA,OAAA,EAAY,GAAA,GAAA,GAAO,EAAK,GAAA,EAAA,GAAK,MAAM,CAAA;AAC5E,CAAA;AAEA,MAAM,SAAA,GAAY,CAAC,SAA4B,KAAA;AAC7C,EAAI,IAAA,kBAAA,CAAmB,SAAW,EAAA,CAAC,CAAG,EAAA;AACpC,IAAO,OAAA,QAAA;AAAA;AAET,EAAI,IAAA,kBAAA,CAAmB,SAAW,EAAA,CAAC,CAAG,EAAA;AACpC,IAAO,OAAA,YAAA;AAAA;AAET,EAAI,IAAA,kBAAA,CAAmB,SAAW,EAAA,EAAE,CAAG,EAAA;AACrC,IAAO,OAAA,eAAA;AAAA;AAET,EAAO,OAAA,YAAA;AACT,CAAA;AAEa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAM,MAAA,EAAE,mBAAqB,EAAA,UAAA,EAAe,GAAA,KAAA;AAC5C,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAA,OAAO,YAAa,CAAA,iCAAA;AAAA,MAClB,oCAAoC,UAAU,CAAA;AAAA,KAChD;AAAA,GACD,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAG,EAAA,KAAA,EAAO,IAAI,CAAA,EACnB,mBAAmB,IAAI,IAAA,CAAK,mBAAmB,CAAA,EAAG,EAAE,CAChD,GAAA,CAAA,WAAA,EAAc,oBAAoB,kBAAmB,EAAC,KACtD,EACN,CAAA,CAAA;AAAA,MACA,IAAK,EAAA,QAAA;AAAA,MACL,KAAO,EAAA,EAAE,eAAiB,EAAA,SAAA,CAAU,mBAAmB,CAAE;AAAA;AAAA,GAC3D;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import * as react from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
3
  import { Entity } from '@backstage/catalog-model';
5
4
 
@@ -18,6 +17,6 @@ declare const isDynatraceAvailable: (entity: Entity) => boolean;
18
17
  * Creates a routable extension for the dynatrace plugin tab.
19
18
  * @public
20
19
  */
21
- declare const DynatraceTab: () => react.JSX.Element;
20
+ declare const DynatraceTab: () => react_jsx_runtime.JSX.Element;
22
21
 
23
22
  export { DynatraceTab, dynatracePlugin, isDynatraceAvailable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-dynatrace",
3
- "version": "10.4.1",
3
+ "version": "10.5.0",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "dynatrace",
@@ -38,18 +38,18 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@backstage/catalog-model": "^1.7.3",
41
- "@backstage/core-components": "^0.17.0",
42
- "@backstage/core-plugin-api": "^1.10.5",
41
+ "@backstage/core-components": "^0.17.1",
42
+ "@backstage/core-plugin-api": "^1.10.6",
43
43
  "@material-ui/core": "^4.12.2",
44
44
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
45
45
  "react-use": "^17.2.4"
46
46
  },
47
47
  "devDependencies": {
48
- "@backstage/cli": "^0.31.0",
49
- "@backstage/core-app-api": "^1.16.0",
50
- "@backstage/dev-utils": "^1.1.8",
51
- "@backstage/plugin-catalog-react": "^1.16.0",
52
- "@backstage/test-utils": "^1.7.6",
48
+ "@backstage/cli": "^0.32.0",
49
+ "@backstage/core-app-api": "^1.16.1",
50
+ "@backstage/dev-utils": "^1.1.9",
51
+ "@backstage/plugin-catalog-react": "^1.17.0",
52
+ "@backstage/test-utils": "^1.7.7",
53
53
  "@testing-library/dom": "^10.0.0",
54
54
  "@testing-library/jest-dom": "^6.0.0",
55
55
  "@testing-library/react": "^15.0.0",
@@ -59,11 +59,18 @@
59
59
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@backstage/plugin-catalog-react": "^1.16.0",
62
+ "@backstage/plugin-catalog-react": "^1.17.0",
63
63
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
64
64
  "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
65
65
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
66
66
  },
67
67
  "configSchema": "config.d.ts",
68
+ "typesVersions": {
69
+ "*": {
70
+ "package.json": [
71
+ "package.json"
72
+ ]
73
+ }
74
+ },
68
75
  "module": "./dist/index.esm.js"
69
76
  }