summaryrefslogtreecommitdiff
path: root/src/components/_sila/Global/Search.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/_sila/Global/Search.vue')
-rw-r--r--src/components/_sila/Global/Search.vue30
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();
},