Browse Source

fix(gui): hide attachment edit option in readonly mode

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5063/head
Pranav C 2 years ago
parent
commit
9c61b18f0a
  1. 5
      packages/nc-gui/components/cell/attachment/Modal.vue
  2. 8
      packages/nc-gui/components/template/Editor.vue
  3. 23
      packages/nc-gui/components/virtual-cell/Lookup.vue

5
packages/nc-gui/components/cell/attachment/Modal.vue

@ -146,7 +146,10 @@ function onRemoveFileClick(title: any, i: number) {
</div>
</a-tooltip>
<a-tooltip placement="bottom">
<a-tooltip
v-if="isSharedForm || (!readOnly && isUIAllowed('tableAttachment') && !isPublic && !isLocked)"
placement="bottom"
>
<template #title> Rename File </template>
<div class="nc-attachment-download group-hover:(opacity-100) mr-[35px]">

8
packages/nc-gui/components/template/Editor.vue

@ -501,16 +501,12 @@ async function importTemplate() {
}
}
}
const createdTable = await $api.base.tableCreate(
project.value?.id as string,
(baseId || project.value?.bases?.[0].id)!,
{
const createdTable = await $api.base.tableCreate(project.value?.id as string, (baseId || project.value?.bases?.[0].id)!, {
table_name: table.table_name,
// leave title empty to get a generated one based on table_name
title: '',
columns: table.columns || [],
},
)
})
table.id = createdTable.id
table.title = createdTable.title

23
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -92,12 +92,17 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
:edit-enabled="false"
:model-value="v"
:column="lookupColumn"
:readOnly="true"
:read-only="true"
/>
</template>
<LazySmartsheetVirtualCell v-else :edit-enabled="false"
:readOnly="true" :model-value="arrValue" :column="lookupColumn" />
<LazySmartsheetVirtualCell
v-else
:edit-enabled="false"
:read-only="true"
:model-value="arrValue"
:column="lookupColumn"
/>
</div>
<!-- Render normal cell -->
@ -106,8 +111,7 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
v-if="isAttachment(lookupColumn) && arrValue[0] && !Array.isArray(arrValue[0]) && typeof arrValue[0] === 'object'"
class="min-w-max"
>
<LazySmartsheetCell :model-value="arrValue" :column="lookupColumn" :edit-enabled="false"
:readOnly="true" />
<LazySmartsheetCell :model-value="arrValue" :column="lookupColumn" :edit-enabled="false" :read-only="true" />
</div>
<!-- For attachment cell avoid adding chip style -->
<template v-else>
@ -122,8 +126,13 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
),
}"
>
<LazySmartsheetCell :model-value="v" :column="lookupColumn" :edit-enabled="false" :virtual="true"
:readOnly="true" />
<LazySmartsheetCell
:model-value="v"
:column="lookupColumn"
:edit-enabled="false"
:virtual="true"
:read-only="true"
/>
</div>
</template>
</template>

Loading…
Cancel
Save