Commit 7b25dc8f authored by Malte Reißig's avatar Malte Reißig

Add Tableview extraMenuItem with options dialog (closes #8)

parent 4f9b6ce5
Pipeline #7610 passed with stages
in 2 minutes and 50 seconds
<template>
<div class="dm5-tableview-options">
<div class="field-label">Table Topic Type</div>
<el-select v-model="tableTopicType">
<el-option v-for="type in topicTypes"
:label="type.value" :value="type.uri" :key="type.id">
</el-option>
</el-select>
</div>
</template>
<script>
export default {
inject: {
http: 'axios'
},
created() {
this.fetchTableTopicTypes()
},
data () {
return {
tableTopicType: undefined,
topicTypes: []
}
},
methods: {
fetchTableTopicTypes() {
let self = this
self.http.get('/tableview/topictypes')
.then(function(response) {
const types = response.data
self.topicTypes = types && types.sort((t1, t2) => t1.value.localeCompare(t2.value))
})
}
}
}
</script>
<style>
</style>
......@@ -11,10 +11,6 @@
export default {
inject: {
http: 'axios'
},
props: ["object", "context"],
computed: {
......
......@@ -4,4 +4,21 @@ export default ({store, dm5, axios, Vue}) => ({
'dmx.tableview': require('./components/dmx-tableview-renderer').default
},
extraMenuItems: [{
uri: 'dmx.tableview',
optionsComp: require('./components/dm5-tableview-options.vue').default,
create: (name, data) => {
axios.post('/tableview', {
name: name, tableTopicType: data.tableTopicType
})
.then(function (response) {
console.log("[Tableview Command] Created table view topic", response.data);
store.dispatch('revealTopicById', response.data.id)
})
.catch(function(error) {
console.error("[Tableview Command] Creating table view topic failed", error)
})
}
}]
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment