Update:Show loading indicator when first connecting to server

This commit is contained in:
advplyr
2023-02-17 17:47:46 -06:00
parent d899fd4d89
commit 08ee08c698
4 changed files with 29 additions and 14 deletions
+7 -2
View File
@@ -3,7 +3,10 @@
<home-bookshelf-nav-bar />
<home-bookshelf-toolbar v-show="!hideToolbar" />
<div id="bookshelf-wrapper" class="main-content overflow-y-auto overflow-x-hidden relative" :class="hideToolbar ? 'no-toolbar' : ''">
<nuxt-child />
<nuxt-child :loading.sync="loading" />
</div>
<div v-if="loading" class="absolute top-0 left-0 z-50 w-full h-full flex items-center justify-center">
<ui-loading-indicator text="Loading..." />
</div>
</div>
</template>
@@ -11,7 +14,9 @@
<script>
export default {
data() {
return {}
return {
loading: false
}
},
computed: {
hideToolbar() {
+14 -7
View File
@@ -26,18 +26,17 @@
</div>
</div>
</div>
<div v-if="loading" class="absolute top-0 left-0 w-full h-full flex items-center justify-center">
<ui-loading-indicator text="Loading Library..." />
</div>
</div>
</template>
<script>
export default {
props: {
loading: Boolean
},
data() {
return {
shelves: [],
loading: false,
isFirstNetworkConnection: true,
lastServerFetch: 0,
lastServerFetchLibraryId: null,
@@ -97,6 +96,14 @@ export default {
},
localMediaProgress() {
return this.$store.state.globals.localMediaProgress
},
isLoading: {
get() {
return this.loading
},
set(val) {
this.$emit('update:loading', val)
}
}
},
methods: {
@@ -213,7 +220,7 @@ export default {
}
}
this.loading = true
this.isLoading = true
this.shelves = []
if (this.user && this.currentLibraryId && this.networkConnected) {
@@ -229,7 +236,7 @@ export default {
this.shelves = localCategories
this.lastServerFetch = 0
this.lastLocalFetch = Date.now()
this.loading = false
this.isLoading = false
console.log('[categories] Local shelves set from failure', this.shelves.length, this.lastLocalFetch)
return
}
@@ -267,7 +274,7 @@ export default {
console.log('[categories] Local shelves set', this.shelves.length, this.lastLocalFetch)
}
this.loading = false
this.isLoading = false
},
openMediaPlayerWithMostRecentListening() {
// If we don't already have a player open