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

Feat: Show noncompliant warning in members tables #2812

Merged
merged 8 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion packages/frontend-2/components/form/select/WorkspaceRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
mount-menu-on-body
:fully-control-value="fullyControlValue"
:disabled="disabled"
:disabled-item-predicate="disabledItemPredicate"
>
<template #nothing-selected>
{{ multiple ? 'Select roles' : 'Select role' }}
Expand Down Expand Up @@ -69,7 +70,11 @@ const props = defineProps({
type: String,
default: 'Workspace Roles'
},
disabled: Boolean
disabled: Boolean,
disabledItems: {
required: false,
type: Array as PropType<WorkspaceRoles[]>
}
})

const elementToWatchForChanges = ref(null as Nullable<HTMLElement>)
Expand All @@ -85,4 +90,7 @@ const { selectedValue, isMultiItemArrayValue, hiddenSelectedItemCount, firstItem
})

const roles = computed(() => Object.values(Roles.Workspace))

const disabledItemPredicate = (item: WorkspaceRoles) =>
props.disabledItems ? props.disabledItems.includes(item) : true
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<div class="flex items-center gap-2">
<UserAvatar :user="item" />
<span class="truncate text-body-xs text-foreground">{{ item.name }}</span>
<div
v-if="item.workspaceDomainPolicyCompliant === false"
v-tippy="
'This user does not comply with the domain policy set on this workspace'
"
>
<ExclamationCircleIcon class="text-danger w-5 w-4" />
</div>
</div>
</template>
<template #company="{ item }">
Expand All @@ -41,6 +49,11 @@
:disabled="!isWorkspaceAdmin"
:model-value="item.role as WorkspaceRoles"
fully-control-value
:disabled-items="
!item.workspaceDomainPolicyCompliant
? [Roles.Workspace.Member, Roles.Workspace.Admin]
: []
"
@update:model-value="
(newRoleValue) => openChangeUserRoleDialog(item, newRoleValue)
"
Expand Down Expand Up @@ -84,7 +97,11 @@
import type { WorkspaceRoles } from '@speckle/shared'
import type { SettingsWorkspacesMembersMembersTable_WorkspaceFragment } from '~~/lib/common/generated/gql/graphql'
import { graphql } from '~/lib/common/generated/gql'
import { EllipsisHorizontalIcon, XMarkIcon } from '@heroicons/vue/24/outline'
import {
EllipsisHorizontalIcon,
XMarkIcon,
ExclamationCircleIcon
} from '@heroicons/vue/24/outline'
import { useWorkspaceUpdateRole } from '~/lib/workspaces/composables/management'
import type { LayoutMenuItem } from '~~/lib/layout/helpers/components'
import { HorizontalDirection } from '~~/lib/common/composables/window'
Expand All @@ -103,6 +120,7 @@ graphql(`
name
company
verified
workspaceDomainPolicyCompliant(workspaceId: $workspaceId)
}
}
`)
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend-2/lib/common/generated/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const documents = {
"\n fragment SettingsWorkspacesMembersGuestsTable_Workspace on Workspace {\n id\n ...SettingsWorkspacesMembersTableHeader_Workspace\n team {\n id\n ...SettingsWorkspacesMembersGuestsTable_WorkspaceCollaborator\n }\n }\n": types.SettingsWorkspacesMembersGuestsTable_WorkspaceFragmentDoc,
"\n fragment SettingsWorkspacesMembersInvitesTable_PendingWorkspaceCollaborator on PendingWorkspaceCollaborator {\n id\n inviteId\n role\n title\n updatedAt\n user {\n id\n ...LimitedUserAvatar\n }\n invitedBy {\n id\n ...LimitedUserAvatar\n }\n }\n": types.SettingsWorkspacesMembersInvitesTable_PendingWorkspaceCollaboratorFragmentDoc,
"\n fragment SettingsWorkspacesMembersInvitesTable_Workspace on Workspace {\n id\n ...SettingsWorkspacesMembersTableHeader_Workspace\n invitedTeam(filter: $invitesFilter) {\n ...SettingsWorkspacesMembersInvitesTable_PendingWorkspaceCollaborator\n }\n }\n": types.SettingsWorkspacesMembersInvitesTable_WorkspaceFragmentDoc,
"\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n }\n }\n": types.SettingsWorkspacesMembersMembersTable_WorkspaceCollaboratorFragmentDoc,
"\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n workspaceDomainPolicyCompliant(workspaceId: $workspaceId)\n }\n }\n": types.SettingsWorkspacesMembersMembersTable_WorkspaceCollaboratorFragmentDoc,
"\n fragment SettingsWorkspacesMembersMembersTable_Workspace on Workspace {\n id\n ...SettingsWorkspacesMembersTableHeader_Workspace\n team {\n id\n ...SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator\n }\n }\n": types.SettingsWorkspacesMembersMembersTable_WorkspaceFragmentDoc,
"\n fragment SettingsWorkspacesMembersTableHeader_Workspace on Workspace {\n id\n role\n ...WorkspaceInviteDialog_Workspace\n }\n": types.SettingsWorkspacesMembersTableHeader_WorkspaceFragmentDoc,
"\n fragment SettingsWorkspacesSecurityDomainRemoveDialog_WorkspaceDomain on WorkspaceDomain {\n id\n domain\n }\n": types.SettingsWorkspacesSecurityDomainRemoveDialog_WorkspaceDomainFragmentDoc,
Expand Down Expand Up @@ -717,7 +717,7 @@ export function graphql(source: "\n fragment SettingsWorkspacesMembersInvitesTa
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n }\n }\n"): (typeof documents)["\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n }\n }\n"];
export function graphql(source: "\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n workspaceDomainPolicyCompliant(workspaceId: $workspaceId)\n }\n }\n"): (typeof documents)["\n fragment SettingsWorkspacesMembersMembersTable_WorkspaceCollaborator on WorkspaceCollaborator {\n id\n role\n user {\n id\n avatar\n name\n company\n verified\n workspaceDomainPolicyCompliant(workspaceId: $workspaceId)\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading