Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/web/html
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-02-27 15:31:20 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-02-27 15:31:20 +0300
commit9b026572cf8af4ecd6afaf59660f3fe1897a93c1 (patch)
treec129572b9c002b0eff05a0ae11438ccf9eb24b13 /web/html
parent6b34a3ae132b49e9ba09ef46aef4badd1ca1dfa6 (diff)
close modal only after success msg
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/common/prompt_modal.html8
-rw-r--r--web/html/xui/inbounds.html25
2 files changed, 14 insertions, 19 deletions
diff --git a/web/html/common/prompt_modal.html b/web/html/common/prompt_modal.html
index edfad682..b91ede03 100644
--- a/web/html/common/prompt_modal.html
+++ b/web/html/common/prompt_modal.html
@@ -1,6 +1,7 @@
{{define "promptModal"}}
<a-modal id="prompt-modal" v-model="promptModal.visible" :title="promptModal.title"
:closable="true" @ok="promptModal.ok" :mask-closable="false"
+ :confirm-loading="promptModal.confirmLoading"
:ok-text="promptModal.okText" cancel-text='{{ i18n "cancel" }}' :class="themeSwitcher.currentTheme">
<a-input id="prompt-modal-input" :type="promptModal.type"
v-model="promptModal.value"
@@ -17,6 +18,7 @@
value: '',
okText: '{{ i18n "sure"}}',
visible: false,
+ confirmLoading: false,
keyEnter(e) {
if (this.type !== 'textarea') {
e.preventDefault();
@@ -30,7 +32,6 @@
}
},
ok() {
- promptModal.close();
promptModal.confirm(promptModal.value);
},
confirm() {},
@@ -53,7 +54,10 @@
},
close() {
this.visible = false;
- }
+ },
+ loading(loading=true) {
+ this.confirmLoading = loading;
+ },
};
const promptModalApp = new Vue({
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html
index 117cbffb..28d6b6e8 100644
--- a/web/html/xui/inbounds.html
+++ b/web/html/xui/inbounds.html
@@ -848,9 +848,7 @@
okText: '{{ i18n "pages.inbounds.create"}}',
cancelText: '{{ i18n "close" }}',
confirm: async (inbound, dbInbound) => {
- inModal.loading();
- await this.addInbound(inbound, dbInbound);
- inModal.close();
+ await this.addInbound(inbound, dbInbound, inModal);
},
isEdit: false
});
@@ -865,9 +863,7 @@
inbound: inbound,
dbInbound: dbInbound,
confirm: async (inbound, dbInbound) => {
- inModal.loading();
await this.updateInbound(inbound, dbInbound);
- inModal.close();
},
isEdit: true
});
@@ -917,9 +913,7 @@
okText: '{{ i18n "pages.client.submitAdd"}}',
dbInbound: dbInbound,
confirm: async (clients, dbInboundId) => {
- clientModal.loading();
- await this.addClient(clients, dbInboundId);
- clientModal.close();
+ await this.addClient(clients, dbInboundId, clientModal);
},
isEdit: false
});
@@ -931,9 +925,7 @@
okText: '{{ i18n "pages.client.bulk"}}',
dbInbound: dbInbound,
confirm: async (clients, dbInboundId) => {
- clientsBulkModal.loading();
- await this.addClient(clients, dbInboundId);
- clientsBulkModal.close();
+ await this.addClient(clients, dbInboundId, clientsBulkModal);
},
});
},
@@ -962,19 +954,19 @@
default: return clients.findIndex(item => item.id === client.id && item.email === client.email);
}
},
- async addClient(clients, dbInboundId) {
+ async addClient(clients, dbInboundId, modal) {
const data = {
id: dbInboundId,
settings: '{"clients": [' + clients.toString() + ']}',
};
- await this.submit(`/panel/inbound/addClient`, data);
+ await this.submit(`/panel/inbound/addClient`, data, modal);
},
async updateClient(client, dbInboundId, clientId) {
const data = {
id: dbInboundId,
settings: '{"clients": [' + client.toString() + ']}',
};
- await this.submit(`/panel/inbound/updateClient/${clientId}`, data);
+ await this.submit(`/panel/inbound/updateClient/${clientId}`, data, clientModal);
},
resetTraffic(dbInboundId) {
dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
@@ -1077,8 +1069,8 @@
await this.updateClient(clients[index], dbInboundId, clientId);
this.loading(false);
},
- async submit(url, data) {
- const msg = await HttpUtil.postWithModal(url, data);
+ async submit(url, data, modal) {
+ const msg = await HttpUtil.postWithModal(url, data, modal);
if (msg.success) {
await this.getDBInbounds();
}
@@ -1237,7 +1229,6 @@
okText: '{{ i18n "pages.inbounds.import" }}',
confirm: async (dbInboundText) => {
await this.submit('/panel/inbound/import', {data: dbInboundText}, promptModal);
- promptModal.close();
},
});
},