Skip to content

Commit 17684e9

Browse files
committed
1 parent 8beae21 commit 17684e9

4 files changed

Lines changed: 50 additions & 29 deletions

File tree

src/main/malewicz/src/components/ConnectionsListPanel.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525
}
2626
},
2727
created: function () {
28-
this.$http.get(this.$store.state.host + '/endpoints').then(
29-
response => {
30-
this.connections = response.body.filter(v => {return v.properties.visible !== false})
31-
this.$store.commit('setNewConnection', response.body.map(v => { return v.name }))
32-
}
33-
)
28+
this.$http.get(this.$store.state.host + '/endpoints').then(
29+
response => {
30+
this.connections = response.body.filter(v => {
31+
return v.properties.visible !== false
32+
})
33+
this.$store.commit('setAllConnection', response.body)
34+
}
35+
)
3436
}
37+
3538
}
3639
</script>

src/main/malewicz/src/components/HelloWorld.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@
3838
left: null
3939
}),
4040
41-
props: {
42-
source: String
43-
},
44-
4541
props: ['panel'],
4642
name: 'HelloWorld',
4743
components: {ObjectsTablePanel, ConnectionsListPanel, TypesListPanel},
4844
watch: {
45+
4946
$route(to, from) {
5047
this.$store.commit('changeUri', to.fullPath)
5148
},
49+
5250
getSimpleUri: function (newUri, oldUri) {
5351
this.$router.push({path: '/' + newUri})
5452
}

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

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
</v-toolbar>
5959

6060

61-
62-
6361
<v-data-table
6462
:headers="defaultMeta"
6563
:items="items"
@@ -79,7 +77,9 @@
7977
<td v-for="met in defaultMeta">
8078
<a v-if="met.properties.datatype==='json' && props.item[met.name]"
8179
:href="'#/'+props.item['endpoint']+'/'+JSON.parse(props.item[met.name].value).link">
82-
<v-chip color="green" dark>{{ JSON.parse(props.item[met.name].value).label }}</v-chip>
80+
<v-chip color="green" dark>
81+
{{ JSON.parse(props.item[met.name].value).label }}
82+
</v-chip>
8383
</a>
8484
<span v-else-if="met.properties.datatype">{{ props.item[met.name] | formatDate }}</span>
8585
<span v-else>{{ props.item[met.name] }}</span>
@@ -104,32 +104,39 @@ export default {
104104
return {
105105
meta: [],
106106
items: [],
107+
descending: false,
107108
pagination: {
108-
rowsPerPage: -1
109+
rowsPerPage: -1,
110+
sortBy: ''
109111
},
110112
dialog: false,
111113
dialog2: false,
112114
isLoading: false
113115
}
114116
},
115117
created: function () {
116-
this.isLoading = true
117-
this.$http.get(this.$store.getters.preparedTypeUri).then(
118-
response => {
119-
this.meta = response.body[0]
120-
}
121-
)
122-
this.$http.get(this.$store.getters.preparedUri).then(
123-
response => {
124-
this.items = response.body
125-
if (this.items.length >= 15 && this.message === this.getPageCount()) {
126-
this.increasePageCount()
118+
// if (this.$store.state.allConnections.length > 0) {
119+
this.isLoading = true
120+
this.$http.get(this.$store.getters.preparedTypeUri).then(
121+
response => {
122+
this.meta = response.body[0]
127123
}
128-
this.isLoading = false
129-
}
130-
)
124+
)
125+
this.$http.get(this.$store.getters.preparedUri).then(
126+
response => {
127+
this.items = response.body
128+
if (this.items.length >= 15 && this.message === this.getPageCount()) {
129+
this.increasePageCount()
130+
}
131+
this.isLoading = false
132+
}
133+
)
134+
// }
131135
},
132136
computed: {
137+
getSort () {
138+
return this.pagination
139+
},
133140
defaultMeta: function () {
134141
if (this.meta.metadata) {
135142
return this.meta.metadata.filter( v => { return v.properties.visible !== false } )
@@ -153,6 +160,15 @@ export default {
153160
}
154161
},
155162
watch: {
163+
getSort(newValue) {
164+
if (newValue.descending === true) {
165+
this.$store.commit('setSort', { "field": newValue.sortBy, "ord": "desc" })
166+
} else if (newValue.descending === false) {
167+
this.$store.commit('setSort', { "field": newValue.sortBy, "ord": "asc" })
168+
} else {
169+
this.$store.commit('setSort', {})
170+
}
171+
},
156172
count (newValue) {
157173
this.meta = []
158174
this.$http.get(newValue).then(

src/main/malewicz/src/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ const store = new Vuex.Store({
7373
host: '',
7474
// host: 'http://localhost:8007/',
7575
newConnections: [],
76+
allConnections: [],
7677
type: 'table',
77-
path: [''],
78+
path: [],
7879
page: { 'number': 1, 'size': 15, 'count': 1 },
7980
orderby: {},
8081
where: '',
@@ -114,6 +115,9 @@ const store = new Vuex.Store({
114115
setNewConnection (state, connectionName) {
115116
state.newConnections = connectionName
116117
},
118+
setAllConnection (state, connectionName) {
119+
state.allConnections = connectionName
120+
},
117121
setType (state, typeName) {
118122
state.type = typeName
119123
},

0 commit comments

Comments
 (0)