diff --git a/frontend/src/lib/components/SuperadminSettings.svelte b/frontend/src/lib/components/SuperadminSettings.svelte index 2edbe6318c..52b932e5f7 100644 --- a/frontend/src/lib/components/SuperadminSettings.svelte +++ b/frontend/src/lib/components/SuperadminSettings.svelte @@ -1,431 +1,20 @@ - x.email + ' ' + x.name + ' ' + x.company} -/> - - listUsers(activeOnly)} - size="1200px" - on:close={removeHash} -> + -
-
-
-
-
Windmill
-
-
-
-
- -
-
- - Users - {#each settingsKeys as category} - - {category} - - {/each} - {#snippet content()} -
- -
- {#if !automateUsernameCreation && !isCloudHosted()} -
-

Automatic username creation

-
- Automatically create a username for new users based on their email, shared - across workspaces. Learn more -
- - { - automateUsernameModalOpen = false - enableAutomateUsernameCreationSetting() - }} - on:canceled={() => (automateUsernameModalOpen = false)} - title="Automatic username creation" - confirmationText="Enable" - > - Once activated, it will not be possible to disable this feature. In case - existing users have different usernames in different workspaces, you will have - to manually confirm the username for each user. - -
- {/if} - -
- listUsers(activeOnly)} /> -
- -
-

All instance users

- -
-
-
- -
-
- - - - email - auth - name - {#if automateUsernameCreation} - username - {/if} - {#if activeOnly} - kind - {/if} - - - - {#snippet body()} - - {#if filteredUsers && users} - {#each filteredUsers.slice(0, nbDisplayed) as { email, super_admin, devops, login_type, name, username, operator_only } (email)} - - {email} - {login_type} - {truncate(name ?? '', 30)} - - {#if automateUsernameCreation} - - {#if username} - {username} - {:else} - {#key filteredUsers.map((u) => u.username).join()} - { - listUsers(activeOnly) - }} - /> - {/key} - {/if} - - {/if} - {#if activeOnly} - - {#if operator_only} - Operator only - {:else} - Developer - {/if} - - {/if} - - { - if (email == $userStore?.email) { - sendUserToast('You cannot demote yourself', true) - listUsers(activeOnly) - return - } - - let role = e.detail - - if (role === 'super_admin') { - await UserService.globalUserUpdate({ - email, - requestBody: { - is_super_admin: true, - is_devops: false - } - }) - } - if (role === 'devops') { - await UserService.globalUserUpdate({ - email, - requestBody: { - is_super_admin: false, - is_devops: true - } - }) - } - if (role === 'user') { - await UserService.globalUserUpdate({ - email, - requestBody: { - is_super_admin: false, - is_devops: false - } - }) - } - sendUserToast('User updated') - listUsers(activeOnly) - }} - > - {#snippet children({ item })} - - - - {/snippet} - - - -
- { - listUsers(activeOnly) - }} - on:save={(e) => { - updateName(e.detail, email) - }} - on:renamed={() => { - listUsers(activeOnly) - }} - {automateUsernameCreation} - /> - -
- - - {/each} - {/if} - - {/snippet} -
-
- {#if filteredUsers && filteredUsers?.length > 50 && nbDisplayed < filteredUsers.length} - {nbDisplayed} users out of {filteredUsers.length} - - {/if} -
-
- - - - {/snippet} -
-
-
- {#if tab != 'users'} -
- -
{/if} +
- - { - deleteConfirmedCallback = undefined - }} - on:confirmed={() => { - if (deleteConfirmedCallback) { - deleteConfirmedCallback() - } - deleteConfirmedCallback = undefined - }} -> -
- Are you sure you want to remove ? -
-
diff --git a/frontend/src/lib/components/SuperadminSettingsInner.svelte b/frontend/src/lib/components/SuperadminSettingsInner.svelte new file mode 100644 index 0000000000..6dbc2533de --- /dev/null +++ b/frontend/src/lib/components/SuperadminSettingsInner.svelte @@ -0,0 +1,407 @@ + + + x.email + ' ' + x.name + ' ' + x.company} +/> + +
+
+
+
+
Windmill
+
+
+
+
+ +
+
+ + Users + {#each settingsKeys as category} + + {category} + + {/each} + {#snippet content()} +
+ +
+ {#if !automateUsernameCreation && !isCloudHosted()} +
+

Automatic username creation

+
+ Automatically create a username for new users based on their email, shared + across workspaces. Learn more +
+ + { + automateUsernameModalOpen = false + enableAutomateUsernameCreationSetting() + }} + on:canceled={() => (automateUsernameModalOpen = false)} + title="Automatic username creation" + confirmationText="Enable" + > + Once activated, it will not be possible to disable this feature. In case existing + users have different usernames in different workspaces, you will have to manually + confirm the username for each user. + +
+ {/if} + +
+ listUsers(activeOnly)} /> +
+ +
+

All instance users

+ +
+
+
+ +
+
+ + + + email + auth + name + {#if automateUsernameCreation} + username + {/if} + {#if activeOnly} + kind + {/if} + + + + {#snippet body()} + + {#if filteredUsers && users} + {#each filteredUsers.slice(0, nbDisplayed) as { email, super_admin, devops, login_type, name, username, operator_only } (email)} + + {email} + {login_type} + {truncate(name ?? '', 30)} + + {#if automateUsernameCreation} + + {#if username} + {username} + {:else} + {#key filteredUsers.map((u) => u.username).join()} + { + listUsers(activeOnly) + }} + /> + {/key} + {/if} + + {/if} + {#if activeOnly} + + {#if operator_only} + Operator only + {:else} + Developer + {/if} + + {/if} + + { + if (email == $userStore?.email) { + sendUserToast('You cannot demote yourself', true) + listUsers(activeOnly) + return + } + + let role = e.detail + + if (role === 'super_admin') { + await UserService.globalUserUpdate({ + email, + requestBody: { + is_super_admin: true, + is_devops: false + } + }) + } + if (role === 'devops') { + await UserService.globalUserUpdate({ + email, + requestBody: { + is_super_admin: false, + is_devops: true + } + }) + } + if (role === 'user') { + await UserService.globalUserUpdate({ + email, + requestBody: { + is_super_admin: false, + is_devops: false + } + }) + } + sendUserToast('User updated') + listUsers(activeOnly) + }} + > + {#snippet children({ item })} + + + + {/snippet} + + + +
+ { + listUsers(activeOnly) + }} + on:save={(e) => { + updateName(e.detail, email) + }} + on:renamed={() => { + listUsers(activeOnly) + }} + {automateUsernameCreation} + /> + +
+ + + {/each} + {/if} + + {/snippet} +
+
+ {#if filteredUsers && filteredUsers?.length > 50 && nbDisplayed < filteredUsers.length} + {nbDisplayed} users out of {filteredUsers.length} + + {/if} +
+
+ + + + {/snippet} +
+
+
+{#if tab != 'users'} +
+ +
{/if} + + { + deleteConfirmedCallback = undefined + }} + on:confirmed={() => { + if (deleteConfirmedCallback) { + deleteConfirmedCallback() + } + deleteConfirmedCallback = undefined + }} +> +
+ Are you sure you want to remove ? +
+
diff --git a/frontend/src/lib/components/UserSettings.svelte b/frontend/src/lib/components/UserSettings.svelte index a6237515cc..899c318031 100644 --- a/frontend/src/lib/components/UserSettings.svelte +++ b/frontend/src/lib/components/UserSettings.svelte @@ -8,14 +8,24 @@ import UserInfoSettings from './settings/UserInfoSettings.svelte' import AIUserSettings from './settings/AIUserSettings.svelte' - export let scopes: string[] | undefined = undefined - export let newTokenLabel: string | undefined = undefined - export let newTokenWorkspace: string | undefined = undefined - export let newToken: string | undefined = undefined - export let showMcpMode: boolean = false + interface Props { + scopes?: string[] | undefined + newTokenLabel?: string | undefined + newTokenWorkspace?: string | undefined + newToken?: string | undefined + showMcpMode?: boolean + } - let drawer: Drawer - let openWithMcpMode = false + let { + scopes = undefined, + newTokenLabel = undefined, + newTokenWorkspace = undefined, + newToken = $bindable(undefined), + showMcpMode = false + }: Props = $props() + + let drawer: Drawer | undefined = $state() + let openWithMcpMode = $state(false) const dispatch = createEventDispatcher()