Skip to content

Commit a8412bb

Browse files
committed
Bootstrapping UI for ephemeral environments (#565)
## πŸ“ Description Ephemeral environments UI ## βœ… Checklist - [x] I have tested this change - [ ] This change requires documentation update
1 parent 055fc72 commit a8412bb

File tree

190 files changed

+8502
-2274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+8502
-2274
lines changed

β€Žfront/Dockerfileβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ RUN mix sentry_recompile && mix compile --warnings-as-errors
4747
# -- node stage
4848
FROM node:16-alpine AS node
4949
WORKDIR /assets
50-
COPY front/assets/package.json front/assets/package-lock.json ./
51-
RUN npm set progress=false && npm install
5250
COPY front/assets ./
51+
RUN npm ci --force
5352
# -- node stage
5453

5554
# -- dev stage - for local development

β€Žfront/assets/.eslintrc.jsβ€Ž

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
},
2727
ignorePatterns: ["*.js", "*.json"],
2828
rules: {},
29-
overrides: [
29+
overrides: [
3030
{
3131
files: ["js/**/*.spec.js"],
3232
env: {
@@ -86,7 +86,8 @@ module.exports = {
8686
},
8787
},
8888
],
89-
"no-console": 1,
89+
"no-console": ["error", { allow: ["warn", "error"] }],
90+
"max-len": ["error", {"code": 120, "ignoreComments": true, "ignoreStrings": true, "ignoreTemplateLiterals": true}],
9091
"no-multi-spaces": "error",
9192
"@typescript-eslint/member-delimiter-style": [
9293
"warn",
@@ -97,7 +98,7 @@ module.exports = {
9798
},
9899
singleline: {
99100
delimiter: "comma",
100-
requireLast: true,
101+
requireLast: false,
101102
},
102103
},
103104
],
@@ -114,6 +115,12 @@ module.exports = {
114115
beforeClosing: "never",
115116
},
116117
],
118+
"@typescript-eslint/no-misused-promises": [
119+
"error",
120+
{
121+
"checksVoidReturn": false
122+
}
123+
]
117124
},
118125
},
119126
],

