Skip to content

Commit

Permalink
enh: improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck authored and blizzz committed Mar 11, 2024
1 parent 1d1d0f0 commit 1e64bed
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/modules/modals/CreateContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
} else {
const newContextId = await this.sendNewContextToBE()
if (newContextId) {
await this.$router.push('/context/' + newContextId)
await this.$router.push('/application/' + newContextId)
this.actionCancel()
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/modules/modals/EditContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import { NcModal, NcEmojiPicker, NcButton } from '@nextcloud/vue'
import { showError, showSuccess } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/dist/index.css'
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
import NcContextResource from '../../shared/components/ncContextResource/NcContextResource.vue'
import { NODE_TYPE_TABLE, NODE_TYPE_VIEW } from '../../shared/constants.js'
Expand Down Expand Up @@ -83,6 +83,7 @@ export default {
},
computed: {
...mapGetters(['getContext']),
...mapState(['tables', 'views']),
localContext() {
return this.getContext(this.contextId)
},
Expand Down Expand Up @@ -146,10 +147,10 @@ export default {
},
getContextResources(context) {
const resources = []
const nodes = Object.values(context)
const nodes = Object.values(context.nodes)
for (const node of nodes) {
if (parseInt(node.node_type) === NODE_TYPE_TABLE || parseInt(node.node_type) === NODE_TYPE_VIEW) {
const element = parseInt(node.node_type) === NODE_TYPE_TABLE ? this.tables.find(t => t.id === node.id) : this.views.find(v => v.id === node.id)
const element = parseInt(node.node_type) === NODE_TYPE_TABLE ? this.tables.find(t => t.id === node.node_id) : this.views.find(v => v.id === node.node_id)
if (element) {
const elementKey = parseInt(node.node_type) === NODE_TYPE_TABLE ? 'table-' : 'view-'
const resource = {
Expand Down
3 changes: 1 addition & 2 deletions src/modules/navigation/partials/NavigationContextItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script>
import { NcAppNavigationItem, NcActionButton } from '@nextcloud/vue'
import '@nextcloud/dialogs/dist/index.css'
import { mapGetters, mapState } from 'vuex'
import { mapGetters } from 'vuex'
import Table from 'vue-material-design-icons/Table.vue'
import { emit } from '@nextcloud/event-bus'
import PlaylistEdit from 'vue-material-design-icons/PlaylistEdit.vue'
Expand Down Expand Up @@ -51,7 +51,6 @@ export default {
computed: {
...mapGetters(['activeContext']),
...mapState(['tables', 'views']),
},
methods: {
emit,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Context.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<div v-if="!loading && context">
<div class="content first-row">
<div class="row">
<h1> {{ context.iconName }}&nbsp; {{ context.name }}</h1>
<h1> {{ activeContext.iconName }}&nbsp; {{ activeContext.name }}</h1>
</div>
<div class="row">
<h3> {{ context.description }}</h3>
<h3> {{ activeContext.description }}</h3>
</div>
</div>

Expand Down Expand Up @@ -126,7 +126,7 @@ export default {
},
async loadContext() {
this.contextResources = []
await this.$store.dispatch('getContext', { id: this.activeContextId })
await this.$store.dispatch('loadContext', { id: this.activeContextId })
const index = this.contexts.findIndex(c => parseInt(c.id) === parseInt(this.activeContextId))
this.context = this.contexts[index]
Expand Down
4 changes: 1 addition & 3 deletions src/shared/components/ncContextResource/ResourceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
<div v-for="resource in getResources" :key="resource.key" class="row">
<div class="fix-col-2">
<div style="display:flex; align-items: center;">
{{ resource.emoji }}
</div>
<div> {{ resource.title }} </div>
{{ resource.emoji }} &nbsp; {{ resource.title }} </div>

Check warning on line 11 in src/shared/components/ncContextResource/ResourceList.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected 1 line break before closing tag (`</div>`), but no line breaks found
</div>
<div class="fix-col-2" style="justify-content: end;">
<NcActionButton :close-after-click="true" icon="icon-delete" @click="actionDelete(resource)">
Expand Down
2 changes: 1 addition & 1 deletion src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export default new Vuex.Store({
return true
},

async getContext({ state, commit, dispatch }, { id }) {
async loadContext({ state, commit, dispatch }, { id }) {
try {
const res = await axios.get(generateOcsUrl('/apps/tables/api/2/contexts/' + id))
commit('setContext', res.data.ocs.data)
Expand Down

0 comments on commit 1e64bed

Please sign in to comment.