Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search for history view #20

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading