|
157 | 157 | style="min-height: 36px; padding-top: 12px; padding-left: 12px;" |
158 | 158 | > |
159 | 159 | <search-filter |
160 | | - :filters="getActiveFilters()" |
| 160 | + :filters="activeFiltersList" |
161 | 161 | :apiName="apiName" |
162 | 162 | @removeFilter="removeFilter" |
163 | 163 | /> |
@@ -1130,9 +1130,36 @@ export default { |
1130 | 1130 | } |
1131 | 1131 | }, |
1132 | 1132 | computed: { |
| 1133 | + activeFiltersList () { |
| 1134 | + const queryParams = Object.assign({}, this.$route.query) |
| 1135 | + const activeFilters = [] |
| 1136 | + for (const filter in queryParams) { |
| 1137 | + if (this.$route.name === 'host' && filter === 'type') { |
| 1138 | + continue |
| 1139 | + } |
| 1140 | + if (!filter.startsWith('tags[')) { |
| 1141 | + activeFilters.push({ |
| 1142 | + key: filter, |
| 1143 | + value: queryParams[filter], |
| 1144 | + isTag: false |
| 1145 | + }) |
| 1146 | + } else if (filter.endsWith('].key')) { |
| 1147 | + const tagIdx = filter.split('[')[1].split(']')[0] |
| 1148 | + const tagKey = queryParams[`tags[${tagIdx}].key`] |
| 1149 | + const tagValue = queryParams[`tags[${tagIdx}].value`] |
| 1150 | + activeFilters.push({ |
| 1151 | + key: tagKey, |
| 1152 | + value: tagValue, |
| 1153 | + isTag: true, |
| 1154 | + tagIdx: tagIdx |
| 1155 | + }) |
| 1156 | + } |
| 1157 | + } |
| 1158 | + return activeFilters |
| 1159 | + }, |
1133 | 1160 | showSearchFilters () { |
1134 | 1161 | const excludedKeys = ['page', 'pagesize', 'q', 'keyword', 'tags', 'projectid'] |
1135 | | - return !this.dataView && this.$config.showSearchFilters && this.getActiveFilters().some(f => !excludedKeys.includes(f.key)) |
| 1162 | + return !this.dataView && this.$config.showSearchFilters && this.activeFiltersList.some(f => !excludedKeys.includes(f.key)) |
1136 | 1163 | }, |
1137 | 1164 | hasSelected () { |
1138 | 1165 | return this.selectedRowKeys.length > 0 |
@@ -1690,30 +1717,6 @@ export default { |
1690 | 1717 | eventBus.emit('action-closing', { action: this.currentAction }) |
1691 | 1718 | this.closeAction() |
1692 | 1719 | }, |
1693 | | - getActiveFilters () { |
1694 | | - const queryParams = Object.assign({}, this.$route.query) |
1695 | | - const activeFilters = [] |
1696 | | - for (const filter in queryParams) { |
1697 | | - if (!filter.startsWith('tags[')) { |
1698 | | - activeFilters.push({ |
1699 | | - key: filter, |
1700 | | - value: queryParams[filter], |
1701 | | - isTag: false |
1702 | | - }) |
1703 | | - } else if (filter.endsWith('].key')) { |
1704 | | - const tagIdx = filter.split('[')[1].split(']')[0] |
1705 | | - const tagKey = queryParams[`tags[${tagIdx}].key`] |
1706 | | - const tagValue = queryParams[`tags[${tagIdx}].value`] |
1707 | | - activeFilters.push({ |
1708 | | - key: tagKey, |
1709 | | - value: tagValue, |
1710 | | - isTag: true, |
1711 | | - tagIdx: tagIdx |
1712 | | - }) |
1713 | | - } |
1714 | | - } |
1715 | | - return activeFilters |
1716 | | - }, |
1717 | 1720 | removeFilter (filter) { |
1718 | 1721 | const queryParams = Object.assign({}, this.$route.query) |
1719 | 1722 | if (filter.isTag) { |
|
0 commit comments