|
53 | 53 | <a-select |
54 | 54 | v-if="!dataView && filters && filters.length > 0" |
55 | 55 | :placeholder="$t('label.filterby')" |
56 | | - :value="$route.query.filter || (projectView && $route.name === 'vm' || |
57 | | - ['Admin', 'DomainAdmin'].includes($store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes($route.name) |
58 | | - ? 'all' : ['publicip'].includes($route.name) |
59 | | - ? 'allocated' : ['guestnetwork', 'guestvlans'].includes($route.name) |
60 | | - ? 'all' : ['volume'].includes($route.name) |
61 | | - ? 'user' : 'self')" |
| 56 | + :value="filterValue" |
62 | 57 | style="min-width: 120px; margin-left: 10px" |
63 | 58 | @change="changeFilter" |
64 | 59 | showSearch |
@@ -670,6 +665,25 @@ export default { |
670 | 665 | return [...new Set(sizes)].sort(function (a, b) { |
671 | 666 | return a - b |
672 | 667 | }).map(String) |
| 668 | + }, |
| 669 | + filterValue () { |
| 670 | + if (this.$route.query.filter) { |
| 671 | + return this.$route.query.filter |
| 672 | + } |
| 673 | + const routeName = this.$route.name |
| 674 | + if ((this.projectView && routeName === 'vm') || (['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes(routeName)) || ['guestnetwork', 'guestvlans'].includes(routeName)) { |
| 675 | + return 'all' |
| 676 | + } |
| 677 | + if (['publicip'].includes(routeName)) { |
| 678 | + return 'allocated' |
| 679 | + } |
| 680 | + if (['volume'].includes(routeName)) { |
| 681 | + return 'user' |
| 682 | + } |
| 683 | + if (['event'].includes(routeName)) { |
| 684 | + return 'active' |
| 685 | + } |
| 686 | + return 'self' |
673 | 687 | } |
674 | 688 | }, |
675 | 689 | methods: { |
@@ -1593,6 +1607,12 @@ export default { |
1593 | 1607 | } else if (filter === 'allocatedonly') { |
1594 | 1608 | query.allocatedonly = 'true' |
1595 | 1609 | } |
| 1610 | + } else if (this.$route.name === 'event') { |
| 1611 | + if (filter === 'archived') { |
| 1612 | + query.archived = true |
| 1613 | + } else { |
| 1614 | + delete query.archived |
| 1615 | + } |
1596 | 1616 | } |
1597 | 1617 | query.filter = filter |
1598 | 1618 | query.page = '1' |
|
0 commit comments