Skip to content

🔥 🔥 🔥 A Free & Self-hostable Airtable Alternative

fix(nc-gui): add notice in workspace role update confirm modal

Ramesh Mane43c5b396defa
diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
index 69fa1a4c47..401b90df97 100644
--- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
+++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
@@ -479,15 +479,7 @@ defineExpose({
</div>
<div
class="text-xs font-medium flex items-center gap-2 gap-1"
- :class="{
- 'text-nc-purple-200': RoleColors[currentUserRole] === 'purple',
- 'text-nc-blue-200': RoleColors[currentUserRole] === 'blue',
- 'text-nc-green-200': RoleColors[currentUserRole] === 'green',
- 'text-nc-orange-200': RoleColors[currentUserRole] === 'orange',
- 'text-nc-yellow-200': RoleColors[currentUserRole] === 'yellow',
- 'text-nc-red-200': RoleColors[currentUserRole] === 'red',
- 'text-nc-maroon-200': RoleColors[currentUserRole] === 'maroon',
- }"
+ :class="[roleColorsMapping[RoleColors[currentUserRole]]?.contentTooltip]"
>
<GeneralIcon :icon="RoleIcons[currentUserRole]" class="w-4 h-4" />
{{ $t(`objects.roleType.${RoleLabels[currentUserRole]}`) }}
diff --git a/packages/nc-gui/components/roles/Badge.vue b/packages/nc-gui/components/roles/Badge.vue
index 07adf996fc..f10b6c2183 100644
--- a/packages/nc-gui/components/roles/Badge.vue
+++ b/packages/nc-gui/components/roles/Badge.vue
@@ -38,7 +38,7 @@ const roleProperties = computed(() => {
const icon = RoleIcons[role]
const label = RoleLabels[role]
return {
- color: props.disabled ? 'grey' : color,
+ color: props.disabled ? 'gray' : color,
icon,
label,
}
@@ -58,18 +58,12 @@ const roleProperties = computed(() => {
<NcBadge class="!px-2 w-full" :class="ncBadgeClass" :color="roleProperties.color" :border="borderRef" :size="sizeSelect">
<div
class="badge-text w-full flex items-center justify-between gap-2"
- :class="{
- 'text-purple-700': roleProperties.color === 'purple',
- 'text-blue-700': roleProperties.color === 'blue',
- 'text-green-700': roleProperties.color === 'green',
- 'text-orange-700': roleProperties.color === 'orange',
- 'text-yellow-700': roleProperties.color === 'yellow',
- 'text-red-700': roleProperties.color === 'red',
- 'text-maroon-700': roleProperties.color === 'maroon',
- 'text-gray-400': !roleProperties.color === 'grey',
- 'text-gray-300': !roleProperties.color,
- sizeSelect,
- }"
+ :class="[
+ roleColorsMapping[roleProperties.color]?.content ?? 'text-gray-300',
+ {
+ sizeSelect,
+ },
+ ]"
>
<div class="flex items-center gap-2">
<GeneralIcon v-if="showIcon" :icon="roleProperties.icon" />
diff --git a/packages/nc-gui/components/workspace/CollaboratorsList.vue b/packages/nc-gui/components/workspace/CollaboratorsList.vue
index 8f6deda086..d4efacda90 100644
--- a/packages/nc-gui/components/workspace/CollaboratorsList.vue
+++ b/packages/nc-gui/components/workspace/CollaboratorsList.vue
@@ -148,6 +148,9 @@ const updateCollaborator = async (collab: any, roles: WorkspaceUserRoles, overri
}
}
+// Todo: Enable this after we add support for overriding base role in backend
+const showOverrideBaseRoleCheckbox = ref(false)
+
const userRoleUpdateInfo = ref<{
collab?: WorkspaceUserType
roles?: WorkspaceUserRoles
@@ -565,16 +568,29 @@ const removeCollaborator = (userId: string, workspaceId: string) => {
<NcModalConfirm
v-if="currentWorkspace"
v-model:visible="userRoleUpdateInfo.showConfirmationModal"
- title="Change Workspace Role"
ok-class="capitalize"
:ok-text="$t('general.confirm')"
:show-icon="false"
@cancel="onCancelRoleChangeConfirmationModal"
@ok="onConfirmRoleChangeConfirmationModal"
>
+ <template #title> {{ $t('title.changeWorkspaceRole') }} to {{ userRoleUpdateInfo.roles }}</template>
<template #extraContent>
<div class="flex flex-col gap-5 text-caption text-nc-content-gray">
- <div class="flex items-start gap-3">
+ <NcAlert
+ type="info"
+ :show-icon="false"
+ class="!p-3 bg-nc-bg-yellow-light !border-nc-fill-yellow-light"
+ description-class="!line-clamp-none"
+ >
+ <template #description>
+ <div class="text-nc-content-yellow-dark">
+ <b>{{ $t('general.notice') }}:</b>
+ {{ $t('msg.info.workspaceRoleUpdateNotice') }}
+ </div>
+ </template>
+ </NcAlert>
+ <div v-if="showOverrideBaseRoleCheckbox" class="flex items-start gap-3">
<div class="flex items-center h-5">
<NcCheckbox v-model:checked="userRoleUpdateInfo.overrideBaseRole" />
</div>
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 9d24168afe..ba853e8739 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -445,7 +445,8 @@
"overview": "Overview",
"baseType": "Base Type",
"beta": "Beta",
- "selected": "selected"
+ "selected": "selected",
+ "notice": "Notice"
},
"objects": {
"script": "Script",
@@ -948,7 +949,8 @@
"confirmLeaveWorkspaceTitle": "Are you sure you want to leave this workspace?",
"confirmLeaveWorkspaceSubtile": "If you leave this workspace, you will lose access to all the bases and data within this workspace. You’ll need an invitation to rejoin.",
"confirmRemoveMemberFromWorkspaceTitle": "Are you sure you want to remove member from workspace?",
- "confirmRemoveMemberFromWorkspaceSubtitle": "If you remove, they will lose access to all bases and data within this workspace. They’ll need an invitation to rejoin."
+ "confirmRemoveMemberFromWorkspaceSubtitle": "If you remove, they will lose access to all bases and data within this workspace. They’ll need an invitation to rejoin.",
+ "changeWorkspaceRole": "Change Workspace Role"
},
"labels": {
"hideEditor": "Hide Editor",
@@ -2363,7 +2365,8 @@
"leaveWithoutFinishing": "Leave without finishing?",
"leaveWithoutFinishingConfirmation": "Your changes are automatically saved, but you're still in edit mode.",
"matchedByButtonLabel": "Matched by button label",
- "matchedByFieldDescription": "Matched by field description"
+ "matchedByFieldDescription": "Matched by field description",
+ "workspaceRoleUpdateNotice": "Changing a user’s workspace role will automatically update their access to bases where they do not have explicitly assigned roles. Bases with explicit roles will continue to retain their individual permissions."
},
"error": {
"failedToDeleteMcpToken": "Failed to delete MCP token",
diff --git a/packages/nc-gui/utils/cssUtils.ts b/packages/nc-gui/utils/cssUtils.ts
index 5979a0db4b..47d3f39792 100644
--- a/packages/nc-gui/utils/cssUtils.ts
+++ b/packages/nc-gui/utils/cssUtils.ts
@@ -20,3 +20,53 @@ export const onboardingFlowColoursMapping: Record<string, { lightBg: string; con
content: 'text-nc-content-pink-dark',
},
}
+
+export const roleColorsMapping: Record<
+ string,
+ {
+ bg: string
+ content: string
+ contentTooltip: string
+ }
+> = {
+ purple: {
+ bg: 'bg-nc-bg-purple-light',
+ content: 'text-nc-content-purple-dark',
+ contentTooltip: 'text-nc-purple-200',
+ },
+ blue: {
+ bg: 'bg-nc-bg-blue-light',
+ content: 'text-nc-content-blue-dark',
+ contentTooltip: 'text-nc-blue-200',
+ },
+ green: {
+ bg: 'bg-nc-bg-green-light',
+ content: 'text-nc-content-green-dark',
+ contentTooltip: 'text-nc-green-200',
+ },
+ orange: {
+ bg: 'bg-nc-bg-orange-light',
+ content: 'text-nc-content-orange-dark',
+ contentTooltip: 'text-nc-orange-200',
+ },
+ yellow: {
+ bg: 'bg-nc-bg-yellow-light',
+ content: 'text-nc-content-yellow-dark',
+ contentTooltip: 'text-nc-yellow-200',
+ },
+ red: {
+ bg: 'bg-nc-bg-red-light',
+ content: 'text-nc-content-red-dark',
+ contentTooltip: 'text-nc-red-200',
+ },
+ maroon: {
+ bg: 'bg-nc-bg-maroon-light',
+ content: 'text-nc-content-maroon-dark',
+ contentTooltip: 'text-nc-maroon-200',
+ },
+ gray: {
+ bg: 'bg-nc-bg-gray-light',
+ content: 'text-nc-content-gray-disabled',
+ contentTooltip: 'text-nc-gray-200',
+ },
+}