Only show loading spinner over menu when loading namespaces
This commit is contained in:
@ -1,11 +1,19 @@
|
||||
import {LOADING} from './mutation-types'
|
||||
|
||||
export const setLoading = context => {
|
||||
export const setLoading = (context, loadFunc = null) => {
|
||||
const timeout = setTimeout(() => {
|
||||
context.commit(LOADING, true, {root: true})
|
||||
if (loadFunc === null) {
|
||||
context.commit(LOADING, true, {root: true})
|
||||
} else {
|
||||
loadFunc(true)
|
||||
}
|
||||
}, 100)
|
||||
return () => {
|
||||
clearTimeout(timeout)
|
||||
context.commit(LOADING, false, {root: true})
|
||||
if (loadFunc === null) {
|
||||
context.commit(LOADING, false, {root: true})
|
||||
} else {
|
||||
loadFunc(false)
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ export default {
|
||||
namespaced: true,
|
||||
state: () => ({
|
||||
namespaces: [],
|
||||
loading: false,
|
||||
}),
|
||||
mutations: {
|
||||
namespaces(state, namespaces) {
|
||||
@ -88,7 +89,9 @@ export default {
|
||||
},
|
||||
actions: {
|
||||
loadNamespaces(ctx) {
|
||||
const cancel = setLoading(ctx)
|
||||
const cancel = setLoading(ctx, status => {
|
||||
ctx.commit('loading', status, {root: true})
|
||||
})
|
||||
|
||||
const namespaceService = new NamespaceService()
|
||||
// We always load all namespaces and filter them on the frontend
|
||||
|
Reference in New Issue
Block a user