mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-25 21:47:03 +08:00
Fix filtering of template tags [SCI-8422]
This commit is contained in:
parent
e3c23bd474
commit
fc18c76efd
1 changed files with 16 additions and 22 deletions
|
|
@ -43,11 +43,11 @@
|
||||||
{{ field.key }}
|
{{ field.key }}
|
||||||
<i class="sn-icon sn-icon-plus-square"></i>
|
<i class="sn-icon sn-icon-plus-square"></i>
|
||||||
</div>
|
</div>
|
||||||
<template v-for="(repository, index) in filteredFields.repositories">
|
<div v-for="(repository, index) in filteredFields.repositories" :key="`repository_${index}`">
|
||||||
<div :key="`repository_${index}`" class="block-title">
|
<div class="block-title">
|
||||||
{{ repository.repository_name }}
|
{{ repository.repository_name }}
|
||||||
</div>
|
</div>
|
||||||
<div :key="`repository_${index}_${index1}`" v-for="(field, index1) in repository.tags"
|
<div v-for="(field, index1) in repository.tags" :key="`repository_${index}_${index1}`"
|
||||||
data-toggle="tooltip"
|
data-toggle="tooltip"
|
||||||
data-placement="right"
|
data-placement="right"
|
||||||
:data-template="tooltipTemplate"
|
:data-template="tooltipTemplate"
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
{{ field.key }}
|
{{ field.key }}
|
||||||
<i class="sn-icon sn-icon-plus-square"></i>
|
<i class="sn-icon sn-icon-plus-square"></i>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</div>
|
||||||
<div class="no-results" v-if="this.noResults">
|
<div class="no-results" v-if="this.noResults">
|
||||||
{{ i18n.t('label_templates.show.insert_dropdown.nothing_found') }}
|
{{ i18n.t('label_templates.show.insert_dropdown.nothing_found') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -107,28 +107,22 @@
|
||||||
</div>`
|
</div>`
|
||||||
},
|
},
|
||||||
filteredFields() {
|
filteredFields() {
|
||||||
let result = {};
|
|
||||||
if (this.searchValue.length == 0) {
|
|
||||||
result = this.fields;
|
|
||||||
} else {
|
|
||||||
let filteredRepositories = this.filterArray(this.fields.repositories, 'repository_name');
|
|
||||||
filteredRepositories = filteredRepositories.map((repo) => {
|
|
||||||
repo.tags = this.filterArray(repo.tags, 'key');
|
|
||||||
return repo;
|
|
||||||
});
|
|
||||||
|
|
||||||
result = {
|
|
||||||
default: this.filterArray(this.fields.default, 'key'),
|
|
||||||
common: this.filterArray(this.fields.common, 'key'),
|
|
||||||
repositories: filteredRepositories,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
$('.tooltip').remove();
|
$('.tooltip').remove();
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
|
if (this.searchValue.length == 0) {
|
||||||
|
return this.fields;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
default: this.filterArray(this.fields.default, 'key'),
|
||||||
|
common: this.filterArray(this.fields.common, 'key'),
|
||||||
|
repositories: this.filterArray(this.fields.repositories, 'repository_name').map((repo) => {
|
||||||
|
return { ...repo, tags: this.filterArray(repo.tags, 'key') };
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
noResults() {
|
noResults() {
|
||||||
return this.filteredFields.default.concat(this.filteredFields.common, this.filteredFields.repositories).length === 0;
|
return this.filteredFields.default.concat(this.filteredFields.common, this.filteredFields.repositories).length === 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue