Skip to content

Commit 1501ab6

Browse files
feat: upgrade versions and formatted using prettier
1 parent 8bb4808 commit 1501ab6

File tree

26 files changed

+2123
-2116
lines changed

26 files changed

+2123
-2116
lines changed

dev/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ createDevApp()
88
.addPage({
99
element: <EntityGitlabContent />,
1010
title: 'Root Page',
11-
path: '/backstage-plugin-gitlab'
11+
path: '/backstage-plugin-gitlab',
1212
})
1313
.render();

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@loblaw/backstage-plugin-gitlab",
2+
"name": "@internal/backstage-plugin-gitlab",
33
"version": "0.1.24",
44
"main": "src/index.ts",
55
"types": "src/index.ts",
@@ -33,9 +33,9 @@
3333
},
3434
"dependencies": {
3535
"@backstage/core-components": "^0.12.0",
36-
"@backstage/core-plugin-api": "^1.0.0",
37-
"@backstage/plugin-catalog-react": "^1.0.0",
38-
"@backstage/theme": "^0.2.14",
36+
"@backstage/core-plugin-api": "^1.2.0",
37+
"@backstage/plugin-catalog-react": "^1.2.2",
38+
"@backstage/theme": "^0.2.16",
3939
"@material-ui/core": "^4.12.2",
4040
"@material-ui/icons": "^4.9.1",
4141
"@material-ui/lab": "4.0.0-alpha.61",
@@ -48,13 +48,15 @@
4848
"react-dom": "^16.13.1 || ^17.0.0"
4949
},
5050
"devDependencies": {
51-
"@backstage/cli": "^0.18.0",
52-
"@backstage/core-app-api": "^1.0.0",
51+
"@backstage/cli": "^0.22.0",
52+
"@backstage/core-app-api": "^1.3.0",
5353
"@backstage/dev-utils": "^1.0.0",
54-
"@backstage/plugin-catalog-react": "^1.0.0",
55-
"@backstage/test-utils": "^1.0.0",
54+
"@backstage/plugin-catalog-react": "^1.2.2",
55+
"@backstage/test-utils": "^1.2.3",
56+
"@spotify/prettier-config": "^12.0.0",
57+
"prettier": "^2.3.2",
5658
"@testing-library/jest-dom": "^5.12.0",
57-
"@testing-library/react": "^12.1.2",
59+
"@testing-library/react": "^12.1.3",
5860
"@testing-library/user-event": "^14.3.0",
5961
"@types/jest": "^27.4.0",
6062
"@types/node": "^17.0.13",
@@ -63,5 +65,6 @@
6365
},
6466
"files": [
6567
"dist"
66-
]
68+
],
69+
"prettier": "@spotify/prettier-config"
6770
}

src/Router.tsx

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,44 @@ const GITLAB_ANNOTATION_PROJECT_ID = 'gitlab.com/project-id';
1010
export const GITLAB_ANNOTATION_PROJECT_SLUG = 'gitlab.com/project-slug';
1111

1212
export const isGitlabAvailable = (entity: Entity) =>
13-
isGitlabProjectIDAnnotationAvailable(entity) || isGitlabSlugAnnotationAvailable(entity)
14-
13+
isGitlabProjectIDAnnotationAvailable(entity) ||
14+
isGitlabSlugAnnotationAvailable(entity);
1515

1616
export const isGitlabProjectIDAnnotationAvailable = (entity: Entity) =>
17-
Boolean(entity.metadata.annotations?.[GITLAB_ANNOTATION_PROJECT_ID]);
17+
Boolean(entity.metadata.annotations?.[GITLAB_ANNOTATION_PROJECT_ID]);
1818

1919
export const isGitlabSlugAnnotationAvailable = (entity: Entity) =>
20-
Boolean(entity.metadata.annotations?.[GITLAB_ANNOTATION_PROJECT_SLUG]);
20+
Boolean(entity.metadata.annotations?.[GITLAB_ANNOTATION_PROJECT_SLUG]);
2121

2222
type Props = {
23-
/** @deprecated The entity is now grabbed from context instead */
24-
entity?: Entity;
23+
/** @deprecated The entity is now grabbed from context instead */
24+
entity?: Entity;
2525
};
2626

