Commit 03fd00ac authored by Malte Reißig's avatar Malte Reißig

Tried to adapt dmx-plugin-template to create a topic-command (unsuccessfull).

parent b6c72be7
Pipeline #4800 canceled with stages
{
"name": "dm5-plugin-template",
"version": "0.4.0",
"description": "A starter project for DeepaMehta 5 plugin developers",
"author": "Jörg Richter",
"name": "dmx-tableview-command",
"version": "0.1.0",
"description": "A topic command for navigating tableviews.",
"author": "Malte Reißig",
"license": "GPL-3.0-or-later",
"repository": {
"type": "git",
"url": "https://github.com/jri/dm5-plugin-template.git"
"url": "https://git.dmx.systems/dmx-plugins/dmx-tableview-command.git"
},
"scripts": {
"build": "../../node_modules/.bin/webpack -p --hide-modules",
"stats": "../../node_modules/.bin/webpack -p --json > stats.json && ../../node_modules/.bin/webpack-bundle-analyzer stats.json src/main/resources/web"
"stats": "../../node_modules/.bin/webpack -p --json > stats.json && ../../node_modules/.bin/webpack-bundle-analyzer stats.json dist"
}
}
......@@ -4,10 +4,10 @@
<modelVersion>4.0.0</modelVersion>
<name>DeepaMehta 5 Plugin Template</name>
<groupId>com.example</groupId>
<artifactId>dm5-plugin-template</artifactId>
<version>0.3</version>
<name>DMX Tableview Command</name>
<groupId>systems.dmx</groupId>
<artifactId>dm5-tableview-command</artifactId>
<version>1.0</version>
<packaging>bundle</packaging>
<parent>
......
<!--
The DMX webclient registers a bunch of Vue components globally, so you can just use them in your component's
<template> without registering them yourself. These components comprise:
1. all Element UI components utilized by the webclient, e.g. <el-button>, <el-input>, <el-select>, ..., see
https://github.com/jri/deepamehta/blob/master/modules/dmx-webclient/src/main/js/element-ui.js
2. all components provided by the `dm5-object-renderer` module, see
https://github.com/jri/dm5-object-renderer/tree/master/src/components
-->
<template>
<el-button class="greeting" @click="click">{{buttonLabel}}</el-button>
</template>
<script>
export default {
// In a DMX webclient component you can inject 3 dependencies: 'dm5', 'axios', 'Vue'.
// Important: do *not* import/require these libraries yourself. They would be statically bundled with your plugin then
// (instead of being injected at runtime). Disadvantages: 1) The plugin build size would increase, and 2) at runtime
// the libraries would be instantiated more than once, possibly causing problems.
inject: {
dm5: 'dm5',
http: 'axios',
Vue: 'Vue'
},
created () {
this.http.get('/core/topic/0').then(response => {
console.log(new this.dm5.Topic(response.data))
})
this.Vue.nextTick(() => {
console.log('Hello Vue!')
})
},
computed: {
buttonLabel () {
return this.$store.state.greeting.buttonLabel
}
},
methods: {
click () {
this.$store.dispatch('greet')
}
}
}
</script>
<style>
.greeting {
margin-left: 2em;
}
</style>
<template>
<div class="dmx-tableview-renderer">
<div class="composite-title field">
<h2 class="field-value">{{object.value}}</h2>
<h2 class="command" @click="openTableView(object.id)">x</h2>
</div>
</div>
</template>
<script>
export default {
inject: {
http: 'axios'
},
props: ["object", "context"],
methods: {
openTableView: function (topicId) {
// this.$store.dispatch("revealTopicById", topicId);
window.document.location.url = "/tableview/#/" + topicId;
}
}
}
</script>
<style>
</style>
// This is the Vuex store module provided by your plugin.
// This file exports a Vuex store module object or a function which returns such an object.
// The function receives a "dependencies" object with 3 properties: 'dm5', 'axios', and 'Vue'.
export default ({dm5, axios, Vue}) => ({
state: {
buttonLabel: "Greetings!"
},
actions: {
greet () {
dm5.restClient.createTopic({
typeUri: 'dmx.notes.note',
childs: {
'dmx.notes.title': {value: 'Greetings'},
'dmx.notes.text': {value: '<p>from <b>DMX</b>!<p>'}
}
})
}
}
})
// Every DMX plugin which extends the DMX webclient has a `src/main/js/plugin.js` file.
// This file exports a DMX plugin configuration object or a function which returns such an object.
// The function receives a "dependencies" object with 4 properties: 'store', 'dm5', 'axios', and 'Vue'.
// 'store' is the DMX webclient's Vuex store object.
export default ({store, dm5, axios, Vue}) => ({
// A DMX plugin can provide its own Vuex store module.
// This plugin's state is accessible as 'store.state.greeting' (according to the 'name' property).
storeModule: {
name: 'greeting',
module: require('./greeting').default
objectRenderers: {
'dmx.tableview.table': require('./components/dmx-tableview-renderer').default
},
// A DMX plugin can statically add Vue components to the DMX webclient.
// 3 mount points are supported: 'webclient', 'toolbar-left', and 'toolbar-right'
components: [{
comp: require('./components/Greeting').default,
mount: 'toolbar-left'
}]
// A DMX plugin can do more things at the client-side (not demonstrated here):
// - declare Vuex store watchers
// - provide type-specific detail renderers
// - provide additional topicmap types and renderers
// - add special items to the webclient's Create menu
})
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