Skip to content

Commit 9117486

Browse files
Sathish Kumarsatrox28
authored andcommitted
Fixing changes for project slug
1 parent 12f3bdf commit 9117486

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ metadata:
8383
# ...
8484
annotations:
8585
gitlab.com/project-id: 'project-id' #1234. This must be in quotes and can be found under Settings --> General
86+
or
87+
gitlab.com/project-slug: 'project-slug' # group_name/project_name
8688
spec:
8789
type: service
8890
# ...

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@loblaw/backstage-plugin-gitlab",
3-
"version": "0.1.15",
3+
"version": "0.1.16",
44
"main": "src/index.ts",
55
"types": "src/index.ts",
66
"license": "Apache-2.0",

src/Router.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { useEntity } from '@backstage/plugin-catalog-react';
1010
const GITLAB_ANNOTATION_PROJECT_ID = 'gitlab.com/project-id';
1111
export const GITLAB_ANNOTATION_PROJECT_SLUG = 'gitlab.com/project-slug';
1212

13-
export const isGitlabAnnotationAvailable = (entity: Entity) =>
13+
export const isGitlabAvailable = (entity: Entity) =>
14+
isGitlabProjectIDAnnotationAvailable(entity) || isGitlabSlugAnnotationAvailable(entity)
15+
16+
17+
export const isGitlabProjectIDAnnotationAvailable = (entity: Entity) =>
1418
Boolean(entity.metadata.annotations?.[GITLAB_ANNOTATION_PROJECT_ID]);
1519

1620
export const isGitlabSlugAnnotationAvailable = (entity: Entity) =>
@@ -25,7 +29,7 @@ export const Router = (_props: Props) => {
2529
const { entity } = useEntity();
2630

2731
if (
28-
isGitlabAnnotationAvailable(entity) ||
32+
isGitlabProjectIDAnnotationAvailable(entity) ||
2933
isGitlabSlugAnnotationAvailable(entity)
3034
) {
3135
return (

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { gitlabPlugin, EntityGitlabContent } from './plugin';
2-
export { isGitlabAvailable } from './Router';
2+
export { isGitlabAvailable } from './Router';

0 commit comments

Comments
 (0)