@backstage-community/plugin-quay 1.14.5 → 1.15.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 +25 -0
- package/dist/api/index.esm.js.map +1 -1
- package/dist/components/PermissionAlert/PermissionAlert.esm.js.map +1 -1
- package/dist/components/QuayRepository/QuayRepository.esm.js.map +1 -1
- package/dist/components/QuayRepository/tableHeading.esm.js.map +1 -1
- package/dist/components/QuayTagDetails/component.esm.js.map +1 -1
- package/dist/components/QuayTagPage/component.esm.js.map +1 -1
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/hooks/quay.esm.js.map +1 -1
- package/dist/hooks/useQuayViewPermission.esm.js.map +1 -1
- package/dist/lib/utils.esm.js.map +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/types.esm.js.map +1 -1
- package/package.json +24 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
### Dependencies
|
|
2
2
|
|
|
3
|
+
## 1.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7daf65a: Backstage version bump to v1.34.2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 0f5c451: Updated dependency `prettier` to `3.4.2`.
|
|
12
|
+
- 064b809: Updated dependency `start-server-and-test` to `2.0.9`.
|
|
13
|
+
- 18f9d9d: Updated dependency `@types/node` to `18.19.68`.
|
|
14
|
+
- 4eef4d1: Updated dependency `@playwright/test` to `1.49.1`.
|
|
15
|
+
- Updated dependencies [0f5c451]
|
|
16
|
+
- Updated dependencies [7daf65a]
|
|
17
|
+
- @backstage-community/plugin-quay-common@1.4.0
|
|
18
|
+
|
|
19
|
+
## 1.14.6
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 1af220c: Clean up api report warnings and remove unnecessary files
|
|
24
|
+
- aa02f04: Updated dependency `@playwright/test` to `1.49.0`.
|
|
25
|
+
- Updated dependencies [1af220c]
|
|
26
|
+
- @backstage-community/plugin-quay-common@1.3.4
|
|
27
|
+
|
|
3
28
|
## 1.14.5
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/api/index.ts"],"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 */\nimport {\n ConfigApi,\n createApiRef,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\n\nimport {\n LabelsResponse,\n ManifestByDigestResponse,\n SecurityDetailsResponse,\n TagsResponse,\n} from '../types';\n\nconst DEFAULT_PROXY_PATH = '/quay/api';\n\nexport interface QuayApiV1 {\n getTags(\n org: string,\n repo: string,\n page?: number,\n limit?: number,\n ): Promise<TagsResponse>;\n getLabels(org: string, repo: string, digest: string): Promise<LabelsResponse>;\n getManifestByDigest(\n org: string,\n repo: string,\n digest: string,\n ): Promise<ManifestByDigestResponse>;\n getSecurityDetails(\n org: string,\n repo: string,\n digest: string,\n ): Promise<SecurityDetailsResponse>;\n}\n\nexport const quayApiRef = createApiRef<QuayApiV1>({\n id: 'plugin.quay.service',\n});\n\nexport type Options = {\n discoveryApi: DiscoveryApi;\n configApi: ConfigApi;\n identityApi: IdentityApi;\n};\n\nexport class QuayApiClient implements QuayApiV1 {\n // @ts-ignore\n private readonly discoveryApi: DiscoveryApi;\n\n private readonly configApi: ConfigApi;\n\n private readonly identityApi: IdentityApi;\n\n constructor(options: Options) {\n this.discoveryApi = options.discoveryApi;\n this.configApi = options.configApi;\n this.identityApi = options.identityApi;\n }\n\n private async getBaseUrl() {\n const proxyPath =\n this.configApi.getOptionalString('quay.proxyPath') || DEFAULT_PROXY_PATH;\n return `${await this.discoveryApi.getBaseUrl('proxy')}${proxyPath}`;\n }\n\n private async fetcher(url: string) {\n const { token: idToken } = await this.identityApi.getCredentials();\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n });\n if (!response.ok) {\n throw new Error(\n `failed to fetch data, status ${response.status}: ${response.statusText}`,\n );\n }\n return await response.json();\n }\n\n private encodeGetParams(params: Record<string, any>) {\n return Object.keys(params)\n .filter(key => typeof params[key] !== 'undefined')\n .map(\n k =>\n `${encodeURIComponent(k)}=${encodeURIComponent(params[k] as string)}`,\n )\n .join('&');\n }\n\n async getTags(\n org: string,\n repo: string,\n page?: number,\n limit?: number,\n specifcTag?: string,\n ) {\n const proxyUrl = await this.getBaseUrl();\n\n const params = this.encodeGetParams({\n limit,\n page,\n onlyActiveTags: true,\n specifcTag,\n });\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/tag/?${params}`,\n )) as TagsResponse;\n }\n\n async getLabels(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}/labels`,\n )) as LabelsResponse;\n }\n\n async getManifestByDigest(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}`,\n )) as ManifestByDigestResponse;\n }\n\n async getSecurityDetails(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n const params = this.encodeGetParams({\n vulnerabilities: true,\n });\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}/security?${params}`,\n )) as SecurityDetailsResponse;\n }\n}\n"],"names":[],"mappings":";;AA6BA,MAAM,kBAAqB,GAAA,WAAA
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/api/index.ts"],"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 */\nimport {\n ConfigApi,\n createApiRef,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\n\nimport {\n LabelsResponse,\n ManifestByDigestResponse,\n SecurityDetailsResponse,\n TagsResponse,\n} from '../types';\n\nconst DEFAULT_PROXY_PATH = '/quay/api';\n\nexport interface QuayApiV1 {\n getTags(\n org: string,\n repo: string,\n page?: number,\n limit?: number,\n ): Promise<TagsResponse>;\n getLabels(org: string, repo: string, digest: string): Promise<LabelsResponse>;\n getManifestByDigest(\n org: string,\n repo: string,\n digest: string,\n ): Promise<ManifestByDigestResponse>;\n getSecurityDetails(\n org: string,\n repo: string,\n digest: string,\n ): Promise<SecurityDetailsResponse>;\n}\n\nexport const quayApiRef = createApiRef<QuayApiV1>({\n id: 'plugin.quay.service',\n});\n\nexport type Options = {\n discoveryApi: DiscoveryApi;\n configApi: ConfigApi;\n identityApi: IdentityApi;\n};\n\nexport class QuayApiClient implements QuayApiV1 {\n // @ts-ignore\n private readonly discoveryApi: DiscoveryApi;\n\n private readonly configApi: ConfigApi;\n\n private readonly identityApi: IdentityApi;\n\n constructor(options: Options) {\n this.discoveryApi = options.discoveryApi;\n this.configApi = options.configApi;\n this.identityApi = options.identityApi;\n }\n\n private async getBaseUrl() {\n const proxyPath =\n this.configApi.getOptionalString('quay.proxyPath') || DEFAULT_PROXY_PATH;\n return `${await this.discoveryApi.getBaseUrl('proxy')}${proxyPath}`;\n }\n\n private async fetcher(url: string) {\n const { token: idToken } = await this.identityApi.getCredentials();\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n });\n if (!response.ok) {\n throw new Error(\n `failed to fetch data, status ${response.status}: ${response.statusText}`,\n );\n }\n return await response.json();\n }\n\n private encodeGetParams(params: Record<string, any>) {\n return Object.keys(params)\n .filter(key => typeof params[key] !== 'undefined')\n .map(\n k =>\n `${encodeURIComponent(k)}=${encodeURIComponent(params[k] as string)}`,\n )\n .join('&');\n }\n\n async getTags(\n org: string,\n repo: string,\n page?: number,\n limit?: number,\n specifcTag?: string,\n ) {\n const proxyUrl = await this.getBaseUrl();\n\n const params = this.encodeGetParams({\n limit,\n page,\n onlyActiveTags: true,\n specifcTag,\n });\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/tag/?${params}`,\n )) as TagsResponse;\n }\n\n async getLabels(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}/labels`,\n )) as LabelsResponse;\n }\n\n async getManifestByDigest(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}`,\n )) as ManifestByDigestResponse;\n }\n\n async getSecurityDetails(org: string, repo: string, digest: string) {\n const proxyUrl = await this.getBaseUrl();\n\n const params = this.encodeGetParams({\n vulnerabilities: true,\n });\n\n return (await this.fetcher(\n `${proxyUrl}/api/v1/repository/${org}/${repo}/manifest/${digest}/security?${params}`,\n )) as SecurityDetailsResponse;\n }\n}\n"],"names":[],"mappings":";;AA6BA,MAAM,kBAAqB,GAAA,WAAA;AAsBpB,MAAM,aA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,CAAA;AAAA,KACjE;AAAA;AACF,EAEA,MAAM,kBAAA,CAAmB,GAAa,EAAA,IAAA,EAAc,MAAgB,EAAA;AAClE,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,UAAW,EAAA;AAEvC,IAAM,MAAA,MAAA,GAAS,KAAK,eAAgB,CAAA;AAAA,MAClC,eAAiB,EAAA;AAAA,KAClB,CAAA;AAED,IAAA,OAAQ,MAAM,IAAK,CAAA,OAAA;AAAA,MACjB,CAAA,EAAG,QAAQ,CAAsB,mBAAA,EAAA,GAAG,IAAI,IAAI,CAAA,UAAA,EAAa,MAAM,CAAA,UAAA,EAAa,MAAM,CAAA;AAAA,KACpF;AAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionAlert.esm.js","sources":["../../../src/components/PermissionAlert/PermissionAlert.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 */\nimport React from 'react';\n\nimport { Alert, AlertTitle } from '@material-ui/lab';\n\nconst PermissionAlert = () => {\n return (\n <Alert severity=\"warning\" data-testid=\"no-permission-alert\">\n <AlertTitle>Permission required</AlertTitle>\n To view quay image registry, contact your administrator to give you the\n quay.view.read permission.\n </Alert>\n );\n};\nexport default PermissionAlert;\n"],"names":[],"mappings":";;;AAmBA,MAAM,kBAAkB,MAAM;AAC5B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,SAAU,EAAA,aAAA,EAAY,yCACnC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,IAAA,EAAW,qBAAmB,CAAA,EAAa,oGAG9C,CAAA
|
|
1
|
+
{"version":3,"file":"PermissionAlert.esm.js","sources":["../../../src/components/PermissionAlert/PermissionAlert.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 */\nimport React from 'react';\n\nimport { Alert, AlertTitle } from '@material-ui/lab';\n\nconst PermissionAlert = () => {\n return (\n <Alert severity=\"warning\" data-testid=\"no-permission-alert\">\n <AlertTitle>Permission required</AlertTitle>\n To view quay image registry, contact your administrator to give you the\n quay.view.read permission.\n </Alert>\n );\n};\nexport default PermissionAlert;\n"],"names":[],"mappings":";;;AAmBA,MAAM,kBAAkB,MAAM;AAC5B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,SAAU,EAAA,aAAA,EAAY,yCACnC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,IAAA,EAAW,qBAAmB,CAAA,EAAa,oGAG9C,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuayRepository.esm.js","sources":["../../../src/components/QuayRepository/QuayRepository.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 */\nimport React from 'react';\n\nimport { Link, Progress, Table } from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { useRepository, useTags } from '../../hooks';\nimport { useQuayViewPermission } from '../../hooks/useQuayViewPermission';\nimport PermissionAlert from '../PermissionAlert/PermissionAlert';\nimport { columns, useStyles } from './tableHeading';\n\ntype QuayRepositoryProps = Record<never, any>;\n\nexport function QuayRepository(_props: QuayRepositoryProps) {\n const { repository, organization } = useRepository();\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const quayUiUrl = configApi.getOptionalString('quay.uiUrl');\n\n const hasViewPermission = useQuayViewPermission();\n\n const title = quayUiUrl ? (\n <>\n {`Quay repository: `}\n <Link\n to={`${quayUiUrl}/repository/${organization}/${repository}`}\n >{`${organization}/${repository}`}</Link>\n </>\n ) : (\n `Quay repository: ${organization}/${repository}`\n );\n const { loading, data } = useTags(organization, repository);\n\n if (!hasViewPermission) {\n return <PermissionAlert />;\n }\n\n if (loading) {\n return (\n <div data-testid=\"quay-repo-progress\">\n <Progress />\n </div>\n );\n }\n\n return (\n <div data-testid=\"quay-repo-table\">\n <Table\n title={title}\n options={{ sorting: true, paging: true, padding: 'dense' }}\n data={data}\n columns={columns}\n emptyContent={\n <div data-testid=\"quay-repo-table-empty\" className={classes.empty}>\n There are no images available.\n </div>\n }\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA2BO,SAAS,eAAe,MAA6B,EAAA;AAC1D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAa,EAAA,GAAI,aAAc,EAAA
|
|
1
|
+
{"version":3,"file":"QuayRepository.esm.js","sources":["../../../src/components/QuayRepository/QuayRepository.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 */\nimport React from 'react';\n\nimport { Link, Progress, Table } from '@backstage/core-components';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { useRepository, useTags } from '../../hooks';\nimport { useQuayViewPermission } from '../../hooks/useQuayViewPermission';\nimport PermissionAlert from '../PermissionAlert/PermissionAlert';\nimport { columns, useStyles } from './tableHeading';\n\ntype QuayRepositoryProps = Record<never, any>;\n\nexport function QuayRepository(_props: QuayRepositoryProps) {\n const { repository, organization } = useRepository();\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const quayUiUrl = configApi.getOptionalString('quay.uiUrl');\n\n const hasViewPermission = useQuayViewPermission();\n\n const title = quayUiUrl ? (\n <>\n {`Quay repository: `}\n <Link\n to={`${quayUiUrl}/repository/${organization}/${repository}`}\n >{`${organization}/${repository}`}</Link>\n </>\n ) : (\n `Quay repository: ${organization}/${repository}`\n );\n const { loading, data } = useTags(organization, repository);\n\n if (!hasViewPermission) {\n return <PermissionAlert />;\n }\n\n if (loading) {\n return (\n <div data-testid=\"quay-repo-progress\">\n <Progress />\n </div>\n );\n }\n\n return (\n <div data-testid=\"quay-repo-table\">\n <Table\n title={title}\n options={{ sorting: true, paging: true, padding: 'dense' }}\n data={data}\n columns={columns}\n emptyContent={\n <div data-testid=\"quay-repo-table-empty\" className={classes.empty}>\n There are no images available.\n </div>\n }\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA2BO,SAAS,eAAe,MAA6B,EAAA;AAC1D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAa,EAAA,GAAI,aAAc,EAAA;AACnD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAM,MAAA,SAAA,GAAY,SAA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+1 @@
|
|
|
1
|
-
{"version":3,"file":"tableHeading.esm.js","sources":["../../../src/components/QuayRepository/tableHeading.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 */\nimport React from 'react';\n\nimport { Link, Progress, TableColumn } from '@backstage/core-components';\n\nimport { Tooltip } from '@material-ui/core';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\n\nimport { securityScanComparator, vulnerabilitySummary } from '../../lib/utils';\nimport type { QuayTagData } from '../../types';\n\nexport const columns: TableColumn<QuayTagData>[] = [\n {\n title: 'Tag',\n field: 'name',\n type: 'string',\n highlight: true,\n },\n {\n title: 'Last Modified',\n field: 'last_modified',\n type: 'date',\n },\n {\n title: 'Security Scan',\n field: 'securityScan',\n render: (rowData: QuayTagData): React.ReactNode => {\n if (!rowData.securityStatus && !rowData.securityDetails) {\n return (\n <span data-testid=\"quay-repo-security-scan-progress\">\n <Progress />\n </span>\n );\n }\n\n if (rowData.securityStatus === 'queued') {\n return (\n <Tooltip title=\"The manifest for this tag is queued to be scanned for vulnerabilities\">\n <span data-testid=\"quay-repo-queued-for-scan\">Queued</span>\n </Tooltip>\n );\n }\n\n if (rowData.securityStatus === 'unsupported') {\n return (\n <Tooltip title=\"The manifest for this tag has an operating system or package manager unsupported by Quay Security Scanner\">\n <span data-testid=\"quay-repo-security-scan-unsupported\">\n Unsupported\n </span>\n </Tooltip>\n );\n }\n\n const tagManifest = rowData.manifest_digest_raw;\n const retStr = vulnerabilitySummary(rowData.securityDetails);\n return (\n <Link\n data-testid={`${rowData.name}-security-scan`}\n to={`tag/${tagManifest}`}\n >\n {retStr}\n </Link>\n );\n },\n id: 'securityScan',\n customSort: (a: QuayTagData, b: QuayTagData) =>\n securityScanComparator(a, b),\n },\n {\n title: 'Size',\n field: 'size',\n type: 'numeric',\n customSort: (a: QuayTagData, b: QuayTagData) => a.rawSize - b.rawSize,\n },\n {\n title: 'Expires',\n field: 'expiration',\n type: 'date',\n emptyValue: <i>Never</i>,\n },\n {\n title: 'Manifest',\n field: 'manifest_digest',\n type: 'string',\n customSort: (a: QuayTagData, b: QuayTagData) =>\n a.manifest_digest_raw.localeCompare(b.manifest_digest_raw),\n },\n];\n\nexport const useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,OAAsC,GAAA;AAAA,EACjD;AAAA,IACE,KAAO,EAAA,KAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,SAAW,EAAA
|
|
1
|
+
{"version":3,"file":"tableHeading.esm.js","sources":["../../../src/components/QuayRepository/tableHeading.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 */\nimport React from 'react';\n\nimport { Link, Progress, TableColumn } from '@backstage/core-components';\n\nimport { Tooltip } from '@material-ui/core';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\n\nimport { securityScanComparator, vulnerabilitySummary } from '../../lib/utils';\nimport type { QuayTagData } from '../../types';\n\nexport const columns: TableColumn<QuayTagData>[] = [\n {\n title: 'Tag',\n field: 'name',\n type: 'string',\n highlight: true,\n },\n {\n title: 'Last Modified',\n field: 'last_modified',\n type: 'date',\n },\n {\n title: 'Security Scan',\n field: 'securityScan',\n render: (rowData: QuayTagData): React.ReactNode => {\n if (!rowData.securityStatus && !rowData.securityDetails) {\n return (\n <span data-testid=\"quay-repo-security-scan-progress\">\n <Progress />\n </span>\n );\n }\n\n if (rowData.securityStatus === 'queued') {\n return (\n <Tooltip title=\"The manifest for this tag is queued to be scanned for vulnerabilities\">\n <span data-testid=\"quay-repo-queued-for-scan\">Queued</span>\n </Tooltip>\n );\n }\n\n if (rowData.securityStatus === 'unsupported') {\n return (\n <Tooltip title=\"The manifest for this tag has an operating system or package manager unsupported by Quay Security Scanner\">\n <span data-testid=\"quay-repo-security-scan-unsupported\">\n Unsupported\n </span>\n </Tooltip>\n );\n }\n\n const tagManifest = rowData.manifest_digest_raw;\n const retStr = vulnerabilitySummary(rowData.securityDetails);\n return (\n <Link\n data-testid={`${rowData.name}-security-scan`}\n to={`tag/${tagManifest}`}\n >\n {retStr}\n </Link>\n );\n },\n id: 'securityScan',\n customSort: (a: QuayTagData, b: QuayTagData) =>\n securityScanComparator(a, b),\n },\n {\n title: 'Size',\n field: 'size',\n type: 'numeric',\n customSort: (a: QuayTagData, b: QuayTagData) => a.rawSize - b.rawSize,\n },\n {\n title: 'Expires',\n field: 'expiration',\n type: 'date',\n emptyValue: <i>Never</i>,\n },\n {\n title: 'Manifest',\n field: 'manifest_digest',\n type: 'string',\n customSort: (a: QuayTagData, b: QuayTagData) =>\n a.manifest_digest_raw.localeCompare(b.manifest_digest_raw),\n },\n];\n\nexport const useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,OAAsC,GAAA;AAAA,EACjD;AAAA,IACE,KAAO,EAAA,KAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,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IACJ,YAAY,CAAC,CAAA,EAAgB,CAC3B,KAAA,sBAAA,CAAuB,GAAG,CAAC;AAAA,GAC/B;AAAA,EACA;AAAA,IACE,KAAO,EAAA,MAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,IAAM,EAAA,SAAA;AAAA,IACN,YAAY,CAAC,CAAA,EAAgB,CAAmB,KAAA,CAAA,CAAE,UAAU,CAAE,CAAA;AAAA,GAChE;AAAA,EACA;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA,YAAA;AAAA,IACP,IAAM,EAAA,MAAA;AAAA,IACN,UAAA,kBAAa,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,IAAA,EAAE,OAAK;AAAA,GACtB;AAAA,EACA;AAAA,IACE,KAAO,EAAA,UAAA;AAAA,IACP,KAAO,EAAA,iBAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,UAAA,EAAY,CAAC,CAAgB,EAAA,CAAA,KAC3B,EAAE,mBAAoB,CAAA,aAAA,CAAc,EAAE,mBAAmB;AAAA;AAE/D;AAEa,MAAA,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EAC5C,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.esm.js","sources":["../../../src/components/QuayTagDetails/component.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 */\nimport React from 'react';\n\nimport { Link, Table, TableColumn } from '@backstage/core-components';\nimport type { RouteFunc } from '@backstage/core-plugin-api';\n\nimport { makeStyles, TableContainer, TableHead } from '@material-ui/core';\nimport KeyboardBackspaceIcon from '@material-ui/icons/KeyboardBackspace';\nimport LinkIcon from '@material-ui/icons/Link';\nimport WarningIcon from '@material-ui/icons/Warning';\n\nimport { SEVERITY_COLORS } from '../../lib/utils';\nimport {\n Layer,\n Vulnerability,\n VulnerabilityListItem,\n VulnerabilityOrder,\n} from '../../types';\n\ntype QuayTagDetailsProps = {\n layer: Layer;\n digest: string;\n rootLink: RouteFunc<undefined>;\n};\n\n// from: https://github.com/quay/quay/blob/f1d85588157eababc3cbf789002c5db521dbd616/web/src/routes/TagDetails/SecurityReport/SecurityReportTable.tsx#L43\nconst getVulnerabilityLink = (link: string) => link.split(' ')[0];\n\nconst columns: TableColumn<VulnerabilityListItem>[] = [\n {\n title: 'Advisory',\n field: 'name',\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {rowData.Name}\n {rowData.Link.trim().length > 0 ? (\n <Link to={getVulnerabilityLink(rowData.Link)}>\n <LinkIcon style={{ marginLeft: '0.5rem' }} />\n </Link>\n ) : null}\n </div>\n );\n },\n customSort: (a: VulnerabilityListItem, b: VulnerabilityListItem) =>\n a.Name.localeCompare(b.Name, 'en'),\n },\n {\n title: 'Severity',\n field: 'Severity',\n customSort: (a: VulnerabilityListItem, b: VulnerabilityListItem) => {\n const severityA = VulnerabilityOrder[a.Severity];\n const severityB = VulnerabilityOrder[b.Severity];\n\n return severityA - severityB;\n },\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <WarningIcon\n htmlColor={SEVERITY_COLORS[rowData.Severity]}\n style={{\n marginRight: '0.5rem',\n }}\n />\n <span>{rowData.Severity}</span>\n </div>\n );\n },\n },\n {\n title: 'Package Name',\n field: 'PackageName',\n type: 'string',\n },\n {\n title: 'Current Version',\n field: 'CurrentVersion',\n type: 'string',\n },\n {\n title: 'Fixed By',\n field: 'FixedBy',\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <>\n {rowData.FixedBy.length > 0 ? (\n <span>{rowData.FixedBy}</span>\n ) : (\n '(None)'\n )}\n </>\n );\n },\n },\n];\n\nconst useStyles = makeStyles({\n link: {\n display: 'flex',\n alignItems: 'center',\n },\n linkText: {\n marginLeft: '0.5rem',\n fontSize: '1.1rem',\n },\n tableHead: {\n display: 'flex',\n alignItems: 'center',\n marginBottom: '1rem',\n },\n});\n\nexport const QuayTagDetails = ({\n layer,\n rootLink,\n digest,\n}: QuayTagDetailsProps) => {\n const classes = useStyles();\n const vulnerabilities = layer.Features.filter(\n feat => typeof feat.Vulnerabilities !== 'undefined',\n )\n .map(feature => {\n // TS doesn't seem to register this list as never being undefined from the above filter\n // so we cast it into the list\n // NOSONAR - irrelevant as per above comment\n return (feature.Vulnerabilities as Vulnerability[]).map(\n (v: Vulnerability): VulnerabilityListItem => {\n return {\n ...v,\n PackageName: feature.Name,\n CurrentVersion: feature.Version,\n };\n },\n );\n })\n .flat()\n .sort((a, b) => {\n const severityA = VulnerabilityOrder[a.Severity];\n const severityB = VulnerabilityOrder[b.Severity];\n\n return severityA - severityB;\n });\n\n return (\n <TableContainer>\n <TableHead className={classes.tableHead}>\n <Link to={rootLink()} className={classes.link}>\n <KeyboardBackspaceIcon />\n <span className={classes.linkText}>Back to repository</span>\n </Link>\n </TableHead>\n <Table\n title={`Vulnerabilities for ${digest.substring(0, 17)}`}\n data={vulnerabilities}\n columns={columns}\n />\n </TableContainer>\n );\n};\n\nexport default QuayTagDetails;\n"],"names":[],"mappings":";;;;;;;;;AAwCA,MAAM,uBAAuB,CAAC,IAAA,KAAiB,KAAK,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA
|
|
1
|
+
{"version":3,"file":"component.esm.js","sources":["../../../src/components/QuayTagDetails/component.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 */\nimport React from 'react';\n\nimport { Link, Table, TableColumn } from '@backstage/core-components';\nimport type { RouteFunc } from '@backstage/core-plugin-api';\n\nimport { makeStyles, TableContainer, TableHead } from '@material-ui/core';\nimport KeyboardBackspaceIcon from '@material-ui/icons/KeyboardBackspace';\nimport LinkIcon from '@material-ui/icons/Link';\nimport WarningIcon from '@material-ui/icons/Warning';\n\nimport { SEVERITY_COLORS } from '../../lib/utils';\nimport {\n Layer,\n Vulnerability,\n VulnerabilityListItem,\n VulnerabilityOrder,\n} from '../../types';\n\ntype QuayTagDetailsProps = {\n layer: Layer;\n digest: string;\n rootLink: RouteFunc<undefined>;\n};\n\n// from: https://github.com/quay/quay/blob/f1d85588157eababc3cbf789002c5db521dbd616/web/src/routes/TagDetails/SecurityReport/SecurityReportTable.tsx#L43\nconst getVulnerabilityLink = (link: string) => link.split(' ')[0];\n\nconst columns: TableColumn<VulnerabilityListItem>[] = [\n {\n title: 'Advisory',\n field: 'name',\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {rowData.Name}\n {rowData.Link.trim().length > 0 ? (\n <Link to={getVulnerabilityLink(rowData.Link)}>\n <LinkIcon style={{ marginLeft: '0.5rem' }} />\n </Link>\n ) : null}\n </div>\n );\n },\n customSort: (a: VulnerabilityListItem, b: VulnerabilityListItem) =>\n a.Name.localeCompare(b.Name, 'en'),\n },\n {\n title: 'Severity',\n field: 'Severity',\n customSort: (a: VulnerabilityListItem, b: VulnerabilityListItem) => {\n const severityA = VulnerabilityOrder[a.Severity];\n const severityB = VulnerabilityOrder[b.Severity];\n\n return severityA - severityB;\n },\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <WarningIcon\n htmlColor={SEVERITY_COLORS[rowData.Severity]}\n style={{\n marginRight: '0.5rem',\n }}\n />\n <span>{rowData.Severity}</span>\n </div>\n );\n },\n },\n {\n title: 'Package Name',\n field: 'PackageName',\n type: 'string',\n },\n {\n title: 'Current Version',\n field: 'CurrentVersion',\n type: 'string',\n },\n {\n title: 'Fixed By',\n field: 'FixedBy',\n render: (rowData: VulnerabilityListItem): React.ReactNode => {\n return (\n <>\n {rowData.FixedBy.length > 0 ? (\n <span>{rowData.FixedBy}</span>\n ) : (\n '(None)'\n )}\n </>\n );\n },\n },\n];\n\nconst useStyles = makeStyles({\n link: {\n display: 'flex',\n alignItems: 'center',\n },\n linkText: {\n marginLeft: '0.5rem',\n fontSize: '1.1rem',\n },\n tableHead: {\n display: 'flex',\n alignItems: 'center',\n marginBottom: '1rem',\n },\n});\n\nexport const QuayTagDetails = ({\n layer,\n rootLink,\n digest,\n}: QuayTagDetailsProps) => {\n const classes = useStyles();\n const vulnerabilities = layer.Features.filter(\n feat => typeof feat.Vulnerabilities !== 'undefined',\n )\n .map(feature => {\n // TS doesn't seem to register this list as never being undefined from the above filter\n // so we cast it into the list\n // NOSONAR - irrelevant as per above comment\n return (feature.Vulnerabilities as Vulnerability[]).map(\n (v: Vulnerability): VulnerabilityListItem => {\n return {\n ...v,\n PackageName: feature.Name,\n CurrentVersion: feature.Version,\n };\n },\n );\n })\n .flat()\n .sort((a, b) => {\n const severityA = VulnerabilityOrder[a.Severity];\n const severityB = VulnerabilityOrder[b.Severity];\n\n return severityA - severityB;\n });\n\n return (\n <TableContainer>\n <TableHead className={classes.tableHead}>\n <Link to={rootLink()} className={classes.link}>\n <KeyboardBackspaceIcon />\n <span className={classes.linkText}>Back to repository</span>\n </Link>\n </TableHead>\n <Table\n title={`Vulnerabilities for ${digest.substring(0, 17)}`}\n data={vulnerabilities}\n columns={columns}\n />\n </TableContainer>\n );\n};\n\nexport default QuayTagDetails;\n"],"names":[],"mappings":";;;;;;;;;AAwCA,MAAM,uBAAuB,CAAC,IAAA,KAAiB,KAAK,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAEhE,MAAM,OAAgD,GAAA;AAAA,EACpD;AAAA,IACE,KAAO,EAAA,UAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,MAAA,EAAQ,CAAC,OAAoD,KAAA;AAC3D,MAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,SAAS,MAAQ,EAAA,UAAA,EAAY,QAAS,EAAA,EAAA,EACjD,OAAQ,CAAA,IAAA,EACR,OAAQ,CAAA,IAAA,CAAK,MAAO,CAAA,MAAA,GAAS,CAC5B,mBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAI,oBAAqB,CAAA,OAAA,CAAQ,IAAI,CACzC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,QAAA,EAAY,EAAA,CAC7C,IACE,IACN,CAAA;AAAA,KAEJ;AAAA,IACA,UAAA,EAAY,CAAC,CAA0B,EAAA,CAAA,KACrC,EAAE,IAAK,CAAA,aAAA,CAAc,CAAE,CAAA,IAAA,EAAM,IAAI;AAAA,GACrC;AAAA,EACA;AAAA,IACE,KAAO,EAAA,UAAA;AAAA,IACP,KAAO,EAAA,UAAA;AAAA,IACP,UAAA,EAAY,CAAC,CAAA,EAA0B,CAA6B,KAAA;AAClE,MAAM,MAAA,SAAA,GAAY,kBAAmB,CAAA,CAAA,CAAE,QAAQ,CAAA;AAC/C,MAAM,MAAA,SAAA,GAAY,k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aAAA,CAAC,qBAAsB,EAAA,IAAA,CAAA,kBACtB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,QAAU,EAAA,EAAA,oBAAkB,CACvD,CACF,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAuB,oBAAA,EAAA,MAAA,CAAO,SAAU,CAAA,CAAA,EAAG,EAAE,CAAC,CAAA,CAAA;AAAA,MACrD,IAAM,EAAA,eAAA;AAAA,MACN;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.esm.js","sources":["../../../src/components/QuayTagPage/component.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 */\nimport React from 'react';\nimport { useParams } from 'react-router-dom';\n\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { useRepository, useTagDetails } from '../../hooks';\nimport { useQuayViewPermission } from '../../hooks/useQuayViewPermission';\nimport { rootRouteRef } from '../../routes';\nimport PermissionAlert from '../PermissionAlert/PermissionAlert';\nimport { QuayTagDetails } from '../QuayTagDetails';\n\nexport const QuayTagPage = () => {\n const rootLink = useRouteRef(rootRouteRef);\n const { repository, organization } = useRepository();\n const { digest } = useParams();\n const hasViewPermission = useQuayViewPermission();\n if (!digest) {\n throw new Error('digest is not defined');\n }\n const { loading, value } = useTagDetails(organization, repository, digest);\n\n if (!hasViewPermission) {\n return <PermissionAlert />;\n }\n\n if (loading) {\n return (\n <div data-testid=\"quay-tag-page-progress\">\n <Progress variant=\"query\" />\n </div>\n );\n }\n if (!value?.data) {\n return <ErrorPanel error={new Error('no digest')} />;\n }\n\n return (\n <QuayTagDetails\n rootLink={rootLink}\n layer={value.data.Layer}\n digest={digest}\n />\n );\n};\n\nexport default QuayTagPage;\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,QAAA,GAAW,YAAY,YAAY,CAAA
|
|
1
|
+
{"version":3,"file":"component.esm.js","sources":["../../../src/components/QuayTagPage/component.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 */\nimport React from 'react';\nimport { useParams } from 'react-router-dom';\n\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { useRepository, useTagDetails } from '../../hooks';\nimport { useQuayViewPermission } from '../../hooks/useQuayViewPermission';\nimport { rootRouteRef } from '../../routes';\nimport PermissionAlert from '../PermissionAlert/PermissionAlert';\nimport { QuayTagDetails } from '../QuayTagDetails';\n\nexport const QuayTagPage = () => {\n const rootLink = useRouteRef(rootRouteRef);\n const { repository, organization } = useRepository();\n const { digest } = useParams();\n const hasViewPermission = useQuayViewPermission();\n if (!digest) {\n throw new Error('digest is not defined');\n }\n const { loading, value } = useTagDetails(organization, repository, digest);\n\n if (!hasViewPermission) {\n return <PermissionAlert />;\n }\n\n if (loading) {\n return (\n <div data-testid=\"quay-tag-page-progress\">\n <Progress variant=\"query\" />\n </div>\n );\n }\n if (!value?.data) {\n return <ErrorPanel error={new Error('no digest')} />;\n }\n\n return (\n <QuayTagDetails\n rootLink={rootLink}\n layer={value.data.Layer}\n digest={digest}\n />\n );\n};\n\nexport default QuayTagPage;\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,QAAA,GAAW,YAAY,YAAY,CAAA;AACzC,EAAA,MAAM,EAAE,UAAA,EAAY,YAAa,EAAA,GAAI,aAAc,EAAA;AACnD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,oBAAoB,qBAAsB,EAAA;AAChD,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAEzC,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,KAAU,aAAc,CAAA,YAAA,EAAc,YAAY,MAAM,CAAA;AAEzE,EAAA,IAAI,CAAC,iBAAmB,EAAA;AACtB,IAAA,2CAAQ,eAAgB,EAAA,IAAA,CAAA;AAAA;AAG1B,EAAA,IAAI,OAAS,EAAA;AACX,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,aAAY,EAAA,wBAAA,EAAA,sCACd,QAAS,EAAA,EAAA,OAAA,EAAQ,SAAQ,CAC5B,CAAA;AAAA;AAGJ,EAAI,IAAA,CAAC,OAAO,IAAM,EAAA;AAChB,IAAA,2CAAQ,UAAW,EAAA,EAAA,KAAA,EAAO,IAAI,KAAA,CAAM,WAAW,CAAG,EAAA,CAAA;AAAA;AAGpD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MACA,KAAA,EAAO,MAAM,IAAK,CAAA,KAAA;AAAA,MAClB;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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 */\nimport React from 'react';\nimport { Route, Routes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\n\nimport { QUAY_ANNOTATION_REPOSITORY } from '../hooks';\nimport { tagRouteRef } from '../routes';\nimport { QuayRepository } from './QuayRepository';\nimport { QuayTagPage } from './QuayTagPage';\n\n/** *\n * @public\n */\nexport const isQuayAvailable = (entity: Entity) =>\n Boolean(entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY]);\n/**\n *\n * @public\n */\nexport const Router = () => (\n <Routes>\n <Route path=\"/\" element={<QuayRepository />} />\n <Route path={tagRouteRef.path} element={<QuayTagPage />} />\n </Routes>\n);\n"],"names":[],"mappings":";;;;;;;AA4Ba,MAAA,eAAA,GAAkB,CAAC,MAC9B,KAAA,OAAA,CAAQ,QAAQ,QAAS,CAAA,WAAA,GAAc,0BAA0B,CAAC
|
|
1
|
+
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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 */\nimport React from 'react';\nimport { Route, Routes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\n\nimport { QUAY_ANNOTATION_REPOSITORY } from '../hooks';\nimport { tagRouteRef } from '../routes';\nimport { QuayRepository } from './QuayRepository';\nimport { QuayTagPage } from './QuayTagPage';\n\n/** *\n * @public\n */\nexport const isQuayAvailable = (entity: Entity) =>\n Boolean(entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY]);\n/**\n *\n * @public\n */\nexport const Router = () => (\n <Routes>\n <Route path=\"/\" element={<QuayRepository />} />\n <Route path={tagRouteRef.path} element={<QuayTagPage />} />\n </Routes>\n);\n"],"names":[],"mappings":";;;;;;;AA4Ba,MAAA,eAAA,GAAkB,CAAC,MAC9B,KAAA,OAAA,CAAQ,QAAQ,QAAS,CAAA,WAAA,GAAc,0BAA0B,CAAC;AAKvD,MAAA,MAAA,GAAS,sBACnB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,sCACE,KAAM,EAAA,EAAA,IAAA,EAAK,GAAI,EAAA,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,GAAI,CAC7C,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAM,IAAM,EAAA,WAAA,CAAY,MAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EAAI,CAC3D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quay.esm.js","sources":["../../src/hooks/quay.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 */\nimport React, { useMemo } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { formatByteSize, formatDate } from '@janus-idp/shared-react';\nimport { Box, Chip, makeStyles } from '@material-ui/core';\n\nimport { quayApiRef } from '../api';\nimport { Layer, QuayTagData, Tag } from '../types';\n\nconst useLocalStyles = makeStyles({\n chip: {\n margin: 0,\n marginRight: '.2em',\n height: '1.5em',\n '& > span': {\n padding: '.3em',\n },\n },\n});\n\nexport const useTags = (organization: string, repository: string) => {\n const quayClient = useApi(quayApiRef);\n const [tags, setTags] = React.useState<Tag[]>([]);\n const [tagManifestLayers, setTagManifestLayers] = React.useState<\n Record<string, Layer>\n >({});\n const [tagManifestStatuses, setTagManifestStatuses] = React.useState<\n Record<string, string>\n >({});\n const localClasses = useLocalStyles();\n\n const fetchSecurityDetails = async (tag: Tag) => {\n const securityDetails = await quayClient.getSecurityDetails(\n organization,\n repository,\n tag.manifest_digest,\n );\n return securityDetails;\n };\n\n const { loading } = useAsync(async () => {\n const tagsResponse = await quayClient.getTags(organization, repository);\n Promise.all(\n tagsResponse.tags.map(async tag => {\n const securityDetails = await fetchSecurityDetails(tag);\n const securityData = securityDetails.data;\n const securityStatus = securityDetails.status;\n\n setTagManifestStatuses(prevState => ({\n ...prevState,\n [tag.manifest_digest]: securityStatus,\n }));\n\n if (securityData) {\n setTagManifestLayers(prevState => ({\n ...prevState,\n [tag.manifest_digest]: securityData.Layer,\n }));\n }\n }),\n );\n setTags(prevTags => [...prevTags, ...tagsResponse.tags]);\n return tagsResponse;\n });\n\n const data: QuayTagData[] = useMemo(() => {\n return Object.values(tags)?.map(tag => {\n const hashFunc = tag.manifest_digest.substring(0, 6);\n const shortHash = tag.manifest_digest.substring(7, 19);\n return {\n id: `${tag.manifest_digest}-${tag.name}`,\n name: tag.name,\n last_modified: formatDate(tag.last_modified),\n size: formatByteSize(tag.size),\n rawSize: tag.size,\n manifest_digest: (\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <Chip label={hashFunc} className={localClasses.chip} />\n {shortHash}\n </Box>\n ),\n expiration: tag.expiration,\n securityDetails: tagManifestLayers[tag.manifest_digest],\n securityStatus: tagManifestStatuses[tag.manifest_digest],\n manifest_digest_raw: tag.manifest_digest,\n // is_manifest_list: tag.is_manifest_list,\n // reversion: tag.reversion,\n // start_ts: tag.start_ts,\n // end_ts: tag.end_ts,\n // manifest_list: tag.manifest_list,\n };\n });\n }, [tags, localClasses.chip, tagManifestLayers, tagManifestStatuses]);\n\n return { loading, data };\n};\n\nexport const QUAY_ANNOTATION_REPOSITORY = 'quay.io/repository-slug';\n\nexport const useQuayAppData = ({ entity }: { entity: Entity }) => {\n const repositorySlug =\n entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY] ?? '';\n\n if (!repositorySlug) {\n throw new Error(\"'Quay' annotations are missing\");\n }\n return { repositorySlug };\n};\n\nexport const useRepository = () => {\n const { entity } = useEntity();\n const { repositorySlug } = useQuayAppData({ entity });\n const info = repositorySlug.split('/');\n\n const organization = info.shift() as 'string';\n const repository = info.join('/');\n return {\n organization,\n repository,\n };\n};\n\nexport const useTagDetails = (org: string, repo: string, digest: string) => {\n const quayClient = useApi(quayApiRef);\n const result = useAsync(async () => {\n const manifestLayer = await quayClient.getSecurityDetails(\n org,\n repo,\n digest,\n );\n return manifestLayer;\n });\n return result;\n};\n"],"names":[],"mappings":";;;;;;;;AA4BA,MAAM,iBAAiB,UAAW,CAAA;AAAA,EAChC,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,CAAA;AAAA,IACR,WAAa,EAAA,MAAA;AAAA,IACb,MAAQ,EAAA,OAAA;AAAA,IACR,UAAY,EAAA;AAAA,MACV,OAAS,EAAA
|
|
1
|
+
{"version":3,"file":"quay.esm.js","sources":["../../src/hooks/quay.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 */\nimport React, { useMemo } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { formatByteSize, formatDate } from '@janus-idp/shared-react';\nimport { Box, Chip, makeStyles } from '@material-ui/core';\n\nimport { quayApiRef } from '../api';\nimport { Layer, QuayTagData, Tag } from '../types';\n\nconst useLocalStyles = makeStyles({\n chip: {\n margin: 0,\n marginRight: '.2em',\n height: '1.5em',\n '& > span': {\n padding: '.3em',\n },\n },\n});\n\nexport const useTags = (organization: string, repository: string) => {\n const quayClient = useApi(quayApiRef);\n const [tags, setTags] = React.useState<Tag[]>([]);\n const [tagManifestLayers, setTagManifestLayers] = React.useState<\n Record<string, Layer>\n >({});\n const [tagManifestStatuses, setTagManifestStatuses] = React.useState<\n Record<string, string>\n >({});\n const localClasses = useLocalStyles();\n\n const fetchSecurityDetails = async (tag: Tag) => {\n const securityDetails = await quayClient.getSecurityDetails(\n organization,\n repository,\n tag.manifest_digest,\n );\n return securityDetails;\n };\n\n const { loading } = useAsync(async () => {\n const tagsResponse = await quayClient.getTags(organization, repository);\n Promise.all(\n tagsResponse.tags.map(async tag => {\n const securityDetails = await fetchSecurityDetails(tag);\n const securityData = securityDetails.data;\n const securityStatus = securityDetails.status;\n\n setTagManifestStatuses(prevState => ({\n ...prevState,\n [tag.manifest_digest]: securityStatus,\n }));\n\n if (securityData) {\n setTagManifestLayers(prevState => ({\n ...prevState,\n [tag.manifest_digest]: securityData.Layer,\n }));\n }\n }),\n );\n setTags(prevTags => [...prevTags, ...tagsResponse.tags]);\n return tagsResponse;\n });\n\n const data: QuayTagData[] = useMemo(() => {\n return Object.values(tags)?.map(tag => {\n const hashFunc = tag.manifest_digest.substring(0, 6);\n const shortHash = tag.manifest_digest.substring(7, 19);\n return {\n id: `${tag.manifest_digest}-${tag.name}`,\n name: tag.name,\n last_modified: formatDate(tag.last_modified),\n size: formatByteSize(tag.size),\n rawSize: tag.size,\n manifest_digest: (\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <Chip label={hashFunc} className={localClasses.chip} />\n {shortHash}\n </Box>\n ),\n expiration: tag.expiration,\n securityDetails: tagManifestLayers[tag.manifest_digest],\n securityStatus: tagManifestStatuses[tag.manifest_digest],\n manifest_digest_raw: tag.manifest_digest,\n // is_manifest_list: tag.is_manifest_list,\n // reversion: tag.reversion,\n // start_ts: tag.start_ts,\n // end_ts: tag.end_ts,\n // manifest_list: tag.manifest_list,\n };\n });\n }, [tags, localClasses.chip, tagManifestLayers, tagManifestStatuses]);\n\n return { loading, data };\n};\n\nexport const QUAY_ANNOTATION_REPOSITORY = 'quay.io/repository-slug';\n\nexport const useQuayAppData = ({ entity }: { entity: Entity }) => {\n const repositorySlug =\n entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY] ?? '';\n\n if (!repositorySlug) {\n throw new Error(\"'Quay' annotations are missing\");\n }\n return { repositorySlug };\n};\n\nexport const useRepository = () => {\n const { entity } = useEntity();\n const { repositorySlug } = useQuayAppData({ entity });\n const info = repositorySlug.split('/');\n\n const organization = info.shift() as 'string';\n const repository = info.join('/');\n return {\n organization,\n repository,\n };\n};\n\nexport const useTagDetails = (org: string, repo: string, digest: string) => {\n const quayClient = useApi(quayApiRef);\n const result = useAsync(async () => {\n const manifestLayer = await quayClient.getSecurityDetails(\n org,\n repo,\n digest,\n );\n return manifestLayer;\n });\n return result;\n};\n"],"names":[],"mappings":";;;;;;;;AA4BA,MAAM,iBAAiB,UAAW,CAAA;AAAA,EAChC,IAAM,EAAA;AAAA,IACJ,MAAQ,EA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;AAClC,IAAM,MAAA,aAAA,GAAgB,MAAM,UAAW,CAAA,kBAAA;AAAA,MACrC,GAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACF;AACA,IAAO,OAAA,aAAA;AAAA,GACR,CAAA;AACD,EAAO,OAAA,MAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuayViewPermission.esm.js","sources":["../../src/hooks/useQuayViewPermission.ts"],"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 */\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { quayViewPermission } from '@backstage-community/plugin-quay-common';\n\nexport const useQuayViewPermission = () => {\n const quayViewPermissionResult = usePermission({\n permission: quayViewPermission,\n });\n\n return quayViewPermissionResult.allowed;\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,wBAAwB,MAAM;AACzC,EAAA,MAAM,2BAA2B,aAAc,CAAA;AAAA,IAC7C,UAAY,EAAA
|
|
1
|
+
{"version":3,"file":"useQuayViewPermission.esm.js","sources":["../../src/hooks/useQuayViewPermission.ts"],"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 */\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { quayViewPermission } from '@backstage-community/plugin-quay-common';\n\nexport const useQuayViewPermission = () => {\n const quayViewPermissionResult = usePermission({\n permission: quayViewPermission,\n });\n\n return quayViewPermissionResult.allowed;\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,wBAAwB,MAAM;AACzC,EAAA,MAAM,2BAA2B,aAAc,CAAA;AAAA,IAC7C,UAAY,EAAA;AAAA,GACb,CAAA;AAED,EAAA,OAAO,wBAAyB,CAAA,OAAA;AAClC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../../src/lib/utils.ts"],"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 */\nimport {\n Layer,\n QuayTagData,\n VulnerabilityOrder,\n VulnerabilitySeverity,\n} from '../types';\n\nexport const SEVERITY_COLORS = new Proxy(\n new Map([\n [VulnerabilitySeverity.Critical, '#7D1007'],\n [VulnerabilitySeverity.High, '#C9190B'],\n [VulnerabilitySeverity.Medium, '#EC7A08'],\n [VulnerabilitySeverity.Low, '#F0AB00'],\n [VulnerabilitySeverity.None, '#3E8635'],\n ]) as any,\n {\n get: (o: Map<VulnerabilitySeverity, string>, k: VulnerabilitySeverity) =>\n o.has(k) ? o.get(k) : '#8A8D90',\n },\n);\n\nexport const vulnerabilitySummary = (layer: Layer): string => {\n const summary: Record<string, number> = {};\n\n layer?.Features.forEach(feature => {\n feature.Vulnerabilities?.forEach(vulnerability => {\n const { Severity } = vulnerability;\n if (!summary[Severity]) {\n summary[Severity] = 0;\n }\n summary[Severity]++;\n });\n });\n\n const scanResults = Object.entries(summary)\n .sort((a, b) => {\n const severityA = VulnerabilityOrder[a[0] as VulnerabilitySeverity];\n const severityB = VulnerabilityOrder[b[0] as VulnerabilitySeverity];\n\n return severityA - severityB;\n })\n .map(([severity, count]) => `${severity}: ${count}`)\n .join(', ');\n return scanResults.trim() !== '' ? scanResults : 'Passed';\n};\n\nconst securityScanOrder = [\n 'High',\n 'Medium',\n 'Low',\n 'Passed',\n 'Scanning',\n 'Queued',\n 'Unscanned',\n 'Unsupported',\n];\n\nexport const capitalizeFirstLetter = (s: string): string => {\n return s.charAt(0).toLocaleUpperCase('en-US') + s.slice(1);\n};\n\nexport const securityScanComparator = (\n ar: QuayTagData,\n br: QuayTagData,\n order: 'asc' | 'desc' = 'desc',\n) => {\n const a = vulnerabilitySummary(ar.securityDetails);\n const b = vulnerabilitySummary(br.securityDetails);\n\n const parseScan = (scan: string) => {\n const values: { [key: string]: number } = {\n High: 0,\n Medium: 0,\n Low: 0,\n };\n scan.split(', ').forEach((part: string) => {\n const [key, value] = part.split(': ');\n if (values[key] !== undefined) {\n values[key] = parseInt(value, 10);\n }\n });\n return values;\n };\n\n const aParts = a.split(', ');\n const bParts = b.split(', ');\n\n const multiplier = order === 'asc' ? 1 : -1;\n\n if (\n aParts.length >= 1 &&\n bParts.length >= 1 &&\n aParts[0] !== 'Passed' &&\n bParts[0] !== 'Passed'\n ) {\n const aParsed = parseScan(a);\n const bParsed = parseScan(b);\n\n if (aParsed.High !== bParsed.High) {\n return (bParsed.High - aParsed.High) * multiplier;\n }\n if (aParsed.Medium !== bParsed.Medium) {\n return (bParsed.Medium - aParsed.Medium) * multiplier;\n }\n if (aParsed.Low !== bParsed.Low) {\n return (bParsed.Low - aParsed.Low) * multiplier;\n }\n }\n\n const finalAValue = capitalizeFirstLetter(\n ar.securityStatus === 'scanned'\n ? aParts[0].split(':')[0]\n : ar.securityStatus ?? 'scanning',\n );\n\n const finalBValue = capitalizeFirstLetter(\n br.securityStatus === 'scanned'\n ? bParts[0].split(':')[0]\n : br.securityStatus ?? 'scanning',\n );\n\n if (finalAValue === 'Scanning' || finalBValue === 'Scanning') return 1;\n\n return (\n (securityScanOrder.indexOf(finalAValue) -\n securityScanOrder.indexOf(finalBValue)) *\n multiplier\n );\n};\n"],"names":[],"mappings":";;AAsBO,MAAM,kBAAkB,IAAI,KAAA;AAAA,sBAC7B,GAAI,CAAA;AAAA,IACN,CAAC,qBAAsB,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,IAC1C,CAAC,qBAAsB,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,IACtC,CAAC,qBAAsB,CAAA,MAAA,EAAQ,SAAS,CAAA;AAAA,IACxC,CAAC,qBAAsB,CAAA,GAAA,EAAK,SAAS,CAAA;AAAA,IACrC,CAAC,qBAAsB,CAAA,IAAA,EAAM,SAAS
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../../src/lib/utils.ts"],"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 */\nimport {\n Layer,\n QuayTagData,\n VulnerabilityOrder,\n VulnerabilitySeverity,\n} from '../types';\n\nexport const SEVERITY_COLORS = new Proxy(\n new Map([\n [VulnerabilitySeverity.Critical, '#7D1007'],\n [VulnerabilitySeverity.High, '#C9190B'],\n [VulnerabilitySeverity.Medium, '#EC7A08'],\n [VulnerabilitySeverity.Low, '#F0AB00'],\n [VulnerabilitySeverity.None, '#3E8635'],\n ]) as any,\n {\n get: (o: Map<VulnerabilitySeverity, string>, k: VulnerabilitySeverity) =>\n o.has(k) ? o.get(k) : '#8A8D90',\n },\n);\n\nexport const vulnerabilitySummary = (layer: Layer): string => {\n const summary: Record<string, number> = {};\n\n layer?.Features.forEach(feature => {\n feature.Vulnerabilities?.forEach(vulnerability => {\n const { Severity } = vulnerability;\n if (!summary[Severity]) {\n summary[Severity] = 0;\n }\n summary[Severity]++;\n });\n });\n\n const scanResults = Object.entries(summary)\n .sort((a, b) => {\n const severityA = VulnerabilityOrder[a[0] as VulnerabilitySeverity];\n const severityB = VulnerabilityOrder[b[0] as VulnerabilitySeverity];\n\n return severityA - severityB;\n })\n .map(([severity, count]) => `${severity}: ${count}`)\n .join(', ');\n return scanResults.trim() !== '' ? scanResults : 'Passed';\n};\n\nconst securityScanOrder = [\n 'High',\n 'Medium',\n 'Low',\n 'Passed',\n 'Scanning',\n 'Queued',\n 'Unscanned',\n 'Unsupported',\n];\n\nexport const capitalizeFirstLetter = (s: string): string => {\n return s.charAt(0).toLocaleUpperCase('en-US') + s.slice(1);\n};\n\nexport const securityScanComparator = (\n ar: QuayTagData,\n br: QuayTagData,\n order: 'asc' | 'desc' = 'desc',\n) => {\n const a = vulnerabilitySummary(ar.securityDetails);\n const b = vulnerabilitySummary(br.securityDetails);\n\n const parseScan = (scan: string) => {\n const values: { [key: string]: number } = {\n High: 0,\n Medium: 0,\n Low: 0,\n };\n scan.split(', ').forEach((part: string) => {\n const [key, value] = part.split(': ');\n if (values[key] !== undefined) {\n values[key] = parseInt(value, 10);\n }\n });\n return values;\n };\n\n const aParts = a.split(', ');\n const bParts = b.split(', ');\n\n const multiplier = order === 'asc' ? 1 : -1;\n\n if (\n aParts.length >= 1 &&\n bParts.length >= 1 &&\n aParts[0] !== 'Passed' &&\n bParts[0] !== 'Passed'\n ) {\n const aParsed = parseScan(a);\n const bParsed = parseScan(b);\n\n if (aParsed.High !== bParsed.High) {\n return (bParsed.High - aParsed.High) * multiplier;\n }\n if (aParsed.Medium !== bParsed.Medium) {\n return (bParsed.Medium - aParsed.Medium) * multiplier;\n }\n if (aParsed.Low !== bParsed.Low) {\n return (bParsed.Low - aParsed.Low) * multiplier;\n }\n }\n\n const finalAValue = capitalizeFirstLetter(\n ar.securityStatus === 'scanned'\n ? aParts[0].split(':')[0]\n : ar.securityStatus ?? 'scanning',\n );\n\n const finalBValue = capitalizeFirstLetter(\n br.securityStatus === 'scanned'\n ? bParts[0].split(':')[0]\n : br.securityStatus ?? 'scanning',\n );\n\n if (finalAValue === 'Scanning' || finalBValue === 'Scanning') return 1;\n\n return (\n (securityScanOrder.indexOf(finalAValue) -\n securityScanOrder.indexOf(finalBValue)) *\n multiplier\n );\n};\n"],"names":[],"mappings":";;AAsBO,MAAM,kBAAkB,IAAI,KAAA;AAAA,sBAC7B,GAAI,CAAA;AAAA,IACN,CAAC,qBAAsB,CAAA,QAAA,EAAU,SAAS,CAAA;AAAA,IAC1C,CAAC,qBAAsB,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,IACtC,CAAC,qBAAsB,CAAA,MAAA,EAAQ,SAAS,CAAA;AAAA,IACxC,CAAC,qBAAsB,CAAA,GAAA,EAAK,SAAS,CAAA;AAAA,IACrC,CAAC,qBAAsB,CAAA,IAAA,EAAM,SAAS;AAAA,GACvC,CAAA;AAAA,EACD;AAAA,IACE,GAAA,EAAK,CAAC,CAAA,EAAuC,CAC3C,KAAA,CAAA,CAAE,GAAI,CAAA,CAAC,CAAI,GAAA,CAAA,CAAE,GAAI,CAAA,CAAC,CAAI,GAAA;AAAA;AAE5B;AAEa,MAAA,oBAAA,GAAuB,CAAC,KAAyB,KAAA;AAC5D,EAAA,MAAM,UAAkC,EAAC;AAEzC,EAAO,KAAA,EAAA,QAAA,CAAS,QAAQ,CAAW,OAAA,KAAA;AACjC,IAAQ,OAAA,CAAA,eAAA,EAAiB,QAAQ,CAAiB,aAAA,KAAA;AAChD,MAAM,MAAA,EAAE,UAAa,GAAA,aAAA;AACrB,MAAI,IAAA,CAAC,OAAQ,CAAA,QAAQ,CAAG,EAAA;AACtB,QAAA,OAA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,OAAA,CAAA,OAAA,CAAQ,MAAS,GAAA,OAAA,CAAQ,MAAU,IAAA,UAAA;AAAA;AAE7C,IAAI,IAAA,OAAA,CAAQ,GAAQ,KAAA,OAAA,CAAQ,GAAK,EAAA;AAC/B,MAAQ,OAAA,CAAA,OAAA,CAAQ,GAAM,GAAA,OAAA,CAAQ,GAAO,IAAA,UAAA;AAAA;AACvC;AAGF,EAAA,MAAM,WAAc,GAAA,qBAAA;AAAA,IAClB,EAAG,CAAA,cAAA,KAAmB,SAClB,GAAA,MAAA,CAAO,CAAC,CAAA,CAAE,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACtB,GAAA,EAAA,CAAG,cAAkB,IAAA;AAAA,GAC3B;AAEA,EAAA,MAAM,WAAc,GAAA,qBAAA;AAAA,IAClB,EAAG,CAAA,cAAA,KAAmB,SAClB,GAAA,MAAA,CAAO,CAAC,CAAA,CAAE,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACtB,GAAA,EAAA,CAAG,cAAkB,IAAA;AAAA,GAC3B;AAEA,EAAA,IAAI,WAAgB,KAAA,UAAA,IAAc,WAAgB,KAAA,UAAA,EAAmB,OAAA,CAAA;AAErE,EAAA,OAAA,CACG,kBAAkB,OAAQ,CAAA,WAAW,IACpC,iBAAkB,CAAA,OAAA,CAAQ,WAAW,CACvC,IAAA,UAAA;AAEJ;;;;"}
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 */\nimport { Entity } from '@backstage/catalog-model';\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { QuayApiClient, quayApiRef } from './api';\nimport { QUAY_ANNOTATION_REPOSITORY } from './hooks';\nimport { rootRouteRef, tagRouteRef } from './routes';\n\n/**\n * Quay plugin\n *\n * @public\n */\nexport const quayPlugin = createPlugin({\n id: 'quay',\n routes: {\n root: rootRouteRef,\n tag: tagRouteRef,\n },\n apis: [\n createApiFactory({\n api: quayApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, configApi, identityApi }) =>\n new QuayApiClient({ discoveryApi, configApi, identityApi }),\n }),\n ],\n});\n\n/**\n * Quay page\n *\n * @public\n */\nexport const QuayPage = quayPlugin.provide(\n createRoutableExtension({\n name: 'QuayPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Returns true if the catalog entity contains the quay annotation `quay.io/repository-slug`.\n *\n * @public\n */\nexport const isQuayAvailable = (entity: Entity) =>\n Boolean(entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY]);\n"],"names":[],"mappings":";;;;;AAkCO,MAAM,aAAa,YAAa,CAAA;AAAA,EACrC,EAAI,EAAA,MAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,GAAK,EAAA
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 */\nimport { Entity } from '@backstage/catalog-model';\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { QuayApiClient, quayApiRef } from './api';\nimport { QUAY_ANNOTATION_REPOSITORY } from './hooks';\nimport { rootRouteRef, tagRouteRef } from './routes';\n\n/**\n * Quay plugin\n *\n * @public\n */\nexport const quayPlugin = createPlugin({\n id: 'quay',\n routes: {\n root: rootRouteRef,\n tag: tagRouteRef,\n },\n apis: [\n createApiFactory({\n api: quayApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, configApi, identityApi }) =>\n new QuayApiClient({ discoveryApi, configApi, identityApi }),\n }),\n ],\n});\n\n/**\n * Quay page\n *\n * @public\n */\nexport const QuayPage = quayPlugin.provide(\n createRoutableExtension({\n name: 'QuayPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Returns true if the catalog entity contains the quay annotation `quay.io/repository-slug`.\n *\n * @public\n */\nexport const isQuayAvailable = (entity: Entity) =>\n Boolean(entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY]);\n"],"names":[],"mappings":";;;;;AAkCO,MAAM,aAAa,YAAa,CAAA;AAAA,EACrC,EAAI,EAAA,MAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,GAAK,EAAA;AAAA,GACP;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,UAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,SAAW,EAAA,YAAA;AAAA,QACX,WAAa,EAAA;AAAA,OACf;AAAA,MACA,OAAS,EAAA,CAAC,EAAE,YAAA,EAAc,SAAW,EAAA,WAAA,EACnC,KAAA,IAAI,aAAc,CAAA,EAAE,YAAc,EAAA,SAAA,EAAW,aAAa;AAAA,KAC7D;AAAA;AAEL,CAAC;AAOM,MAAM,WAAW,UAAW,CAAA,OAAA;AAAA,EACjC,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,UAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,4BAAqB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACjE,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 */\nimport { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'quay',\n});\n\nexport const tagRouteRef = createSubRouteRef({\n id: 'quay-tag',\n parent: rootRouteRef,\n path: '/tag/:digest',\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 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 */\nimport { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'quay',\n});\n\nexport const tagRouteRef = createSubRouteRef({\n id: 'quay-tag',\n parent: rootRouteRef,\n path: '/tag/:digest',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,cAAc,iBAAkB,CAAA;AAAA,EAC3C,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA;AACR,CAAC;;;;"}
|
package/dist/types.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"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 */\nexport interface TagsResponse {\n page: number;\n has_additional: boolean;\n tags: Tag[];\n}\n\nexport interface Tag {\n name: string;\n is_manifest_list: boolean;\n last_modified: string;\n manifest_digest: string;\n reversion: boolean;\n size: number;\n start_ts?: number;\n end_ts?: number;\n manifest_list?: ManifestList;\n expiration?: string;\n}\n\nexport interface LabelsResponse {\n labels: Label[];\n}\nexport interface QuayTagData {\n id: string;\n name: string;\n last_modified: string;\n size: string;\n rawSize: number;\n manifest_digest: React.JSX.Element;\n expiration?: string;\n securityDetails: Layer;\n securityStatus: string;\n manifest_digest_raw: string;\n}\nexport interface Label {\n id: string;\n key: string;\n value: string;\n source_type: string;\n media_type: string;\n}\n\nexport interface ManifestList {\n schemaVersion: number;\n mediaType: string;\n manifests: Manifest[];\n}\n\nexport interface Manifest {\n mediaType: string;\n size: number;\n digest: string;\n platform: Platform;\n security: SecurityDetailsResponse;\n layers: Layer[];\n}\n\nexport interface Platform {\n architecture: string;\n os: string;\n features?: string[];\n variant?: string;\n 'os.version'?: string;\n}\n\nexport interface SecurityDetailsResponse {\n status: 'unsupported' | 'unscanned' | 'scanning' | 'scanned' | 'queued';\n data: Data | null;\n}\nexport interface Data {\n Layer: Layer;\n}\nexport interface Layer {\n Name: string;\n ParentName: string;\n NamespaceName: string;\n IndexedByVersion: number;\n Features: Feature[];\n}\nexport interface Feature {\n Name: string;\n VersionFormat: string;\n NamespaceName: string;\n AddedBy: string;\n Version: string;\n Vulnerabilities?: Vulnerability[];\n BaseScores?: number[];\n CVEIds?: string[];\n}\n\nexport interface Vulnerability {\n Severity: VulnerabilitySeverity;\n NamespaceName: string;\n Link: string;\n FixedBy: string;\n Description: string;\n Name: string;\n Metadata: VulnerabilityMetadata;\n}\n\nexport interface VulnerabilityMetadata {\n UpdatedBy: string;\n RepoName: string | null;\n RepoLink: string | null;\n DistroName: string;\n DistroVersion: string;\n NVD: {\n CVSSv3: {\n Vectors: string;\n Score: number | string;\n };\n };\n}\n\nexport enum VulnerabilitySeverity {\n Critical = 'Critical',\n High = 'High',\n Medium = 'Medium',\n Low = 'Low',\n Negligible = 'Negligible',\n None = 'None',\n Unknown = 'Unknown',\n}\n\nexport const VulnerabilityOrder = {\n [VulnerabilitySeverity.Critical]: 0,\n [VulnerabilitySeverity.High]: 1,\n [VulnerabilitySeverity.Medium]: 2,\n [VulnerabilitySeverity.Low]: 3,\n [VulnerabilitySeverity.Negligible]: 4,\n [VulnerabilitySeverity.None]: 5,\n [VulnerabilitySeverity.Unknown]: 6,\n};\n\nexport interface ManifestByDigestResponse {\n digest: string;\n is_manifest_list: boolean;\n manifest_data: string;\n config_media_type: string;\n layers: LayerByDigest[];\n layers_compressed_size: number;\n}\n\nexport interface LayerByDigest {\n index: number;\n compressed_size: number;\n is_remote: boolean;\n urls: string[] | null;\n command: string[] | null;\n comment: string | null;\n author: string | null;\n blob_digest: string;\n created_datetime: string;\n}\n\nexport interface VulnerabilityListItem extends Vulnerability {\n PackageName: string;\n CurrentVersion: string;\n}\n"],"names":["VulnerabilitySeverity"],"mappings":"AAiIY,IAAA,qBAAA,qBAAAA,sBAAL,KAAA;AACL,EAAAA,uBAAA,UAAW,CAAA,GAAA,UAAA
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"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 */\nexport interface TagsResponse {\n page: number;\n has_additional: boolean;\n tags: Tag[];\n}\n\nexport interface Tag {\n name: string;\n is_manifest_list: boolean;\n last_modified: string;\n manifest_digest: string;\n reversion: boolean;\n size: number;\n start_ts?: number;\n end_ts?: number;\n manifest_list?: ManifestList;\n expiration?: string;\n}\n\nexport interface LabelsResponse {\n labels: Label[];\n}\nexport interface QuayTagData {\n id: string;\n name: string;\n last_modified: string;\n size: string;\n rawSize: number;\n manifest_digest: React.JSX.Element;\n expiration?: string;\n securityDetails: Layer;\n securityStatus: string;\n manifest_digest_raw: string;\n}\nexport interface Label {\n id: string;\n key: string;\n value: string;\n source_type: string;\n media_type: string;\n}\n\nexport interface ManifestList {\n schemaVersion: number;\n mediaType: string;\n manifests: Manifest[];\n}\n\nexport interface Manifest {\n mediaType: string;\n size: number;\n digest: string;\n platform: Platform;\n security: SecurityDetailsResponse;\n layers: Layer[];\n}\n\nexport interface Platform {\n architecture: string;\n os: string;\n features?: string[];\n variant?: string;\n 'os.version'?: string;\n}\n\nexport interface SecurityDetailsResponse {\n status: 'unsupported' | 'unscanned' | 'scanning' | 'scanned' | 'queued';\n data: Data | null;\n}\nexport interface Data {\n Layer: Layer;\n}\nexport interface Layer {\n Name: string;\n ParentName: string;\n NamespaceName: string;\n IndexedByVersion: number;\n Features: Feature[];\n}\nexport interface Feature {\n Name: string;\n VersionFormat: string;\n NamespaceName: string;\n AddedBy: string;\n Version: string;\n Vulnerabilities?: Vulnerability[];\n BaseScores?: number[];\n CVEIds?: string[];\n}\n\nexport interface Vulnerability {\n Severity: VulnerabilitySeverity;\n NamespaceName: string;\n Link: string;\n FixedBy: string;\n Description: string;\n Name: string;\n Metadata: VulnerabilityMetadata;\n}\n\nexport interface VulnerabilityMetadata {\n UpdatedBy: string;\n RepoName: string | null;\n RepoLink: string | null;\n DistroName: string;\n DistroVersion: string;\n NVD: {\n CVSSv3: {\n Vectors: string;\n Score: number | string;\n };\n };\n}\n\nexport enum VulnerabilitySeverity {\n Critical = 'Critical',\n High = 'High',\n Medium = 'Medium',\n Low = 'Low',\n Negligible = 'Negligible',\n None = 'None',\n Unknown = 'Unknown',\n}\n\nexport const VulnerabilityOrder = {\n [VulnerabilitySeverity.Critical]: 0,\n [VulnerabilitySeverity.High]: 1,\n [VulnerabilitySeverity.Medium]: 2,\n [VulnerabilitySeverity.Low]: 3,\n [VulnerabilitySeverity.Negligible]: 4,\n [VulnerabilitySeverity.None]: 5,\n [VulnerabilitySeverity.Unknown]: 6,\n};\n\nexport interface ManifestByDigestResponse {\n digest: string;\n is_manifest_list: boolean;\n manifest_data: string;\n config_media_type: string;\n layers: LayerByDigest[];\n layers_compressed_size: number;\n}\n\nexport interface LayerByDigest {\n index: number;\n compressed_size: number;\n is_remote: boolean;\n urls: string[] | null;\n command: string[] | null;\n comment: string | null;\n author: string | null;\n blob_digest: string;\n created_datetime: string;\n}\n\nexport interface VulnerabilityListItem extends Vulnerability {\n PackageName: string;\n CurrentVersion: string;\n}\n"],"names":["VulnerabilitySeverity"],"mappings":"AAiIY,IAAA,qBAAA,qBAAAA,sBAAL,KAAA;AACL,EAAAA,uBAAA,UAAW,CAAA,GAAA,UAAA;AACX,EAAAA,uBAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,uBAAA,QAAS,CAAA,GAAA,QAAA;AACT,EAAAA,uBAAA,KAAM,CAAA,GAAA,KAAA;AACN,EAAAA,uBAAA,YAAa,CAAA,GAAA,YAAA;AACb,EAAAA,uBAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,uBAAA,SAAU,CAAA,GAAA,SAAA;AAPA,EAAAA,OAAAA,sBAAAA;AAAA,CAAA,EAAA,qBAAA,IAAA,EAAA;AAUL,MAAM,kBAAqB,GAAA;AAAA,EAChC,CAAC,4BAAiC,CAAA;AAAA,EAClC,CAAC,oBAA6B,CAAA;AAAA,EAC9B,CAAC,wBAA+B,CAAA;AAAA,EAChC,CAAC,kBAA4B,CAAA;AAAA,EAC7B,CAAC,gCAAmC,CAAA;AAAA,EACpC,CAAC,oBAA6B,CAAA;AAAA,EAC9B,CAAC,0BAAgC;AACnC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-quay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"ui-test": "start-server-and-test start localhost:3000 'playwright test'"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@backstage-community/plugin-quay-common": "^1.
|
|
40
|
-
"@backstage/catalog-model": "^1.7.
|
|
41
|
-
"@backstage/core-components": "^0.
|
|
42
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
43
|
-
"@backstage/plugin-catalog-common": "^1.1.
|
|
44
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
45
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
46
|
-
"@backstage/theme": "^0.6.
|
|
39
|
+
"@backstage-community/plugin-quay-common": "^1.4.0",
|
|
40
|
+
"@backstage/catalog-model": "^1.7.2",
|
|
41
|
+
"@backstage/core-components": "^0.16.2",
|
|
42
|
+
"@backstage/core-plugin-api": "^1.10.2",
|
|
43
|
+
"@backstage/plugin-catalog-common": "^1.1.2",
|
|
44
|
+
"@backstage/plugin-catalog-react": "^1.15.0",
|
|
45
|
+
"@backstage/plugin-permission-react": "^0.4.29",
|
|
46
|
+
"@backstage/theme": "^0.6.3",
|
|
47
47
|
"@janus-idp/shared-react": "^2.13.1",
|
|
48
48
|
"@material-ui/core": "^4.12.2",
|
|
49
49
|
"@material-ui/icons": "^4.11.3",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"react-router-dom": "^6.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@backstage/cli": "0.
|
|
60
|
-
"@backstage/core-app-api": "1.15.
|
|
61
|
-
"@backstage/dev-utils": "1.1.
|
|
62
|
-
"@backstage/test-utils": "1.7.
|
|
63
|
-
"@playwright/test": "1.
|
|
59
|
+
"@backstage/cli": "^0.29.4",
|
|
60
|
+
"@backstage/core-app-api": "^1.15.3",
|
|
61
|
+
"@backstage/dev-utils": "^1.1.5",
|
|
62
|
+
"@backstage/test-utils": "^1.7.3",
|
|
63
|
+
"@playwright/test": "1.49.1",
|
|
64
64
|
"@redhat-developer/red-hat-developer-hub-theme": "0.4.0",
|
|
65
65
|
"@spotify/prettier-config": "^15.0.0",
|
|
66
66
|
"@testing-library/dom": "^10.0.0",
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"@testing-library/react": "^15.0.0",
|
|
69
69
|
"@testing-library/react-hooks": "8.0.1",
|
|
70
70
|
"@testing-library/user-event": "14.5.2",
|
|
71
|
-
"@types/node": "18.19.
|
|
71
|
+
"@types/node": "18.19.68",
|
|
72
72
|
"@types/react": "^18.2.58",
|
|
73
73
|
"@types/react-dom": "^18.2.19",
|
|
74
74
|
"cross-fetch": "4.0.0",
|
|
75
75
|
"msw": "1.3.5",
|
|
76
|
-
"prettier": "3.
|
|
76
|
+
"prettier": "3.4.2",
|
|
77
77
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
78
78
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
79
79
|
"react-router-dom": "^6.0.0",
|
|
80
|
-
"start-server-and-test": "2.0.
|
|
80
|
+
"start-server-and-test": "2.0.9"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"app-config.dynamic.yaml",
|
|
@@ -102,5 +102,12 @@
|
|
|
102
102
|
"@karthikjeeyar"
|
|
103
103
|
],
|
|
104
104
|
"author": "Red Hat",
|
|
105
|
+
"typesVersions": {
|
|
106
|
+
"*": {
|
|
107
|
+
"index": [
|
|
108
|
+
"dist/index.d.ts"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
105
112
|
"module": "./dist/index.esm.js"
|
|
106
113
|
}
|