Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: disable change icon color of managed app

Ramesh Maned6d5c38a508f
diff --git a/packages/nc-gui/components/general/BaseIconColorPicker.vue b/packages/nc-gui/components/general/BaseIconColorPicker.vue
index d58542847a..8c0c949f9e 100644
--- a/packages/nc-gui/components/general/BaseIconColorPicker.vue
+++ b/packages/nc-gui/components/general/BaseIconColorPicker.vue
@@ -20,13 +20,17 @@ const props = withDefaults(
const emit = defineEmits(['update:modelValue'])
-const { modelValue, readonly } = toRefs(props)
+const { modelValue, readonly, managedApp } = toRefs(props)
const { size } = props
const isOpen = ref(false)
const colorRef = ref(tinycolor(modelValue.value).isValid() ? modelValue.value : baseIconColors[0])
+const isMasterManagedApp = computed(() => {
+ return !!managedApp.value?.managed_app_id && !!managedApp.value?.managed_app_master
+})
+
const updateIconColor = (color: string) => {
const tcolor = tinycolor(color)
if (tcolor.isValid()) {
@@ -35,7 +39,7 @@ const updateIconColor = (color: string) => {
}
const onClick = (e: Event) => {
- if (readonly.value) return
+ if (readonly.value || isMasterManagedApp.value) return
e.stopPropagation()
@@ -60,13 +64,13 @@ watch(
<a-dropdown
v-model:visible="isOpen"
:trigger="['click']"
- :disabled="readonly"
+ :disabled="readonly || isMasterManagedApp"
overlay-class-name="nc-base-icon-color-picker-dropdown overflow-hidden max-w-[342px] relative"
>
<div
class="flex flex-row justify-center items-center select-none rounded nc-base-icon-picker-trigger"
:class="{
- 'hover:bg-gray-500 dark:hover:bg-nc-bg-gray-dark hover:bg-opacity-15 cursor-pointer': !readonly,
+ 'hover:bg-gray-500 dark:hover:bg-nc-bg-gray-dark hover:bg-opacity-15 cursor-pointer': !readonly && !isMasterManagedApp,
'bg-gray-500 dark:bg-nc-bg-gray-dark bg-opacity-15': isOpen,
'h-5 w-5 text-base': size === 'xsmall',
'h-6 w-6 text-lg': size === 'small',
@@ -77,25 +81,17 @@ watch(
@click="onClick"
>
<NcTooltip placement="topLeft" :disabled="readonly || isOpen">
- <template #title> {{ $t('tooltip.changeIconColour') }} </template>
+ <template #title>
+ {{
+ isMasterManagedApp ? $t('tooltip.changeIconColorNotSupportedForManagedMasterApp') : $t('tooltip.changeIconColour')
+ }}
+ </template>
<div class="flex items-center">
<GeneralProjectIcon :color="colorRef" :class="iconClass" :managed-app="managedApp" />
</div>
</NcTooltip>
</div>
-
- <template #overlay>
- <div class="flex justify-start">
- <GeneralColorPicker
- :model-value="colorRef"
- :colors="baseIconColors"
- :is-new-design="true"
- class="nc-base-icon-color-picker"
- @input="updateIconColor"
- />
- </div>
- </template>
</a-dropdown>
</div>
</template>
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 545246fabb..24e9425c3c 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -2128,6 +2128,7 @@
"clientCert": "Select .cert file",
"clientCA": "Select CA file",
"changeIconColour": "Change icon colour",
+ "changeIconColorNotSupportedForManagedMasterApp": "Change icon color is not supported for managed master app",
"preFillFormInfo": "To get a prefilled link, make sure you’ve filled the necessary fields in the form view builder.",
"surveyFormInfo": "Form mode with one field per page",
"useFieldEditMenuToConfigFieldType": "Use field edit menu for type conversions after file is imported",