Browse Source

fix(swagger): ignore system fields from filter and sort

- ignore hasmany and manytomany fields from sort

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3057/head
Pranav C 2 years ago
parent
commit
83be973007
  1. 11
      packages/nc-gui-v2/components/dashboard/TreeView.vue
  2. 22
      packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue
  3. 1
      packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue

11
packages/nc-gui-v2/components/dashboard/TreeView.vue

@ -296,12 +296,19 @@ const activeTable = computed(() => {
@apply relative cursor-pointer after:(content-[''] absolute top-0 left-0 w-full h-full right-0 !bg-current transition transition-opactity duration-100 opacity-0);
}
.nc-tree-item svg{
@apply text-gray-500
}
.nc-tree-item.active {
@apply !text-primary after:(!opacity-10);
@apply !text-primary after:(!opacity-5);
svg {
@apply !text-primary
}
}
.nc-tree-item:hover {
@apply !text-grey after:(!opacity-5);
@apply !text-grey after:(!opacity-2);
}
</style>

22
packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue

@ -1,6 +1,7 @@
<script setup lang="ts">
import type { SelectProps } from 'ant-design-vue'
import { isVirtualCol } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import { computed } from 'vue'
import { MetaInj } from '~/context'
import VirtualCellIcon from '~/components/smartsheet-header/VirtualCellIcon.vue'
@ -8,9 +9,10 @@ import CellIcon from '~/components/smartsheet-header/CellIcon.vue'
interface Props {
modelValue?: string
isSort?: boolean
}
const { modelValue } = defineProps<Props>()
const { modelValue, isSort } = defineProps<Props>()
const emit = defineEmits(['update:modelValue'])
@ -48,7 +50,18 @@ const localValue = computed({
},
} */
const options = computed<SelectProps['options']>(() =>
meta?.value?.columns?.map((c) => ({
meta?.value?.columns
?.filter(
(c: ColumnType) =>
c &&
(isSort
? !(
c.uidt === UITypes.LinkToAnotherRecord &&
(c.colOptions as LinkToAnotherRecordType).type !== RelationTypes.BELONGS_TO
)
: !c.colOptions || !c.system),
)
.map((c: ColumnType) => ({
value: c.id,
label: c.title,
icon: h(isVirtualCol(c) ? VirtualCellIcon : CellIcon, {
@ -75,7 +88,8 @@ const filterOption = (input: string, option: any) => {
>
<a-select-option v-for="option in options" :key="option.value" :value="option.value">
<div class="flex gap-2 text-xs items-center align-center h-full">
<component :is="option.icon" class="min-w-5 !mx-0" /> <span class="min-w-0"> {{ option.label }}</span>
<component :is="option.icon" class="min-w-5 !mx-0" />
<span class="min-w-0"> {{ option.label }}</span>
</div>
</a-select-option>
</a-select>

1
packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue

@ -59,6 +59,7 @@ watch(
v-model="sort.fk_column_id"
class="caption nc-sort-field-select"
:columns="columns"
is-sort
@click.stop
@update:model-value="saveOrUpdate(sort, i)"
/>

Loading…
Cancel
Save