mirror of
https://github.com/h44z/wg-portal.git
synced 2025-10-06 16:36:18 +00:00
implement checkall checkbox (#372)
This commit is contained in:
@@ -13,8 +13,9 @@ const profile = profileStore()
|
||||
const viewedPeerId = ref("")
|
||||
const editPeerId = ref("")
|
||||
|
||||
const sortKey = ref("");
|
||||
const sortOrder = ref(1);
|
||||
const sortKey = ref("")
|
||||
const sortOrder = ref(1)
|
||||
const selectAll = ref(false)
|
||||
|
||||
function sortBy(key) {
|
||||
if (sortKey.value === key) {
|
||||
@@ -34,6 +35,12 @@ function friendlyInterfaceName(id, name) {
|
||||
return id
|
||||
}
|
||||
|
||||
function toggleSelectAll() {
|
||||
profile.FilteredAndPagedPeers.forEach(peer => {
|
||||
peer.IsSelected = selectAll.value;
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await profile.LoadUser()
|
||||
await profile.LoadPeers()
|
||||
@@ -86,8 +93,7 @@ onMounted(async () => {
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<input id="flexCheckDefault" class="form-check-input" :title="$t('general.select-all')" type="checkbox"
|
||||
value="">
|
||||
<input class="form-check-input" :title="$t('general.select-all')" type="checkbox" v-model="selectAll" @change="toggleSelectAll">
|
||||
</th><!-- select -->
|
||||
<th scope="col"></th><!-- status -->
|
||||
<th scope="col" @click="sortBy('DisplayName')">
|
||||
@@ -112,7 +118,7 @@ onMounted(async () => {
|
||||
<tbody>
|
||||
<tr v-for="peer in profile.FilteredAndPagedPeers" :key="peer.Identifier">
|
||||
<th scope="row">
|
||||
<input id="flexCheckDefault" class="form-check-input" type="checkbox" value="">
|
||||
<input class="form-check-input" type="checkbox" v-model="peer.IsSelected">
|
||||
</th>
|
||||
<td class="text-center">
|
||||
<span v-if="peer.Disabled" class="text-danger"><i class="fa fa-circle-xmark"
|
||||
|
Reference in New Issue
Block a user