Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple roles per user (management + switching, incl. GraphQL & TS) #3982

Merged
merged 72 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
77f6c45
utils/GlobalDialogs
nl0 May 23, 2024
e6d68ea
add global dialogs provider
nl0 May 23, 2024
b46c5b9
gql: hack for passing optimistic responses to mutations
nl0 May 22, 2024
8717bf1
update gql schema and generated stuff
nl0 May 22, 2024
844b01c
gql: keys and updaters for newly added types
nl0 May 22, 2024
b4c146b
admin/Users: TSify, use GraphQL queries/mutations
nl0 May 22, 2024
3498bd4
handle results/errors
nl0 May 24, 2024
298587b
update gql schema: me, roles, role switching
nl0 May 24, 2024
fed8df4
gql for querying "me" and role switching
nl0 May 24, 2024
a83e32e
Switch roles draft UI
fiskus May 24, 2024
c1fb574
update gql schema and generated code
nl0 May 24, 2024
447ec9a
add roles to UserSelection
nl0 May 24, 2024
da795db
utils/Dialogs: Close: default type param to never
nl0 May 24, 2024
c0a1e00
NavBar: regen gql
nl0 May 24, 2024
9e26dee
NavBar: get user from gql
nl0 May 24, 2024
1258d7a
admin: set roles ui tracer bullet
nl0 May 24, 2024
86859d2
deploy catalog
nl0 May 24, 2024
a682fdb
role switching wip
nl0 May 24, 2024
1cf05de
merge with remote and combine both implementations
nl0 May 30, 2024
e91e468
prettify .graphql
fiskus May 24, 2024
fb2e6a4
rename close back since we dont close SwitchRoles dialog
fiskus May 24, 2024
54ef45b
fancier username display
nl0 May 27, 2024
dd0dd38
update gql schema, regen
nl0 May 29, 2024
6b3a65e
adjust api, draft ui
nl0 May 29, 2024
53a8c8e
Don't fold GQL `Me` data, split code to `MobileSignIn`/`DesktopSignIn…
fiskus May 30, 2024
3e4b9bc
adjust role selection model
nl0 May 30, 2024
197100b
unify form helpers
nl0 May 30, 2024
048c251
role selection ui wip
nl0 May 30, 2024
9c8b8ec
fix form re-init
nl0 May 30, 2024
dafac6b
Amdin/Form: FormErrorAuto component
nl0 May 30, 2024
39dd9b8
Admin/Users: use FormErrorAuto, fix submit error handling
nl0 May 30, 2024
beff626
nicer edit dialog
nl0 May 30, 2024
140ec59
Admin/Form: add XXX note
nl0 May 31, 2024
044e3af
Admin/Form: adjust FormErrorAuto API
nl0 May 31, 2024
211e478
tweak user admin table ui
nl0 May 31, 2024
23f597f
adjust dialogs layout
nl0 May 31, 2024
72109ac
tweak styling
nl0 May 31, 2024
efa966c
adjust spacing
nl0 Jun 3, 2024
2e8d73c
move stuff
nl0 Jun 3, 2024
d7c829b
cleanup
nl0 Jun 3, 2024
9729d07
proper suspense wrappers
nl0 Jun 3, 2024
33b8f24
dry
nl0 Jun 3, 2024
7fbb9e0
NavBar: refactor and tweak nav menu logic and layout
nl0 Jun 5, 2024
6e9cc87
simplify
nl0 Jun 5, 2024
8f3c663
tweak role switcher a little
nl0 Jun 5, 2024
7e9e8ae
mv RoleSwitcher out
nl0 Jun 6, 2024
14f8f34
polish role switch ui
nl0 Jun 6, 2024
7be023e
regen gql
nl0 Jun 6, 2024
a6815e3
nav menu polish
nl0 Jun 6, 2024
453f992
CHECKPOINT
nl0 Jun 7, 2024
7635228
adjust the menu
nl0 Jun 7, 2024
859b236
icons for nav links on mobile
nl0 Jun 7, 2024
4b71c60
adjust badge display
nl0 Jun 7, 2024
540001b
address some CR feedback
nl0 Jun 7, 2024
aedf253
add help text
nl0 Jun 7, 2024
b053c0f
CHECKPOINT
nl0 Jun 7, 2024
e23070c
role selection: transfer list ui
nl0 Jun 10, 2024
1c1409d
role switch: "repeat" icon
nl0 Jun 10, 2024
373c58a
fix icon name
nl0 Jun 10, 2024
fa08866
tweak role switch icon
nl0 Jun 11, 2024
bc98967
move RoleSelect into a separate file
nl0 Jun 11, 2024
7539b21
Merge branch 'master' into users-gql
nl0 Jun 11, 2024
96859fe
update gql schema and regen stuff
nl0 Jun 17, 2024
faae2b4
Merge branch 'master' into users-gql
nl0 Jun 17, 2024
70a7a24
Merge branch 'master' into users-gql
nl0 Jun 18, 2024
3e9b1a7
RoleSwitcher: add button for confirming role switch
nl0 Jun 18, 2024
b4a3139
add space around menu list dividers
nl0 Jun 18, 2024
e49036d
Hide navbar controls for guests (from #3704)
nl0 Jun 18, 2024
f47fcea
admin tables: remove "Actions" column header
nl0 Jun 18, 2024
13064f1
Revert "deploy catalog"
nl0 Jun 18, 2024
46d982f
changelog
nl0 Jun 18, 2024
10d4302
address some feedback
nl0 Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions catalog/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import * as APIConnector from 'utils/APIConnector'
import * as GraphQL from 'utils/GraphQL'
import { BucketCacheProvider } from 'utils/BucketCache'
import GlobalAPI from 'utils/GlobalAPI'
import WithGlobalDialogs from 'utils/GlobalDialogs'
import log from 'utils/Logging'
import * as NamedRoutes from 'utils/NamedRoutes'
import { PFSCookieManager } from 'utils/PFSCookieManager'
Expand Down Expand Up @@ -123,6 +124,7 @@ const render = () => {
AWS.Athena.Provider,
AWS.S3.Provider,
Notifications.WithNotifications,
WithGlobalDialogs,
Errors.ErrorBoundary,
BucketCacheProvider,
PFSCookieManager,
Expand Down
46 changes: 31 additions & 15 deletions catalog/app/containers/Admin/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import * as React from 'react'
import type * as RF from 'react-final-form'
import * as RF from 'react-final-form'

Check warning on line 2 in catalog/app/containers/Admin/Form.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Form.tsx#L2

Added line #L2 was not covered by tests
import * as M from '@material-ui/core'

export interface FieldProps {
errors: Record<string, React.ReactNode>
input: RF.FieldInputProps<string>
meta: RF.FieldMetaState<string>
type ErrorMessageMap = Record<string, React.ReactNode>

interface FieldOwnProps {
errors: ErrorMessageMap
}

export type FieldProps = FieldOwnProps & RF.FieldRenderProps<string> & M.TextFieldProps

// TODO: re-use components/Form/TextField
// XXX: extract all custom logic into a function and use MUI's TextField (and other components) explicitly
export function Field({
input,
meta,
errors,
helperText,
InputLabelProps,
...rest
}: FieldProps & M.TextFieldProps) {
const error = meta.submitFailed && (meta.error || meta.submitError)
}: FieldProps) {

Check warning on line 22 in catalog/app/containers/Admin/Form.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Form.tsx#L22

Added line #L22 was not covered by tests
const error =
meta.submitFailed && (meta.error || (!meta.dirtySinceLastSubmit && meta.submitError))
const props = {
error: !!error,
helperText: error ? errors[error] || error : helperText,
Expand All @@ -37,7 +41,7 @@
})

export interface CheckboxProps {
errors?: Record<string, React.ReactNode>
errors?: ErrorMessageMap
input?: RF.FieldInputProps<boolean>
meta: RF.FieldMetaState<string | Symbol>
label?: React.ReactNode
Expand Down Expand Up @@ -80,16 +84,12 @@
},
}))