2727
export const Router = (_props: Props) => {
28-
const { entity } = useEntity();
29-
30-
if (
31-
isGitlabAvailable(entity)
32-
) {
33-
return (
34-
<Routes>
35-
<Route path="/" element={<GitlabCI />} />
36-
</Routes>
37-
);
38-
}
39-
40-
return (
41-
<>
42-
<MissingAnnotationEmptyState annotation={GITLAB_ANNOTATION_PROJECT_ID} />
43-
<MissingAnnotationEmptyState
44-
annotation={GITLAB_ANNOTATION_PROJECT_SLUG}
45-
/>
46-
<Button
47-
variant='contained'
48-
color='primary'
49-
href='https://github.com/loblaw-sre/backstage-plugin-gitlab/blob/main/README.md'
50-
>
51-
Read Gitlab Plugin Docs
52-
</Button>
53-
</>
54-
);
28+
const { entity } = useEntity();
29+
30+
if (isGitlabAvailable(entity)) {
31+
return (
32+
<Routes>
33+
<Route path="/" element={<GitlabCI />} />
34+
</Routes>
35+
);
36+
}
37+
38+
return (
39+
<>
40+
<MissingAnnotationEmptyState annotation={GITLAB_ANNOTATION_PROJECT_ID} />
41+
<MissingAnnotationEmptyState
42+
annotation={GITLAB_ANNOTATION_PROJECT_SLUG}
43+
/>
44+
<Button
45+
variant="contained"
46+
color="primary"
47+
href="https://github.com/loblaw-sre/backstage-plugin-gitlab/blob/main/README.md"
48+
>
49+
Read Gitlab Plugin Docs
50+
</Button>
51+
</>
52+
);
5553
};

src/api/GitlabCIApi.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
import { createApiRef } from '@backstage/core-plugin-api';
22
import {
3-
ContributorData,
4-
MergeRequest,
5-
PipelineObject,
6-
IssueObject
3+
ContributorData,
4+
MergeRequest,
5+
PipelineObject,
6+
IssueObject,
77
} from '../components/types';
88

99
export interface PipelineSummary {
10-
getPipelinesData: PipelineObject[];
10+
getPipelinesData: PipelineObject[];
1111
}
1212

1313
export interface ContributorsSummary {
14-
getContributorsData: ContributorData[];
14+
getContributorsData: ContributorData[];
1515
}
1616

1717
export interface MergeRequestsSummary {
18-
getMergeRequestsData: MergeRequest[];
18+
getMergeRequestsData: MergeRequest[];
1919
}
2020

2121
export interface MergeRequestsStatusSummary {
22-
getMergeRequestsStatusData: MergeRequest[];
22+
getMergeRequestsStatusData: MergeRequest[];
2323
}
2424

2525
export interface LanguagesSummary {
26-
getLanguagesData: any;
26+
getLanguagesData: any;
2727
}
2828

2929
export interface IssuesSummary {
30-
getIssuesData: IssueObject[]
30+
getIssuesData: IssueObject[];
3131
}
3232

3333
export const GitlabCIApiRef = createApiRef<GitlabCIApi>({
34-
id: 'plugin.gitlabci.service',
34+
id: 'plugin.gitlabci.service',
3535
});
3636

3737
export type GitlabCIApi = {
38-
getPipelineSummary(projectID: string): Promise<PipelineSummary | undefined>;
39-
getContributorsSummary(
40-
projectID: string,
41-
): Promise<ContributorsSummary | undefined>;
42-
getMergeRequestsSummary(
43-
projectID: string,
44-
): Promise<MergeRequestsSummary | undefined>;
45-
getMergeRequestsStatusSummary(
46-
projectID: string,
47-
count: number,
48-
): Promise<MergeRequestsStatusSummary | undefined>;
49-
getProjectName(projectID: string): Promise<string | undefined>;
50-
getLanguagesSummary(projectID: string): Promise<LanguagesSummary | undefined>;
51-
retryPipelineBuild(
52-
projectID: string,
53-
pipelineID: string,
54-
): Promise<Object | undefined>;
55-
getProjectDetails(projectSlug: string): Promise<Object | undefined>;
56-
getIssuesSummary(projectID: string): Promise<IssuesSummary | undefined>;
38+
getPipelineSummary(projectID: string): Promise<PipelineSummary | undefined>;
39+
getContributorsSummary(
40+
projectID: string,
41+
): Promise<ContributorsSummary | undefined>;
42+
getMergeRequestsSummary(
43+
projectID: string,
44+
): Promise<MergeRequestsSummary | undefined>;
45+
getMergeRequestsStatusSummary(
46+
projectID: string,
47+
count: number,
48+
): Promise<MergeRequestsStatusSummary | undefined>;
49+
getProjectName(projectID: string): Promise<string | undefined>;
50+
getLanguagesSummary(projectID: string): Promise<LanguagesSummary | undefined>;
51+
retryPipelineBuild(
52+
projectID: string,
53+
pipelineID: string,
54+
): Promise<Object | undefined>;
55+
getProjectDetails(projectSlug: string): Promise<Object | undefined>;
56+
getIssuesSummary(projectID: string): Promise<IssuesSummary | undefined>;
5757
};

0 commit comments

Comments
 (0)