Skip to content

Commit a4f84e3

Browse files
committed
Merge remote-tracking branch 'origin/main' into tokens-ls-all/kira-pilot
2 parents 3f888e9 + 6149905 commit a4f84e3

File tree

47 files changed

+1269
-1103
lines changed

Some content is hidden

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

47 files changed

+1269
-1103
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ jobs:
506506
507507
- uses: actions/setup-node@v3
508508
with:
509-
node-version: "14"
509+
node-version: "16.16.0"
510510

511511
- name: Install node_modules
512512
run: ./scripts/yarn_install.sh
@@ -555,7 +555,7 @@ jobs:
555555

556556
- uses: actions/setup-node@v3
557557
with:
558-
node-version: "14"
558+
node-version: "16.16.0"
559559

560560
- name: Echo Go Cache Paths
561561
id: go-cache-paths
@@ -609,6 +609,10 @@ jobs:
609609
# only get 1 commit on shallow checkout.
610610
fetch-depth: 0
611611

612+
- uses: actions/setup-node@v3
613+
with:
614+
node-version: "16.16.0"
615+
612616
- name: Install dependencies
613617
run: cd site && yarn
614618

coderd/users.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
387387
ctx := r.Context()
388388
auditor := *api.Auditor.Load()
389389
user := httpmw.UserParam(r)
390+
auth := httpmw.UserAuthorization(r)
390391
aReq, commitAudit := audit.InitRequest[database.User](rw, &audit.RequestParams{
391392
Audit: auditor,
392393
Log: api.Logger,
@@ -401,6 +402,13 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
401402
return
402403
}
403404

405+
if auth.Actor.ID == user.ID.String() {
406+
httpapi.Write(ctx, rw, http.StatusForbidden, codersdk.Response{
407+
Message: "You cannot delete yourself!",
408+
})
409+
return
410+
}
411+
404412
workspaces, err := api.Database.GetWorkspaces(ctx, database.GetWorkspacesParams{
405413
OwnerID: user.ID,
406414
})

coderd/users_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ func TestDeleteUser(t *testing.T) {
327327
require.ErrorAs(t, err, &apiErr)
328328
require.Equal(t, http.StatusExpectationFailed, apiErr.StatusCode())
329329
})
330+
t.Run("Self", func(t *testing.T) {
331+
t.Parallel()
332+
client := coderdtest.New(t, nil)
333+
user := coderdtest.CreateFirstUser(t, client)
334+
err := client.DeleteUser(context.Background(), user.UserID)
335+
var apiErr *codersdk.Error
336+
require.Error(t, err, "should not be able to delete self")
337+
require.ErrorAs(t, err, &apiErr, "should be a coderd error")
338+
require.Equal(t, http.StatusForbidden, apiErr.StatusCode(), "should be forbidden")
339+
})
330340
}
331341