interface FormErrorProps {
errors: Record<string, React.ReactNode>
interface FormErrorProps extends M.TypographyProps {
error?: string
errors: ErrorMessageMap
}

export function FormError({
error,
errors,
...rest
}: FormErrorProps & M.TypographyProps) {
export function FormError({ error, errors, ...rest }: FormErrorProps) {

Check warning on line 92 in catalog/app/containers/Admin/Form.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Form.tsx#L92

Added line #L92 was not covered by tests
const classes = useFormErrorStyles()
if (!error) return null
return (
Expand All @@ -98,3 +98,19 @@
</M.Typography>
)
}

interface FormErrorAutoProps extends M.TypographyProps {
children: ErrorMessageMap
}

export function FormErrorAuto({ children: errors, ...props }: FormErrorAutoProps) {
const state = RF.useFormState({

Check warning on line 107 in catalog/app/containers/Admin/Form.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Form.tsx#L106-L107

Added lines #L106 - L107 were not covered by tests
subscription: {
error: true,
submitError: true,
submitFailed: true,
},
})
const error = state.submitFailed && (state.submitError || state.error)
return <FormError error={error} errors={errors} {...props} />

Check warning on line 115 in catalog/app/containers/Admin/Form.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Form.tsx#L115

Added line #L115 was not covered by tests
}
49 changes: 0 additions & 49 deletions catalog/app/containers/Admin/RFForm.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions catalog/app/containers/Admin/RolesAndPolicies/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion catalog/app/containers/Admin/Table/untyped.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
)}
</M.TableCell>
))}
{withInlineActions && <M.TableCell align="right">Actions</M.TableCell>}
{withInlineActions && <M.TableCell align="right">&nbsp;</M.TableCell>}

Check warning on line 46 in catalog/app/containers/Admin/Table/untyped.js

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Table/untyped.js#L46

Added line #L46 was not covered by tests
</M.TableRow>
</M.TableHead>
)
Expand Down
Loading
Loading