Browse Source

Merge branch 'develop' into feat/ajv-validation-followup

pull/5222/head
Wing-Kam Wong 2 years ago
parent
commit
5b21e5bc44
  1. 3
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 8
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  3. 1
      packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue
  4. 1
      packages/nc-gui/lang/ar.json
  5. 1
      packages/nc-gui/lang/bn_IN.json
  6. 1
      packages/nc-gui/lang/cs.json
  7. 1
      packages/nc-gui/lang/da.json
  8. 3
      packages/nc-gui/lang/de.json
  9. 1
      packages/nc-gui/lang/es.json
  10. 1
      packages/nc-gui/lang/eu.json
  11. 1
      packages/nc-gui/lang/fa.json
  12. 1
      packages/nc-gui/lang/fi.json
  13. 1
      packages/nc-gui/lang/fr.json
  14. 1
      packages/nc-gui/lang/he.json
  15. 1
      packages/nc-gui/lang/hi.json
  16. 1
      packages/nc-gui/lang/hr.json
  17. 1
      packages/nc-gui/lang/id.json
  18. 1
      packages/nc-gui/lang/it.json
  19. 1
      packages/nc-gui/lang/ja.json
  20. 1
      packages/nc-gui/lang/ko.json
  21. 1
      packages/nc-gui/lang/lv.json
  22. 1
      packages/nc-gui/lang/nl.json
  23. 1
      packages/nc-gui/lang/no.json
  24. 1
      packages/nc-gui/lang/pl.json
  25. 1
      packages/nc-gui/lang/pt.json
  26. 1
      packages/nc-gui/lang/pt_BR.json
  27. 1
      packages/nc-gui/lang/ru.json
  28. 1
      packages/nc-gui/lang/sk.json
  29. 1
      packages/nc-gui/lang/sl.json
  30. 1
      packages/nc-gui/lang/sv.json
  31. 1
      packages/nc-gui/lang/th.json
  32. 1
      packages/nc-gui/lang/tr.json
  33. 1
      packages/nc-gui/lang/uk.json
  34. 1
      packages/nc-gui/lang/vi.json
  35. 1
      packages/nc-gui/lang/zh-Hans.json
  36. 1
      packages/nc-gui/lang/zh-Hant.json
  37. 77
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
  38. 2
      tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts

3
packages/nc-gui/components/cell/MultiSelect.vue

@ -32,6 +32,7 @@ interface Props {
modelValue?: string | string[]
rowIndex?: number
disableOptionCreation?: boolean
location?: 'cell' | 'filter'
}
const { modelValue, disableOptionCreation } = defineProps<Props>()
@ -336,7 +337,7 @@ useEventListener(document, 'click', handleClose, true)
v-for="op of options"
:key="op.id || op.title"
:value="op.title"
:data-testid="`select-option-${column.title}-${rowIndex}`"
:data-testid="`select-option-${column.title}-${location === 'filter' ? 'filter' : rowIndex}`"
:class="`nc-select-option-${column.title}-${op.title}`"
@click.stop
>