332342
func TestPostLogout(t *testing.T) {

site/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@xstate/inspect": "0.6.5",
4545
"@xstate/react": "3.0.1",
4646
"axios": "0.26.1",
47-
"canvas": "^2.11.0",
47+
"canvas": "2.11.0",
4848
"chart.js": "3.9.1",
4949
"chartjs-adapter-date-fns": "3.0.0",
5050
"color-convert": "2.0.1",
@@ -61,12 +61,12 @@
6161
"jest-location-mock": "1.0.9",
6262
"just-debounce-it": "3.1.1",
6363
"lodash": "4.17.21",
64-
"playwright": "^1.29.2",
64+
"playwright": "1.29.2",
6565
"react": "18.2.0",
6666
"react-chartjs-2": "4.3.1",
6767
"react-color": "2.19.3",
6868
"react-dom": "18.2.0",
69-
"react-headless-tabs": "^6.0.3",
69+
"react-headless-tabs": "6.0.3",
7070
"react-helmet-async": "1.3.0",
7171
"react-i18next": "12.1.1",
7272
"react-markdown": "8.0.3",
@@ -121,10 +121,10 @@
121121
"eslint-plugin-unicorn": "44.0.0",
122122
"jest": "27.5.1",
123123
"jest-canvas-mock": "2.4.0",
124-
"jest-esm-transformer": "^1.0.0",
124+
"jest-esm-transformer": "1.0.0",
125125
"jest-runner-eslint": "1.1.0",
126126
"jest-websocket-mock": "2.4.0",
127-
"monaco-editor": "^0.34.1",
127+
"monaco-editor": "0.34.1",
128128
"msw": "0.47.0",
129129
"prettier": "2.8.1",
130130
"resize-observer": "1.0.4",

site/src/components/AppLink/AppLink.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ const useStyles = makeStyles((theme) => ({
130130

131131
button: {
132132
whiteSpace: "nowrap",
133+
backgroundColor: theme.palette.background.default,
134+
135+
"&:hover": {
136+
backgroundColor: `${theme.palette.background.default} !important`,
137+
},
133138
},
134139

135140
unhealthyIcon: {

site/src/components/DeploySettingsLayout/Fieldset.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const useStyles = makeStyles((theme) => ({
3939
},
4040
title: {
4141
...theme.typography.h5,
42-
fontWeight: "bold",
42+
fontWeight: 600,
4343
},
4444
body: {
4545
...theme.typography.body2,

site/src/components/Dialogs/Dialog.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,16 @@ const useButtonStyles = makeStyles((theme) => ({
8989
backgroundColor: colors.red[10],
9090
borderColor: colors.red[9],
9191
color: theme.palette.text.primary,
92-
"&:hover": {
92+
93+
"&:hover:not(:disabled)": {
9394
backgroundColor: colors.red[9],
95+
borderColor: colors.red[9],
9496
},
97+
9598
"&.Mui-disabled": {
96-
opacity: 0.5,
99+
backgroundColor: colors.red[15],
100+
borderColor: colors.red[15],
101+
color: colors.red[9],
97102
},
98103
},
99104
},

site/src/components/DropdownButton/ActionCtas.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const UpdateButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({
2626

2727
return (
2828
<Button
29+
variant="outlined"
2930
className={styles.actionButton}
3031
startIcon={<CloudQueueIcon />}
3132
onClick={handleAction}
@@ -43,6 +44,7 @@ export const ChangeVersionButton: FC<
4344

4445
return (
4546
<Button
47+
variant="outlined"
4648
className={styles.actionButton}
4749
startIcon={<UpdateOutlined />}
4850
onClick={handleAction}
@@ -60,6 +62,7 @@ export const BuildParametersButton: FC<
6062

6163
return (
6264
<Button
65+
variant="outlined"
6366
className={styles.actionButton}
6467
startIcon={<SettingsOutlined />}
6568
onClick={handleAction}
@@ -150,7 +153,7 @@ export const DisabledButton: FC<React.PropsWithChildren<DisabledProps>> = ({
150153
const styles = useStyles()
151154

152155
return (
153-
<Button disabled className={styles.actionButton}>
156+
<Button variant="outlined" disabled className={styles.actionButton}>
154157
{label}
155158
</Button>
156159
)
@@ -167,6 +170,7 @@ export const ActionLoadingButton: FC<React.PropsWithChildren<LoadingProps>> = ({
167170
return (
168171
<LoadingButton
169172
loading
173+
variant="outlined"
170174
loadingLabel={label}
171175
className={combineClasses([styles.loadingButton, styles.actionButton])}
172176
/>
@@ -178,8 +182,13 @@ const useStyles = makeStyles((theme) => ({
178182
// Set fixed width for the action buttons so they will not change the size
179183
// during the transitions
180184
width: theme.spacing(20),
181-
border: "none",
182185
borderRadius: `${theme.shape.borderRadius}px 0px 0px ${theme.shape.borderRadius}px`,
186+
// This is used to show the hover effect
187+
marginRight: -1,
188+
position: "relative",
189+
"&:hover": {
190+
zIndex: 1,
191+
},
183192
},
184193
cancelButton: {
185194
"&.MuiButton-root": {

site/src/components/DropdownButton/DropdownButton.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const DropdownButton: FC<DropdownButtonProps> = ({
4141
<>
4242
{/* popover toggle button */}
4343
<Button
44+
variant="outlined"
4445
data-testid="workspace-actions-button"
4546
aria-controls="workspace-actions-menu"
4647
aria-haspopup="true"
@@ -86,13 +87,9 @@ export const DropdownButton: FC<DropdownButtonProps> = ({
8687

8788
const useStyles = makeStyles((theme) => ({
8889
buttonContainer: {
89-
border: `1px solid ${theme.palette.divider}`,
90-
borderRadius: `${theme.shape.borderRadius}px`,
9190
display: "inline-flex",
9291
},
9392
dropdownButton: {
94-
border: "none",
95-
borderLeft: `1px solid ${theme.palette.divider}`,
9693
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
9794
minWidth: "unset",
9895
width: "64px", // matching cancel button so button grouping doesn't grow in size
@@ -110,8 +107,18 @@ const useStyles = makeStyles((theme) => ({
110107
},
111108
},
112109
popoverPaper: {
113-
padding: `${theme.spacing(1)}px ${theme.spacing(2)}px ${theme.spacing(
114-
1,
115-
)}px`,
110+
padding: 0,
111+
width: theme.spacing(28),
112+
113+
"& .MuiButton-root": {
114+
padding: theme.spacing(1, 2),
115+
borderRadius: 0,
116+
width: "100%",
117+
border: 0,
118+
119+
"&:hover": {
120+
background: theme.palette.action.hover,
121+
},
122+
},
116123
},
117124
}))

site/src/components/FullPageForm/FullPageHorizontalForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const FullPageHorizontalForm: FC<
2323
<Margins size="medium">
2424
<PageHeader
2525
actions={
26-
<Button size="small" onClick={onCancel}>
26+
<Button variant="outlined" size="small" onClick={onCancel}>
2727
Cancel
2828
</Button>
2929
}

site/src/components/LicenseBanner/LicenseBannerView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const useStyles = makeStyles((theme) => ({
9393
link: {
9494
color: "inherit",
9595
textDecoration: "none",
96-
fontWeight: "bold",
96+
fontWeight: 600,
9797
},
9898
list: {
9999
padding: theme.spacing(1),

site/src/components/NavbarView/NavbarView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ const useStyles = makeStyles((theme) => ({
239239
// NavLink adds this class when the current route matches.
240240
"&.active": {
241241
color: theme.palette.text.primary,
242-
fontWeight: "bold",
242+
fontWeight: 500,
243243
},
244244

245245
[theme.breakpoints.up("md")]: {

site/src/components/PaginationWidget/PageButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const PageButton = ({
2121
const styles = useStyles()
2222
return (
2323
<Button
24+
variant="outlined"
2425
className={
2526
activePage === page
2627
? `${styles.pageButton} ${styles.activePageButton}`

site/src/components/PaginationWidget/PaginationWidget.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const PaginationWidget = ({
4444
<Maybe condition={showWidget}>
4545
<div style={containerStyle} className={styles.defaultContainerStyles}>
4646
<Button
47+
variant="outlined"
4748
className={styles.prevLabelStyles}
4849
aria-label="Previous page"
4950
disabled={firstPageActive}
@@ -82,6 +83,7 @@ export const PaginationWidget = ({
8283
</Cond>
8384
</ChooseOne>
8485
<Button
86+
variant="outlined"
8587
aria-label="Next page"
8688
disabled={lastPageActive}
8789
onClick={() => send({ type: "NEXT_PAGE" })}

site/src/components/Pill/Pill.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ export interface PillProps {
99
text: string
1010
type?: PaletteIndex
1111
lightBorder?: boolean
12+
title?: string
1213
}
1314

1415
export const Pill: FC<PillProps> = (props) => {
15-
const { className, icon, text = false } = props
16+
const { className, icon, text = false, title } = props
1617
const styles = useStyles(props)
1718
return (
1819
<div
1920
className={combineClasses([styles.wrapper, styles.pillColor, className])}
2021
role="status"
22+
title={title}
2123
>
2224
{icon && <div className={styles.iconWrapper}>{icon}</div>}
2325
{text}

site/src/components/PortForwardButton/PortForwardButton.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export const PortForwardButton: React.FC<PortForwardButtonProps> = (props) => {
149149
return (
150150
<>
151151
<Button
152+
className={styles.button}
152153
startIcon={<OpenInNewOutlined />}
153154
size="small"
154155
ref={anchorRef}
@@ -208,4 +209,13 @@ const useStyles = makeStyles((theme) => ({
208209
form: {
209210
margin: theme.spacing(1.5, 0, 0),
210211
},
212+
213+
button: {
214+
whiteSpace: "nowrap",
215+
backgroundColor: theme.palette.background.default,
216+
217+
"&:hover": {
218+
backgroundColor: `${theme.palette.background.default} !important`,
219+
},
220+
},
211221
}))

site/src/components/SSHButton/SSHButton.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const SSHButton: React.FC<React.PropsWithChildren<SSHButtonProps>> = ({
3434
return (
3535
<>
3636
<Button
37+
className={styles.button}
3738
startIcon={<CloudIcon />}
3839
size="small"
3940
ref={anchorRef}
@@ -122,4 +123,13 @@ const useStyles = makeStyles((theme) => ({
122123
textHelper: {
123124
fontWeight: 400,
124125
},
126+
127+
button: {
128+
whiteSpace: "nowrap",
129+
backgroundColor: theme.palette.background.default,
130+
131+
"&:hover": {
132+
backgroundColor: `${theme.palette.background.default} !important`,
133+
},
134+
},
125135
}))

site/src/components/SearchBarWithFilter/SearchBarWithFilter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const SearchBarWithFilter: React.FC<
7777
<Stack direction="row" spacing={0}>
7878
{presetFilters && presetFilters.length > 0 && (
7979
<Button
80+
variant="outlined"
8081
aria-controls="filter-menu"
8182
aria-haspopup="true"
8283
onClick={handleClick}

site/src/components/SignInForm/OAuthSignInForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const OAuthSignInForm: FC<OAuthSignInFormProps> = ({
4242
disabled={isLoading}
4343
fullWidth
4444
type="submit"
45-
variant="contained"
45+
variant="outlined"
4646
>
4747
{Language.githubSignIn}
4848
</Button>
@@ -71,7 +71,7 @@ export const OAuthSignInForm: FC<OAuthSignInFormProps> = ({
7171
disabled={isLoading}
7272
fullWidth
7373
type="submit"
74-
variant="contained"
74+
variant="outlined"
7575
>
7676
{authMethods.oidc.signInText || Language.oidcSignIn}
7777
</Button>

site/src/components/SignInForm/PasswordSignInForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const PasswordSignInForm: FC<PasswordSignInFormProps> = ({
8888
loading={isLoading}
8989
fullWidth
9090
type="submit"
91-
variant="contained"
91+
variant="outlined"
9292
>
9393
{isLoading ? "" : Language.passwordSignIn}
9494
</LoadingButton>

0 commit comments

Comments
 (0)