Commit 12083e37 authored by Jörg Richter's avatar Jörg Richter

Create role types interactively (#207)

parent 4e97ad41
Pipeline #6382 passed with stages
in 3 minutes and 40 seconds
......@@ -22,6 +22,12 @@ export default ({store}) => ({
create: (name, _, pos) => {
store.dispatch('createAssocType', {name, pos})
}
},
{
uri: 'dmx.core.role_type',
create: (name, _, pos) => {
store.dispatch('createRoleType', {name, pos})
}
}
]
})
......@@ -18,6 +18,15 @@ const actions = {
dispatch('putAssocType', assocType)
dispatch('revealTopic', {topic: assocType, pos})
})
},
createRoleType ({dispatch}, {name, pos}) {
console.log('Creating role type', name)
dm5.restClient.createRoleType(defaultRoleType(name)).then(roleType => {
console.log('Created', roleType)
dispatch('putRoleType', roleType)
dispatch('revealTopic', {topic: roleType, pos})
})
}
}
......@@ -25,22 +34,34 @@ export default {
actions
}
const defaultTopicType = name => ({
// Note: a new type gets its default URI at server-side.
// Also "typeUri" is provided at server-side (see ModelFactoryImpl).
value: name,
dataTypeUri: 'dmx.core.text',
viewConfigTopics: [{
typeUri: 'dmx.webclient.view_config',
childs: {
'dmx.webclient.add_to_create_menu': true
}
}]
})
const defaultAssocType = name => ({
// Note: a new type gets its default URI at server-side.
// Also "typeUri" is provided at server-side (see ModelFactoryImpl).
value: name,
dataTypeUri: 'dmx.core.text'
})
function defaultTopicType (name) {
return {
// Note: a new type gets its default URI at server-side.
// Also "typeUri" is provided at server-side (see ModelFactoryImpl).
value: name,
dataTypeUri: 'dmx.core.text',
viewConfigTopics: [{
typeUri: 'dmx.webclient.view_config',
childs: {
'dmx.webclient.add_to_create_menu': true
}
}]
}
}
function defaultAssocType (name) {
return {
// Note: a new type gets its default URI at server-side.
// Also "typeUri" is provided at server-side (see ModelFactoryImpl).
value: name,
dataTypeUri: 'dmx.core.text'
}
}
function defaultRoleType (name) {
return {
// Note: a new type gets its default URI at server-side.
// Also "typeUri" is provided at server-side (see PersistenceLayer#createRoleType).
value: name
}
}
......@@ -9,7 +9,7 @@ import 'font-awesome/css/font-awesome.css'
import './element-ui'
import './websocket'
console.log('[DMX] 2019/05/14')
console.log('[DMX] 2019/05/17')
// 1) Init dm5 library
// The dm5 library must be inited *before* the dm5-webclient component is instantiated.
......
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