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. 16
      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> </div>
</a-tooltip> </a-tooltip>
<a-tooltip placement="bottom"> <a-tooltip
v-if="isSharedForm || (!readOnly && isUIAllowed('tableAttachment') && !isPublic && !isLocked)"
placement="bottom"
>
<template #title> Rename File </template> <template #title> Rename File </template>
<div class="nc-attachment-download group-hover:(opacity-100) mr-[35px]"> <div class="nc-attachment-download group-hover:(opacity-100) mr-[35px]">

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

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

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

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

Loading…
Cancel
Save