-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tomas Coufal <[email protected]>
- Loading branch information
Showing
13 changed files
with
61 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
plugins/quay/src/components/QuayDashboardPage/QuayDashboardPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { useEntity } from '@backstage/plugin-catalog-react' | ||
import React from 'react' | ||
import { QuayRepository } from '../QuayRepository' | ||
import { useQuayAppData } from '../useQuayAppData' | ||
import { useEntity } from '@backstage/plugin-catalog-react'; | ||
import React from 'react'; | ||
import { QuayRepository } from '../QuayRepository'; | ||
import { useQuayAppData } from '../useQuayAppData'; | ||
|
||
export const QuayDashboardPage = () => { | ||
const { entity } = useEntity() | ||
const { repositorySlug } = useQuayAppData({ entity }) | ||
const info = repositorySlug.split('/') | ||
const { entity } = useEntity(); | ||
const { repositorySlug } = useQuayAppData({ entity }); | ||
const info = repositorySlug.split('/'); | ||
|
||
const organization = info.shift() as 'string' | ||
const repository = info.join('/') | ||
const organization = info.shift() as 'string'; | ||
const repository = info.join('/'); | ||
|
||
return ( | ||
<QuayRepository | ||
organization={organization} | ||
repository={repository} | ||
widget={false} | ||
/> | ||
) | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { QuayDashboardPage } from './QuayDashboardPage' | ||
export { QuayDashboardPage } from './QuayDashboardPage'; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { QuayRepository } from './QuayRepository' | ||
export { QuayRepository } from './QuayRepository'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
import { Entity } from '@backstage/catalog-model' | ||
import { MissingAnnotationEmptyState } from '@backstage/core-components' | ||
import { useEntity } from '@backstage/plugin-catalog-react' | ||
import { Card, CardHeader } from '@material-ui/core' | ||
import React from 'react' | ||
import { isQuayAvailable } from '../../plugin' | ||
import { QuayRepository } from '../QuayRepository' | ||
import { | ||
QUAY_ANNOTATION_REPOSITORY, | ||
useQuayAppData, | ||
} from '../useQuayAppData' | ||
import { Entity } from '@backstage/catalog-model'; | ||
import { MissingAnnotationEmptyState } from '@backstage/core-components'; | ||
import { useEntity } from '@backstage/plugin-catalog-react'; | ||
import { Card, CardHeader } from '@material-ui/core'; | ||
import React from 'react'; | ||
import { isQuayAvailable } from '../../plugin'; | ||
import { QuayRepository } from '../QuayRepository'; | ||
import { QUAY_ANNOTATION_REPOSITORY, useQuayAppData } from '../useQuayAppData'; | ||
|
||
const Widget = ({ entity }: { entity: Entity }) => { | ||
const { repositorySlug } = useQuayAppData({ entity }) | ||
const info = repositorySlug.split('/') | ||
const { repositorySlug } = useQuayAppData({ entity }); | ||
const info = repositorySlug.split('/'); | ||
|
||
const organization = info.shift() as 'string' | ||
const repository = info.join('/') | ||
const organization = info.shift() as 'string'; | ||
const repository = info.join('/'); | ||
|
||
return ( | ||
<Card> | ||
<CardHeader title="Docker Image" /> | ||
<QuayRepository organization={organization} repository={repository} widget /> | ||
<QuayRepository | ||
organization={organization} | ||
repository={repository} | ||
widget | ||
/> | ||
</Card> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export const QuayWidget = () => { | ||
const { entity } = useEntity() | ||
const { entity } = useEntity(); | ||
|
||
return !isQuayAvailable(entity) ? ( | ||
<MissingAnnotationEmptyState annotation={QUAY_ANNOTATION_REPOSITORY} /> | ||
) : ( | ||
<Widget entity={entity} /> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export const QuayWidgetEntity = ({ entity }: { entity: Entity }) => { | ||
return !isQuayAvailable(entity) ? ( | ||
<MissingAnnotationEmptyState annotation={QUAY_ANNOTATION_REPOSITORY} /> | ||
) : ( | ||
<Widget entity={entity} /> | ||
) | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { QuayWidget } from './QuayWidget' | ||
export { QuayWidget } from './QuayWidget'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { Entity } from '@backstage/catalog-model' | ||
import { Entity } from '@backstage/catalog-model'; | ||
|
||
export const QUAY_ANNOTATION_REPOSITORY = 'quay.io/repository-slug' | ||
export const QUAY_ANNOTATION_REPOSITORY = 'quay.io/repository-slug'; | ||
|
||
export const useQuayAppData = ({ entity }: { entity: Entity }) => { | ||
const repositorySlug = | ||
entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY] ?? '' | ||
entity?.metadata.annotations?.[QUAY_ANNOTATION_REPOSITORY] ?? ''; | ||
|
||
if (!repositorySlug) { | ||
throw new Error("'Quay' annotations are missing") | ||
throw new Error("'Quay' annotations are missing"); | ||
} | ||
return { repositorySlug } | ||
} | ||
return { repositorySlug }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2443,7 +2443,7 @@ | |
"@backstage/errors" "^1.1.4" | ||
cross-fetch "^3.1.5" | ||
|
||
"@backstage/catalog-model@^1.1.3", "@backstage/catalog-model@^1.1.5": | ||
"@backstage/catalog-model@1.1.5", "@backstage/catalog-model@^1.1.3", "@backstage/catalog-model@^1.1.5": | ||
version "1.1.5" | ||
resolved "https://registry.yarnpkg.com/@backstage/catalog-model/-/catalog-model-1.1.5.tgz#83203771f2fc04353d0d84e20d354f0cef15403f" | ||
integrity sha512-rE1KFhpLlli0A7marJpbd4MCGWG+5vIRj49XZBbEdhevl7HfCCJMAA6IKyj8U7LJjwRVygppSkc8V2yAyEU/2A== | ||
|
@@ -3090,7 +3090,7 @@ | |
"@backstage/plugin-catalog-common" "^1.0.10" | ||
"@backstage/types" "^1.0.2" | ||
|
||
"@backstage/plugin-catalog-react@^1.2.1", "@backstage/plugin-catalog-react@^1.2.4": | ||
"@backstage/plugin-catalog-react@1.2.4", "@backstage/plugin-catalog-react@^1.2.1", "@backstage/plugin-catalog-react@^1.2.4": | ||
version "1.2.4" | ||
resolved "https://registry.yarnpkg.com/@backstage/plugin-catalog-react/-/plugin-catalog-react-1.2.4.tgz#477582c3c015985ac92531e40e0b6ce5e6121772" | ||
integrity sha512-u26FK7JvQXmhlpTYTxoHf969By/kmHRWv7W2wV+osJYGuRX5ckX1Bpf7dY+WodOMCScksNHgz1gyHbkLd1iXeQ== | ||
|
@@ -7304,13 +7304,20 @@ | |
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" | ||
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== | ||
|
||
"@types/[email protected]", "@types/react-dom@<18.0.0", "@types/react-dom@^17", "@types/react-dom@^18.0.0": | ||
"@types/[email protected]", "@types/react-dom@<18.0.0": | ||
version "17.0.18" | ||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.18.tgz#8f7af38f5d9b42f79162eea7492e5a1caff70dc2" | ||
integrity sha512-rLVtIfbwyur2iFKykP2w0pl/1unw26b5td16d5xMgp7/yjTHomkyxPYChFoCr/FtEX1lN9wY6lFj1qvKdS5kDw== | ||
dependencies: | ||
"@types/react" "^17" | ||
|
||
"@types/react-dom@^18.0.0": | ||
version "18.0.10" | ||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.10.tgz#3b66dec56aa0f16a6cc26da9e9ca96c35c0b4352" | ||
integrity sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg== | ||
dependencies: | ||
"@types/react" "*" | ||
|
||
"@types/react-redux@^7.1.20": | ||
version "7.1.25" | ||
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.25.tgz#de841631205b24f9dfb4967dd4a7901e048f9a88" | ||
|