Browse Source

refactor(gui): remove sort option from LTAR column

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4504/head
Pranav C 2 years ago
parent
commit
0c83506e7f
  1. 37
      packages/nc-gui/components/smartsheet/header/Menu.vue

37
packages/nc-gui/components/smartsheet/header/Menu.vue

@ -1,12 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk' import { RelationTypes, UITypes } from 'nocodb-sdk'
import { import {
ColumnInj, ColumnInj,
IsLockedInj, IsLockedInj,
MetaInj, MetaInj,
Modal, Modal,
ReloadViewDataHookInj, ReloadViewDataHookInj,
defineEmits,
defineProps,
extractSdkResponseErrorMsg, extractSdkResponseErrorMsg,
inject, inject,
message, message,
@ -156,11 +158,12 @@ const duplicateColumn = async () => {
await getMeta(meta!.value!.id!, true) await getMeta(meta!.value!.id!, true)
eventBus.emit(SmartsheetStoreEvents.FIELD_RELOAD) eventBus.emit(SmartsheetStoreEvents.FIELD_RELOAD)
} catch (e: any) { } catch (e) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
} }
// add column before or after current column
const addColumn = async (before = false) => { const addColumn = async (before = false) => {
const gridViewColumnList = await $api.dbViewColumn.list(view.value?.id as string) const gridViewColumnList = await $api.dbViewColumn.list(view.value?.id as string)
@ -189,6 +192,7 @@ const addColumn = async (before = false) => {
}) })
} }
// hide the field in view
const hideField = async () => { const hideField = async () => {
const gridViewColumnList = await $api.dbViewColumn.list(view.value?.id as string) const gridViewColumnList = await $api.dbViewColumn.list(view.value?.id as string)
@ -212,20 +216,21 @@ const hideField = async () => {
{{ $t('general.edit') }} {{ $t('general.edit') }}
</div> </div>
</a-menu-item> </a-menu-item>
<a-divider class="!my-0" /> <template v-if="column.uidt !== UITypes.LinkToAnotherRecord || column.colOptions.type !== RelationTypes.BELONGS_TO">
<a-menu-item @click="sortByColumn('asc')"> <a-divider class="!my-0" />
<div class="nc-column-insert-after nc-header-menu-item"> <a-menu-item @click="sortByColumn('asc')">
<MdiSortAscending class="text-primary" /> <div class="nc-column-insert-after nc-header-menu-item">
Sort Ascending <MdiSortAscending class="text-primary" />
</div> Sort Ascending
</a-menu-item> </div>
<a-menu-item @click="sortByColumn('desc')"> </a-menu-item>
<div class="nc-column-insert-before nc-header-menu-item"> <a-menu-item @click="sortByColumn('desc')">
<MdiSortDescending class="text-primary" /> <div class="nc-column-insert-before nc-header-menu-item">
Sort Descending <MdiSortDescending class="text-primary" />
</div> Sort Descending
</a-menu-item> </div>
</a-menu-item>
</template>
<a-divider class="!my-0" /> <a-divider class="!my-0" />
<a-menu-item @click="hideField"> <a-menu-item @click="hideField">
<div class="nc-column-insert-before nc-header-menu-item"> <div class="nc-column-insert-before nc-header-menu-item">

Loading…
Cancel
Save