Skip to content

Commit

Permalink
Merge pull request #20 from gapitio/history
Browse files Browse the repository at this point in the history
feat: add search for history view
  • Loading branch information
sbgap authored May 16, 2024
2 parents a3af75e + 8be46aa commit 460ec60
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<v-spacer />

<v-text-field
v-if="$route.name === 'alerts'"
v-if="$route.name === 'alerts' || $route.name === 'history'"
v-model="query"
:flat="!hasFocus"
:label="$t('Search')"
Expand Down
69 changes: 39 additions & 30 deletions src/views/History.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
<template>
<div class="alerts">
<v-tabs
v-model="currentTab"
class="px-1"
grow
>
<v-tab
v-for="env in environments"
:key="env"
:href="'#tab-' + env"
@click="setEnv(env)"
>
{{ env }}&nbsp;({{ environmentCounts[env] || 0 }})
</v-tab>

<v-spacer />

<v-tabs-items
<v-card>
<v-card-title class="title">
{{ $t('Alerts History') }}
</v-card-title>
<v-tabs
v-model="currentTab"
class="px-1"
grow
>
<v-tab-item
<v-tab
v-for="env in environments"
:key="env"
:value="'tab-' + env"
:transition="false"
:reverse-transition="false"
:href="'#tab-' + env"
@click="setEnv(env)"
>
<keep-alive max="1">
<history-list
v-if="env == filter.environment || env == 'ALL'"
:history="historyByEnvironment"
/>
</keep-alive>
</v-tab-item>
</v-tabs-items>
</v-tabs>
{{ env }}&nbsp;({{ environmentCounts[env] || 0 }})
</v-tab>

<v-spacer />

<v-tabs-items
v-model="currentTab"
>
<v-tab-item
v-for="env in environments"
:key="env"
:value="'tab-' + env"
:transition="false"
:reverse-transition="false"
>
<keep-alive max="1">
<history-list
v-if="env == filter.environment || env == 'ALL'"
:history="historyByEnvironment"
/>
</keep-alive>
</v-tab-item>
</v-tabs-items>
</v-tabs>
</v-card>
</div>
</template>

Expand Down Expand Up @@ -151,6 +156,7 @@ export default {
}
},
created() {
this.setSearch(this.query)
if (this.hash) {
let hashMap = utils.fromHash(this.hash)
this.setFilter(hashMap)
Expand Down Expand Up @@ -185,6 +191,9 @@ export default {
getHistory() {
return this.$store.dispatch('alerts/getAlertHistory')
},
setSearch(query) {
this.$store.dispatch('alerts/updateQuery', query)
},
getEnvironments() {
this.$store.dispatch('alerts/getEnvironments')
},
Expand Down

0 comments on commit 460ec60

Please sign in to comment.