Commit 1f3c3219 authored by gj4210's avatar gj4210 👁 Committed by janis.streib
Browse files

FIX: Loading now actually loads correctly

(no more v-ifs yaaay)
parent fe74fbc5
......@@ -14,7 +14,7 @@
</b-input-group>
<FilterInput v-model="filter.text"/>
</b-form>
<Loading :data="[records]">
<Loading :data="records">
<b-table :responsive="true" striped :items="records" :fields="table_fields" :filter="filter" :filter-function="filterRecords">
<template v-slot:cell(data)="data">
<span style="white-space: pre-wrap">{{ data.item.data }}</span>
......
<template>
<div class="fqdn-record-table">
<Loading :data="[fqdn_rrs]">
<Loading :data="fqdn_rrs">
<div>
<FilterInput v-model="filter"></FilterInput>
<b-table responsive :filter="filter" class="shadow" :items="fqdn_rrs" :fields="fqdn_list_fields">
......
<template>
<Loading :data="[fqdns]">
<Loading :data="fqdns">
<div class="fqdn-table">
<FilterInput v-model="filter"></FilterInput>
<b-pagination v-if="fqdns && fqdns.length > per_page && filter === ''" :total-rows="fqdns.length"
<b-pagination v-if="fqdns.length > per_page && filter === ''" :total-rows="fqdns.length"
:per-page="per_page" v-model="current_page" align="center"></b-pagination>
<b-table :per-page="per_page" :current-page="current_page" responsive class="shadow" :items="fqdns"
:fields="fqdn_list_fields" :filter="filter">
......
<template>
<div class="loading-container">
<div v-if="loaded"><slot/></div>
<div v-else class="text-center mt-3">
<b-spinner variant="primary"/>
</div>
<div class="loading-container">
<div v-if="loaded">
<slot/>
</div>
<div v-else class="text-center my-3">
<b-spinner variant="primary"/>
</div>
</div>
</template>
<script>
export default {
name: 'Loading',
props: { data: Array },
data () {
props: {
data: {
default() {
return null
}
}
},
data() {
return {
loaded: false
}
},
watch: {
data (val) {
data(val) {
let loaded = true
val.forEach((item) => {
if (item == null) { loaded = false }
})
if (val && val.isArray) {
val.forEach((item) => {
if (item == null) {
loaded = false
}
})
}
this.loaded = loaded
}
}
......
......@@ -13,7 +13,7 @@
So kann eine höhere Sicherheit Ihrer API-Anwendungen erzielt werden.
</p>
<hr/>
<Loading :data="[groups]">
<Loading :data="groups">
<b-button v-if="entry" style="margin-bottom: 20px" block variant="outline-success"
id="button-create-group" @click="createSubgroup('')">
<font-awesome-icon :icon="['fas', 'plus']"/>
......
<template>
<div class="dhcp-leases">
<h1>Aktive Leases in BCD "{{ $route.params.bcd }}"</h1>
<Loading :data="[leases]">
<Loading :data="leases">
<b-table responsive striped :items="leases" :busy="!leases" :fields="table_fields">
<template v-slot:cell(ip)="data">
<code>{{ data.item.ip }}</code>
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
</b-alert>
<b-checkbox :value="true" :unchecked-value="false" v-model="only_own" switch>Nur eigene BCDs anzeigen
</b-checkbox>
<Loading :data="[clients_by_bcd]">
<Loading :data="clients_by_bcd">
<PaginatorList items_per_page="25" :items="bcds">
<template v-slot:item="card_data">
<b-card no-body :key="'card-bcd-' + card_data.item.name" class="mb-4 shadow">
......
......@@ -90,7 +90,7 @@
</b-button>
</template>
</b-modal>
<Loading :data="[filtered_accounts]">
<Loading :data="filtered_accounts">
<template v-for="account in filtered_accounts">
<b-card no-body :key="'card-account-' + account.login_name" class="mb-4 shadow">
<template v-slot:header>
......
<template>
<div>
<h1>Organisationseinheitstypen</h1>
<Loading :data="[unit_types]">
<Loading :data="unit_types">
<FilterInput v-model="filter"></FilterInput>
<b-table :filter="filter" responsive striped :items="unit_types" :fields="fields" sort-by="position">
<template v-slot:head(actions)="">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment