mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
[editor] [#25] Allow searching in / sort rules
resolves #25 Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
41a7e6bf17
commit
86144f8783
1 changed files with 27 additions and 1 deletions
|
@ -1,5 +1,23 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<b-row class="mb-2">
|
||||||
|
<b-col>
|
||||||
|
<b-input-group>
|
||||||
|
<b-form-input
|
||||||
|
v-model.lazy="filter"
|
||||||
|
placeholder="Search in / filter rules..."
|
||||||
|
/>
|
||||||
|
<b-input-group-append>
|
||||||
|
<b-button @click="filter = ''">
|
||||||
|
<font-awesome-icon
|
||||||
|
fixed-width
|
||||||
|
:icon="['fas', 'trash']"
|
||||||
|
/>
|
||||||
|
</b-button>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-table
|
<b-table
|
||||||
|
@ -7,7 +25,7 @@
|
||||||
:busy="!rules"
|
:busy="!rules"
|
||||||
:fields="rulesFields"
|
:fields="rulesFields"
|
||||||
hover
|
hover
|
||||||
:items="rules"
|
:items="filteredRules"
|
||||||
striped
|
striped
|
||||||
>
|
>
|
||||||
<template #cell(_actions)="data">
|
<template #cell(_actions)="data">
|
||||||
|
@ -594,11 +612,19 @@ export default {
|
||||||
count += this.models.rule.match_users ? 1 : 0
|
count += this.models.rule.match_users ? 1 : 0
|
||||||
return count
|
return count
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filteredRules() {
|
||||||
|
const rules = [...this.rules]
|
||||||
|
.filter(rule => !this.filter || rule.description.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()))
|
||||||
|
rules.sort((a, b) => a.description.toLocaleLowerCase().localeCompare(b.description.toLocaleLowerCase()))
|
||||||
|
return rules
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
actions: [],
|
actions: [],
|
||||||
|
filter: '',
|
||||||
models: {
|
models: {
|
||||||
addAction: '',
|
addAction: '',
|
||||||
rule: {},
|
rule: {},
|
||||||
|
|
Loading…
Reference in a new issue