8
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -85,17 +85,17 @@ const filterUpdateCondition = (filter: FilterType, i: number) => {
) {
// anyof and nanyof can allow multiple selections,
// while `eq` and `neq` only allow one selection
filter.value = ''
filter.value = null
} else if (['blank', 'notblank', 'empty', 'notempty', 'null', 'notnull'].includes(filter.comparison_op!)) {
// since `blank`, `empty`, `null` doesn't require value,
// hence remove the previous value
filter.value = ''
filter.value = null
filter.comparison_sub_op = null
} else if ([UITypes.Date, UITypes.DateTime].includes(col.uidt as UITypes)) {
// for date / datetime,
// the input type could be decimal or datepicker / datetime picker
// hence remove the previous value
filter.value = ''
filter.value = null
if (
!comparisonSubOpList(filter.comparison_op!)
.map((op) => op.value)
@ -181,7 +181,7 @@ const selectFilterField = (filter: Filter, index: number) => {
}
// reset filter value as well
filter.value = ''
filter.value = null
saveOrUpdate(filter, index)
}

1
packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue

@ -193,6 +193,7 @@ const hasExtraPadding = $computed(() => {
:column="column"
class="flex"
v-bind="componentProps"
location="filter"
/>
</div>
</template>

1
packages/nc-gui/lang/ar.json

@ -235,6 +235,7 @@
"action": "إجراء",
"actions": "إجراءات",
"operation": "عملية",
"operationSub": "Sub Operation",
"operationType": "نوع العملية",
"operationSubType": "نوع العملية الفرعية",
"description": "وصف",

1
packages/nc-gui/lang/bn_IN.json

@ -235,6 +235,7 @@
"action": "করম",
"actions": "কি",
"operation": "অপশন",
"operationSub": "Sub Operation",
"operationType": "অপশন টইপ",
"operationSubType": "অপশন সব-টইপ",
"description": "বরণন",

1
packages/nc-gui/lang/cs.json

@ -235,6 +235,7 @@
"action": "Akce",
"actions": "Akce",
"operation": "Operace",
"operationSub": "Sub Operation",
"operationType": "Typ operace",
"operationSubType": "Podtyp operace",
"description": "Popis",

1
packages/nc-gui/lang/da.json

@ -235,6 +235,7 @@
"action": "Handling",
"actions": "Handlinger",
"operation": "Operation",
"operationSub": "Sub Operation",
"operationType": "Driftstype",
"operationSubType": "Drift Undertype",
"description": "Beskrivelse",

3
packages/nc-gui/lang/de.json

@ -100,7 +100,7 @@
"form": "Formular",
"kanban": "Kanban",
"calendar": "Kalender",
"map": "Karte"
"map": "Map"
},
"user": "Nutzer",
"users": "Benutzer",
@ -235,6 +235,7 @@
"action": "Aktion",
"actions": "Aktionen",
"operation": "Vorgang",
"operationSub": "Sub Operation",
"operationType": "Vorgangstyp",
"operationSubType": "Vorgangsuntertyp",
"description": "Beschreibung",

1
packages/nc-gui/lang/es.json

@ -235,6 +235,7 @@
"action": "Acción",
"actions": "Acciones",
"operation": "Operación",
"operationSub": "Sub Operation",
"operationType": "Tipo de operación",
"operationSubType": "Sub-tipo de operación",
"description": "Descripción",

1
packages/nc-gui/lang/eu.json

@ -235,6 +235,7 @@
"action": "Ekintza",
"actions": "Ekintzak",
"operation": "Operation",
"operationSub": "Sub Operation",
"operationType": "Operation type",
"operationSubType": "Operation sub-type",
"description": "Deskribapena",

1
packages/nc-gui/lang/fa.json

@ -235,6 +235,7 @@
"action": "اقدام",
"actions": "اقدامات",
"operation": "عملیات",
"operationSub": "Sub Operation",
"operationType": "نوع عملیات",
"operationSubType": "زیرگونه عملیات",
"description": "شرح",

1
packages/nc-gui/lang/fi.json

@ -235,6 +235,7 @@
"action": "Toiminta",
"actions": "Toiminnot",
"operation": "Operaatio",
"operationSub": "Sub Operation",
"operationType": "Käyttötyyppi",
"operationSubType": "Käyttö Alatyyppi",
"description": "Kuvaus",

1
packages/nc-gui/lang/fr.json

@ -235,6 +235,7 @@
"action": "Action",
"actions": "Actions",
"operation": "Opération",
"operationSub": "Sub Operation",
"operationType": "Type d'opération",
"operationSubType": "Sous-type d'opération",
"description": "Description",

1
packages/nc-gui/lang/he.json

@ -235,6 +235,7 @@
"action": "פעולה",
"actions": "פעולות",
"operation": "מבצע",
"operationSub": "Sub Operation",
"operationType": "סוג הפעולה",
"operationSubType": "מבצע תת-סוג",
"description": "תיאור",

1
packages/nc-gui/lang/hi.json

@ -235,6 +235,7 @@
"action": "गतििि",
"actions": "करवई",
"operation": "सलन",
"operationSub": "Sub Operation",
"operationType": "परचलन परकर",
"operationSubType": "परचलन उप-परकर",
"description": "विवरण",

1
packages/nc-gui/lang/hr.json

@ -235,6 +235,7 @@
"action": "Akcijski",
"actions": "Akcije",
"operation": "Operacija",
"operationSub": "Sub Operation",
"operationType": "Vrsta rada",
"operationSubType": "Operacija pod-vrsti",
"description": "Opis",

1
packages/nc-gui/lang/id.json

@ -235,6 +235,7 @@
"action": "Tindakan",
"actions": "Tindakan",
"operation": "Operasi",
"operationSub": "Sub Operation",
"operationType": "Jenis operasi",
"operationSubType": "SUB-tipe operasi",
"description": "Keterangan",

1
packages/nc-gui/lang/it.json

@ -235,6 +235,7 @@
"action": "Azione",
"actions": "Azioni",
"operation": "Operazione",
"operationSub": "Sub Operation",
"operationType": "Tipo di operazioni",
"operationSubType": "Sottotipo di operazioni",
"description": "Descrizione",

1
packages/nc-gui/lang/ja.json

@ -235,6 +235,7 @@
"action": "アクション",
"actions": "アクション",
"operation": "操作",
"operationSub": "Sub Operation",
"operationType": "操作タイプ",
"operationSubType": "操作サブタイプ",
"description": "説明",

1
packages/nc-gui/lang/ko.json

@ -235,6 +235,7 @@
"action": "동작",
"actions": "행위",
"operation": "작업",
"operationSub": "Sub Operation",
"operationType": "작업 유형",
"operationSubType": "작업 하위 유형",
"description": "설명",

1
packages/nc-gui/lang/lv.json

@ -235,6 +235,7 @@
"action": "Darbība",
"actions": "Darbības",
"operation": "Operācija",
"operationSub": "Sub Operation",
"operationType": "Operācijas tips",
"operationSubType": "Operācijas apakštips",
"description": "Apraksts",

1
packages/nc-gui/lang/nl.json

@ -235,6 +235,7 @@
"action": "Actie",
"actions": "Acties",
"operation": "Operatie",
"operationSub": "Sub Operation",
"operationType": "Operatietype",
"operationSubType": "Operatiesubtype",
"description": "Beschrijving",

1
packages/nc-gui/lang/no.json

@ -235,6 +235,7 @@
"action": "Handling",
"actions": "Handlinger",
"operation": "Operasjon",
"operationSub": "Sub Operation",
"operationType": "Operasjonstype",
"operationSubType": "OPERATION SUB-TYPE",
"description": "Beskrivelse",

1
packages/nc-gui/lang/pl.json

@ -235,6 +235,7 @@
"action": "Akcja",
"actions": "Akcje",
"operation": "Operacja",
"operationSub": "Sub Operation",
"operationType": "Typ operacji",
"operationSubType": "Podtypowy akcji",
"description": "Opis",

1
packages/nc-gui/lang/pt.json

@ -235,6 +235,7 @@
"action": "Açao",
"actions": "Ações",
"operation": "Operação",
"operationSub": "Sub Operation",
"operationType": "Tipo de operação",
"operationSubType": "Sub-tipo de operação",
"description": "Descrição",

1
packages/nc-gui/lang/pt_BR.json

@ -235,6 +235,7 @@
"action": "Açao",
"actions": "Ações",
"operation": "Operação",
"operationSub": "Sub Operation",
"operationType": "Tipo de operação",
"operationSubType": "Sub-tipo de operação",
"description": "Descrição",

1
packages/nc-gui/lang/ru.json

@ -235,6 +235,7 @@
"action": "Действие",
"actions": "Действия",
"operation": "Операция",
"operationSub": "Sub Operation",
"operationType": "Тип операции",
"operationSubType": "Подтип операции",
"description": "Описание",

1
packages/nc-gui/lang/sk.json

@ -235,6 +235,7 @@
"action": "Akcia",
"actions": "Činnosti",
"operation": "Operácia",
"operationSub": "Sub Operation",
"operationType": "Typ operácie",
"operationSubType": "Podtyp operácie",
"description": "Popis",

1
packages/nc-gui/lang/sl.json

@ -235,6 +235,7 @@
"action": "Akcija",
"actions": "Akcijah",
"operation": "Operacija",
"operationSub": "Sub Operation",
"operationType": "Tip operacije.",
"operationSubType": "Podpis delovanja",
"description": "Opis",

1
packages/nc-gui/lang/sv.json

@ -235,6 +235,7 @@
"action": "Handling",
"actions": "Handlingar",
"operation": "Drift",
"operationSub": "Sub Operation",
"operationType": "Driftstyp",
"operationSubType": "Driftstyp",
"description": "Beskrivning",

1
packages/nc-gui/lang/th.json

@ -235,6 +235,7 @@
"action": "หนงบ",
"actions": "การกระทำ",
"operation": "การดำเนนการ",
"operationSub": "Sub Operation",
"operationType": "ประเภทการทำงาน",
"operationSubType": "การดำเนนงานประเภทยอย",
"description": "คำอธบาย",

1
packages/nc-gui/lang/tr.json

@ -235,6 +235,7 @@
"action": "Aksiyon",
"actions": "Aksiyonlar",
"operation": "İşlem",
"operationSub": "Sub Operation",
"operationType": "İşlem türü",
"operationSubType": "İşlem alt-türü",
"description": "Tanım",

1
packages/nc-gui/lang/uk.json

@ -235,6 +235,7 @@
"action": "Дія",
"actions": "Дії",
"operation": "Операція",
"operationSub": "Sub Operation",
"operationType": "Тип операції",
"operationSubType": "Підтип операції",
"description": "Опис",

1
packages/nc-gui/lang/vi.json

@ -235,6 +235,7 @@
"action": "Hoạt động",
"actions": "Hành động",
"operation": "Hoạt động",
"operationSub": "Sub Operation",
"operationType": "Loại hoạt động",
"operationSubType": "Loại phụ hoạt động",
"description": "Sự miêu tả",

1
packages/nc-gui/lang/zh-Hans.json

@ -235,6 +235,7 @@
"action": "操作",
"actions": "操作",
"operation": "操作",
"operationSub": "Sub Operation",
"operationType": "操作类型",
"operationSubType": "子操作类型",
"description": "描述",

1
packages/nc-gui/lang/zh-Hant.json

@ -235,6 +235,7 @@
"action": "行動",
"actions": "行動",
"operation": "操作",
"operationSub": "Sub Operation",
"operationType": "操作類型",
"operationSubType": "操作子類型",
"description": "描述",

77
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -90,10 +90,20 @@ const parseConditionV2 = async (
const parentModel = await parentColumn.getModel();
await parentModel.getColumns();
if (colOptions.type === RelationTypes.HAS_MANY) {
if (
filter.comparison_op === 'empty' ||
filter.comparison_op === 'notempty'
) {
if (['blank', 'notblank'].includes(filter.comparison_op)) {
// handle self reference
if (parentModel.id === childModel.id) {
if (filter.comparison_op === 'blank') {
return (qb) => {
qb.whereNull(childColumn.column_name);
};
} else {
return (qb) => {
qb.whereNotNull(childColumn.column_name);
};
}
}
const selectHmCount = knex(childModel.table_name)
.count(childColumn.column_name)
.where(
@ -105,7 +115,7 @@ const parseConditionV2 = async (
);
return (qb) => {
if (filter.comparison_op === 'empty') {
if (filter.comparison_op === 'blank') {
qb.where(knex.raw('0'), selectHmCount);
} else {
qb.whereNot(knex.raw('0'), selectHmCount);
@ -136,14 +146,36 @@ const parseConditionV2 = async (
else qbP.whereIn(parentColumn.column_name, selectQb);
};
} else if (colOptions.type === RelationTypes.BELONGS_TO) {
if (filter.comparison_op === 'null') {
return (qb) => {
qb.whereNull(childColumn.column_name);
};
}
if (filter.comparison_op === 'notnull') {
if (['blank', 'notblank'].includes(filter.comparison_op)) {
// handle self reference
if (parentModel.id === childModel.id) {
if (filter.comparison_op === 'blank') {
return (qb) => {
qb.whereNull(childColumn.column_name);
};
} else {
return (qb) => {
qb.whereNotNull(childColumn.column_name);
};
}
}
const selectBtCount = knex(parentModel.table_name)
.count(parentColumn.column_name)
.where(
parentColumn.column_name,
knex.raw('??.??', [
alias || childModel.table_name,
childColumn.column_name,
])
);
return (qb) => {
qb.whereNotNull(childColumn.column_name);
if (filter.comparison_op === 'blank') {
qb.where(knex.raw('0'), selectBtCount);
} else {
qb.whereNot(knex.raw('0'), selectBtCount);
}
};
}
@ -175,10 +207,20 @@ const parseConditionV2 = async (
const mmParentColumn = await colOptions.getMMParentColumn();
const mmChildColumn = await colOptions.getMMChildColumn();
if (
filter.comparison_op === 'empty' ||
filter.comparison_op === 'notempty'
) {
if (['blank', 'notblank'].includes(filter.comparison_op)) {
// handle self reference
if (mmModel.id === childModel.id) {
if (filter.comparison_op === 'blank') {
return (qb) => {
qb.whereNull(childColumn.column_name);
};
} else {
return (qb) => {
qb.whereNotNull(childColumn.column_name);
};
}
}
const selectMmCount = knex(mmModel.table_name)
.count(mmChildColumn.column_name)
.where(
@ -190,7 +232,7 @@ const parseConditionV2 = async (
);
return (qb) => {
if (filter.comparison_op === 'empty') {
if (filter.comparison_op === 'blank') {
qb.where(knex.raw('0'), selectMmCount);
} else {
qb.whereNot(knex.raw('0'), selectMmCount);
@ -205,6 +247,7 @@ const parseConditionV2 = async (
`${mmModel.table_name}.${mmParentColumn.column_name}`,
`${parentModel.table_name}.${parentColumn.column_name}`
);
(
await parseConditionV2(
new Filter({

2
tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts

@ -123,7 +123,7 @@ export class ToolbarFilterPage extends BasePage {
for (let i = 0; i < v.length; i++) {
await this.rootPage
.locator(`.nc-dropdown-multi-select-cell`)
.locator(`.nc-select-option-MultiSelect-${v[i]}`)
.locator(`[data-testid="select-option-MultiSelect-filter"].nc-select-option-MultiSelect-${v[i]}`)
.click();
}
break;

Loading…
Cancel
Save