Skip to content

Commit 4ba217f

Browse files
committed
1 parent 64487bf commit 4ba217f

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

src/main/malewicz/src/components/ObjectsTablePanel.vue

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<v-data-table
6969
:headers="defaultMeta"
7070
:items="items"
71-
:pagination.sync="uirPagination"
71+
:pagination.sync="uriPagination"
7272
:loading="isLoading"
7373
hide-actions
7474
class="elevation-1">
@@ -139,7 +139,7 @@ export default {
139139
return this.$store.commit('pageNumber', value)
140140
}
141141
},
142-
uirPagination: {
142+
uriPagination: {
143143
get () {
144144
return this.$store.getters.getPagination
145145
},
@@ -152,19 +152,6 @@ export default {
152152
completeUri: {
153153
handler(newVal, oldVal) {
154154
this.meta = this.$store.getters.getTypes.find( v => { return v.name === this.$store.getters.getUri.type } )
155-
156-
console.log("URI_VAL = " + JSON.stringify(this.$store.getters.getUri))
157-
if (Object.keys(this.$store.getters.getUri.orderby).length === 0) {
158-
const defaultSort = this.meta.metadata.filter(v => { return v.properties.sort }).map(v => v.name)[0]
159-
console.log("defaultSort = " + defaultSort)
160-
if (defaultSort) {
161-
const sortType = this.meta.metadata.filter(v => { return v.properties.sort })[0].properties.sort
162-
console.log("sortType = " + sortType)
163-
this.setSort(defaultSort + '-' + sortType)
164-
return
165-
}
166-
}
167-
168155
this.items = []
169156
this.isLoading = true
170157
this.$http.get(this.$store.getters.preparedUri).then(

src/main/malewicz/src/main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,16 @@ const store = new Vuex.Store({
151151
skipObjectUri (state, type) {
152152
const c = state.uri.connections
153153
state.pageCount = 1
154-
state.uri = { connections: c, type: type, path: [], orderby: {}, page: { number: 1, size: 15 }}
154+
155+
const meta = state.types.find( v => { return v.name === type } )
156+
const defaultSort = meta.metadata.filter(v => { return v.properties.sort }).map(v => v.name)[0]
157+
if (defaultSort) {
158+
const sortType = meta.metadata.filter(v => { return v.properties.sort })[0].properties.sort
159+
state.uri = { connections: c, type: type, path: [], orderby: { field: defaultSort, ord: sortType }, page: { number: 1, size: 15 }}
160+
} else {
161+
state.uri = { connections: c, type: type, path: [], orderby: {}, page: { number: 1, size: 15 }}
162+
}
163+
155164
},
156165
setType (state, typeName) {
157166
state.uri.type = typeName

0 commit comments

Comments
 (0)