|
114 | 114 | style="min-height: 36px; padding-top: 12px; padding-left: 12px;" |
115 | 115 | > |
116 | 116 | <search-filter |
117 | | - :filters="getActiveFilters()" |
| 117 | + :filters="activeFiltersList" |
118 | 118 | :apiName="apiName" |
119 | 119 | @removeFilter="removeFilter" |
120 | 120 | /> |
@@ -690,9 +690,36 @@ export default { |
690 | 690 | } |
691 | 691 | }, |
692 | 692 | computed: { |
| 693 | + activeFiltersList () { |
| 694 | + const queryParams = Object.assign({}, this.$route.query) |
| 695 | + const activeFilters = [] |
| 696 | + for (const filter in queryParams) { |
| 697 | + if (this.$route.name === 'host' && filter === 'type') { |
| 698 | + continue |
| 699 | + } |
| 700 | + if (!filter.startsWith('tags[')) { |
| 701 | + activeFilters.push({ |
| 702 | + key: filter, |
| 703 | + value: queryParams[filter], |
| 704 | + isTag: false |
| 705 | + }) |
| 706 | + } else if (filter.endsWith('].key')) { |
| 707 | + const tagIdx = filter.split('[')[1].split(']')[0] |
| 708 | + const tagKey = queryParams[`tags[${tagIdx}].key`] |
| 709 | + const tagValue = queryParams[`tags[${tagIdx}].value`] |
| 710 | + activeFilters.push({ |
| 711 | + key: tagKey, |
| 712 | + value: tagValue, |
| 713 | + isTag: true, |
| 714 | + tagIdx: tagIdx |
| 715 | + }) |
| 716 | + } |
| 717 | + } |
| 718 | + return activeFilters |
| 719 | + }, |
693 | 720 | showSearchFilters () { |
694 | 721 | const excludedKeys = ['page', 'pagesize', 'q', 'keyword', 'tags', 'projectid'] |
695 | | - return !this.dataView && this.$config.showSearchFilters && this.getActiveFilters().some(f => !excludedKeys.includes(f.key)) |
| 722 | + return !this.dataView && this.$config.showSearchFilters && this.activeFiltersList.some(f => !excludedKeys.includes(f.key)) |
696 | 723 | }, |
697 | 724 | hasSelected () { |
698 | 725 | return this.selectedRowKeys.length > 0 |
@@ -1145,30 +1172,6 @@ export default { |
1145 | 1172 | eventBus.emit('action-closing', { action: this.currentAction }) |
1146 | 1173 | this.closeAction() |
1147 | 1174 | }, |
1148 | | - getActiveFilters () { |
1149 | | - const queryParams = Object.assign({}, this.$route.query) |
1150 | | - const activeFilters = [] |
1151 | | - for (const filter in queryParams) { |
1152 | | - if (!filter.startsWith('tags[')) { |
1153 | | - activeFilters.push({ |
1154 | | - key: filter, |
1155 | | - value: queryParams[filter], |
1156 | | - isTag: false |
1157 | | - }) |
1158 | | - } else if (filter.endsWith('].key')) { |
1159 | | - const tagIdx = filter.split('[')[1].split(']')[0] |
1160 | | - const tagKey = queryParams[`tags[${tagIdx}].key`] |
1161 | | - const tagValue = queryParams[`tags[${tagIdx}].value`] |
1162 | | - activeFilters.push({ |
1163 | | - key: tagKey, |
1164 | | - value: tagValue, |
1165 | | - isTag: true, |
1166 | | - tagIdx: tagIdx |
1167 | | - }) |
1168 | | - } |
1169 | | - } |
1170 | | - return activeFilters |
1171 | | - }, |
1172 | 1175 | removeFilter (filter) { |
1173 | 1176 | const queryParams = Object.assign({}, this.$route.query) |
1174 | 1177 | if (filter.isTag) { |
|
0 commit comments