mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
feat: link to the groups page wherever a group can be picked (#12125)
* feat: link to the groups page wherever a group can be picked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: point the groups link at the operating workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: reload group pickers on return from the groups page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: scope the groups link to the workspace its picker lists Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
633d176a3e
commit
efcffb5117
@@ -22,6 +22,7 @@
|
||||
import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte'
|
||||
import { ArrowDown, ArrowUp, Eye, Pen, Plus, Trash } from 'lucide-svelte'
|
||||
import Label from './Label.svelte'
|
||||
import ManageGroupsLink from './ManageGroupsLink.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { onMount, tick, untrack } from 'svelte'
|
||||
import Select from './select/Select.svelte'
|
||||
@@ -35,7 +36,6 @@
|
||||
import Badge from './common/badge/Badge.svelte'
|
||||
import InputError from './InputError.svelte'
|
||||
import Popover from './meltComponents/Popover.svelte'
|
||||
import GroupsPageLink from './GroupsPageLink.svelte'
|
||||
import { deepEqual } from 'fast-equals'
|
||||
import {
|
||||
folderPermissionDiff,
|
||||
@@ -654,7 +654,9 @@
|
||||
<span class="text-sm leading-6 font-semibold">Add a member</span>
|
||||
<Label label="User or group">
|
||||
{#snippet action()}
|
||||
<GroupsPageLink />
|
||||
{#if !offOperating}
|
||||
<ManageGroupsLink onReturn={loadGroups} />
|
||||
{/if}
|
||||
{/snippet}
|
||||
<div class="flex items-center gap-1">
|
||||
<!-- The toggle group is `w-full`; unwrapped it takes half the row. -->
|
||||
@@ -913,7 +915,14 @@
|
||||
<Cell head first class="text-secondary">
|
||||
path_glob <Tooltip>Glob relative to <code>f/{name}/</code></Tooltip>
|
||||
</Cell>
|
||||
<Cell head class="text-secondary">Permissioned as</Cell>
|
||||
<Cell head class="text-secondary">
|
||||
<div class="flex items-center gap-2">
|
||||
Permissioned as
|
||||
{#if !offOperating}
|
||||
<ManageGroupsLink onReturn={loadGroups} />
|
||||
{/if}
|
||||
</div>
|
||||
</Cell>
|
||||
<Cell head last actions class="text-secondary">Actions</Cell>
|
||||
</tr>
|
||||
</Head>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { ExternalLink } from 'lucide-svelte'
|
||||
|
||||
// A new tab: every group picker sits in a drawer or modal whose unsaved form a navigation would drop.
|
||||
</script>
|
||||
|
||||
<a
|
||||
href="/groups"
|
||||
target="_blank"
|
||||
class="inline-flex items-center gap-1 text-2xs font-normal whitespace-nowrap"
|
||||
>
|
||||
Manage groups <ExternalLink size={12} />
|
||||
</a>
|
||||
@@ -0,0 +1,65 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
import { fromStore } from 'svelte/store'
|
||||
import { ExternalLink } from 'lucide-svelte'
|
||||
import { Button } from '$lib/components/common'
|
||||
import { capabilitiesInWorkspace, useRoleCapabilities } from '$lib/operatorWriteRights'
|
||||
import { useOperatingWorkspace } from './operatingWorkspace.svelte'
|
||||
import { withWorkspaceParam } from './sessions/sessionMode.svelte'
|
||||
|
||||
interface Props {
|
||||
label?: string
|
||||
/** The workspace whose groups the caller lists, when it is not the operating one. */
|
||||
workspace?: string
|
||||
/** Called when the user comes back to this tab after following the link, so the
|
||||
* caller can reload the groups it lists. */
|
||||
onReturn?: () => void
|
||||
/** Text shown before the link, hidden with it. */
|
||||
children?: Snippet
|
||||
}
|
||||
|
||||
let { label = 'Manage groups', workspace, onReturn, children }: Props = $props()
|
||||
|
||||
// Inside a fork's editor the pickers list the fork's groups, not the navigated workspace's.
|
||||
const operating = fromStore(useOperatingWorkspace())
|
||||
const operatingCaps = fromStore(useRoleCapabilities())
|
||||
const target = $derived(workspace ?? operating.current)
|
||||
const canSeeGroups = $derived(
|
||||
(workspace ? capabilitiesInWorkspace(workspace) : operatingCaps.current).visibility.groups
|
||||
)
|
||||
let followed = false
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
onfocus={() => {
|
||||
if (!followed) return
|
||||
followed = false
|
||||
onReturn?.()
|
||||
}}
|
||||
/>
|
||||
|
||||
{#snippet link()}
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="xs"
|
||||
href={withWorkspaceParam('/groups', target)}
|
||||
target="_blank"
|
||||
endIcon={{ icon: ExternalLink }}
|
||||
onClick={() => (followed = true)}
|
||||
>
|
||||
{label}
|
||||
</Button>
|
||||
{/snippet}
|
||||
|
||||
<!-- Groups have no entry in the main menu, so every place that picks one links to their page.
|
||||
It opens in a new tab: the callers are forms whose unsaved state a navigation would drop. -->
|
||||
{#if canSeeGroups}
|
||||
{#if children}
|
||||
<div class="flex items-center gap-2 text-xs text-secondary">
|
||||
{@render children()}
|
||||
{@render link()}
|
||||
</div>
|
||||
{:else}
|
||||
{@render link()}
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -13,6 +13,7 @@
|
||||
import PropPickerWrapper from '../propPicker/PropPickerWrapper.svelte'
|
||||
import type { FlowEditorContext } from '../types'
|
||||
import Label from '$lib/components/Label.svelte'
|
||||
import ManageGroupsLink from '$lib/components/ManageGroupsLink.svelte'
|
||||
import SuspendDrawer from './SuspendDrawer.svelte'
|
||||
import EditableSchemaDrawer from '$lib/components/schema/EditableSchemaDrawer.svelte'
|
||||
import SchemaForm from '$lib/components/SchemaForm.svelte'
|
||||
@@ -256,10 +257,13 @@
|
||||
<div class="mb-4"></div>
|
||||
|
||||
{#if Boolean(flowModule.suspend?.user_auth_required) && allUserGroups.length !== 0 && flowModule.suspend && schema.properties['groups']}
|
||||
<span class="text-xs font-bold"
|
||||
>Require approvers to be members of one of the following user groups (leave empty
|
||||
for any)
|
||||
</span>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="text-xs font-bold"
|
||||
>Require approvers to be members of one of the following user groups (leave empty
|
||||
for any)
|
||||
</span>
|
||||
<ManageGroupsLink onReturn={loadGroups} />
|
||||
</div>
|
||||
<PropPickerWrapper
|
||||
sidePane
|
||||
notSelectable
|
||||
@@ -280,6 +284,13 @@
|
||||
/>
|
||||
</PropPickerWrapper>
|
||||
{/if}
|
||||
<!-- Every workspace is created with `all` and `wm_deployers`; neither is a group
|
||||
anyone made to pick approvers from. -->
|
||||
{#if Boolean(flowModule.suspend?.user_auth_required) && allUserGroups.length > 0 && allUserGroups.every((g) => g === 'all' || g === 'wm_deployers')}
|
||||
<ManageGroupsLink label="Go to groups" onReturn={loadGroups}>
|
||||
Create a group to restrict approval to its members.
|
||||
</ManageGroupsLink>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
import Select from '$lib/components/select/Select.svelte'
|
||||
import { ChevronDown, Plus, Trash } from 'lucide-svelte'
|
||||
import GroupEditorDrawer from '$lib/components/GroupEditorDrawer.svelte'
|
||||
import ManageGroupsLink from '$lib/components/ManageGroupsLink.svelte'
|
||||
import FolderEditorDrawer from '$lib/components/FolderEditorDrawer.svelte'
|
||||
import GroupsPageLink from '$lib/components/GroupsPageLink.svelte'
|
||||
import { Cell, DataTable, Row } from '$lib/components/table'
|
||||
import Head from '$lib/components/table/Head.svelte'
|
||||
import AccessHelp from './AccessHelp.svelte'
|
||||
@@ -324,9 +324,7 @@
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<GroupsPageLink />
|
||||
<ManageGroupsLink onReturn={loadPrincipals} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import MultiSelect from '../select/MultiSelect.svelte'
|
||||
import Toggle from '../Toggle.svelte'
|
||||
import Tooltip from '../Tooltip.svelte'
|
||||
import ManageGroupsLink from '../ManageGroupsLink.svelte'
|
||||
import CloseButton from '../common/CloseButton.svelte'
|
||||
import Checkbox from '../common/checkbox/Checkbox.svelte'
|
||||
import Cell from '../table/Cell.svelte'
|
||||
@@ -410,6 +411,9 @@
|
||||
Users, groups and folders allowed to connect as this role. Workspace admins can
|
||||
use every role.
|
||||
</Tooltip>
|
||||
{#if !governing}
|
||||
<ManageGroupsLink {workspace} onReturn={() => loadTenantItems(workspace)} />
|
||||
{/if}
|
||||
</Cell>
|
||||
<Cell head>
|
||||
Default
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { Section, Button, DrawerContent } from '$lib/components/common'
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
import Label from '$lib/components/Label.svelte'
|
||||
import ManageGroupsLink from '$lib/components/ManageGroupsLink.svelte'
|
||||
import MultiSelect from '$lib/components/select/MultiSelect.svelte'
|
||||
import TextInput from '$lib/components/text_input/TextInput.svelte'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
@@ -17,7 +18,6 @@
|
||||
import { DEV_WORKSPACE_LOCK_RULE_NAME } from '$lib/workspaceProtectionRules.svelte'
|
||||
import { untrack } from 'svelte'
|
||||
import { ArrowRight, Plus, Save, Trash2 } from 'lucide-svelte'
|
||||
import GroupsPageLink from '$lib/components/GroupsPageLink.svelte'
|
||||
import { safeSelectItems } from '$lib/components/select/utils.svelte'
|
||||
import Select from '$lib/components/select/Select.svelte'
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
>
|
||||
<Label label="Groups">
|
||||
{#snippet action()}
|
||||
<GroupsPageLink />
|
||||
<ManageGroupsLink onReturn={loadAvailableGroups} />
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
bind:value={selectedGroups}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import { latestRequest } from '$lib/utils/latestRequest'
|
||||
import DataTable from '$lib/components/table/DataTable.svelte'
|
||||
import Cell from '$lib/components/table/Cell.svelte'
|
||||
import { Pen, Trash, Plus, UploadCloud, FolderOpen } from 'lucide-svelte'
|
||||
import { Pen, Trash, Plus, UploadCloud, FolderOpen, Users } from 'lucide-svelte'
|
||||
import DeployToHub from '$lib/components/workspaceSettings/DeployToHub.svelte'
|
||||
import Head from '$lib/components/table/Head.svelte'
|
||||
import Row from '$lib/components/table/Row.svelte'
|
||||
@@ -104,7 +104,12 @@
|
||||
tooltip="Folders allow to group items such as scripts/flows/resources/schedule together and to grant homogenous RBAC permissions to groups and individual users towards them."
|
||||
documentationLink="https://www.windmill.dev/docs/core_concepts/groups_and_folders"
|
||||
>
|
||||
<div class="flex flex-row">
|
||||
<div class="flex flex-row gap-2">
|
||||
{#if $roleCapabilities.visibility.groups}
|
||||
<Button variant="default" unifiedSize="md" href="/groups" startIcon={{ icon: Users }}>
|
||||
Groups
|
||||
</Button>
|
||||
{/if}
|
||||
{#if restricted}
|
||||
<Button
|
||||
variant="accent"
|
||||
|
||||
Reference in New Issue
Block a user