|
|
@ -10,16 +10,16 @@ |
|
|
|
<template v-if="filter.is_group"> |
|
|
|
<template v-if="filter.is_group"> |
|
|
|
<v-icon |
|
|
|
<v-icon |
|
|
|
v-if="!filter.readOnly" |
|
|
|
v-if="!filter.readOnly" |
|
|
|
|
|
|
|
:key="i + '_1'" |
|
|
|
small |
|
|
|
small |
|
|
|
class="nc-filter-item-remove-btn" |
|
|
|
class="nc-filter-item-remove-btn" |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
:key="i + '_1'" |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
mdi-close-box |
|
|
|
mdi-close-box |
|
|
|
</v-icon> |
|
|
|
</v-icon> |
|
|
|
<span v-else :key="i + '_1'" /> |
|
|
|
<span v-else :key="i + '_1'" /> |
|
|
|
|
|
|
|
|
|
|
|
<span :key="i + '_2'" v-if="!i" class="caption d-flex align-center">{{ $t('labels.where') }}</span> |
|
|
|
<span v-if="!i" :key="i + '_2'" class="caption d-flex align-center">{{ $t('labels.where') }}</span> |
|
|
|
<v-select |
|
|
|
<v-select |
|
|
|
v-else |
|
|
|
v-else |
|
|
|
:key="i + '_2'" |
|
|
|
:key="i + '_2'" |
|
|
@ -38,12 +38,12 @@ |
|
|
|
<span class="caption font-weight-regular">{{ item }}</span> |
|
|
|
<span class="caption font-weight-regular">{{ item }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</v-select> |
|
|
|
</v-select> |
|
|
|
<span :key="i + '_3'" style="grid-column: span 3"></span> |
|
|
|
<span :key="i + '_3'" style="grid-column: span 3" /> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<div v-if="filter.is_group" :key="i + '_4'" style="grid-column: span 5; padding: 6px" class="elevation-4"> |
|
|
|
<div v-if="filter.is_group" :key="i + '_4'" style="grid-column: span 5; padding: 6px" class="elevation-4"> |
|
|
|
<column-filter |
|
|
|
<column-filter |
|
|
|
v-if="filter.id || shared" |
|
|
|
v-if="filter.id || shared || !autoApply" |
|
|
|
ref="nestedFilter" |
|
|
|
ref="nestedFilter" |
|
|
|
v-model="filter.children" |
|
|
|
v-model="filter.children" |
|
|
|
:parent-id="filter.id" |
|
|
|
:parent-id="filter.id" |
|
|
@ -100,12 +100,12 @@ |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<v-select |
|
|
|
<v-select |
|
|
|
|
|
|
|
v-if="filter && filter.fk_column_id" |
|
|
|
:key="i + '_8'" |
|
|
|
:key="i + '_8'" |
|
|
|
v-model="filter.comparison_op" |
|
|
|
v-model="filter.comparison_op" |
|
|
|
class="flex-shrink-1 flex-grow-0 caption nc-filter-operation-select" |
|
|
|
class="flex-shrink-1 flex-grow-0 caption nc-filter-operation-select" |
|
|
|
:items="filterComparisonOp(filter)" |
|
|
|
:items="filterComparisonOp(filter)" |
|
|
|
:placeholder="$t('labels.operation')" |
|
|
|
:placeholder="$t('labels.operation')" |
|
|
|
v-if="filter && filter.fk_column_id" |
|
|
|
|
|
|
|
solo |
|
|
|
solo |
|
|
|
flat |
|
|
|
flat |
|
|
|
style="max-width: 120px" |
|
|
|
style="max-width: 120px" |
|
|
@ -120,7 +120,7 @@ |
|
|
|
<span class="caption font-weight-regular">{{ item.text }}</span> |
|
|
|
<span class="caption font-weight-regular">{{ item.text }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</v-select> |
|
|
|
</v-select> |
|
|
|
<span v-else :key="i + '_8'"></span> |
|
|
|
<span v-else :key="i + '_8'" /> |
|
|
|
<span v-if="['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)" :key="i + '_5'" /> |
|
|
|
<span v-if="['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)" :key="i + '_5'" /> |
|
|
|
<v-checkbox |
|
|
|
<v-checkbox |
|
|
|
v-else-if="types[filter.field] === 'boolean'" |
|
|
|
v-else-if="types[filter.field] === 'boolean'" |
|
|
@ -143,19 +143,19 @@ |
|
|
|
@click.stop |
|
|
|
@click.stop |
|
|
|
@input="saveOrUpdate(filter, i)" |
|
|
|
@input="saveOrUpdate(filter, i)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<span v-else :key="i + '_9'"></span> |
|
|
|
<span v-else :key="i + '_9'" /> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<v-btn small class="elevation-0 grey--text my-3" @click.stop="addFilter"> |
|
|
|
<v-btn small class="elevation-0 grey--text my-3" @click.stop="addFilter"> |
|
|
|
<v-icon small color="grey"> mdi-plus</v-icon> |
|
|
|
<v-icon small color="grey"> mdi-plus </v-icon> |
|
|
|
<!-- Add Filter --> |
|
|
|
<!-- Add Filter --> |
|
|
|
{{ $t('activity.addFilter') }} |
|
|
|
{{ $t('activity.addFilter') }} |
|
|
|
</v-btn> |
|
|
|
</v-btn> |
|
|
|
<v-btn v-if="!webHook" small class="elevation-0 grey--text my-3" @click.stop="addFilterGroup"> |
|
|
|
<v-btn v-if="!webHook" small class="elevation-0 grey--text my-3" @click.stop="addFilterGroup"> |
|
|
|
<v-icon small color="grey"> mdi-plus</v-icon> |
|
|
|
<v-icon small color="grey"> mdi-plus </v-icon> |
|
|
|
Add Filter Group |
|
|
|
Add Filter Group |
|
|
|
<!-- todo: add i18n {{ $t('activity.addFilterGroup') }}--> |
|
|
|
<!-- todo: add i18n {{ $t('activity.addFilterGroup') }}--> |
|
|
|
</v-btn> |
|
|
|
</v-btn> |
|
|
@ -297,11 +297,14 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
async viewId(v) { |
|
|
|
viewId: { |
|
|
|
|
|
|
|
async handler(v) { |
|
|
|
if (v) { |
|
|
|
if (v) { |
|
|
|
await this.loadFilter(); |
|
|
|
await this.loadFilter(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
immediate: true, |
|
|
|
|
|
|
|
}, |
|
|
|
filters: { |
|
|
|
filters: { |
|
|
|
handler(v) { |
|
|
|
handler(v) { |
|
|
|
this.$emit('input', v && v.filter(f => (f.fk_column_id && f.comparison_op) || f.is_group)); |
|
|
|
this.$emit('input', v && v.filter(f => (f.fk_column_id && f.comparison_op) || f.is_group)); |
|
|
@ -309,9 +312,6 @@ export default { |
|
|
|
deep: true, |
|
|
|
deep: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
|
|
|
|
this.loadFilter(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
filterComparisonOp(f) { |
|
|
|
filterComparisonOp(f) { |
|
|
|
return this.comparisonOp.filter(op => { |
|
|
|
return this.comparisonOp.filter(op => { |
|
|
@ -348,11 +348,15 @@ export default { |
|
|
|
await this.$api.dbTableFilter.update(filter.id, { |
|
|
|
await this.$api.dbTableFilter.update(filter.id, { |
|
|
|
...filter, |
|
|
|
...filter, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
|
|
|
|
children: undefined, |
|
|
|
|
|
|
|
status: undefined, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
await this.$api.dbTableFilter.update(filter.id, { |
|
|
|
await this.$api.dbTableFilter.update(filter.id, { |
|
|
|
...filter, |
|
|
|
...filter, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
|
|
|
|
children: undefined, |
|
|
|
|
|
|
|
status: undefined, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (this.hookId || hookId) { |
|
|
|
} else if (this.hookId || hookId) { |
|
|
@ -362,6 +366,7 @@ export default { |
|
|
|
await this.$api.dbTableWebhookFilter.create(this.hookId || hookId, { |
|
|
|
await this.$api.dbTableWebhookFilter.create(this.hookId || hookId, { |
|
|
|
...filter, |
|
|
|
...filter, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
|
|
|
|
status: undefined, |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -371,6 +376,7 @@ export default { |
|
|
|
await this.$api.dbTableFilter.create(this.viewId, { |
|
|
|
await this.$api.dbTableFilter.create(this.viewId, { |
|
|
|
...filter, |
|
|
|
...filter, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
fk_parent_id: this.parentId, |
|
|
|
|
|
|
|
status: undefined, |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -378,9 +384,11 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.$refs.nestedFilter) { |
|
|
|
if (this.$refs.nestedFilter) { |
|
|
|
for (const nestedFilter of this.$refs.nestedFilter) { |
|
|
|
for (const nestedFilter of this.$refs.nestedFilter) { |
|
|
|
|
|
|
|
if (nestedFilter.parentId) { |
|
|
|
await nestedFilter.applyChanges(true); |
|
|
|
await nestedFilter.applyChanges(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
this.loadFilter(); |
|
|
|
this.loadFilter(); |
|
|
|
if (!nested) { |
|
|
|
if (!nested) { |
|
|
|
this.$emit('updated'); |
|
|
|
this.$emit('updated'); |
|
|
@ -389,12 +397,12 @@ export default { |
|
|
|
async loadFilter() { |
|
|
|
async loadFilter() { |
|
|
|
let filters = []; |
|
|
|
let filters = []; |
|
|
|
if (this.viewId && this._isUIAllowed('filterSync')) { |
|
|
|
if (this.viewId && this._isUIAllowed('filterSync')) { |
|
|
|
filters = this.parentId |
|
|
|
filters = this.nested |
|
|
|
? await this.$api.dbTableFilter.childrenRead(this.parentId) |
|
|
|
? await this.$api.dbTableFilter.childrenRead(this.parentId) |
|
|
|
: await this.$api.dbTableFilter.read(this.viewId); |
|
|
|
: await this.$api.dbTableFilter.read(this.viewId); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.hookId && this._isUIAllowed('filterSync')) { |
|
|
|
if (this.hookId && this._isUIAllowed('filterSync')) { |
|
|
|
filters = this.parentId |
|
|
|
filters = this.nested |
|
|
|
? await this.$api.dbTableFilter.childrenRead(this.parentId) |
|
|
|
? await this.$api.dbTableFilter.childrenRead(this.parentId) |
|
|
|
: await this.$api.dbTableWebhookFilter.read(this.hookId); |
|
|
|
: await this.$api.dbTableWebhookFilter.read(this.hookId); |
|
|
|
} |
|
|
|
} |
|
|
|