Skip to content

Commit

Permalink
Added suffix for meta node actions. Fixes #169 (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Jun 3, 2016
1 parent 0257287 commit 970822f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/visualizers/panels/ForgeActionButton/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,34 @@ define([
}
],

MyPipelines: [
MyPipelines_META: [
{
name: 'Create new pipeline',
icon: 'queue',
action: create.Pipeline
}
],
MyArchitectures: [
MyArchitectures_META: [
{
name: 'Create new architecture',
icon: 'queue',
action: create.Architecture
}
],
MyDataTypes: [
MyDataTypes_META: [
{
name: 'Create new data type',
icon: 'queue',
action: create.Data
}
],
MyOperations: [
MyOperations_META: [
{
name: 'Create new operation',
icon: 'queue',
action: create.Operation
}
],

Pipeline: [
{
name: 'Create new node',
Expand Down
8 changes: 4 additions & 4 deletions src/visualizers/panels/ForgeActionButton/ForgeActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ define([
ForgeActionButton.prototype.findActionsFor = function(nodeId) {
var node = this.client.getNode(nodeId),
base = this.client.getNode(node.getMetaTypeId()),
isMeta = base.getId() === node.getId(),
suffix = isMeta ? '_META' : '',
basename;

while (base && !ACTIONS[basename]) {
basename = base.getAttribute('name');
basename = base.getAttribute('name') + suffix;
base = this.client.getNode(base.getBaseId());
}

return ACTIONS[basename] || [];
};

Expand All @@ -65,8 +68,5 @@ define([
this.update();
};

// Add the ability to create initial nodes
// TODO

return ForgeActionButton;
});

0 comments on commit 970822f

Please sign in to comment.