Skip to content

Commit b1674db

Browse files
committed
\t
1 parent 82cb6ef commit b1674db

File tree

902 files changed

+80144
-80148
lines changed

Some content is hidden

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

902 files changed

+80144
-80148
lines changed

site/biome.json

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
11
{
2-
"files": {
3-
"ignore": ["**/*Generated.ts"]
4-
},
5-
"formatter": {
6-
"indentStyle": "space",
7-
"indentWidth": 2
8-
},
9-
"linter": {
10-
"rules": {
11-
"a11y": {
12-
"noSvgWithoutTitle": { "level": "off" },
13-
"useButtonType": { "level": "off" }
14-
},
15-
"style": {
16-
"noNonNullAssertion": { "level": "off" },
17-
"noParameterAssign": { "level": "off" },
18-
"useDefaultParameterLast": { "level": "off" },
19-
"useSelfClosingElements": { "level": "off" }
20-
},
21-
"suspicious": {
22-
"noArrayIndexKey": { "level": "off" },
23-
"noThenProperty": { "level": "off" }
24-
},
25-
"nursery": {
26-
"noRestrictedImports": {
27-
"level": "error",
28-
"options": {
29-
"paths": {
30-
"@mui/material": "Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
31-
"@mui/icons-material": "Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
32-
"@mui/material/Avatar": "Use components/Avatar/Avatar instead.",
33-
"@mui/material/Alert": "Use components/Alert/Alert instead.",
34-
"@mui/material/Popover": "Use components/Popover/Popover instead.",
35-
"@mui/material/Typography": "Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
36-
"@mui/material/Box": "Use a <div> instead.",
37-
"@mui/material/styles": "Import from @emotion/react instead.",
38-
"lodash": "Use lodash/<name> instead."
39-
}
40-
}
41-
}
42-
}
43-
}
44-
}
2+
"files": {
3+
"ignore": ["**/*Generated.ts"]
4+
},
5+
"linter": {
6+
"rules": {
7+
"a11y": {
8+
"noSvgWithoutTitle": { "level": "off" },
9+
"useButtonType": { "level": "off" }
10+
},
11+
"style": {
12+
"noNonNullAssertion": { "level": "off" },
13+
"noParameterAssign": { "level": "off" },
14+
"useDefaultParameterLast": { "level": "off" },
15+
"useSelfClosingElements": { "level": "off" }
16+
},
17+
"suspicious": {
18+
"noArrayIndexKey": { "level": "off" },
19+
"noThenProperty": { "level": "off" }
20+
},
21+
"nursery": {
22+
"noRestrictedImports": {
23+
"level": "error",
24+
"options": {
25+
"paths": {
26+
"@mui/material": "Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
27+
"@mui/icons-material": "Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
28+
"@mui/material/Avatar": "Use components/Avatar/Avatar instead.",
29+
"@mui/material/Alert": "Use components/Alert/Alert instead.",
30+
"@mui/material/Popover": "Use components/Popover/Popover instead.",
31+
"@mui/material/Typography": "Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
32+
"@mui/material/Box": "Use a <div> instead.",
33+
"@mui/material/styles": "Import from @emotion/react instead.",
34+
"lodash": "Use lodash/<name> instead."
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
4541
}

site/e2e/api.ts

Lines changed: 126 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -9,174 +9,174 @@ import { findSessionToken, randomName } from "./helpers";
99
let currentOrgId: string;
1010

1111
export const setupApiCalls = async (page: Page) => {
12-
try {
13-
const token = await findSessionToken(page);
14-
API.setSessionToken(token);
15-
} catch {
16-
// If this fails, we have an unauthenticated client.
17-
}
18-
19-
API.setHost(`http://127.0.0.1:${coderPort}`);
12+
try {
13+
const token = await findSessionToken(page);
14+
API.setSessionToken(token);
15+
} catch {
16+
// If this fails, we have an unauthenticated client.
17+
}
18+
19+
API.setHost(`http://127.0.0.1:${coderPort}`);
2020
};
2121

2222
export const getCurrentOrgId = async (): Promise<string> => {
23-
if (currentOrgId) {
24-
return currentOrgId;
25-
}
26-
const currentUser = await API.getAuthenticatedUser();
27-
currentOrgId = currentUser.organization_ids[0];
28-
return currentOrgId;
23+
if (currentOrgId) {
24+
return currentOrgId;
25+
}
26+
const currentUser = await API.getAuthenticatedUser();
27+
currentOrgId = currentUser.organization_ids[0];
28+
return currentOrgId;
2929
};
3030

3131
export const createUser = async (orgId: string) => {
32-
const name = randomName();
33-
const user = await API.createUser({
34-
email: `${name}@coder.com`,
35-
username: name,
36-
name: name,
37-
password: "s3cure&password!",
38-
login_type: "password",
39-
disable_login: false,
40-
organization_id: orgId,
41-
});
42-
return user;
32+
const name = randomName();
33+
const user = await API.createUser({
34+
email: `${name}@coder.com`,
35+
username: name,
36+
name: name,
37+
password: "s3cure&password!",
38+
login_type: "password",
39+
disable_login: false,
40+
organization_id: orgId,
41+
});
42+
return user;
4343
};
4444

4545
export const createGroup = async (orgId: string) => {
46-
const name = randomName();
47-
const group = await API.createGroup(orgId, {
48-
name,
49-
display_name: `Display ${name}`,
50-
avatar_url: "/emojis/1f60d.png",
51-
quota_allowance: 0,
52-
});
53-
return group;
46+
const name = randomName();
47+
const group = await API.createGroup(orgId, {
48+
name,
49+
display_name: `Display ${name}`,
50+
avatar_url: "/emojis/1f60d.png",
51+
quota_allowance: 0,
52+
});
53+
return group;
5454
};
5555

5656
export const createOrganization = async () => {
57-
const name = randomName();
58-
const org = await API.createOrganization({
59-
name,
60-
display_name: `Org ${name}`,
61-
description: `Org description ${name}`,
62-
icon: "/emojis/1f957.png",
63-
});
64-
return org;
57+
const name = randomName();
58+
const org = await API.createOrganization({
59+
name,
60+
display_name: `Org ${name}`,
61+
description: `Org description ${name}`,
62+
icon: "/emojis/1f957.png",
63+
});
64+
return org;
6565
};
6666

6767
export async function verifyConfigFlagBoolean(
68-
page: Page,
69-
config: DeploymentConfig,
70-
flag: string,
68+
page: Page,
69+
config: DeploymentConfig,
70+
flag: string,
7171
) {
72-
const opt = findConfigOption(config, flag);
73-
const type = opt.value ? "option-enabled" : "option-disabled";
74-
const value = opt.value ? "Enabled" : "Disabled";
75-
76-
const configOption = page.locator(
77-
`div.options-table .option-${flag} .${type}`,
78-
);
79-
await expect(configOption).toHaveText(value);
72+
const opt = findConfigOption(config, flag);
73+
const type = opt.value ? "option-enabled" : "option-disabled";
74+
const value = opt.value ? "Enabled" : "Disabled";
75+
76+
const configOption = page.locator(
77+
`div.options-table .option-${flag} .${type}`,
78+
);
79+
await expect(configOption).toHaveText(value);
8080
}
8181

8282
export async function verifyConfigFlagNumber(
83-
page: Page,
84-
config: DeploymentConfig,
85-
flag: string,
83+
page: Page,
84+
config: DeploymentConfig,
85+
flag: string,
8686
) {
87-
const opt = findConfigOption(config, flag);
88-
const configOption = page.locator(
89-
`div.options-table .option-${flag} .option-value-number`,
90-
);
91-
await expect(configOption).toHaveText(String(opt.value));
87+
const opt = findConfigOption(config, flag);
88+
const configOption = page.locator(
89+
`div.options-table .option-${flag} .option-value-number`,
90+
);
91+
await expect(configOption).toHaveText(String(opt.value));
9292
}
9393

9494
export async function verifyConfigFlagString(
95-
page: Page,
96-
config: DeploymentConfig,
97-
flag: string,
95+
page: Page,
96+
config: DeploymentConfig,
97+
flag: string,
9898
) {
99-
const opt = findConfigOption(config, flag);
99+
const opt = findConfigOption(config, flag);
100100

101-
const configOption = page.locator(
102-
`div.options-table .option-${flag} .option-value-string`,
103-
);
104-
await expect(configOption).toHaveText(opt.value);
101+
const configOption = page.locator(
102+
`div.options-table .option-${flag} .option-value-string`,
103+
);
104+
await expect(configOption).toHaveText(opt.value);
105105
}
106106

107107
export async function verifyConfigFlagEmpty(page: Page, flag: string) {
108-
const configOption = page.locator(
109-
`div.options-table .option-${flag} .option-value-empty`,
110-
);
111-
await expect(configOption).toHaveText("Not set");
108+
const configOption = page.locator(
109+
`div.options-table .option-${flag} .option-value-empty`,
110+
);
111+
await expect(configOption).toHaveText("Not set");
112112
}
113113

114114
export async function verifyConfigFlagArray(
115-
page: Page,
116-
config: DeploymentConfig,
117-
flag: string,
115+
page: Page,
116+
config: DeploymentConfig,
117+
flag: string,
118118
) {
119-
const opt = findConfigOption(config, flag);
120-
const configOption = page.locator(
121-
`div.options-table .option-${flag} .option-array`,
122-
);
123-
124-
// Verify array of options with simple dots
125-
for (const item of opt.value) {
126-
await expect(configOption.locator("li", { hasText: item })).toBeVisible();
127-
}
119+
const opt = findConfigOption(config, flag);
120+
const configOption = page.locator(
121+
`div.options-table .option-${flag} .option-array`,
122+
);
123+
124+
// Verify array of options with simple dots
125+
for (const item of opt.value) {
126+
await expect(configOption.locator("li", { hasText: item })).toBeVisible();
127+
}
128128
}
129129

130130
export async function verifyConfigFlagEntries(
131-
page: Page,
132-
config: DeploymentConfig,
133-
flag: string,
131+
page: Page,
132+
config: DeploymentConfig,
133+
flag: string,
134134
) {
135-
const opt = findConfigOption(config, flag);
136-
const configOption = page.locator(
137-
`div.options-table .option-${flag} .option-array`,
138-
);
139-
140-
// Verify array of options with green marks.
141-
Object.entries(opt.value)
142-
.sort((a, b) => a[0].localeCompare(b[0]))
143-
.map(async ([item]) => {
144-
await expect(
145-
configOption.locator(`.option-array-item-${item}.option-enabled`, {
146-
hasText: item,
147-
}),
148-
).toBeVisible();
149-
});
135+
const opt = findConfigOption(config, flag);
136+
const configOption = page.locator(
137+
`div.options-table .option-${flag} .option-array`,
138+
);
139+
140+
// Verify array of options with green marks.
141+
Object.entries(opt.value)
142+
.sort((a, b) => a[0].localeCompare(b[0]))
143+
.map(async ([item]) => {
144+
await expect(
145+
configOption.locator(`.option-array-item-${item}.option-enabled`, {
146+
hasText: item,
147+
}),
148+
).toBeVisible();
149+
});
150150
}
151151

152152
export async function verifyConfigFlagDuration(
153-
page: Page,
154-
config: DeploymentConfig,
155-
flag: string,
153+
page: Page,
154+
config: DeploymentConfig,
155+
flag: string,
156156
) {
157-
const opt = findConfigOption(config, flag);
158-
const configOption = page.locator(
159-
`div.options-table .option-${flag} .option-value-string`,
160-
);
161-
await expect(configOption).toHaveText(
162-
formatDuration(
163-
// intervalToDuration takes ms, so convert nanoseconds to ms
164-
intervalToDuration({
165-
start: 0,
166-
end: (opt.value as number) / 1e6,
167-
}),
168-
),
169-
);
157+
const opt = findConfigOption(config, flag);
158+
const configOption = page.locator(
159+
`div.options-table .option-${flag} .option-value-string`,
160+
);
161+
await expect(configOption).toHaveText(
162+
formatDuration(
163+
// intervalToDuration takes ms, so convert nanoseconds to ms
164+
intervalToDuration({
165+
start: 0,
166+
end: (opt.value as number) / 1e6,
167+
}),
168+
),
169+
);
170170
}
171171

172172
export function findConfigOption(
173-
config: DeploymentConfig,
174-
flag: string,
173+
config: DeploymentConfig,
174+
flag: string,
175175
): SerpentOption {
176-
const opt = config.options.find((option) => option.flag === flag);
177-
if (opt === undefined) {
178-
// must be undefined as `false` is expected
179-
throw new Error(`Option with env ${flag} has undefined value.`);
180-
}
181-
return opt;
176+
const opt = config.options.find((option) => option.flag === flag);
177+
if (opt === undefined) {
178+
// must be undefined as `false` is expected
179+
throw new Error(`Option with env ${flag} has undefined value.`);
180+
}
181+
return opt;
182182
}

0 commit comments

Comments
 (0)