多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.4 KiB

<script lang="ts" setup>
import type { WorkspaceType } from 'nocodb-sdk'
import 'emoji-mart-vue-fast/css/emoji-mart.css'
import { Icon } from '@iconify/vue'
import { WorkspaceIconType, isColorDark, stringToColor } from '#imports'
const props = defineProps<{
workspace: WorkspaceType | undefined
workspaceIcon?: {
icon: string | Record<string, any>
iconType: WorkspaceIconType | string
}
hideLabel?: boolean
size?: 'small' | 'medium' | 'large' | 'xlarge'
Nc feat/user management (#8369) * fix: source filter Signed-off-by: mertmit <mertmit99@gmail.com> * feat: sso cloud apis - WIP * feat: admin panel menu option * feat: UI integration - WIP * feat: UI integration - SSO * feat: domain verification * feat: workspace upgrade and sso page - WIP * feat: domain adding and verification - WIP * feat: domain adding and verification * fix: domain validation corrections * chore: lint * feat(nc-gui): organization settings page * feat(nc-gui): organization members page * fix(nc-gui): some more changes * fix(nc-gui): refactor collaborators ui * feat(nc-gui): dashboard ui * feat(nc-gui): bases page * feat(nocodb): wired up ui and apis. wip * fix(nc-gui): some more fixes * fix(nc-gui): move ws to org immediately after creation * fix(nc-gui): some more bug fixes * feat(nocodb): transfer workspace ownership * fix(nc-gui): load roles if baseId is provided in prop * fix(nc-gui): show only org workspaces * fix(nc-gui): some more fixes * fix(nc-gui): rename base * fix(nc-gui): invite fixes * feat: restrict access to org level user(SSO login) * fix: include org and client info in token * fix: include org and client info in refresh token * refactor: minor ui corrections * refactor: add a generic component for copying * refactor: ui correction and cleanup * fix: refresh token update * fix: ui corrections * fix: if user signin using unverified domain show error in sso page rather than showing the json with error * fix: for all sso related exceptions redirect to sso ui page with error * chore: lint * fix: show admin panel option only for user who have permission * fix: redirect to sso login page on logout based on current user info * test: sso - playwright test * fix: duplicate attribute * test: playwright * fix: missing import * test: playwright - WIP * test: playwright - Cloud sso login flow * fix: error handling * test: playwright - sso auth flow tests * fix: show upgrade option only for workspace owner * test: user invite tests corrections * test: user invite tests corrections * test: user management correction * test: playwright - use regex for path match * fix: delete existing provider if any * test: combine sso tests to run serially * test: playwright - title name correction * test: playwright - reset sso client from sso tests only * test: playwright - page navigation correction * refactor: by default navigate to org settings page on org creation and disable org image upload * refactor: reverify domain after 7 days and update role names to avoid confusion between org and cloud org roles * fix: corrections * fix: show org level roles in members section * refactor: disable org update by default * test: unit tests for org admin apis * chore: lint * fix: review comments * chore: lint and cleanup --------- Signed-off-by: mertmit <mertmit99@gmail.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com>
7 months ago
isRounded?: boolean
}>()
const { workspace } = toRefs(props)
const { getPossibleAttachmentSrc } = useAttachment()
const workspaceIcon = computed(() => {
if (!workspace.value) {
return {
icon: '',
iconType: '',
}
}
let icon = workspace.value.meta?.icon || ''
let iconType = workspace.value.meta?.iconType || ''
if (props.workspaceIcon) {
icon = props.workspaceIcon?.icon || ''
iconType = props.workspaceIcon?.iconType || ''
}
return {
icon: iconType === WorkspaceIconType.IMAGE && ncIsObject(icon) ? getPossibleAttachmentSrc(icon) || '' : icon,
iconType,
}
})
const workspaceColor = computed(() => {
const color = workspace.value ? workspace.value.meta?.color || stringToColor(workspace.value.id!) : undefined
if (!props.hideLabel && workspaceIcon.value.icon) {
switch (workspaceIcon.value.iconType) {
case WorkspaceIconType.IMAGE: {
return ''
}
case WorkspaceIconType.EMOJI: {
return '#F4F4F5'
}
case WorkspaceIconType.ICON: {
return '#F4F4F5'
}
default: {
return color || '#0A1433'
}
}
}
return color || '#0A1433'
})
const size = computed(() => props.size || 'medium')
</script>
<template>
<div
class="flex nc-workspace-avatar overflow-hidden"
:class="{
'min-w-4 w-4 h-4 rounded': size === 'small',
'min-w-6 w-6 h-6 rounded-md': size === 'medium',
'min-w-10 w-10 h-10 rounded-lg !text-base': size === 'large',
'min-w-16 w-16 h-16 rounded-lg !text-4xl': size === 'xlarge',
Nc feat/user management (#8369) * fix: source filter Signed-off-by: mertmit <mertmit99@gmail.com> * feat: sso cloud apis - WIP * feat: admin panel menu option * feat: UI integration - WIP * feat: UI integration - SSO * feat: domain verification * feat: workspace upgrade and sso page - WIP * feat: domain adding and verification - WIP * feat: domain adding and verification * fix: domain validation corrections * chore: lint * feat(nc-gui): organization settings page * feat(nc-gui): organization members page * fix(nc-gui): some more changes * fix(nc-gui): refactor collaborators ui * feat(nc-gui): dashboard ui * feat(nc-gui): bases page * feat(nocodb): wired up ui and apis. wip * fix(nc-gui): some more fixes * fix(nc-gui): move ws to org immediately after creation * fix(nc-gui): some more bug fixes * feat(nocodb): transfer workspace ownership * fix(nc-gui): load roles if baseId is provided in prop * fix(nc-gui): show only org workspaces * fix(nc-gui): some more fixes * fix(nc-gui): rename base * fix(nc-gui): invite fixes * feat: restrict access to org level user(SSO login) * fix: include org and client info in token * fix: include org and client info in refresh token * refactor: minor ui corrections * refactor: add a generic component for copying * refactor: ui correction and cleanup * fix: refresh token update * fix: ui corrections * fix: if user signin using unverified domain show error in sso page rather than showing the json with error * fix: for all sso related exceptions redirect to sso ui page with error * chore: lint * fix: show admin panel option only for user who have permission * fix: redirect to sso login page on logout based on current user info * test: sso - playwright test * fix: duplicate attribute * test: playwright * fix: missing import * test: playwright - WIP * test: playwright - Cloud sso login flow * fix: error handling * test: playwright - sso auth flow tests * fix: show upgrade option only for workspace owner * test: user invite tests corrections * test: user invite tests corrections * test: user management correction * test: playwright - use regex for path match * fix: delete existing provider if any * test: combine sso tests to run serially * test: playwright - title name correction * test: playwright - reset sso client from sso tests only * test: playwright - page navigation correction * refactor: by default navigate to org settings page on org creation and disable org image upload * refactor: reverify domain after 7 days and update role names to avoid confusion between org and cloud org roles * fix: corrections * fix: show org level roles in members section * refactor: disable org update by default * test: unit tests for org admin apis * chore: lint * fix: review comments * chore: lint and cleanup --------- Signed-off-by: mertmit <mertmit99@gmail.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com>
7 months ago
'!rounded-[50%]': props.isRounded,
}"
:style="{
backgroundColor:
!props.hideLabel && workspaceIcon.icon && workspaceIcon.iconType === WorkspaceIconType.IMAGE ? undefined : workspaceColor,
}"
>
<template v-if="!props.hideLabel">
<CellAttachmentPreviewImage
v-if="workspaceIcon.icon && workspaceIcon.iconType === WorkspaceIconType.IMAGE"
:srcs="workspaceIcon.icon"
class="flex-none !object-contain max-h-full max-w-full !m-0"
/>
<div
v-else-if="workspaceIcon.icon && workspaceIcon.iconType === WorkspaceIconType.EMOJI"
class="flex items-center justify-center"
:class="{
'text-white': isColorDark(workspaceColor),
'text-black opacity-80': !isColorDark(workspaceColor),
'text-sm': size === 'small',
'text-base': size === 'medium',
'text-2xl': size === 'large',
'text-4xl': size === 'xlarge',
}"
>
<template v-if="isUnicodeEmoji(workspaceIcon.icon)">
{{ workspaceIcon.icon }}
</template>
<template v-else>
<Icon
:data-testid="`nc-icon-${workspaceIcon.icon}`"
class="!text-inherit flex-none"
:class="{
'w-3 h-3': size === 'small',
'w-4 h-4': size === 'medium',
'w-6 h-6': size === 'large',
'w-10 h-10': size === 'xlarge',
}"
:icon="workspaceIcon.icon"
></Icon>
</template>
</div>
<GeneralIcon
v-else-if="workspaceIcon.icon && workspaceIcon.iconType === WorkspaceIconType.ICON"
:icon="workspaceIcon.icon"
class="flex-none"
:class="{
'text-white': isColorDark(workspaceColor),
'text-black opacity-80': !isColorDark(workspaceColor),
'w-3 h-3': size === 'small',
'w-4 h-4': size === 'medium',
'w-6 h-6': size === 'large',
'w-10 h-10': size === 'xlarge',
}"
/>
<div
v-else
class="font-semibold"
:class="{
'text-white': isColorDark(workspaceColor),
'text-black': !isColorDark(workspaceColor),
}"
>
{{ props.workspace?.title?.slice(0, 2) }}
</div>
</template>
</div>
</template>
<style lang="scss" scoped>
.nc-workspace-avatar {
@apply text-xs flex items-center justify-center text-white uppercase;
}
</style>