mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 21:20:06 +00:00
✨ batch update server tag
This commit is contained in:
54
resource/template/dashboard-default/server.html
vendored
54
resource/template/dashboard-default/server.html
vendored
@@ -5,6 +5,9 @@
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
<div class="right floated right aligned twelve wide column">
|
||||
<button class="ui right labeled nezha-primary-btn icon button" onclick="batchEditServerGroup()"><i
|
||||
class="edit icon"></i> {{tr "BatchEditServerGroup"}}
|
||||
</button>
|
||||
<button class="ui right labeled nezha-primary-btn icon button" onclick="addOrEditServer()"><i
|
||||
class="add icon"></i> {{tr "AddServer"}}
|
||||
</button>
|
||||
@@ -128,5 +131,56 @@
|
||||
});
|
||||
})
|
||||
}
|
||||
function batchEditServerGroup() {
|
||||
let groupName = prompt('{{tr "InputServerGroupName"}}')
|
||||
if (!groupName) {
|
||||
return;
|
||||
}
|
||||
const servers = []
|
||||
checkBoxList.forEach(cb => {
|
||||
if (cb.checked) {
|
||||
servers.push(parseInt(cb.value))
|
||||
}
|
||||
})
|
||||
if (servers.length == 0) {
|
||||
$.suiAlert({
|
||||
title: '{{tr "NoServerSelected"}}',
|
||||
description: '',
|
||||
type: 'warning',
|
||||
time: '2',
|
||||
position: 'top-center',
|
||||
});
|
||||
return
|
||||
}
|
||||
$.post('/api/batch-update-server-group', JSON.stringify({ servers: servers, group: groupName }))
|
||||
.then((resp) => {
|
||||
if (resp.code == 200) {
|
||||
$.suiAlert({
|
||||
title: '{{tr "ExecutionResults"}}',
|
||||
description: resp.message,
|
||||
type: 'success',
|
||||
time: '3',
|
||||
position: 'top-center',
|
||||
});
|
||||
window.location.reload()
|
||||
} else {
|
||||
$.suiAlert({
|
||||
title: '',
|
||||
description: resp.message,
|
||||
type: 'error',
|
||||
time: '3',
|
||||
position: 'top-center',
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
$.suiAlert({
|
||||
title: '',
|
||||
description: err,
|
||||
type: 'error',
|
||||
time: '3',
|
||||
position: 'top-center',
|
||||
});
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user