mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
109 lines
4.4 KiB
HTML
109 lines
4.4 KiB
HTML
{{define "clientsBulkModal"}}
|
|
<a-modal id="client-bulk-modal" v-model="clientsBulkModal.visible" :title="clientsBulkModal.title" @ok="clientsBulkModal.ok"
|
|
:confirm-loading="clientsBulkModal.confirmLoading" :closable="true" :mask-closable="false"
|
|
:ok-text="clientsBulkModal.okText" cancel-text='{{ i18n "close" }}'>
|
|
<a-form layout="inline">
|
|
<a-form-item>
|
|
<span slot="label">{{ i18n "pages.client.clientCount" }}</span>
|
|
<a-input-number v-model="clientsBulkModal.quantity" :min="1" :max="100"></a-input-number>
|
|
</a-form-item>
|
|
<a-form-item>
|
|
<span slot="label">
|
|
<span >{{ i18n "pages.inbounds.totalFlow" }}</span>(GB)
|
|
<a-tooltip>
|
|
<template slot="title">
|
|
0 <span>{{ i18n "pages.inbounds.meansNoLimit" }}</span>
|
|
</template>
|
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
|
</a-tooltip>
|
|
</span>
|
|
<a-input-number v-model="clientsBulkModal.totalGB" :min="0"></a-input-number>
|
|
</a-form-item>
|
|
<a-form-item>
|
|
<span slot="label">
|
|
<span >{{ i18n "pages.inbounds.expireDate" }}</span>
|
|
<a-tooltip>
|
|
<template slot="title">
|
|
<span>{{ i18n "pages.inbounds.leaveBlankToNeverExpire" }}</span>
|
|
</template>
|
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
|
</a-tooltip>
|
|
</span>
|
|
<a-date-picker :show-time="{ format: 'HH:mm' }" format="YYYY-MM-DD HH:mm"
|
|
v-model="clientsBulkModal.expiryTime" style="width: 300px;"></a-date-picker>
|
|
</a-form-item>
|
|
</a-form>
|
|
</a-modal>
|
|
<script>
|
|
|
|
const clientsBulkModal = {
|
|
visible: false,
|
|
confirmLoading: false,
|
|
title: '',
|
|
okText: '',
|
|
confirm: null,
|
|
dbInbound: new DBInbound(),
|
|
inbound: new Inbound(),
|
|
clients: [],
|
|
quantity: 1,
|
|
totalGB: 0,
|
|
expiryTime: '',
|
|
ok() {
|
|
for (let i = 0; i < clientsBulkModal.quantity; i++) {
|
|
newClient = clientsBulkModal.newClient(clientsBulkModal.dbInbound.protocol);
|
|
newClient._totalGB = clientsBulkModal.totalGB;
|
|
newClient._expiryTime = clientsBulkModal.expiryTime;
|
|
clientsBulkModal.clients.push(newClient);
|
|
}
|
|
ObjectUtil.execute(clientsBulkModal.confirm, clientsBulkModal.inbound, clientsBulkModal.dbInbound);
|
|
},
|
|
show({ title='', okText='{{ i18n "sure" }}', dbInbound=null, confirm=(inbound, dbInbound)=>{} }) {
|
|
this.visible = true;
|
|
this.title = title;
|
|
this.okText = okText;
|
|
this.confirm = confirm;
|
|
this.quantity = 1;
|
|
this.totalGB = 0;
|
|
this.expiryTime = '';
|
|
this.dbInbound = new DBInbound(dbInbound);
|
|
this.inbound = dbInbound.toInbound();
|
|
this.clients = this.getClients(this.inbound.protocol, this.inbound.settings);
|
|
},
|
|
getClients(protocol, clientSettings) {
|
|
switch(protocol){
|
|
case Protocols.VMESS: return clientSettings.vmesses;
|
|
case Protocols.VLESS: return clientSettings.vlesses;
|
|
case Protocols.TROJAN: return clientSettings.trojans;
|
|
default: return null;
|
|
}
|
|
},
|
|
newClient(protocol) {
|
|
switch (protocol) {
|
|
case Protocols.VMESS: return new Inbound.VmessSettings.Vmess();
|
|
case Protocols.VLESS: return new Inbound.VLESSSettings.VLESS();
|
|
case Protocols.TROJAN: return new Inbound.TrojanSettings.Trojan();
|
|
default: return null;
|
|
}
|
|
},
|
|
close() {
|
|
clientsBulkModal.visible = false;
|
|
clientsBulkModal.loading(false);
|
|
},
|
|
loading(loading) {
|
|
clientsBulkModal.confirmLoading = loading;
|
|
},
|
|
};
|
|
|
|
const clientsBulkModalApp = new Vue({
|
|
delimiters: ['[[', ']]'],
|
|
el: '#client-bulk-modal',
|
|
data: {
|
|
clientsBulkModal,
|
|
get inbound() {
|
|
return this.clientsBulkModal.inbound;
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
{{end}}
|