diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-04 17:05:44 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-04 17:05:44 +0300 |
commit | 87ed13ac7e47945e3c5e1ed94f5aade99d2cc5ae (patch) | |
tree | 916f8bbf9341fc4d69eef4252b6f3751bc2ad744 /src/components/_sila/Global | |
parent | 597dbacbb1eec27115b0e8e5dfe1876952f99ac2 (diff) | |
download | webui-vue-87ed13ac7e47945e3c5e1ed94f5aade99d2cc5ae.tar.xz |
move tasks from sila-dev, lysak
Diffstat (limited to 'src/components/_sila/Global')
-rw-r--r-- | src/components/_sila/Global/Search.vue | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/_sila/Global/Search.vue b/src/components/_sila/Global/Search.vue index c25224a7..79a403ad 100644 --- a/src/components/_sila/Global/Search.vue +++ b/src/components/_sila/Global/Search.vue @@ -82,15 +82,45 @@ export default { searchBy: 'all', }; }, + computed: { + params() { + const hash = window.location.hash; + + if (!hash || hash.indexOf('?') === -1) { + return; + } + + const paramsString = window.location.hash.split('?')[1]; + return new URLSearchParams(paramsString); + }, + }, + created() { + this.search(); + }, methods: { onSelect() { this.$emit('search-by', this.searchBy); }, + removeSearchParam() { + window.location.href = '/#/logs/event-logs'; + }, + search() { + if (!this.params) { + return; + } + + let search = this.params.get('search'); + if (search) { + this.filter = search; + this.onChangeInput(); + } + }, onChangeInput() { this.$emit('change-search', this.filter); }, onClearSearch() { this.filter = ''; + this.removeSearchParam(); this.$emit('clear-search'); this.$refs.searchInput.focus(); }, |