Skip to content

Commit 605b093

Browse files
committed
main
1 parent 8af6e8f commit 605b093

27 files changed

+3234
-308
lines changed
Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
22
<v-tabs v-model="tab" background-color="transparent" color="primary" grow>
3-
<v-tab v-for="tab in tabs" :key="tab.id" :value="tab.id">
4-
<v-icon start>{{ tab.icon }}</v-icon>
5-
{{ $t(`instanceTabs.${tab.id}`) }}
3+
<v-tab v-for="tabItem in tabs" :key="tabItem.id" :value="tabItem.id">
4+
<v-icon start>{{ tabItem.icon }}</v-icon>
5+
{{ $t(`instanceTabs.${tabItem.id}`) }}
66
</v-tab>
77
</v-tabs>
88

99
<v-window v-model="tab">
10-
<v-window-item v-for="tab in tabs" :key="tab.id" :value="tab.id">
10+
<v-window-item v-for="tabItem in tabs" :key="tabItem.id" :value="tabItem.id">
1111
<div class="d-flex flex-column gap-6">
1212
<component
13-
v-for="component in tab.components"
13+
v-for="component in tabItem.components"
1414
:key="component"
1515
:is="component"
1616
:instance="instance"
@@ -38,6 +38,7 @@ import ConnectionAlert from "./profile/ConnectionAlert.vue";
3838
import BasicInfo from "./profile/BasicInfo.vue";
3939
import Privacy from "./profile/Privacy.vue";
4040
import ProfilePhoto from "./profile/ProfilePhoto.vue";
41+
4142
export default {
4243
components: {
4344
Options,
@@ -56,44 +57,46 @@ export default {
5657
Privacy,
5758
ProfilePhoto,
5859
},
59-
data: () => ({
60-
tab: "settings",
61-
tabs: [
62-
{
63-
id: "settings",
64-
icon: "mdi-cog",
65-
components: [
66-
"Options",
67-
"Webhook",
68-
"Websocket",
69-
"Rabbitmq",
70-
"Chatwoot",
71-
"Typebot",
72-
],
73-
},
74-
{
75-
id: "message",
76-
icon: "mdi-message",
77-
components: [
78-
"OpenSendMessage",
79-
"HasWhatsapp",
80-
"MyContacts",
81-
"MyGroups",
82-
"MyChats",
83-
],
84-
},
85-
{
86-
id: "profile",
87-
icon: "mdi-account",
88-
components: [
89-
"ConnectionAlert",
90-
"BasicInfo",
91-
"ProfilePhoto",
92-
"Privacy",
93-
],
94-
},
95-
],
96-
}),
60+
data() {
61+
return {
62+
tab: "settings",
63+
tabs: [
64+
{
65+
id: "settings",
66+
icon: "mdi-cog",
67+
components: [
68+
"Options",
69+
"Webhook",
70+
"Websocket",
71+
"Rabbitmq",
72+
"Chatwoot",
73+
"Typebot",
74+
],
75+
},
76+
{
77+
id: "message",
78+
icon: "mdi-message",
79+
components: [
80+
"OpenSendMessage",
81+
"HasWhatsapp",
82+
"MyContacts",
83+
"MyGroups",
84+
"MyChats",
85+
],
86+
},
87+
{
88+
id: "profile",
89+
icon: "mdi-account",
90+
components: [
91+
"ConnectionAlert",
92+
"BasicInfo",
93+
"ProfilePhoto",
94+
"Privacy",
95+
],
96+
},
97+
],
98+
};
99+
},
97100
props: {
98101
instance: {
99102
type: Object,
@@ -103,4 +106,6 @@ export default {
103106
};
104107
</script>
105108

106-
<style></style>
109+
<style scoped>
110+
/* Add any necessary scoped styles here */
111+
</style>

src/components/instance/InstanceHeader.vue

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@
77
<v-avatar size="100" rounded="xl">
88
<v-icon
99
v-if="
10-
(instance.instance.status != 'open' ||
11-
instance.instance.profilePictureUrl == null) &&
12-
statusMapper[instance.instance.status].icon
10+
(instance.connectionStatus != 'open' ||
11+
instance.profilePicUrl == null) &&
12+
statusMapper[instance.connectionStatus].icon
1313
"
1414
size="70"
1515
>
16-
{{ statusMapper[instance.instance.status].icon }}
16+
{{ statusMapper[instance.connectionStatus].icon }}
1717
</v-icon>
18-
<v-img v-else :src="instance.instance.profilePictureUrl" />
18+
<v-img v-else :src="instance.profilePicUrl" />
1919
</v-avatar>
2020
<div class="d-flex flex-column">
2121
<span class="text-overline" style="line-height: 1em">
2222
{{ owner }}
2323
</span>
2424
<h2 class="mb-0">
25-
{{ instance.instance.instanceName }}
25+
{{ instance.name }}
2626
<v-chip
27-
v-if="instance?.instance?.apikey"
27+
v-if="instance?.token"
2828
color="info"
2929
class="ml-2"
3030
size="x-small"
3131
@click="copyApikey"
3232
>
3333
<v-icon start size="small">mdi-key</v-icon>
34-
{{ (instance.instance?.apikey || "").slice(0, 10) }}...
34+
{{ (instance.token || "").slice(0, 10) }}...
3535
<v-icon end size="small">
3636
{{ copied ? "mdi-check" : "mdi-content-copy" }}
3737
</v-icon>
3838
</v-chip>
3939
</h2>
40-
<small>{{ instance.instance.profileStatus }}</small>
40+
<small>{{ instance.profileStatus }}</small>
4141
</div>
4242
<v-spacer></v-spacer>
4343
<div class="d-flex gap-2 flex-wrap justify-end">
@@ -68,7 +68,7 @@
6868
<v-btn
6969
@click="disconnectInstance"
7070
:disabled="
71-
instance.instance.status === 'close' || restart.loading || reload
71+
instance.connectionStatus === 'close' || restart.loading || reload
7272
"
7373
:loading="disconnect.loading"
7474
variant="tonal"
@@ -102,7 +102,7 @@ export default {
102102
copyApikey() {
103103
if (this.copied) return;
104104
105-
copyToClipboard(this.instance.instance.apikey);
105+
copyToClipboard(this.instance.token);
106106
107107
this.copied = true;
108108
setTimeout(() => {
@@ -123,7 +123,7 @@ export default {
123123
async restartInstance() {
124124
this.restart.loading = true;
125125
try {
126-
await instanceController.restart(this.instance.instance.instanceName);
126+
await instanceController.restart(this.instance.name);
127127
this.restart.success = true;
128128
129129
setTimeout(() => {
@@ -144,7 +144,7 @@ export default {
144144
this.disconnect.loading = true;
145145
try {
146146
this.disconnect.confirm = false;
147-
await instanceController.logout(this.instance.instance.instanceName);
147+
await instanceController.logout(this.instance.name);
148148
await this.AppStore.reconnect();
149149
} catch (e) {
150150
console.log(e);
@@ -156,10 +156,10 @@ export default {
156156
},
157157
computed: {
158158
owner() {
159-
if (!this.instance?.instance?.owner)
160-
return this.$t(`status.${this.instance.instance.status}`) || this.$t("unknown");
159+
if (!this.instance?.ownerJid)
160+
return this.$t(`status.${this.instance.connectionStatus}`) || this.$t("unknown");
161161
162-
return (this.instance?.instance?.owner || "").split("@")[0];
162+
return (this.instance?.ownerJid || "").split("@")[0];
163163
},
164164
},
165165
props: {
@@ -171,4 +171,6 @@ export default {
171171
};
172172
</script>
173173
174-
<style></style>
174+
<style scoped>
175+
/* Add your styles here if needed */
176+
</style>

src/components/instance/message/MyChats.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default {
125125
this.loading = true;
126126
this.error = false;
127127
const chats = await instanceController.chat.getAll(
128-
this.instance.instance.instanceName
128+
this.instance.name
129129
);
130130
131131
this.chats = chats;

src/components/instance/message/MyContacts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default {
141141
this.loading = true;
142142
this.error = false;
143143
const contacts = await instanceController.chat.getContacts(
144-
this.instance.instance.instanceName
144+
this.instance.instance.name
145145
);
146146
147147
this.contacts = contacts.filter((c) => !c.id.includes("@g.us"));

src/components/instance/message/MyGroups.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default {
139139
this.loading = true;
140140
this.error = false;
141141
const groups = await instanceController.group.getAll(
142-
this.instance.instance.instanceName
142+
this.instance.name
143143
);
144144
145145
this.groups = groups;

src/components/instance/profile/BasicInfo.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<v-text-field
3131
class="flex-grow-1 flex-shrink-0"
3232
v-model="data.name"
33-
:disabled=" loading"
33+
:disabled="loading"
3434
:label="$t('profile.name')"
3535
counter
3636
maxlength="25"
@@ -86,7 +86,6 @@ export default {
8686
},
8787
data: () => ({
8888
AppStore: useAppStore(),
89-
9089
expanded: false,
9190
loading: false,
9291
error: false,
@@ -115,13 +114,13 @@ export default {
115114
116115
if (this.data.name !== this.defaultData.name)
117116
await instanceController.profile.updateName(
118-
this.instance.instance.instanceName,
117+
this.instance.name,
119118
this.data.name
120119
);
121120
122121
if (this.data.status !== this.defaultData.status)
123122
await instanceController.profile.updateStatus(
124-
this.instance.instance.instanceName,
123+
this.instance.name,
125124
this.data.status
126125
);
127126
@@ -138,11 +137,11 @@ export default {
138137
try {
139138
this.loading = true;
140139
this.error = false;
141-
const instance = this.instance.instance;
140+
const instance = this.instance;
142141
const { isOpen } = this;
143-
var data = {
144-
name: isOpen ? instance.profileName.replace("not loaded", "") || "" : "",
145-
status: isOpen ? instance.profileStatus || "" : "",
142+
const data = {
143+
name: isOpen ? instance.name : "",
144+
status: isOpen ? instance.Setting.profileStatus || "" : "",
146145
};
147146
148147
this.data = Object.assign({}, data);
@@ -157,7 +156,7 @@ export default {
157156
158157
computed: {
159158
isOpen() {
160-
return this.instance.instance.status === "open";
159+
return this.instance.connectionStatus === "open";
161160
},
162161
},
163162
watch: {

src/components/instance/profile/Privacy.vue

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ import instanceController from "@/services/instanceController";
120120
import { useAppStore } from "@/store/app";
121121
122122
const defaultObj = () => ({
123-
enabled: false,
124-
url: "",
125-
account_id: "",
126-
token: "",
127-
sign_msg: true,
128-
reopen_conversation: true,
129-
conversation_pending: false,
123+
readreceipts: "all",
124+
profile: "all",
125+
status: "all",
126+
online: "all",
127+
last: "all",
128+
groupadd: "all",
129+
calladd: "all",
130130
});
131131
132132
export default {
@@ -165,24 +165,8 @@ export default {
165165
{ value: "none", title: this.$t("privacy.options.none") },
166166
],
167167
168-
privacyData: {
169-
readreceipts: "all",
170-
profile: "all",
171-
status: "all",
172-
online: "all",
173-
last: "all",
174-
groupadd: "all",
175-
calladd: "all",
176-
},
177-
defaultChatwootData: {
178-
readreceipts: "all",
179-
profile: "all",
180-
status: "all",
181-
online: "all",
182-
last: "all",
183-
groupadd: "all",
184-
calladd: "all",
185-
},
168+
privacyData: defaultObj(),
169+
defaultPrivacyData: defaultObj(),
186170
};
187171
},
188172
methods: {
@@ -198,7 +182,7 @@ export default {
198182
this.loading = true;
199183
this.error = false;
200184
await instanceController.profile.updatePrivacy(
201-
this.instance.instance.instanceName,
185+
this.instance.name,
202186
this.privacyData
203187
);
204188
this.defaultPrivacyData = Object.assign({}, this.privacyData);
@@ -214,7 +198,7 @@ export default {
214198
this.loading = true;
215199
this.error = false;
216200
const privacyData = await instanceController.profile.getPrivacy(
217-
this.instance.instance.instanceName
201+
this.instance.name
218202
);
219203
this.privacyData = Object.assign(defaultObj(), privacyData || {});
220204
this.defaultPrivacyData = Object.assign(
@@ -230,7 +214,7 @@ export default {
230214
},
231215
computed: {
232216
isOpen() {
233-
return this.instance.instance.status === "open";
217+
return this.instance.connectionStatus === "open";
234218
},
235219
},
236220
watch: {

0 commit comments

Comments
 (0)