Skip to content

Commit

Permalink
fix: indicate when contexts are loading
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <[email protected]>
  • Loading branch information
enjeck committed Mar 7, 2024
1 parent 5e8317f commit 39b7948
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export default {
}
},
computed: {
...mapState(['tablesLoading']),
...mapState(['tablesLoading', 'contextsLoading']),
somethingIsLoading() {
return this.tablesLoading || this.loading
return this.tablesLoading || this.contextsLoading || this.loading
},
},
watch: {
Expand Down
24 changes: 11 additions & 13 deletions src/modules/modals/EditContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@
<input v-model="title" :class="{ missing: errorTitle }" type="text"
:placeholder="t('tables', 'Title of the context')">
</div>
<div>
<div class="row">
<div class="col-4 mandatory">
{{ t('tables', 'Description') }}
</div>
<input v-model="description" type="text"
:placeholder="t('tables', 'Description of the context')">
</div>
</div>
<div class="row">
<div class="col-4 mandatory">
{{ t('tables', 'Description') }}
</div>
<div class="row">
<div>
{{ t('tables', 'Resources') }}
</div>
<NcContextResource :resources.sync="resources" />
<input v-model="description" type="text" :placeholder="t('tables', 'Description of the context')">
</div>
<div class="row">
<div>
{{ t('tables', 'Resources') }}
</div>
<NcContextResource :resources.sync="resources" />
</div>

<div class="row">
<div class="right-additional-button">
<NcButton type="primary" @click="submit">
Expand Down
2 changes: 2 additions & 0 deletions src/modules/navigation/sections/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
:filter-string="filterString" :table="table" />
</NcAppNavigationItem>
</ul>
<div v-if="contextsLoading" class="icon-loading" />
<ul v-if="!contextsLoading">
<NcAppNavigationCaption :name="t('tables', 'Contexts')">
<template #actions>
Expand All @@ -70,6 +71,7 @@
</ul>
</template>

<!-- TODO make filter work for Contexts -->
<div v-if="filterString !== ''" class="search-info">
<NcEmptyContent :description="t('tables', 'Your results are filtered.')">
<template #icon>
Expand Down
5 changes: 5 additions & 0 deletions src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default new Vuex.Store({
},
actions: {
async insertNewContext({ commit, state, dispatch }, { data }) {
commit('setContextsLoading', true)
let res = null

try {
Expand All @@ -131,6 +132,7 @@ export default new Vuex.Store({
contexts.push(res.data.ocs.data)
commit('setContexts', contexts)

commit('setContextsLoading', false)
return res.data.ocs.data
},
async insertNewTable({ commit, state, dispatch }, { data }) {
Expand Down Expand Up @@ -331,6 +333,8 @@ export default new Vuex.Store({
const table = state.tables[index]
table.favorite = false
commit('setTable', table)

Check failure on line 336 in src/store/store.js

View workflow job for this annotation

GitHub Actions / NPM lint

Trailing spaces not allowed
return true
},
async updateContext({ state, commit, dispatch }, { id, data }) {
let res = null
Expand All @@ -347,6 +351,7 @@ export default new Vuex.Store({
const index = contexts.findIndex(c => c.id === context.id)
contexts[index] = context
commit('setContexts', [...contexts])

return context
},
async transferTable({ state, commit, dispatch }, { id, data }) {
Expand Down

0 comments on commit 39b7948

Please sign in to comment.