Skip to content

Commit 01ea8a3

Browse files
committed
adds error for cases when token is invalid
1 parent e1c946d commit 01ea8a3

4 files changed

Lines changed: 74 additions & 2 deletions

File tree

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "puzl__github-workflow-ui",
33
"private": true,
4-
"version": "0.7.3",
4+
"version": "0.7.4",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

ui/src/pages/App.module.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.app {
22
--app-header-height: 38px;
3+
height: 100vh;
34
}
45

56
.grid {
@@ -8,11 +9,12 @@
89
display: grid;
910
grid-gap: 1rem;
1011
max-width: 2000px;
12+
position: relative;
13+
min-height: calc(100vh - var(--app-header-height));
1114

1215

1316
@media (min-width: 64em) {
1417
grid-template-columns: 20rem 1fr;
15-
min-height: calc(100vh - var(--app-header-height));
1618
}
1719

1820
@media (min-width: 1700px) {

ui/src/pages/_ui/OrganisationSelector/OrganisationSelector.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,41 @@ export const OrganisationSelector = ({}) => {
3232
setOrganisation(orgs[0]);
3333
}
3434
}, [shouldPrefillOrganisation]);
35+
36+
if (error) {
37+
return (
38+
<div className={styles.errorOverlay}>
39+
<div className={styles.errorOverlayContent}>
40+
<div>{error.message}</div>
41+
<div>Please, make sure that you provided valid GitHub fine-grained personal token, issued with the following permissions:</div>
42+
<div className={styles.permissions}>
43+
<p><strong>Repositories:</strong></p>
44+
<div> - Content: `Read and write`</div>
45+
<div> - Workflows: `Read and write`</div>
46+
<p><strong>Organizations:</strong></p>
47+
<div> - Members: `Read-only`</div>
48+
</div>
49+
</div>
50+
</div>
51+
);
52+
} else if (orgs?.length === 0) {
53+
return (
54+
<div className={styles.errorOverlay}>
55+
<div className={styles.errorOverlayContent}>
56+
<div>No organisations found.</div>
57+
<div>At this moment assistant works only for repos within organisation.</div>
58+
<div>Check that your token was issued with following permissions:</div>
59+
<div className={styles.permissions}>
60+
<p><strong>Repositories:</strong></p>
61+
<div> - Content: `Read and write`</div>
62+
<div> - Workflows: `Read and write`</div>
63+
<p><strong>Organizations:</strong></p>
64+
<div> - Members: `Read-only`</div>
65+
</div>
66+
</div>
67+
</div>
68+
);
69+
}
3570

3671
return (
3772
<div className={styles.wrapper}>

ui/src/pages/_ui/OrganisationSelector/OrganisationSelector.module.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,39 @@
88
.picker {
99
max-width: 100%;
1010
min-width: 200px;
11+
}
12+
13+
.errorOverlay {
14+
position: absolute;
15+
top: 0;
16+
bottom: 0;
17+
left: 0;
18+
width: 100%;
19+
text-align: center;
20+
font-size: 1.2rem;
21+
color: var(--muted-foreground);
22+
display: grid;
23+
align-items: center;
24+
justify-items: center;
25+
}
26+
27+
.errorOverlayContent {
28+
width: 100%;
29+
max-width: 40em;
30+
margin: 0 auto;
31+
padding: 1rem;
32+
}
33+
34+
.permissions {
35+
margin: 1.25rem auto;
36+
padding: 1.5rem;
37+
text-align: left;
38+
border-radius: var(--gw__border-radius);
39+
border: 1px solid var(--gw__border-color);
40+
font-size: 0.875em;
41+
max-width: max-content;
42+
}
43+
44+
.permissions * + p {
45+
margin-top: 1em;
1146
}

0 commit comments

Comments
 (0)