mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-07-16 12:12:56 -06:00
new instance layout
This commit is contained in:
parent
7591cc4362
commit
75d01cba39
@ -24,73 +24,84 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<v-row dense>
|
||||||
|
<v-col cols="12" v-if="instances.length === 0 || loading">
|
||||||
|
<v-progress-linear
|
||||||
|
v-if="loading"
|
||||||
|
indeterminate
|
||||||
|
color="info"
|
||||||
|
></v-progress-linear>
|
||||||
|
<v-alert type="info" class="mb-4" v-else :loading="loading" outlined>
|
||||||
|
{{ loading ? "Carregando..." : "Nenhuma instância encontrada" }}
|
||||||
|
</v-alert>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
<v-data-table
|
<v-col
|
||||||
:headers="headers"
|
cols="12"
|
||||||
:items="instances || []"
|
sm="6"
|
||||||
:loading="loading"
|
lg="4"
|
||||||
:items-per-page="10"
|
v-for="{ instance } in instances"
|
||||||
>
|
:key="instance.instanceName"
|
||||||
<template v-slot:no-data>
|
>
|
||||||
<v-card v-if="!loading" variant="outlined" class="my-4">
|
<v-card
|
||||||
<v-card-text>
|
@click="goToInstance(instance)"
|
||||||
<div class="text-center">
|
class="pa-2 rounded-lg"
|
||||||
<v-icon size="70">mdi-server-network-off</v-icon>
|
variant="outlined"
|
||||||
<h3 class="mt-4">Nenhuma instância encontrada</h3>
|
|
||||||
</div>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- eslint-disable-next-line vue/valid-v-slot -->
|
|
||||||
<template v-slot:item.instance.instanceName="{ item }">
|
|
||||||
<b>{{ item.instance.instanceName }}</b>
|
|
||||||
</template>
|
|
||||||
<!-- eslint-disable-next-line vue/valid-v-slot -->
|
|
||||||
<template v-slot:item.instance.status="{ item }">
|
|
||||||
<v-chip
|
|
||||||
:color="statusMapper[item.instance.status].color"
|
|
||||||
:text-color="statusMapper[item.instance.status].textColor"
|
|
||||||
size="small"
|
|
||||||
label
|
|
||||||
>
|
|
||||||
<v-icon
|
|
||||||
v-if="statusMapper[item.instance.status].icon"
|
|
||||||
start
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
{{ statusMapper[item.instance.status].icon }}
|
|
||||||
</v-icon>
|
|
||||||
{{ statusMapper[item.instance.status].text }}
|
|
||||||
</v-chip>
|
|
||||||
</template>
|
|
||||||
<!-- eslint-disable-next-line vue/valid-v-slot -->
|
|
||||||
<template v-slot:item.actions="{ item }">
|
|
||||||
<v-btn
|
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
:to="`/${item.instance.instanceName}`"
|
|
||||||
icon
|
|
||||||
size="x-small"
|
|
||||||
class="mr-1"
|
|
||||||
variant="tonal"
|
|
||||||
color="info"
|
|
||||||
>
|
>
|
||||||
<v-icon>mdi-cog</v-icon>
|
<div class="d-flex align-center gap-2">
|
||||||
</v-btn>
|
<v-avatar size="50">
|
||||||
<v-btn
|
<v-img
|
||||||
:disabled="loading || !!loadingDelete"
|
v-if="instance.profilePictureUrl"
|
||||||
:loading="loadingDelete === item.instance.instanceName"
|
:src="instance.profilePictureUrl"
|
||||||
@click="deleteInstance(item.instance.instanceName)"
|
/>
|
||||||
icon
|
<v-icon v-else>{{ statusMapper[instance.status].icon }}</v-icon>
|
||||||
variant="tonal"
|
</v-avatar>
|
||||||
color="error"
|
<div class="flex-shrink-1">
|
||||||
size="x-small"
|
<v-chip
|
||||||
>
|
:color="statusMapper[instance.status].color"
|
||||||
<v-icon>mdi-delete</v-icon>
|
size="x-small"
|
||||||
</v-btn>
|
label
|
||||||
</template>
|
>
|
||||||
</v-data-table>
|
<v-icon
|
||||||
|
v-if="statusMapper[instance.status].icon"
|
||||||
|
start
|
||||||
|
size="x-small"
|
||||||
|
>
|
||||||
|
{{ statusMapper[instance.status].icon }}
|
||||||
|
</v-icon>
|
||||||
|
{{ statusMapper[instance.status].text }}
|
||||||
|
</v-chip>
|
||||||
|
<h5>{{ instance.instanceName }}</h5>
|
||||||
|
</div>
|
||||||
|
<div class="ml-auto flex-shrink-0">
|
||||||
|
<!-- <v-btn
|
||||||
|
:disabled="loading"
|
||||||
|
:to="`/${instance.instanceName}`"
|
||||||
|
icon
|
||||||
|
size="x-small"
|
||||||
|
class="mr-1"
|
||||||
|
variant="tonal"
|
||||||
|
color="info"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-cog</v-icon>
|
||||||
|
</v-btn> -->
|
||||||
|
<v-btn
|
||||||
|
:disabled="loading || !!loadingDelete"
|
||||||
|
:loading="loadingDelete === instance.instanceName"
|
||||||
|
@click.stop="deleteInstance(instance.instanceName)"
|
||||||
|
icon
|
||||||
|
variant="tonal"
|
||||||
|
color="error"
|
||||||
|
size="x-small"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-delete</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
<v-alert v-if="error" type="error">
|
<v-alert v-if="error" type="error">
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</v-alert>
|
</v-alert>
|
||||||
@ -123,13 +134,16 @@ export default {
|
|||||||
key: "instance.instanceName",
|
key: "instance.instanceName",
|
||||||
},
|
},
|
||||||
{ title: "Status", key: "instance.status" },
|
{ title: "Status", key: "instance.status" },
|
||||||
{ title: "Ações", key: "actions", sortable: false , align: "center"},
|
{ title: "Ações", key: "actions", sortable: false, align: "center" },
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
addInstance() {
|
addInstance() {
|
||||||
this.$refs.createInstanceModal.open();
|
this.$refs.createInstanceModal.open();
|
||||||
},
|
},
|
||||||
|
goToInstance(instance) {
|
||||||
|
this.$router.push(`/${instance.instanceName}`);
|
||||||
|
},
|
||||||
async deleteInstance(instanceName) {
|
async deleteInstance(instanceName) {
|
||||||
try {
|
try {
|
||||||
this.loadingDelete = instanceName;
|
this.loadingDelete = instanceName;
|
||||||
@ -138,7 +152,6 @@ export default {
|
|||||||
);
|
);
|
||||||
if (!confirm) return;
|
if (!confirm) return;
|
||||||
|
|
||||||
|
|
||||||
await instanceController.logout(instanceName).catch(() => {});
|
await instanceController.logout(instanceName).catch(() => {});
|
||||||
await instanceController.delete(instanceName);
|
await instanceController.delete(instanceName);
|
||||||
await this.AppStore.reconnect();
|
await this.AppStore.reconnect();
|
||||||
@ -165,7 +178,6 @@ export default {
|
|||||||
return this.AppStore.instances;
|
return this.AppStore.instances;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {},
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user