@backstage-community/plugin-tech-insights 0.3.42 → 0.4.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 +11 -0
- package/dist/api/TechInsightsApi.esm.js.map +1 -1
- package/dist/api/TechInsightsClient.esm.js.map +1 -1
- package/dist/components/BooleanCheck/BooleanCheck.esm.js.map +1 -1
- package/dist/components/CheckResultRenderer.esm.js.map +1 -1
- package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js.map +1 -1
- package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js.map +1 -1
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
- package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
- package/dist/components/ScorecardsPage/Filters.esm.js.map +1 -1
- package/dist/components/ScorecardsPage/ScorecardsPage.esm.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/package.json +17 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5abfb11: Backstage version bump to v1.34.2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5abfb11]
|
|
12
|
+
- @backstage-community/plugin-tech-insights-common@0.4.0
|
|
13
|
+
|
|
3
14
|
## 0.3.42
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechInsightsApi.esm.js","sources":["../../src/api/TechInsightsApi.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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n CheckLink,\n} from '@backstage-community/plugin-tech-insights-common';\nimport {\n Check,\n InsightFacts,\n} from '@backstage-community/plugin-tech-insights-common/client';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n isCheckResultFailed: (check: CheckResult) => boolean;\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options?: { includeStaticLinks?: boolean },\n ): CheckLink[];\n}\n"],"names":[],"mappings":";;AAmCO,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA
|
|
1
|
+
{"version":3,"file":"TechInsightsApi.esm.js","sources":["../../src/api/TechInsightsApi.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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n CheckLink,\n} from '@backstage-community/plugin-tech-insights-common';\nimport {\n Check,\n InsightFacts,\n} from '@backstage-community/plugin-tech-insights-common/client';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n isCheckResultFailed: (check: CheckResult) => boolean;\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options?: { includeStaticLinks?: boolean },\n ): CheckLink[];\n}\n"],"names":[],"mappings":";;AAmCO,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechInsightsClient.esm.js","sources":["../../src/api/TechInsightsClient.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 { TechInsightsApi } from './TechInsightsApi';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { TechInsightsClient as TechInsightsClientBase } from '@backstage-community/plugin-tech-insights-common/client';\nimport {\n CheckLink,\n CheckResult,\n} from '@backstage-community/plugin-tech-insights-common';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @public */\nexport class TechInsightsClient\n extends TechInsightsClientBase\n implements TechInsightsApi\n{\n private readonly renderers?: CheckResultRenderer[];\n private readonly customGetEntityLinks: (\n result: CheckResult,\n entity: Entity,\n ) => CheckLink[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];\n }) {\n super(options);\n this.renderers = options.renderers;\n this.customGetEntityLinks = options.getEntityLinks ?? (() => []);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n isCheckResultFailed(check: CheckResult) {\n const checkResultRenderers = this.getCheckResultRenderers([\n check.check.type,\n ]);\n if (checkResultRenderers[0] && checkResultRenderers[0].isFailed) {\n return checkResultRenderers[0].isFailed(check);\n }\n return true;\n }\n\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options: { includeStaticLinks?: boolean } = {},\n ): CheckLink[] {\n const links = this.customGetEntityLinks(result, entity);\n if (options.includeStaticLinks) {\n links.push(...(result.check.links ?? []));\n }\n return links;\n }\n}\n"],"names":["TechInsightsClientBase"],"mappings":";;;AA+BO,MAAM,2BACHA,oBAEV,CAAA;AAAA,EACmB,SAAA
|
|
1
|
+
{"version":3,"file":"TechInsightsClient.esm.js","sources":["../../src/api/TechInsightsClient.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 { TechInsightsApi } from './TechInsightsApi';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { TechInsightsClient as TechInsightsClientBase } from '@backstage-community/plugin-tech-insights-common/client';\nimport {\n CheckLink,\n CheckResult,\n} from '@backstage-community/plugin-tech-insights-common';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @public */\nexport class TechInsightsClient\n extends TechInsightsClientBase\n implements TechInsightsApi\n{\n private readonly renderers?: CheckResultRenderer[];\n private readonly customGetEntityLinks: (\n result: CheckResult,\n entity: Entity,\n ) => CheckLink[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];\n }) {\n super(options);\n this.renderers = options.renderers;\n this.customGetEntityLinks = options.getEntityLinks ?? (() => []);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n isCheckResultFailed(check: CheckResult) {\n const checkResultRenderers = this.getCheckResultRenderers([\n check.check.type,\n ]);\n if (checkResultRenderers[0] && checkResultRenderers[0].isFailed) {\n return checkResultRenderers[0].isFailed(check);\n }\n return true;\n }\n\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options: { includeStaticLinks?: boolean } = {},\n ): CheckLink[] {\n const links = this.customGetEntityLinks(result, entity);\n if (options.includeStaticLinks) {\n links.push(...(result.check.links ?? []));\n }\n return links;\n }\n}\n"],"names":["TechInsightsClientBase"],"mappings":";;;AA+BO,MAAM,2BACHA,oBAEV,CAAA;AAAA,EACmB,SAAA;AAAA,EACA,oBAAA;AAAA,EAKjB,YAAY,OAKT,EAAA;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA;AACzB,IAAA,IAAA,CAAK,oBAAuB,GAAA,OAAA,CAAQ,cAAmB,KAAA,MAAM,EAAC,CAAA;AAAA;AAChE,EAEA,wBAAwB,KAAwC,EAAA;AAC9D,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAa,IAAA,CAAC,kCAAkC,CAAA;AACvE,IAAA,OAAO,UAAU,MAAO,CAAA,CAAA,CAAA,KAAK,MAAM,QAAS,CAAA,CAAA,CAAE,IAAI,CAAC,CAAA;AAAA;AACrD,EAEA,oBAAoB,KAAoB,EAAA;AACtC,IAAM,MAAA,oBAAA,GAAuB,KAAK,uBAAwB,CAAA;AAAA,MACxD,MAAM,KAAM,CAAA;AAAA,KACb,CAAA;AACD,IAAA,IAAI,qBAAqB,CAAC,CAAA,IAAK,oBAAqB,CAAA,CAAC,EAAE,QAAU,EAAA;AAC/D,MAAA,OAAO,oBAAqB,CAAA,CAAC,CAAE,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA;AAE/C,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,iBACE,CAAA,MAAA,EACA,MACA,EAAA,OAAA,GAA4C,EAC/B,EAAA;AACb,IAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,oBAAqB,CAAA,MAAA,EAAQ,MAAM,CAAA;AACtD,IAAA,IAAI,QAAQ,kBAAoB,EAAA;AAC9B,MAAA,KAAA,CAAM,KAAK,GAAI,MAAA,CAAO,KAAM,CAAA,KAAA,IAAS,EAAG,CAAA;AAAA;AAE1C,IAAO,OAAA,KAAA;AAAA;AAEX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanCheck.esm.js","sources":["../../../src/components/BooleanCheck/BooleanCheck.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 CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\n\n/**\n * @public\n */\nexport const BooleanCheck = (props: { checkResult: CheckResult }) => {\n return !!props.checkResult.result ? (\n <CheckCircleOutline color=\"primary\" />\n ) : (\n <ErrorOutlineIcon color=\"error\" />\n );\n};\n\n/**\n * @public\n */\nexport const isBooleanCheckFailed = (checkResult: CheckResult) =>\n !checkResult.result;\n"],"names":[],"mappings":";;;;AAwBa,MAAA,YAAA,GAAe,CAAC,KAAwC,KAAA;AACnE,EAAA,OAAO,CAAC,CAAC,KAAM,CAAA,WAAA,CAAY,MACzB,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA,mBAEnC,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,OAAM,OAAQ,EAAA,CAAA
|
|
1
|
+
{"version":3,"file":"BooleanCheck.esm.js","sources":["../../../src/components/BooleanCheck/BooleanCheck.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 CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\n\n/**\n * @public\n */\nexport const BooleanCheck = (props: { checkResult: CheckResult }) => {\n return !!props.checkResult.result ? (\n <CheckCircleOutline color=\"primary\" />\n ) : (\n <ErrorOutlineIcon color=\"error\" />\n );\n};\n\n/**\n * @public\n */\nexport const isBooleanCheckFailed = (checkResult: CheckResult) =>\n !checkResult.result;\n"],"names":[],"mappings":";;;;AAwBa,MAAA,YAAA,GAAe,CAAC,KAAwC,KAAA;AACnE,EAAA,OAAO,CAAC,CAAC,KAAM,CAAA,WAAA,CAAY,MACzB,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA,mBAEnC,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,OAAM,OAAQ,EAAA,CAAA;AAEpC;AAKO,MAAM,oBAAuB,GAAA,CAAC,WACnC,KAAA,CAAC,WAAY,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckResultRenderer.esm.js","sources":["../../src/components/CheckResultRenderer.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 { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport React from 'react';\nimport { BooleanCheck, isBooleanCheckFailed } from './BooleanCheck';\n\n/**\n * Defines a react component that is responsible for rendering a result of a given type.\n *\n * @public\n */\nexport type CheckResultRenderer = {\n type: string;\n component: (check: CheckResult) => React.ReactElement;\n description?: (check: CheckResult) => string | React.ReactElement;\n isFailed?: (check: CheckResult) => boolean;\n};\n\n/**\n * Default renderer for json-rules-engine check results.\n *\n * @public\n */\nexport const jsonRulesEngineCheckResultRenderer: CheckResultRenderer = {\n type: 'json-rules-engine',\n component: (checkResult: CheckResult) => (\n <BooleanCheck checkResult={checkResult} />\n ),\n isFailed: isBooleanCheckFailed,\n};\n"],"names":[],"mappings":";;;AAqCO,MAAM,kCAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,mBAAA;AAAA,EACN,SAAW,EAAA,CAAC,WACV,qBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,WAA0B,EAAA,CAAA;AAAA,EAE1C,QAAU,EAAA
|
|
1
|
+
{"version":3,"file":"CheckResultRenderer.esm.js","sources":["../../src/components/CheckResultRenderer.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 { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport React from 'react';\nimport { BooleanCheck, isBooleanCheckFailed } from './BooleanCheck';\n\n/**\n * Defines a react component that is responsible for rendering a result of a given type.\n *\n * @public\n */\nexport type CheckResultRenderer = {\n type: string;\n component: (check: CheckResult) => React.ReactElement;\n description?: (check: CheckResult) => string | React.ReactElement;\n isFailed?: (check: CheckResult) => boolean;\n};\n\n/**\n * Default renderer for json-rules-engine check results.\n *\n * @public\n */\nexport const jsonRulesEngineCheckResultRenderer: CheckResultRenderer = {\n type: 'json-rules-engine',\n component: (checkResult: CheckResult) => (\n <BooleanCheck checkResult={checkResult} />\n ),\n isFailed: isBooleanCheckFailed,\n};\n"],"names":[],"mappings":";;;AAqCO,MAAM,kCAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,mBAAA;AAAA,EACN,SAAW,EAAA,CAAC,WACV,qBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,WAA0B,EAAA,CAAA;AAAA,EAE1C,QAAU,EAAA;AACZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCheckIcon.esm.js","sources":["../../../src/components/ResultCheckIcon/ResultCheckIcon.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, {\n ElementType,\n MouseEventHandler,\n PropsWithChildren,\n ReactNode,\n useState,\n} from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResultRenderer } from '../CheckResultRenderer';\nimport { ResultLinksMenu, ResultLinksMenuInfo } from '../ResultLinksMenu';\n\n/** @public */\nexport type ResultCheckIconBaseComponentProps = PropsWithChildren<{\n onClick?: MouseEventHandler;\n}>;\n\n/**\n * ResultCheckIcon props\n *\n * The only necessary prop is {@link ResultCheckIconProps.result}, but if\n * {@link ResultCheckIconProps.entity} is provided, the popup menu with links\n * will also include links specifically for this entity.\n *\n * @public\n */\nexport interface ResultCheckIconProps<\n P extends ResultCheckIconBaseComponentProps,\n> {\n /**\n * The CheckResult object to create an icon for\n */\n result: CheckResult;\n /**\n * The entity for which this check result is created. This is optional, but if\n * provided, entity-specific links will be added to the popup menu, if any.\n */\n entity?: Entity;\n /**\n * This can optionally be provided, with a small performance improvement, if\n * it is already cashed upstream.\n */\n checkResultRenderer?: CheckResultRenderer;\n /**\n * Will disable the popup menu\n */\n disableLinksMenu?: boolean;\n /**\n * The icon is rendered with an `IconButton` which handles the onClick.\n * To wrap this in another component, handling the onClick, pass a component,\n * such as `ListItemSecondaryAction` which handles the `onClick` to open the\n * popup menu.\n *\n * The {@link ResultCheckIconProps.componentProps} prop can be specified to\n * add props to the wrapping component.\n */\n component?: ElementType<P>;\n /**\n * Props to provide to the wrapping component\n * {@link ResultCheckIconProps.component}.\n */\n componentProps?: Omit<P, 'onClick' | 'children'>;\n /**\n * Override the component used to display instead of a result icon, when no\n * renderer was found for this check type.\n */\n missingRendererComponent?: ReactNode;\n}\n\nexport const ResultCheckIcon = <P extends ResultCheckIconBaseComponentProps>(\n props: ResultCheckIconProps<P>,\n) => {\n const {\n result,\n entity,\n disableLinksMenu,\n component,\n componentProps,\n missingRendererComponent = <Alert severity=\"error\">Unknown type.</Alert>,\n } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const checkResultRenderer =\n props.checkResultRenderer ??\n api.getCheckResultRenderers([result.check.type])[0];\n\n const [menu, setMenu] = useState<ResultLinksMenuInfo | undefined>();\n\n const iconComponent = checkResultRenderer?.component(result);\n\n const onClick: MouseEventHandler = event => {\n menu?.open(event.currentTarget);\n };\n\n const wrapActions = (inner: React.ReactElement): ReactNode => {\n if (!menu) {\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return <Component {...componentProps}>{inner}</Component>;\n }\n return inner;\n }\n\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return (\n <Component {...componentProps} onClick={onClick}>\n <IconButton edge=\"end\" aria-label=\"icon\">\n {inner}\n </IconButton>\n </Component>\n );\n }\n return (\n <IconButton edge=\"end\" aria-label=\"icon\" onClick={onClick}>\n {inner}\n </IconButton>\n );\n };\n\n return (\n <>\n {!disableLinksMenu && (\n <ResultLinksMenu result={result} entity={entity} setMenu={setMenu} />\n )}\n {wrapActions(iconComponent ?? missingRendererComponent)}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA4Fa,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,wBAA2B,mBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,WAAQ,eAAa
|
|
1
|
+
{"version":3,"file":"ResultCheckIcon.esm.js","sources":["../../../src/components/ResultCheckIcon/ResultCheckIcon.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, {\n ElementType,\n MouseEventHandler,\n PropsWithChildren,\n ReactNode,\n useState,\n} from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResultRenderer } from '../CheckResultRenderer';\nimport { ResultLinksMenu, ResultLinksMenuInfo } from '../ResultLinksMenu';\n\n/** @public */\nexport type ResultCheckIconBaseComponentProps = PropsWithChildren<{\n onClick?: MouseEventHandler;\n}>;\n\n/**\n * ResultCheckIcon props\n *\n * The only necessary prop is {@link ResultCheckIconProps.result}, but if\n * {@link ResultCheckIconProps.entity} is provided, the popup menu with links\n * will also include links specifically for this entity.\n *\n * @public\n */\nexport interface ResultCheckIconProps<\n P extends ResultCheckIconBaseComponentProps,\n> {\n /**\n * The CheckResult object to create an icon for\n */\n result: CheckResult;\n /**\n * The entity for which this check result is created. This is optional, but if\n * provided, entity-specific links will be added to the popup menu, if any.\n */\n entity?: Entity;\n /**\n * This can optionally be provided, with a small performance improvement, if\n * it is already cashed upstream.\n */\n checkResultRenderer?: CheckResultRenderer;\n /**\n * Will disable the popup menu\n */\n disableLinksMenu?: boolean;\n /**\n * The icon is rendered with an `IconButton` which handles the onClick.\n * To wrap this in another component, handling the onClick, pass a component,\n * such as `ListItemSecondaryAction` which handles the `onClick` to open the\n * popup menu.\n *\n * The {@link ResultCheckIconProps.componentProps} prop can be specified to\n * add props to the wrapping component.\n */\n component?: ElementType<P>;\n /**\n * Props to provide to the wrapping component\n * {@link ResultCheckIconProps.component}.\n */\n componentProps?: Omit<P, 'onClick' | 'children'>;\n /**\n * Override the component used to display instead of a result icon, when no\n * renderer was found for this check type.\n */\n missingRendererComponent?: ReactNode;\n}\n\nexport const ResultCheckIcon = <P extends ResultCheckIconBaseComponentProps>(\n props: ResultCheckIconProps<P>,\n) => {\n const {\n result,\n entity,\n disableLinksMenu,\n component,\n componentProps,\n missingRendererComponent = <Alert severity=\"error\">Unknown type.</Alert>,\n } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const checkResultRenderer =\n props.checkResultRenderer ??\n api.getCheckResultRenderers([result.check.type])[0];\n\n const [menu, setMenu] = useState<ResultLinksMenuInfo | undefined>();\n\n const iconComponent = checkResultRenderer?.component(result);\n\n const onClick: MouseEventHandler = event => {\n menu?.open(event.currentTarget);\n };\n\n const wrapActions = (inner: React.ReactElement): ReactNode => {\n if (!menu) {\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return <Component {...componentProps}>{inner}</Component>;\n }\n return inner;\n }\n\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return (\n <Component {...componentProps} onClick={onClick}>\n <IconButton edge=\"end\" aria-label=\"icon\">\n {inner}\n </IconButton>\n </Component>\n );\n }\n return (\n <IconButton edge=\"end\" aria-label=\"icon\" onClick={onClick}>\n {inner}\n </IconButton>\n );\n };\n\n return (\n <>\n {!disableLinksMenu && (\n <ResultLinksMenu result={result} entity={entity} setMenu={setMenu} />\n )}\n {wrapActions(iconComponent ?? missingRendererComponent)}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA4Fa,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,wBAA2B,mBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,WAAQ,eAAa;AA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AAC,gBACA,oBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,MAAA,EAAgB,MAAgB,EAAA,OAAA,EAAkB,CAEpE,EAAA,WAAA,CAAY,aAAiB,IAAA,wBAAwB,CACxD,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLinksMenu.esm.js","sources":["../../../src/components/ResultLinksMenu/ResultLinksMenu.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, {\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n} from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * TechInsightsLinksMenu setMenu receiver.\n *\n * This object contains an {@link ResultLinksMenuInfo.open | open} function,\n * which can be used to open the popup menu. It closes automatically on\n * click-away.\n *\n * @public\n */\nexport type ResultLinksMenuInfo = {\n /**\n * Call this function to open the popup menu. The element argument should be\n * an element which is used as an anchor for the menu - where to display it.\n */\n open: (element: Element) => void;\n};\n\nexport const ResultLinksMenu = (\n props: PropsWithChildren<{\n result: CheckResult;\n entity?: Entity;\n setMenu(opener: ResultLinksMenuInfo | undefined): void;\n }>,\n) => {\n const { result, entity, setMenu } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const links = useMemo(\n () =>\n entity\n ? api.getLinksForEntity(result, entity, {\n includeStaticLinks: true,\n })\n : result.check.links ?? [],\n [api, result, entity],\n );\n\n const menuId = `menu-${result.check.id}-${\n entity ? stringifyEntityRef(entity) : 'unknown'\n }`;\n\n const [anchorEl, setAnchorEl] = React.useState<Element | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (links.length === 0) {\n setMenu(undefined);\n return;\n }\n setMenu({\n open: (elem: Element) => {\n setAnchorEl(elem);\n },\n });\n }, [setMenu, links]);\n\n const handleClose = useCallback(() => {\n setAnchorEl(undefined);\n }, [setAnchorEl]);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <Menu\n id={menuId}\n anchorEl={anchorEl ?? null}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {links.map((link, i) => (\n <MenuItem\n key={`${i}-${link.url}`}\n button\n component=\"a\"\n href={link.url}\n target={link.url.startsWith('/') ? undefined : '_blank'}\n onClick={handleClose}\n >\n {link.title}\n </MenuItem>\n ))}\n </Menu>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8Ca,MAAA,eAAA,GAAkB,CAC7B,KAKG,KAAA;AACH,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA
|
|
1
|
+
{"version":3,"file":"ResultLinksMenu.esm.js","sources":["../../../src/components/ResultLinksMenu/ResultLinksMenu.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, {\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n} from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * TechInsightsLinksMenu setMenu receiver.\n *\n * This object contains an {@link ResultLinksMenuInfo.open | open} function,\n * which can be used to open the popup menu. It closes automatically on\n * click-away.\n *\n * @public\n */\nexport type ResultLinksMenuInfo = {\n /**\n * Call this function to open the popup menu. The element argument should be\n * an element which is used as an anchor for the menu - where to display it.\n */\n open: (element: Element) => void;\n};\n\nexport const ResultLinksMenu = (\n props: PropsWithChildren<{\n result: CheckResult;\n entity?: Entity;\n setMenu(opener: ResultLinksMenuInfo | undefined): void;\n }>,\n) => {\n const { result, entity, setMenu } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const links = useMemo(\n () =>\n entity\n ? api.getLinksForEntity(result, entity, {\n includeStaticLinks: true,\n })\n : result.check.links ?? [],\n [api, result, entity],\n );\n\n const menuId = `menu-${result.check.id}-${\n entity ? stringifyEntityRef(entity) : 'unknown'\n }`;\n\n const [anchorEl, setAnchorEl] = React.useState<Element | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (links.length === 0) {\n setMenu(undefined);\n return;\n }\n setMenu({\n open: (elem: Element) => {\n setAnchorEl(elem);\n },\n });\n }, [setMenu, links]);\n\n const handleClose = useCallback(() => {\n setAnchorEl(undefined);\n }, [setAnchorEl]);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <Menu\n id={menuId}\n anchorEl={anchorEl ?? null}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {links.map((link, i) => (\n <MenuItem\n key={`${i}-${link.url}`}\n button\n component=\"a\"\n href={link.url}\n target={link.url.startsWith('/') ? undefined : '_blank'}\n onClick={handleClose}\n >\n {link.title}\n </MenuItem>\n ))}\n </Menu>\n );\n};\n"],"names":[],"mappings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AAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,MAAA;AAAA,MACJ,UAAU,QAAY,IAAA,IAAA;AAAA,MACtB,WAAW,EAAA,IAAA;AAAA,MACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,MACtB,OAAS,EAAA;AAAA,KAAA;AAAA,IAER,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,CAChB,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,KAAK,GAAG,CAAA,CAAA;AAAA,QACrB,MAAM,EAAA,IAAA;AAAA,QACN,SAAU,EAAA,GAAA;AAAA,QACV,MAAM,IAAK,CAAA,GAAA;AAAA,QACX,QAAQ,IAAK,CAAA,GAAA,CAAI,UAAW,CAAA,GAAG,IAAI,KAAY,CAAA,GAAA,QAAA;AAAA,QAC/C,OAAS,EAAA;AAAA,OAAA;AAAA,MAER,IAAK,CAAA;AAAA,KAET;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.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, { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n expanded = true,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA0Ba,MAAA,cAAA,GAAiB,CAAC,KAOzB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAW,GAAA
|
|
1
|
+
{"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.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, { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n expanded = true,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA0Ba,MAAA,cAAA,GAAiB,CAAC,KAOzB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAW,GAAA;AAAA,GACT,GAAA,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAA,CAAI,UAAU,oBAAqB,CAAA,MAAM,GAAG,QAAQ,CAAA;AAAA,IACtE,CAAC,GAAK,EAAA,MAAA,EAAQ,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC;AAAA,GACxC;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA,GAAQ,KAAM,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAC,CAAA;AAEnE,EAAM,MAAA,oBAAA,GAAuB,QAAQ,MAAM;AACzC,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,cAAA,SAAuB,EAAC;AAE5C,IAAA,MAAM,KAAQ,GAAA,CAAC,GAAG,IAAI,IAAI,cAAe,CAAA,GAAA,CAAI,CAAC,EAAE,KAAM,EAAA,KAAM,KAAM,CAAA,IAAI,CAAC,CAAC,CAAA;AACxE,IAAM,MAAA,SAAA,GAAY,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA;AACnD,IAAA,OAAO,MAAO,CAAA,WAAA;AAAA,MACZ,UAAU,GAAI,CAAA,CAAA,QAAA,KAAY,CAAC,QAAS,CAAA,IAAA,EAAM,QAAQ,CAAC;AAAA,KACrD;AAAA,GACC,EAAA,CAAC,GAAK,EAAA,cAAA,EAAgB,UAAU,CAAC,CAAA;AAEpC,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA;AAAA;AAGnC,EAAM,MAAA,aAAA,GAAgB,CAAC,UACnB,GAAA,cAAA,IAAkB,EACjB,GAAA,CAAA,cAAA,IAAkB,EAAI,EAAA,MAAA;AAAA,IAAO,SAC5B,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG;AAAA,GACtD;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardContent.esm.js","sources":["../../../src/components/ScorecardsContent/ScorecardContent.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 useAsync from 'react-use/esm/useAsync';\nimport { Content, Page, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport Alert from '@material-ui/lab/Alert';\nimport { techInsightsApiRef } from '../../api/TechInsightsApi';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n}) => {\n const { title, description, checksId, filter } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,iBAAmB,EAAA;AAAA,IACjB,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA
|
|
1
|
+
{"version":3,"file":"ScorecardContent.esm.js","sources":["../../../src/components/ScorecardsContent/ScorecardContent.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 useAsync from 'react-use/esm/useAsync';\nimport { Content, Page, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport Alert from '@material-ui/lab/Alert';\nimport { techInsightsApiRef } from '../../api/TechInsightsApi';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n}) => {\n const { title, description, checksId, filter } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,iBAAmB,EAAA;AAAA,IACjB,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,QAA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ardInfo.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, { ReactNode } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { techInsightsApiRef } from '../../api';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"ScorecardInfo.esm.js","sources":["../../../src/components/ScorecardsInfo/ScorecardInfo.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, { ReactNode } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { techInsightsApiRef } from '../../api';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,eAAA;AAAA;AAE/B,CAAE,CAAA,CAAA;AAEF,MAAM,WAAW,CACf,KAAA,EACA,WACA,EAAA,OAAA,EACA,SACA,QACA,EAAA,OAAA,qBAEC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,sBACZ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,E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
|
-
{"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.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 { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { ResultCheckIcon } from '../ResultCheckIcon';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n\n const description = checkResultRenderer?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n component={ListItemSecondaryAction}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.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 { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { ResultCheckIcon } from '../ResultCheckIcon';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n\n const description = checkResultRenderer?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n component={ListItemSecondaryAction}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAEnC,CAAE,CAAA,CAAA;AAEW,MAAA,cAAA,GAAiB,CAAC,KAGzB,KAAA;AACJ,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,KAAA;AAEjC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,CAAC,GAAG,IAAI,IAAI,YAAa,CAAA,GAAA,CAAI,CAAC,EAAE,KAAM,EAAA,KAAM,KAAM,CAAA,IAAI,CAAC,CAAC,CAAA;AACtE,EAAM,MAAA,oBAAA,GAAuB,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA;AAE9D,EAAA,2CACG,IACE,EAAA,IAAA,EAAA,YAAA,CAAa,GAAI,CAAA,CAAC,QAAQ,KAAU,KAAA;AACnC,IAAA,MAAM,sBAAsB,oBAAqB,CAAA,IAAA;AAAA,MAC/C,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA;AAAA,KAC7C;AAEA,IAAA,MAAM,cAAc,mBAAqB,EAAA,WAAA;AAEzC,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,GAAK,EAAA,MAAA,CAAO,MAAM,EAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,KAAA;AAAA,QACL,OAAA,EAAS,OAAO,KAAM,CAAA,IAAA;AAAA,QACtB,SAAA,EACE,WACE,GAAA,WAAA,CAAY,MAAM,CAAA,uCAEjB,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAO,CAAA,KAAA,CAAM,WAAa,EAAA,CAAA;AAAA,QAGxD,WAAW,OAAQ,CAAA;AAAA;AAAA,KAErB,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAW,EAAA,uBAAA;AAAA,QACX;AAAA;AAAA,KAEJ,CAAA;AAAA,GAEH,CACH,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.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 { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA
|
|
1
|
+
{"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.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 { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA;AAAA;AAEd,CAAC,CAAA;AAED,MAAM,0BAAA,GAA6B,WAAW,CAAW,MAAA,MAAA;AAAA,EACvD,KAAO,EAAA;AAAA,IACL,KAAO,EAAA;AAAA,GACT;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ourcesContent":["/*\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, { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;;AAsCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA
|
|
1
|
+
{"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.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, { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;;AAsCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE,KAAO,EAAA,YAAA;AAAA,QACP,YAAY,CAAC,IAAA,EAAM,UAAUA,SAAU,CAAA,IAAA,EAAM,OAAO,eAAe;AAAA;AACrE;AACF,GACF;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAM,MAAA,MAAA,GAAS,MAAM,GAAA,CAAI,YAAa,EAAA;AACtC,IAAA,MAAM,SAAS,MAAM,GAAA,CAAI,aAAc,CAAA,IAAI,oBAAoB,CAAA;AAE/D,IAAO,OAAA;AAAA,MACL,MAAA;AAAA,MACA,MAAA,EAAQ,oBACJ,MAAO,CAAA,MAAA,CAAO,cAAY,QAAS,CAAA,OA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'react';
|
|
|
3
3
|
import react__default, { PropsWithChildren, MouseEventHandler, ElementType, ReactNode } from 'react';
|
|
4
4
|
import * as _backstage_community_plugin_tech_insights_common from '@backstage-community/plugin-tech-insights-common';
|
|
5
5
|
import { CheckResult, BulkCheckResponse, FactSchema, CheckLink } from '@backstage-community/plugin-tech-insights-common';
|
|
6
|
-
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
7
6
|
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
|
|
8
7
|
import * as _backstage_community_plugin_tech_insights_common_client from '@backstage-community/plugin-tech-insights-common/client';
|
|
9
8
|
import { Check as Check$1, InsightFacts as InsightFacts$1, TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
|
|
9
|
+
import * as _backstage_catalog_model_index from '@backstage/catalog-model/index';
|
|
10
10
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
11
11
|
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
12
12
|
import { JsonValue } from '@backstage/types';
|
|
@@ -112,7 +112,7 @@ declare const techInsightsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
112
112
|
declare const ScorecardInfo: (props: {
|
|
113
113
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
114
114
|
title: react.ReactNode;
|
|
115
|
-
entity:
|
|
115
|
+
entity: _backstage_catalog_model_index.Entity;
|
|
116
116
|
description?: string | undefined;
|
|
117
117
|
noWarning?: boolean | undefined;
|
|
118
118
|
expanded?: boolean | undefined;
|
|
@@ -122,7 +122,7 @@ declare const ScorecardInfo: (props: {
|
|
|
122
122
|
*/
|
|
123
123
|
declare const ScorecardsList: (props: {
|
|
124
124
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
125
|
-
entity?:
|
|
125
|
+
entity?: _backstage_catalog_model_index.Entity | undefined;
|
|
126
126
|
}) => react.JSX.Element;
|
|
127
127
|
/**
|
|
128
128
|
* @public
|
|
@@ -157,7 +157,7 @@ declare const TechInsightsCheckIcon: <P extends ResultCheckIconBaseComponentProp
|
|
|
157
157
|
*/
|
|
158
158
|
declare const TechInsightsLinksMenu: (props: react.PropsWithChildren<{
|
|
159
159
|
result: _backstage_community_plugin_tech_insights_common.CheckResult;
|
|
160
|
-
entity?:
|
|
160
|
+
entity?: _backstage_catalog_model_index.Entity | undefined;
|
|
161
161
|
setMenu(opener: ResultLinksMenuInfo | undefined): void;
|
|
162
162
|
}>) => react.JSX.Element | null;
|
|
163
163
|
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +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 */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('./components/ResultCheckIcon').then(m => m.ResultCheckIcon),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('./components/ResultLinksMenu').then(m => m.ResultLinksMenu),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;AA8BO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,kBAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,aAAa,cAAe,EAAA;AAAA,MACnE,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,WAAA,EACxB,KAAA,IAAI,kBAAmB,CAAA,EAAE,YAAc,EAAA,WAAA,EAAa
|
|
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 */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('./components/ResultCheckIcon').then(m => m.ResultCheckIcon),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('./components/ResultLinksMenu').then(m => m.ResultLinksMenu),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;AA8BO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,kBAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,aAAa,cAAe,EAAA;AAAA,MACnE,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,WAAA,EACxB,KAAA,IAAI,kBAAmB,CAAA,EAAE,YAAc,EAAA,WAAA,EAAa;AAAA,KACvD;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;A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AAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,2CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAAe;AAAA;AACtE,GACD;AACH;AAKO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,2CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAAe;AAAA;AACtE,GACD;AACH;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +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: 'tech-insights',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA
|
|
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: 'tech-insights',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-tech-insights",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "tech-insights",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"test": "backstage-cli package test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@backstage-community/plugin-tech-insights-common": "^0.
|
|
43
|
-
"@backstage/catalog-model": "^1.7.
|
|
44
|
-
"@backstage/core-components": "^0.
|
|
45
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
46
|
-
"@backstage/errors": "^1.2.
|
|
47
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
48
|
-
"@backstage/types": "^1.
|
|
42
|
+
"@backstage-community/plugin-tech-insights-common": "^0.4.0",
|
|
43
|
+
"@backstage/catalog-model": "^1.7.2",
|
|
44
|
+
"@backstage/core-components": "^0.16.2",
|
|
45
|
+
"@backstage/core-plugin-api": "^1.10.2",
|
|
46
|
+
"@backstage/errors": "^1.2.6",
|
|
47
|
+
"@backstage/plugin-catalog-react": "^1.15.0",
|
|
48
|
+
"@backstage/types": "^1.2.0",
|
|
49
49
|
"@material-table/exporters": "^1.2.19",
|
|
50
50
|
"@material-ui/core": "^4.12.2",
|
|
51
51
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"react-use": "^17.2.4"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@backstage/cli": "^0.
|
|
58
|
-
"@backstage/dev-utils": "^1.1.
|
|
57
|
+
"@backstage/cli": "^0.29.4",
|
|
58
|
+
"@backstage/dev-utils": "^1.1.5",
|
|
59
59
|
"@testing-library/dom": "^10.0.0",
|
|
60
60
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
61
|
"@testing-library/react": "^15.0.0",
|
|
@@ -70,5 +70,12 @@
|
|
|
70
70
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
71
71
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
72
72
|
},
|
|
73
|
+
"typesVersions": {
|
|
74
|
+
"*": {
|
|
75
|
+
"index": [
|
|
76
|
+
"dist/index.d.ts"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
73
80
|
"module": "./dist/index.esm.js"
|
|
74
81
|
}
|