Skip to content
Permalink
Browse files

feat(properties-panel): add camunda properties

  • Loading branch information...
philippfromme committed Jul 25, 2018
1 parent be26a45 commit 73d3124183dcd8ee0d6dca8ee52ccbf10e0e828a
@@ -351,8 +351,6 @@ PropertiesPanel.prototype.detach = function() {
* @param {Object|String} tab
*/
PropertiesPanel.prototype.activateTab = function(tab) {
console.log('#activateTab', tab);

var tabId = typeof tab === 'string' ? tab : tab.id;

var current = this._current;
@@ -398,7 +396,6 @@ PropertiesPanel.prototype.update = function(element) {
if (needsCreate) {

if (current) {
console.log('getting activeTabId before removing');

// get active tab from the existing panel before remove it
var activeTabNode = domQuery('.dpp-properties-tab.dpp-active', current.panel);
@@ -414,15 +411,10 @@ PropertiesPanel.prototype.update = function(element) {

this._current = this._create(element, newTabs);

console.log('activeTabId: ' + activeTabId, 'trying to activate');

// activate the saved active tab from the remove panel or the first tab
if (activeTabId) {
console.log('activeTabId found, activating', activeTabId)

if (activeTabId) {
this.activateTab(activeTabId)
} else {
console.log('activeTabId NOT found, activating', this._current.tabs[0]);
this.activateTab(this._current.tabs[0]);
}

@@ -912,11 +904,9 @@ PropertiesPanel.prototype._updateActivation = function(current) {
// check whether the active tab is visible
// if not: set the first tab as active tab
function checkActiveTabVisibility(node, visible) {
console.log('checking for active tab', node, visible);
var isActive = domClasses(node).has('dpp-active');
if (!visible && isActive) {
console.log('setting active tab to first tab');

if (!visible && isActive) {
self.activateTab(current.tabs[0]);
}
}
@@ -954,7 +944,6 @@ PropertiesPanel.prototype._updateActivation = function(current) {

groupVisible = groupVisible || entryVisible;

console.log('set visibility of', entryNode, 'to', entryVisible);
toggleVisible(entryNode, entryVisible);

var values = 'get' in entry ? entry.get(element, entryNode) : {};
@@ -0,0 +1,86 @@
'use strict';

var inherits = require('inherits');

var PropertiesActivator = require('../../PropertiesActivator');

// bpmn properties
var idProps = require('../dmn/parts/IdProps'),
nameProps = require('../dmn/parts/NameProps');

// camunda properties
var versionTag = require('./parts/VersionTagProps');

// history time to live
var historyTimeToLive = require('./parts/HistoryTimeToLiveProps');

var getBusinessObject = require('dmn-js-shared/lib/util/ModelUtil').getBusinessObject,
is = require('dmn-js-shared/lib/util/ModelUtil').is;

// helpers ////////////////////////////////////////

function createGeneralTabGroups(element, translate) {

// refer to target element for external labels
element = element.labelTarget || element;

var generalGroup = {
id: 'general',
label: translate('General'),
entries: []
};

idProps(generalGroup, element, translate);
nameProps(generalGroup, element, translate);
versionTag(generalGroup, element, translate);

var historyTimeToLiveGroup = {
id: 'historyConfiguration',
label: translate('History Configuration'),
entries: []
};
historyTimeToLive(historyTimeToLiveGroup, element, translate);

var groups = [];
groups.push(generalGroup);
groups.push(historyTimeToLiveGroup);

return groups;
}

// Camunda Properties Provider /////////////////////////////////////


/**
* A properties provider for Camunda related properties.
*
* @param {EventBus} eventBus
* @param {Function} translate
*/
function CamundaPropertiesProvider(eventBus, translate) {

PropertiesActivator.call(this, eventBus);

this.getTabs = function(element) {

var generalTab = {
id: 'general',
label: translate('General'),
groups: createGeneralTabGroups(element, translate)
};

return [
generalTab
];
};

}

CamundaPropertiesProvider.$inject = [
'eventBus',
'translate'
];

inherits(CamundaPropertiesProvider, PropertiesActivator);

module.exports = CamundaPropertiesProvider;
@@ -0,0 +1,7 @@
module.exports = {
__depends__: [
require('diagram-js/lib/i18n/translate').default
],
__init__: [ 'propertiesProvider' ],
propertiesProvider: [ 'type', require('./CamundaPropertiesProvider') ]
};
@@ -0,0 +1,19 @@
'use strict';

var entryFactory = require('../../../factory/EntryFactory');

var is = require('dmn-js-shared/lib/util/ModelUtil').is;

module.exports = function(group, element, translate) {

if (is(element, 'dmn:Decision')) {
var historyTimeToLiveEntry = entryFactory.textField({
id: 'historyTimeToLive',
label: translate('History Time To Live'),
modelProperty: 'historyTimeToLive',
});

group.entries.push(historyTimeToLiveEntry);
}

};
@@ -0,0 +1,19 @@
'use strict';

var entryFactory = require('../../../factory/EntryFactory');

var is = require('dmn-js-shared/lib/util/ModelUtil').is;

module.exports = function(group, element, translate) {

if (is(element, 'dmn:Decision')) {
var versionTagEntry = entryFactory.textField({
id: 'versionTag',
label: translate('Version Tag'),
modelProperty: 'versionTag'
});

group.entries.push(versionTagEntry);
}

};
@@ -24,6 +24,7 @@
},
"license": "MIT",
"devDependencies": {
"camunda-dmn-moddle": "^1.0.0",
"chai": "^4.1.2",
"diagram-js": "^2.1.1",
"dmn-js": "^5.1.0",

0 comments on commit 73d3124

Please sign in to comment.
You can’t perform that action at this time.