@kartverket/backstage-plugin-risk-scorecard 4.0.5 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,39 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
3
3
  import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
4
- import { Card, CardBody, Text, TableRoot, TableHeader, Column, TableBody, Row, CellText } from '@backstage/ui';
4
+ import { useTable, Card, CardBody, Text, Table, CellText } from '@backstage/ui';
5
5
  import { useSystemChildComponents } from '../../utils/entityRelations.esm.js';
6
6
 
7
7
  function RiScRelationComponent() {
8
8
  const { t } = useTranslationRef(pluginRiScTranslationRef);
9
9
  const componentRelations = useSystemChildComponents();
10
+ const columns = [
11
+ {
12
+ id: "name",
13
+ label: "Name",
14
+ isRowHeader: true,
15
+ cell: (item) => /* @__PURE__ */ jsx(
16
+ CellText,
17
+ {
18
+ title: item.name,
19
+ href: item.riscUrl,
20
+ leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-link" })
21
+ }
22
+ )
23
+ },
24
+ { id: "kind", label: "Kind", cell: (item) => /* @__PURE__ */ jsx(CellText, { title: item.kind }) }
25
+ ];
26
+ const { tableProps } = useTable({
27
+ mode: "complete",
28
+ paginationOptions: {
29
+ pageSize: 5,
30
+ showPageSizeOptions: false
31
+ },
32
+ getData: () => componentRelations.map((item) => ({
33
+ id: item.entityRef,
34
+ ...item
35
+ }))
36
+ });
10
37
  return /* @__PURE__ */ jsx(Fragment, { children: componentRelations.length > 0 && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardBody, { children: [
11
38
  /* @__PURE__ */ jsx(
12
39
  Text,
@@ -18,23 +45,7 @@ function RiScRelationComponent() {
18
45
  children: t("dictionary.relatedComponents")
19
46
  }
20
47
  ),
21
- /* @__PURE__ */ jsxs(TableRoot, { "aria-label": "Related Components", children: [
22
- /* @__PURE__ */ jsxs(TableHeader, { children: [
23
- /* @__PURE__ */ jsx(Column, { isRowHeader: true, children: "Name" }),
24
- /* @__PURE__ */ jsx(Column, { children: "Kind" })
25
- ] }),
26
- /* @__PURE__ */ jsx(TableBody, { children: componentRelations.map((comp) => /* @__PURE__ */ jsxs(Row, { children: [
27
- /* @__PURE__ */ jsx(
28
- CellText,
29
- {
30
- title: comp.name,
31
- leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-link" }),
32
- href: comp.riscUrl
33
- }
34
- ),
35
- /* @__PURE__ */ jsx(CellText, { title: comp.kind })
36
- ] }, comp.entityRef)) })
37
- ] })
48
+ /* @__PURE__ */ jsx(Table, { columnConfig: columns, ...tableProps })
38
49
  ] }) }) });
39
50
  }
