[feature] inbounds manual refresh

Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
MHSanaei 2023-05-06 19:20:42 +03:30
parent 0e77547e98
commit 735df6bd4e

View File

@ -99,7 +99,7 @@
:dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''"> :dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''">
<a-select-option v-for="key in [5,10,30,60]" :value="key*1000">[[ key ]]s</a-select-option> <a-select-option v-for="key in [5,10,30,60]" :value="key*1000">[[ key ]]s</a-select-option>
</a-select> </a-select>
<a-icon type="sync" :spin="isRefreshEnabled" style="margin: 0 5px;"></a-icon> <a-icon type="sync" :spin="refreshing" @click="manualRefresh" style="margin: 0 5px;"></a-icon>
<a-switch v-model="isRefreshEnabled" @change="toggleRefresh"></a-switch> <a-switch v-model="isRefreshEnabled" @change="toggleRefresh"></a-switch>
</a-col> </a-col>
</a-row> </a-row>
@ -331,6 +331,7 @@
defaultKey: '', defaultKey: '',
clientCount: {}, clientCount: {},
isRefreshEnabled: localStorage.getItem("isRefreshEnabled") === "true" ? true : false, isRefreshEnabled: localStorage.getItem("isRefreshEnabled") === "true" ? true : false,
refreshing: false,
refreshInterval: Number(localStorage.getItem("refreshInterval")) || 5000, refreshInterval: Number(localStorage.getItem("refreshInterval")) || 5000,
}, },
methods: { methods: {
@ -338,11 +339,13 @@
this.spinning = spinning; this.spinning = spinning;
}, },
async getDBInbounds() { async getDBInbounds() {
this.refreshing = true;
const msg = await HttpUtil.post('/xui/inbound/list'); const msg = await HttpUtil.post('/xui/inbound/list');
if (!msg.success) { if (!msg.success) {
return; return;
} }
this.setInbounds(msg.obj); this.setInbounds(msg.obj);
this.refreshing = false;
}, },
async getDefaultSettings() { async getDefaultSettings() {
const msg = await HttpUtil.post('/xui/setting/defaultSettings'); const msg = await HttpUtil.post('/xui/setting/defaultSettings');
@ -818,6 +821,13 @@
changeRefreshInterval(){ changeRefreshInterval(){
localStorage.setItem("refreshInterval", this.refreshInterval); localStorage.setItem("refreshInterval", this.refreshInterval);
}, },
async manualRefresh(){
if(!this.refreshing){
this.spinning = true;
await this.getDBInbounds();
this.spinning = false;
}
},
}, },
watch: { watch: {
searchKey: debounce(function (newVal) { searchKey: debounce(function (newVal) {