fix: update base icon in cmd modal

This commit is contained in:
Ramesh Mane
2026-01-29 16:38:40 +00:00
parent 86ecbb4bb4
commit f64dc0c6e2
4 changed files with 42 additions and 6 deletions

View File

@@ -16,6 +16,8 @@ interface CmdAction {
keywords?: string[]
section?: string
iconColor?: string
managed_app_master?: boolean
managed_app_id?: string
}
const props = defineProps<{
@@ -90,6 +92,8 @@ const nestedScope = computed(() => {
section: parentEl?.section,
iconType: parentEl?.iconType,
iconColor: parent.startsWith('ws-') ? parentEl?.iconColor : null,
managed_app_master: !!parentEl?.managed_app_master,
managed_app_id: parentEl?.managed_app_id || '',
})
parent = parentEl?.parent || 'root'
}
@@ -431,9 +435,13 @@ defineExpose({
<template v-else-if="el.section === 'Bases' || el.icon === 'project'">
<GeneralBaseIconColorPicker
:key="el.iconColor"
:key="`${el.iconColor}-${el.managed_app_id}-${el.managed_app_master}`"
:model-value="el.iconColor"
type="database"
:managed-app="{
managed_app_master: el.managed_app_master,
managed_app_id: el.managed_app_id,
}"
readonly
class="cmdk-action-icon !w-5"
>
@@ -544,10 +552,14 @@ defineExpose({
/>
<template v-else-if="item.data.section === 'Bases' || item.data.icon === 'project'">
<GeneralBaseIconColorPicker
:key="item.data.iconColor"
:key="`${item.data.iconColor}-${item.data.managed_app_id}-${item.data.managed_app_master}`"
:model-value="item.data.iconColor"
type="database"
readonly
:managed-app="{
managed_app_master: item.data.managed_app_master,
managed_app_id: item.data.managed_app_id,
}"
>
</GeneralBaseIconColorPicker>
</template>

View File

@@ -219,7 +219,14 @@ onMounted(() => {
</div>
<div class="flex w-1/2 justify-end text-nc-content-gray-subtle2">
<div class="flex gap-2 px-2 py-1 rounded-md items-center">
<component :is="iconMap.project" class="w-4 h-4" />
<GeneralProjectIcon
:managed-app="{
managed_app_master: cmdOption?.managed_app_master,
managed_app_id: cmdOption?.managed_app_id,
}"
:color="cmdOption?.iconColor"
class="!h-4 !w-4"
/>
<a-tooltip overlay-class-name="!px-2 !py-1 !rounded-lg" :tooltip-style="{ zIndex: 1100 }">
<template #title>
{{ cmdOption.baseName }}

View File

@@ -1,5 +1,10 @@
<script lang="ts" setup>
const color1 = ref('')
const managedApp = ref({
managed_app_master: false,
managed_app_id: 'prr1pr4xx9vqn5c',
})
</script>
<template>
@@ -8,8 +13,17 @@ const color1 = ref('')
<h4>Simple</h4>
Selected color: {{ color1 }}
<div class="flex items-center gap-2">
<NcSwitch v-model:checked="managedApp.managed_app_master"> Toggle Managed App state </NcSwitch>
</div>
<div class="inline-block min-h-[24px] min-w-[24px] h-[24px] w-[24px] rounded-md" :class="[`bg-${color1}`]"></div>
<GeneralBaseIconColorPicker :model-value="color1" type="database" @update:model-value="color1 = $event">
<GeneralBaseIconColorPicker
:model-value="color1"
type="database"
@update:model-value="color1 = $event"
:managed-app="managedApp"
>
</GeneralBaseIconColorPicker>
</a-card>
</div>

View File

@@ -1264,7 +1264,7 @@ export const useViewsStore = defineStore('viewsStore', () => {
const tableName = tablesStore.baseTables.get(view.base_id)?.find((t) => t.id === view.fk_model_id)?.title
const baseName = bases.basesList.find((p) => p.id === view.base_id)?.title
const base = bases.basesList.find((p) => p.id === view.base_id)
allRecentViews.value = [
{
viewId: view.id,
@@ -1274,7 +1274,10 @@ export const useViewsStore = defineStore('viewsStore', () => {
viewType: view.type,
workspaceId: activeWorkspaceId.value,
tableName: tableName as string,
baseName: baseName as string,
baseName: base?.title as string,
managed_app_master: base?.managed_app_master,
managed_app_id: base?.managed_app_id,
iconColor: parseProp(base?.meta).iconColor,
},
...allRecentViews.value.filter((f) => f.viewId !== view.id || f.tableID !== view.fk_model_id),
]