Show loading spinner when loading namespaces & lists
This commit is contained in:
parent
50b1d378e0
commit
15a2da41ba
5 changed files with 24 additions and 3 deletions
|
@ -56,7 +56,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside class="menu namespaces-lists">
|
<aside class="menu namespaces-lists loader-container" :class="{'is-loading': loading}">
|
||||||
<template v-for="n in namespaces">
|
<template v-for="n in namespaces">
|
||||||
<div :key="n.id">
|
<div :key="n.id">
|
||||||
<router-link
|
<router-link
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {CURRENT_LIST, IS_FULLPAGE, MENU_ACTIVE} from '@/store/mutation-types'
|
import {CURRENT_LIST, IS_FULLPAGE, LOADING, MENU_ACTIVE} from '@/store/mutation-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'navigation',
|
name: 'navigation',
|
||||||
|
@ -153,6 +153,7 @@ export default {
|
||||||
currentList: CURRENT_LIST,
|
currentList: CURRENT_LIST,
|
||||||
background: 'background',
|
background: 'background',
|
||||||
menuActive: MENU_ACTIVE,
|
menuActive: MENU_ACTIVE,
|
||||||
|
loading: LOADING,
|
||||||
}),
|
}),
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
this.$store.dispatch('namespaces/loadNamespaces')
|
this.$store.dispatch('namespaces/loadNamespaces')
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
import NamespaceService from '../../services/namespace'
|
import NamespaceService from '../../services/namespace'
|
||||||
|
import {setLoading} from '@/store/helper'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
|
@ -87,6 +88,8 @@ export default {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
loadNamespaces(ctx) {
|
loadNamespaces(ctx) {
|
||||||
|
const cancel = setLoading(ctx)
|
||||||
|
|
||||||
const namespaceService = new NamespaceService()
|
const namespaceService = new NamespaceService()
|
||||||
// We always load all namespaces and filter them on the frontend
|
// We always load all namespaces and filter them on the frontend
|
||||||
return namespaceService.getAll({}, {is_archived: true})
|
return namespaceService.getAll({}, {is_archived: true})
|
||||||
|
@ -108,6 +111,9 @@ export default {
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
return Promise.reject(e)
|
return Promise.reject(e)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
cancel()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
loadNamespacesIfFavoritesDontExist(ctx) {
|
loadNamespacesIfFavoritesDontExist(ctx) {
|
||||||
// The first namespace should be the one holding all favorites
|
// The first namespace should be the one holding all favorites
|
||||||
|
|
|
@ -16,6 +16,10 @@ $lists-per-row: 5;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.loader-container.is-loading {
|
||||||
|
min-height: calc(100vh - #{$navbar-height + 1.5rem + 1rem + 1.5rem});
|
||||||
|
}
|
||||||
|
|
||||||
.namespace {
|
.namespace {
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
|
@ -297,6 +297,14 @@
|
||||||
&.namespaces-lists {
|
&.namespaces-lists {
|
||||||
padding-top: $navbar-padding / 2;
|
padding-top: $navbar-padding / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.loader-container.is-loading:after {
|
||||||
|
width: 1.5em;
|
||||||
|
height: 1.5em;
|
||||||
|
top: calc(50% - .75em);
|
||||||
|
left: calc(50% - .75em);
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-menu {
|
.top-menu {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content namespaces-list">
|
<div class="content namespaces-list loader-container" :class="{'is-loading': loading}">
|
||||||
<router-link :to="{name: 'namespace.create'}" class="button is-success new-namespace">
|
<router-link :to="{name: 'namespace.create'}" class="button is-success new-namespace">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<icon icon="plus"/>
|
<icon icon="plus"/>
|
||||||
|
@ -66,6 +66,7 @@
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import ListService from '../../services/list'
|
import ListService from '../../services/list'
|
||||||
import Fancycheckbox from '../../components/input/fancycheckbox'
|
import Fancycheckbox from '../../components/input/fancycheckbox'
|
||||||
|
import {LOADING} from '@/store/mutation-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListNamespaces',
|
name: 'ListNamespaces',
|
||||||
|
@ -89,6 +90,7 @@ export default {
|
||||||
namespaces(state) {
|
namespaces(state) {
|
||||||
return state.namespaces.namespaces.filter(n => this.showArchived ? true : !n.isArchived)
|
return state.namespaces.namespaces.filter(n => this.showArchived ? true : !n.isArchived)
|
||||||
},
|
},
|
||||||
|
loading: LOADING,
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
loadBackgroundsForLists() {
|
loadBackgroundsForLists() {
|
||||||
|
|
Loading…
Reference in a new issue