Browse Source

fix(nc-gui): disable banner & logo upload in oss

pull/7741/head
Ramesh Mane 10 months ago
parent
commit
9924c1ac45
  1. 81
      packages/nc-gui/components/smartsheet/Form.vue
  2. 1
      packages/nc-gui/lang/en.json

81
packages/nc-gui/components/smartsheet/Form.vue

@ -463,7 +463,7 @@ const handleChangeBackground = (color: string) => {
}
const openUploadImage = (isUploadBanner: boolean) => {
if (!isEditable) return
if (!isEditable || !isEeUI) return
imageCropperData.value.uploadConfig = {
path: [NOCO, base.value.id, meta.value?.id, formViewData.value?.id].join('/'),
@ -723,22 +723,29 @@ useEventListener(
<GeneralFormBanner :banner-image-url="formViewData.banner_image_url" />
<div class="absolute bottom-0 right-0 hidden group-hover:block">
<div class="flex items-center space-x-1 m-2">
<NcButton
type="secondary"
size="small"
class="nc-form-upload-banner-btn"
data-testid="nc-form-upload-banner-btn"
@click="openUploadImage(true)"
>
<div class="flex gap-2 items-center">
<component :is="iconMap.upload" class="w-4 h-4" />
<span>
{{ formViewData.banner_image_url ? $t('general.replace') : $t('general.upload') }}
{{ $t('general.banner') }}
</span>
</div>
</NcButton>
<NcTooltip v-if="formViewData.banner_image_url">
<NcTooltip :disabled="isEeUI">
<template #title>
{{ $t('msg.info.thisFeatureIsOnlyAvailableInEnterpriseEdition') }}
</template>
<NcButton
type="secondary"
size="small"
class="nc-form-upload-banner-btn"
data-testid="nc-form-upload-banner-btn"
:disabled="!isEeUI"
@click="openUploadImage(true)"
>
<div class="flex gap-2 items-center">
<component :is="iconMap.upload" class="w-4 h-4" />
<span>
{{ formViewData.banner_image_url ? $t('general.replace') : $t('general.upload') }}
{{ $t('general.banner') }}
</span>
</div>
</NcButton>
</NcTooltip>
<NcTooltip v-if="isEeUI && formViewData.banner_image_url">
<template #title> {{ $t('general.delete') }} {{ $t('general.banner') }} </template>
<NcButton
type="secondary"
@ -788,20 +795,26 @@ useEventListener(
class="items-center space-x-1 flex-nowrap m-3"
:class="formViewData.logo_url ? 'hidden absolute top-0 left-0 group-hover:flex' : 'flex'"
>
<NcButton
v-if="isEditable"
type="secondary"
size="small"
class="nc-form-upload-logo-btn"
data-testid="nc-form-upload-log-btn"
@click="openUploadImage(false)"
>
<div class="flex gap-2 items-center">
<component :is="iconMap.upload" class="w-4 h-4" />
<span> {{ formViewData.logo_url ? $t('general.replace') : $t('general.upload') }} Logo</span>
</div>
</NcButton>
<NcTooltip v-if="formViewData.logo_url">
<NcTooltip :disabled="isEeUI">
<template #title>
{{ $t('msg.info.thisFeatureIsOnlyAvailableInEnterpriseEdition') }}
</template>
<NcButton
v-if="isEditable"
type="secondary"
size="small"
class="nc-form-upload-logo-btn"
data-testid="nc-form-upload-log-btn"
:disabled="!isEeUI"
@click="openUploadImage(false)"
>
<div class="flex gap-2 items-center">
<component :is="iconMap.upload" class="w-4 h-4" />
<span> {{ formViewData.logo_url ? $t('general.replace') : $t('general.upload') }} Logo</span>
</div>
</NcButton>
</NcTooltip>
<NcTooltip v-if="isEeUI && formViewData.logo_url">
<template #title> {{ $t('general.delete') }} {{ $t('general.logo') }} </template>
<NcButton
type="secondary"
@ -1467,12 +1480,12 @@ useEventListener(
}
"
/>
<a-tooltip v-else placement="top">
<NcTooltip v-else placement="top">
<template #title>
{{ $t('msg.info.upgradeToEnterpriseEdition', { extraInfo: `to ${$t('labels.hideNocodbBranding')}` }) }}
{{ $t('msg.info.thisFeatureIsOnlyAvailableInEnterpriseEdition') }}
</template>
<a-switch :checked="false" size="small" :disabled="true" />
</a-tooltip>
</NcTooltip>
<span class="ml-4">{{ $t('labels.hideNocodbBranding') }}</span>
</div>
</div>

1
packages/nc-gui/lang/en.json

@ -1306,6 +1306,7 @@
"groupPasteIsNotSupportedOnLinksColumn": "Group paste operation is not supported on Links/LinkToAnotherRecord column",
"groupClearIsNotSupportedOnLinksColumn": "Group clear operation is not supported on Links/LinkToAnotherRecord column",
"upgradeToEnterpriseEdition": "Upgrade to Enterprise Edition {extraInfo}",
"thisFeatureIsOnlyAvailableInEnterpriseEdition": "This feature is only available in enterprise edition",
"yourCurrentRoleIs": "Your current role is",
"pleaseRequestAccessForView": "Please request for higher permission from the Admin / Base owner / Workspace owner to get access to this {viewName}",
"preventHideAllOptions": "You cannot hide all options if field is required"

Loading…
Cancel
Save