40
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"RiScRelationComponent.esm.js","sources":["../../../src/components/riScInfo/RiScRelationComponent.tsx"],"sourcesContent":["import { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations.ts';\nimport {\n Card,\n CardBody,\n Text,\n TableHeader,\n Column,\n TableBody,\n CellText,\n Row,\n TableRoot,\n} from '@backstage/ui';\nimport { useSystemChildComponents } from '../../utils/entityRelations.ts';\n\nexport function RiScRelationComponent() {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const componentRelations = useSystemChildComponents();\n\n return (\n <>\n {componentRelations.length > 0 && (\n <Card>\n <CardBody>\n <Text\n variant=\"title-small\"\n as=\"h6\"\n weight=\"bold\"\n style={{ marginBottom: '12px' }}\n >\n {t('dictionary.relatedComponents')}\n </Text>\n <TableRoot aria-label=\"Related Components\">\n <TableHeader>\n <Column isRowHeader>Name</Column>\n <Column>Kind</Column>\n </TableHeader>\n <TableBody>\n {componentRelations.map(comp => (\n <Row key={comp.entityRef}>\n <CellText\n title={comp.name}\n leadingIcon={<i className=\"ri-link\" />}\n href={comp.riscUrl}\n />\n <CellText title={comp.kind} />\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,SACb;AAAA,wBACA,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAO,IAAA,CAAK,IAAA,EAAM;AAAA,OAAA,EAAA,EANpB,IAAA,CAAK,SAOf,CACD,CAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,GACF,CAAA,EAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RiScRelationComponent.esm.js","sources":["../../../src/components/riScInfo/RiScRelationComponent.tsx"],"sourcesContent":["import { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations.ts';\nimport {\n Card,\n CardBody,\n Text,\n Table,\n useTable,\n type ColumnConfig,\n CellText,\n} from '@backstage/ui';\nimport { useSystemChildComponents } from '../../utils/entityRelations.ts';\n\nexport function RiScRelationComponent() {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const componentRelations = useSystemChildComponents();\n const columns: ColumnConfig<any>[] = [\n {\n id: 'name',\n label: 'Name',\n isRowHeader: true,\n cell: item => (\n <CellText\n title={item.name}\n href={item.riscUrl}\n leadingIcon={<i className=\"ri-link\" />}\n />\n ),\n },\n { id: 'kind', label: 'Kind', cell: item => <CellText title={item.kind} /> },\n ];\n\n const { tableProps } = useTable({\n mode: 'complete',\n paginationOptions: {\n pageSize: 5,\n showPageSizeOptions: false,\n },\n getData: () =>\n componentRelations.map(item => ({\n id: item.entityRef,\n ...item,\n })),\n });\n\n return (\n <>\n {componentRelations.length > 0 && (\n <Card>\n <CardBody>\n <Text\n variant=\"title-small\"\n as=\"h6\"\n weight=\"bold\"\n style={{ marginBottom: '12px' }}\n >\n {t('dictionary.relatedComponents')}\n </Text>\n <Table columnConfig={columns} {...tableProps} />\n </CardBody>\n </Card>\n )}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;AAaO,SAAS,qBAAA,GAAwB;AACtC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAA,MAAM,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MAAA,EAAO;AAAA,QAE7B,YAAE,8BAA8B;AAAA;AAAA,KACnC;AAAA,oBACA,GAAA,CAAC,KAAA,EAAA,EAAM,YAAA,EAAc,OAAA,EAAU,GAAG,UAAA,EAAY;AAAA,GAAA,EAChD,GACF,CAAA,EAEJ,CAAA;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@kartverket/backstage-plugin-risk-scorecard",
3
- "version": "4.0.5",
3
+ "version": "5.0.1",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
7
7
  "repository": {
8
- "url": "https://github.com/kartverket/backstage-plugin-risk-scorecard-frontend"
8
+ "url": "https://github.com/kartverket/backstage-plugin-risk-scorecard-frontend.git"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
@@ -40,10 +40,10 @@
40
40
  "rm-node-modules": "yarn run _rm-node-modules"
41
41
  },
42
42
  "dependencies": {
43
- "@backstage/core-components": "^0.18.5",
44
- "@backstage/core-plugin-api": "^1.12.1",
45
- "@backstage/plugin-catalog-react": "^1.21.5",
46
- "@backstage/ui": "^0.11.1",
43
+ "@backstage/core-components": "backstage:^",
44
+ "@backstage/core-plugin-api": "backstage:^",
45
+ "@backstage/plugin-catalog-react": "backstage:^",
46
+ "@backstage/ui": "backstage:^",
47
47
  "@emotion/cache": "^11.14.0",
48
48
  "@emotion/react": "^11.14.0",
49
49
  "@emotion/styled": "^11.14.0",
@@ -70,10 +70,10 @@
70
70
  "react-router-dom": "^6.3.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@backstage/cli": "^0.35.2",
74
- "@backstage/core-app-api": "^1.19.3",
75
- "@backstage/dev-utils": "^1.1.19",
76
- "@backstage/test-utils": "^1.7.14",
73
+ "@backstage/cli": "backstage:^",
74
+ "@backstage/core-app-api": "backstage:^",
75
+ "@backstage/dev-utils": "backstage:^",
76
+ "@backstage/test-utils": "backstage:^",
77
77
  "@testing-library/jest-dom": "^6.6.3",
78
78
  "@testing-library/react": "^16.3.0",
79
79
  "@types/classnames": "^2.3.4",
@@ -105,4 +105,4 @@
105
105
  }
106
106
  },
107
107
  "module": "./dist/index.esm.js"
108
- }
108
+ }