β€Žfront/assets/build.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const buildOptions = {
8383

8484
if (watch) {
8585
esbuild.context(buildOptions).then(async context => {
86-
context.watch()
86+
await context.watch()
8787
await copyAssets()
8888

8989
const chokidar = require('chokidar')

β€Žfront/assets/css/app-semaphore.cssβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
transition: background .1s ease, border-color .1s ease;
5858
position: relative;
5959
}
60+
61+
.form-control-border,
6062
input.form-control,
6163
textarea.form-control {
6264
box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), inset 0 1px 1px 0 #E5E8EA;

β€Žfront/assets/css/app.cssβ€Ž

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -107,40 +107,19 @@ summary.no-expand::marker {
107107
}
108108

109109
.material-symbols-outlined {
110-
font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 16;
111-
font-size: 16px;
112-
}
113-
114-
.material-symbols-outlined.f1 {
115-
font-size: 3rem;
116-
}
117-
118-
.material-symbols-outlined.f2 {
119-
font-size: 2.25rem;
120-
}
121-
122-
.material-symbols-outlined.f3 {
123-
font-size: 1.5rem;
124-
}
125-
126-
.material-symbols-outlined.f4 {
127-
font-size: 1.25rem;
128-
}
129-
130-
.material-symbols-outlined.f5 {
131-
font-size: 1rem;
132-
}
133-
134-
.material-symbols-outlined.f6 {
135-
font-size: .875rem;
110+
font-variation-settings:
111+
'FILL' var(--material-symbol-fill, 0),
112+
'wght' var(--material-symbol-weight, 300),
113+
'GRAD' var(--material-symbol-grad, 0),
114+
'opsz' var(--material-symbol-opsz, 20);
136115
}
137116

138-
.material-symbols-outlined.f7 {
139-
font-size: .75rem;
117+
.material-symbols-outlined.fill {
118+
--material-symbol-fill: 1;
140119
}
141120

142121
.material-symbols-outlined.b {
143-
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
122+
--material-symbol-weight: 400;
144123
}
145124

146125
sem-tooltip slot[slot="content"],
@@ -466,21 +445,43 @@ sem-popover {
466445
user-select: none;
467446
}
468447

469-
.material-symbols-outlined {
470-
font-variation-settings:
471-
'FILL' 0,
472-
'wght' 300,
473-
'GRAD' 0,
474-
'opsz' 20
448+
.gap-1 {
449+
gap: 0.25rem;
450+
}
451+
452+
.gap-2 {
453+
gap: 0.5rem;
454+
}
455+
456+
.gap-3 {
457+
gap: 0.75rem;
458+
}
459+
460+
.gap-4 {
461+
gap: 1rem;
462+
}
463+
464+
.flex-1 {
465+
flex: 1 1 0%;
466+
}
467+
468+
.flex-2 {
469+
flex: 2 2 0%;
470+
}
471+
472+
.flex-3 {
473+
flex: 3 3 0%;
474+
}
475+
476+
.flex-4 {
477+
flex: 4 4 0%;
478+
}
479+
480+
.flex-break {
481+
flex-basis: 100%;
482+
height: 0;
483+
}
484+
.break-column {
485+
flex-basis: 100%;
486+
width: 0;
475487
}
476-
.material-symbols-outlined.fill {
477-
font-variation-settings:
478-
'FILL' 1,
479-
'wght' 300,
480-
'GRAD' 0,
481-
'opsz' 20
482-
}
483-
.material-symbols-outlined.md-18 { font-size: 18px; }
484-
.material-symbols-outlined.md-24 { font-size: 24px; }
485-
.material-symbols-outlined.md-36 { font-size: 36px; }
486-
.material-symbols-outlined.md-48 { font-size: 48px; }

β€Žfront/assets/js/agents/index.tsxβ€Ž

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
55
import * as stores from "js/agents/stores";
66
import * as pages from "js/agents/pages";
77

8-
export default function ({ dom, config }: { dom: HTMLElement, config: any, }) {
8+
export default function ({ dom, config }: { dom: HTMLElement, config: any }) {
99
const configState = stores.Config.State.fromJSON(config);
1010
render(
1111
<BrowserRouter basename={config.baseUrl}>
@@ -18,15 +18,9 @@ export default function ({ dom, config }: { dom: HTMLElement, config: any, }) {
1818
{configState.accessProvider.canManageAgents() && (
1919
<Fragment>
2020
<Route path="settings" element={<pages.SelfHosted.Edit/>}/>
21-
<Route
22-
path="disable_all"
23-
element={<pages.SelfHosted.DisableAll/>}
24-
/>
21+
<Route path="disable_all" element={<pages.SelfHosted.DisableAll/>}/>
2522
<Route path="delete" element={<pages.SelfHosted.Delete/>}/>
26-
<Route
27-
path="reset"
28-
element={<pages.SelfHosted.ResetToken/>}
29-
/>
23+
<Route path="reset" element={<pages.SelfHosted.ResetToken/>}/>
3024
</Fragment>
3125
)}
3226
<Route path="*" element={<Navigate to="." replace/>}/>

β€Žfront/assets/js/agents/stores/activity.tsxβ€Ž

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ export class Item {
125125
}
126126

127127
export type Action =
128-
| { type: `SET_WAITING_ITEMS`, value: Item[], }
129-
| { type: `SET_RUNNING_ITEMS`, value: Item[], }
130-
| { type: `SET_LOBBY_ITEMS`, value: Item[], }
131-
| { type: `SET_HOSTED_AGENTS`, value: Agent[], }
132-
| { type: `SET_SELF_HOSTED_AGENTS`, value: Agent[], }
133-
| { type: `DELETE_SELF_HOSTED_AGENT`, value: string, }
134-
| { type: `SET_INVISIBLE_JOBS_COUNT`, value: number, };
128+
| { type: `SET_WAITING_ITEMS`, value: Item[] }
129+
| { type: `SET_RUNNING_ITEMS`, value: Item[] }
130+
| { type: `SET_LOBBY_ITEMS`, value: Item[] }
131+
| { type: `SET_HOSTED_AGENTS`, value: Agent[] }
132+
| { type: `SET_SELF_HOSTED_AGENTS`, value: Agent[] }
133+
| { type: `DELETE_SELF_HOSTED_AGENT`, value: string }
134+
| { type: `SET_INVISIBLE_JOBS_COUNT`, value: number };
135135

136136
export interface State {
137137
hostedAgents: Agent[];
@@ -159,9 +159,7 @@ export const Reducer = (state: State, action: Action): State => {
159159
case `DELETE_SELF_HOSTED_AGENT`:
160160
return {
161161
...state,
162-
selfHostedAgents: state.selfHostedAgents.filter(
163-
(agent) => agent.name !== action.value
164-
),
162+
selfHostedAgents: state.selfHostedAgents.filter((agent) => agent.name !== action.value),
165163
};
166164

167165
case `SET_WAITING_ITEMS`:

β€Žfront/assets/js/agents/stores/self_hosted_agent.tsxβ€Ž

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { createContext } from "preact";
22
import * as types from "../types";
33

44
export type Action =
5-
| { type: `SET_AGENT_TYPE`, value: types.SelfHosted.AgentType, }
6-
| { type: `SET_AGENTS`, value: types.SelfHosted.Agent[], }
7-
| { type: `SET_TOKEN`, value: string, }
8-
| { type: `REVEAL_TOKEN`, }
9-
| { type: `HIDE_TOKEN`, }
10-
| { type: `JUST_CREATED`, }
11-
| { type: `JUST_RESET`, };
5+
| { type: `SET_AGENT_TYPE`, value: types.SelfHosted.AgentType }
6+
| { type: `SET_AGENTS`, value: types.SelfHosted.Agent[] }
7+
| { type: `SET_TOKEN`, value: string }
8+
| { type: `REVEAL_TOKEN` }
9+
| { type: `HIDE_TOKEN` }
10+
| { type: `JUST_CREATED` }
11+
| { type: `JUST_RESET` };
1212

1313
export interface State {
1414
token: string;

β€Žfront/assets/js/app.jsβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import { default as AddPeople } from "./people/add_people";
6767
import { default as EditPerson } from "./people/edit_person";
6868
import { default as SyncPeople } from "./people/sync_people";
6969
import { default as ServiceAccounts } from "./service_accounts";
70+
import { default as EphemeralEnvironments } from "./ephemeral_environments";
7071
import { default as Report } from "./report";
7172

7273
import { InitializingScreen } from "./project_onboarding/initializing";
@@ -287,6 +288,13 @@ export var App = {
287288
});
288289
new Star();
289290
},
291+
ephemeral_environments_page: function () {
292+
const ephemeralEnvironmentsEl = document.getElementById("ephemeral-environments");
293+
if (ephemeralEnvironmentsEl) {
294+
const config = JSON.parse(ephemeralEnvironmentsEl.dataset.config);
295+
EphemeralEnvironments({ dom: ephemeralEnvironmentsEl, config });
296+
}
297+
},
290298
people_page: function () {
291299
ListPeople.init();
292300
ChangeRoleDropdown.init();

0 commit comments

Comments
Β (0)