From d2056aec52ec489edf3447ac5eea5d8fc3c14942 Mon Sep 17 00:00:00 2001 From: Gabriel Pastori <58153955+gabrielpastori1@users.noreply.github.com> Date: Tue, 12 Dec 2023 11:03:45 -0300 Subject: [PATCH] add search and fix chatwoot save --- package.json | 2 +- src/components/instance/settings/Chatwoot.vue | 3 +- src/views/Home.vue | 189 +++++++++++------- 3 files changed, 118 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 7464d22..c86399e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "evolution-manager", "description": "Evolution Manager is an open-source interface for managing the Evolution API, simplifying the creation and administration of API instances with advanced features and diverse integrations.", - "version": "0.4.2", + "version": "0.4.3", "main": "dist", "engines": { "node": ">=16.0.0" diff --git a/src/components/instance/settings/Chatwoot.vue b/src/components/instance/settings/Chatwoot.vue index 7d5ffaa..4a46f49 100644 --- a/src/components/instance/settings/Chatwoot.vue +++ b/src/components/instance/settings/Chatwoot.vue @@ -139,11 +139,12 @@ v-model="chatwootData.auto_create" label="Conversa pendente" :disabled="loading || !AppStore.versionSatisfies('>=1.6.0')" - :error-messages="[ + :hint="[ !AppStore.versionSatisfies('>=1.6.0') ? 'Disponível a partir da versão 1.6.0' : undefined, ]" + :persistent-hint="!AppStore.versionSatisfies('>=1.6.0')" hide-details="auto" class="mb-3" density="compact" diff --git a/src/views/Home.vue b/src/views/Home.vue index 6cd2153..d3d87eb 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -25,77 +25,111 @@ - + - {{ loading ? "Carregando..." : "Nenhuma instância encontrada" }} + Carregando... - - - +
+ + + + Todos + + + {{ item.text }} + + +
+
+ + + + Nenhuma instância encontrada +
@@ -122,16 +156,8 @@ export default { loadingDelete: false, error: false, statusMapper: statusMapper, - headers: [ - { - title: "Nome", - align: "start", - sortable: true, - key: "instance.instanceName", - }, - { title: "Status", key: "instance.status" }, - { title: "Ações", key: "actions", sortable: false, align: "center" }, - ], + statusFilter: false, + search: "", }), methods: { addInstance() { @@ -176,10 +202,25 @@ export default { loading() { return this.loadingInner || this.AppStore.connecting; }, - instances() { return this.AppStore.instances; }, + filteredInstances() { + const instances = this.instances.filter((instance) => { + if (!this.statusFilter) return true; + return instance.instance.status === this.statusFilter; + }); + + if (!this.search) return instances; + return instances.filter((instance) => { + const search = this.search.trim().toLowerCase(); + + return ( + instance.instance.instanceName.toLowerCase().includes(search) || + instance.instance.owner.toLowerCase().includes(search) + ); + }); + }, }, mounted() {}, };