Added eslint, jshint config. Fixes #99
WIP #99 Updated code style violations
Esse commit está contido em:
@@ -0,0 +1,4 @@
|
||||
src/common/lua.js
|
||||
src/visualizers/widgets/TextEditor/lib/*
|
||||
src/common/js-yaml.min.js
|
||||
src/visualizers/Visualizers.json
|
||||
@@ -0,0 +1,18 @@
|
||||
env:
|
||||
browser: true
|
||||
mocha: true
|
||||
es6: true
|
||||
extends: 'eslint:recommended'
|
||||
rules:
|
||||
indent:
|
||||
- error
|
||||
- 4
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"esversion": 6
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
/* globals define */
|
||||
define([
|
||||
'deepforge/js-yaml.min'
|
||||
], function(
|
||||
@@ -148,28 +149,11 @@ define([
|
||||
|
||||
GraphChecker.prototype = new Importer();
|
||||
|
||||
// Check if two models are isomorphic
|
||||
var modelMatches = function(gmeNodes, text) {
|
||||
var nodes = convertNodes(gmeNodes),
|
||||
soln = yaml.load(text);
|
||||
|
||||
nodes.concat(soln).forEach(node => {
|
||||
node.next = node.next || [];
|
||||
node.attributes = node.attributes || {};
|
||||
});
|
||||
|
||||
return _modelMatches(nodes, soln);
|
||||
};
|
||||
|
||||
//////////////// Operators ////////////////
|
||||
// Check if two models are isomorphic
|
||||
var _modelMatches = function(soln, nodes) {
|
||||
var nodeMap = createMap(nodes),
|
||||
solnMap = createMap(soln),
|
||||
sInits, // soln start nodes
|
||||
nInits, // 'nodes' start nodes
|
||||
resMap = {}, // soln node id to node id
|
||||
solnIds = soln.map(n => n.id),
|
||||
nodeIds = nodes.map(n => n.id);
|
||||
solnMap = createMap(soln);
|
||||
|
||||
if (nodes.length !== soln.length) {
|
||||
return false;
|
||||
@@ -187,8 +171,7 @@ define([
|
||||
};
|
||||
|
||||
var getMostConstrained = function(soln, nodes) {
|
||||
var options = soln.map(sn => [sn, nodes.filter(n => nodesMatch(sn, n))]),
|
||||
startId;
|
||||
var options = soln.map(sn => [sn, nodes.filter(n => nodesMatch(sn, n))]);
|
||||
|
||||
options.sort((a, b) => b[1].length < a[1].length);
|
||||
return options[0];
|
||||
@@ -199,8 +182,7 @@ define([
|
||||
nodes = Object.keys(nodeMap).map(id => nodeMap[id]),
|
||||
snode = solnMap[id],
|
||||
options,
|
||||
used,
|
||||
node;
|
||||
used;
|
||||
|
||||
mappings = mappings || {};
|
||||
|
||||
@@ -247,14 +229,16 @@ define([
|
||||
snext.push(startId);
|
||||
}
|
||||
|
||||
var inferNext = (prev, curr) => {
|
||||
mappings2 = inferGraph(curr, solnMap, nodeMap, mappings2);
|
||||
return prev && mappings;
|
||||
};
|
||||
|
||||
for (var i = options.length; i--;) {
|
||||
mappings[id] = options[i].id; // need to clone the object
|
||||
|
||||
mappings2 = clone(mappings);
|
||||
result = snext.reduce((prev, curr) => {
|
||||
mappings2 = inferGraph(curr, solnMap, nodeMap, mappings2);
|
||||
return prev && mappings;
|
||||
}, true);
|
||||
result = snext.reduce(inferNext, true);
|
||||
|
||||
if (result) {
|
||||
return mappings2;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* globals define*/
|
||||
define([
|
||||
], function(
|
||||
) {
|
||||
@@ -25,7 +26,6 @@ define([
|
||||
var createLayerDict = function(core, meta) {
|
||||
var node,
|
||||
names = Object.keys(meta),
|
||||
attributes,
|
||||
layers = {};
|
||||
|
||||
for (var i = names.length; i--;) {
|
||||
|
||||
@@ -28,6 +28,7 @@ define([
|
||||
|
||||
_.extend(OperationDecorator.prototype, DecoratorBase.prototype);
|
||||
|
||||
OperationDecorator.prototype.DECORATOR_ID = DECORATOR_ID;
|
||||
OperationDecorator.prototype.expand = function() {
|
||||
DecoratorBase.prototype.expand.call(this);
|
||||
// Add the ports for data inputs/outputs
|
||||
@@ -36,7 +37,7 @@ define([
|
||||
//var outputs = this._node.outputs;
|
||||
};
|
||||
|
||||
OperationDecorator.prototype._highlightPort = function(name) {
|
||||
OperationDecorator.prototype._highlightPort = function(/*name*/) {
|
||||
// Highlight port with the given name
|
||||
// TODO
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ define([
|
||||
}
|
||||
|
||||
return this.createExecution(this.activeNode)
|
||||
.then(node => {
|
||||
.then(() => {
|
||||
this.result.setSuccess(true);
|
||||
callback(null, this.result);
|
||||
})
|
||||
@@ -103,7 +103,7 @@ define([
|
||||
);
|
||||
})
|
||||
.then(() => { // datamapping is set!
|
||||
this.updateReferences(copies, dataMapping)
|
||||
this.updateReferences(copies, dataMapping);
|
||||
this.boxOperations(opTuples.map(o => o[0]), tgtNode);
|
||||
return this.save(`Created execution of ${name}`);
|
||||
})
|
||||
@@ -152,8 +152,7 @@ define([
|
||||
CreateExecution.prototype.sortIOByName = function (container) {
|
||||
return container.sort((a, b) =>
|
||||
// sort by name
|
||||
this.core.getAttribute(a, 'name') < this.core.getAttribute(b, 'name')
|
||||
? 1 : -1
|
||||
this.core.getAttribute(a, 'name') < this.core.getAttribute(b, 'name') ? 1 : -1
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -51,8 +51,7 @@ define([
|
||||
CreateTorchMeta.prototype.main = function (callback) {
|
||||
// Use self to access core, project, result, logger etc from PluginBase.
|
||||
// These are all instantiated at this point.
|
||||
var self = this,
|
||||
nodeObject;
|
||||
var self = this;
|
||||
|
||||
if (!this.META.Language) {
|
||||
callback('"Language" container required to run plugin', this.result);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/*globals define*/
|
||||
define([
|
||||
'text!./entry.ejs',
|
||||
'text!./main.ejs',
|
||||
|
||||
@@ -65,7 +65,7 @@ define([
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
if (layers[i][Constants.NEXT].length > 1) {
|
||||
// no support for
|
||||
console.error('No support for parallel layers... yet');
|
||||
this.logger.error('No support for parallel layers... yet');
|
||||
break;
|
||||
} else {
|
||||
// args
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* globals define */
|
||||
define([
|
||||
'SimpleNodes/Constants',
|
||||
'deepforge/lua'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* globals define */
|
||||
// This is the searcher for the mock library
|
||||
define([
|
||||
'deepforge/layer-args',
|
||||
@@ -10,10 +11,10 @@ define([
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var nop = function() {};
|
||||
var createSearcher = function(plugin) {
|
||||
var core = plugin.core,
|
||||
META = plugin.META,
|
||||
logger = plugin.logger.fork('nn'),
|
||||
parent = plugin.tgtNode,
|
||||
LayerDict = createLayerDict(core, META);
|
||||
|
||||
@@ -41,8 +42,7 @@ define([
|
||||
};
|
||||
|
||||
Layer.prototype._node = function() {
|
||||
var attrs = this._attrs,
|
||||
name,
|
||||
var name,
|
||||
node,
|
||||
value;
|
||||
|
||||
@@ -83,11 +83,11 @@ define([
|
||||
this._outputs = [];
|
||||
};
|
||||
|
||||
Container.prototype.add = function(self, tlayer) {
|
||||
console.error('Add is not overridden!');
|
||||
Container.prototype.add = function() {
|
||||
logger.error('Add is not overridden!');
|
||||
};
|
||||
|
||||
var Sequential = function(attrs, args) {
|
||||
var Sequential = function(/*attrs, args*/) {
|
||||
Container.call(this);
|
||||
};
|
||||
|
||||
@@ -95,8 +95,7 @@ define([
|
||||
|
||||
Sequential.prototype.add = function(self, tlayer) {
|
||||
var layer = tlayer.get('_node'),
|
||||
nodes = layer._inputs,
|
||||
conn;
|
||||
nodes = layer._inputs;
|
||||
|
||||
// If this._inputs is empty, add the layer to the inputs list
|
||||
if (this._inputs.length === 0) { // first node
|
||||
@@ -146,15 +145,12 @@ define([
|
||||
var CreateLayer = function(type) {
|
||||
var res = luajs.newContext()._G,
|
||||
attrs = [].slice.call(arguments, 1),
|
||||
proto,
|
||||
node;
|
||||
|
||||
if (LAYERS[type]) {
|
||||
node = new LAYERS[type](LayerDict[type] || [], attrs);
|
||||
proto = LAYERS[type].prototype;
|
||||
} else { // Call generic Layer with type name
|
||||
node = new Layer(type, LayerDict[type] || [], attrs);
|
||||
proto = Layer.prototype;
|
||||
}
|
||||
|
||||
res.set('_node', node);
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
[
|
||||
{
|
||||
"id": "AutoViz",
|
||||
"title": "AutoViz",
|
||||
"panel": "panels/AutoViz/AutoVizPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "EasyDAG",
|
||||
"title": "EasyDAG",
|
||||
"panel": "panels/EasyDAG/EasyDAGPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "ArchEditor",
|
||||
"title": "ArchEditor",
|
||||
"panel": "panels/ArchEditor/ArchEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "TextEditor",
|
||||
"title": "TextEditor",
|
||||
"panel": "panels/TextEditor/TextEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "OperationEditor",
|
||||
"title": "OperationEditor",
|
||||
"panel": "panels/OperationEditor/OperationEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "PipelineEditor",
|
||||
"title": "PipelineEditor",
|
||||
"panel": "panels/PipelineEditor/PipelineEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "ExecutionView",
|
||||
"title": "ExecutionView",
|
||||
"panel": "panels/ExecutionView/ExecutionViewPanel",
|
||||
"DEBUG_ONLY": false
|
||||
}
|
||||
{
|
||||
"id": "AutoViz",
|
||||
"title": "AutoViz",
|
||||
"panel": "panels/AutoViz/AutoVizPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "EasyDAG",
|
||||
"title": "EasyDAG",
|
||||
"panel": "panels/EasyDAG/EasyDAGPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "ArchEditor",
|
||||
"title": "ArchEditor",
|
||||
"panel": "panels/ArchEditor/ArchEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "TextEditor",
|
||||
"title": "TextEditor",
|
||||
"panel": "panels/TextEditor/TextEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "OperationEditor",
|
||||
"title": "OperationEditor",
|
||||
"panel": "panels/OperationEditor/OperationEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "PipelineEditor",
|
||||
"title": "PipelineEditor",
|
||||
"panel": "panels/PipelineEditor/PipelineEditorPanel",
|
||||
"DEBUG_ONLY": false
|
||||
},
|
||||
{
|
||||
"id": "ExecutionView",
|
||||
"title": "ExecutionView",
|
||||
"panel": "panels/ExecutionView/ExecutionViewPanel",
|
||||
"DEBUG_ONLY": false
|
||||
}
|
||||
]
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define */
|
||||
/*jshint browser: true*/
|
||||
/**
|
||||
* Generated by VisualizerGenerator 1.7.0 from webgme on Tue May 17 2016 11:25:46 GMT-0400 (EDT).
|
||||
@@ -42,32 +42,32 @@ define([
|
||||
}
|
||||
|
||||
// Add layer type (base class's base class)
|
||||
desc.layerType = null;
|
||||
if (desc.baseName) {
|
||||
var node = this._client.getNode(id),
|
||||
base = this._client.getNode(node.getMetaTypeId()),
|
||||
layerType = this._client.getNode(base.getBaseId());
|
||||
desc.layerType = null;
|
||||
if (desc.baseName) {
|
||||
var node = this._client.getNode(id),
|
||||
base = this._client.getNode(node.getMetaTypeId()),
|
||||
layerType = this._client.getNode(base.getBaseId());
|
||||
|
||||
if (layerType) {
|
||||
desc.layerType = layerType.getAttribute(nodePropertyNames.Attributes.name);
|
||||
}
|
||||
}
|
||||
if (layerType) {
|
||||
desc.layerType = layerType.getAttribute(nodePropertyNames.Attributes.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
};
|
||||
|
||||
ArchEditorControl.prototype._getValidInitialNodes = function() {
|
||||
return this._client.getChildrenMeta(this._currentNodeId).items
|
||||
// For now, anything is possible!
|
||||
// FIXME
|
||||
.map(info => this._getAllDescendentIds(info.id))
|
||||
.reduce((prev, curr) => prev.concat(curr))
|
||||
// Filter all abstract nodes
|
||||
.filter(nodeId => {
|
||||
return !this._client.getNode(nodeId).isAbstract();
|
||||
})
|
||||
.map(id => this._getObjectDescriptor(id))
|
||||
.filter(obj => !obj.isConnection && obj.name !== 'Connection');
|
||||
// For now, anything is possible!
|
||||
// FIXME
|
||||
.map(info => this._getAllDescendentIds(info.id))
|
||||
.reduce((prev, curr) => prev.concat(curr))
|
||||
// Filter all abstract nodes
|
||||
.filter(nodeId => {
|
||||
return !this._client.getNode(nodeId).isAbstract();
|
||||
})
|
||||
.map(id => this._getObjectDescriptor(id))
|
||||
.filter(obj => !obj.isConnection && obj.name !== 'Connection');
|
||||
};
|
||||
|
||||
return ArchEditorControl;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define */
|
||||
/*jshint browser: true*/
|
||||
/**
|
||||
* Generated by VisualizerGenerator 1.7.0 from webgme on Tue May 24 2016 10:15:19 GMT-0500 (CDT).
|
||||
@@ -6,12 +6,10 @@
|
||||
|
||||
define([
|
||||
'panels/PipelineEditor/PipelineEditorControl',
|
||||
'underscore',
|
||||
'js/NodePropertyNames'
|
||||
'underscore'
|
||||
], function (
|
||||
PipelineEditorControl,
|
||||
_,
|
||||
nodePropertyNames
|
||||
_
|
||||
) {
|
||||
|
||||
'use strict';
|
||||
@@ -28,5 +26,22 @@ define([
|
||||
/* * * * * * * * Visualizer content update callbacks * * * * * * * */
|
||||
ExecutionViewControl.prototype.TERRITORY_RULE = {children: 4};
|
||||
|
||||
ExecutionViewControl.prototype.updateTerritory = function() {
|
||||
var nodeId = this._currentNodeId;
|
||||
|
||||
// activeNode rules
|
||||
this._territories = {};
|
||||
|
||||
this._territoryId = this._client.addUI(this, events => {
|
||||
this._eventCallback(events);
|
||||
});
|
||||
|
||||
this._territories[nodeId] = {children: 0}; // Territory "rule"
|
||||
this._client.updateTerritory(this._territoryId, this._territories);
|
||||
|
||||
this._territories[nodeId] = this.TERRITORY_RULE;
|
||||
this._client.updateTerritory(this._territoryId, this._territories);
|
||||
};
|
||||
|
||||
return ExecutionViewControl;
|
||||
});
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*globals WebGMEGlobal*/
|
||||
/*globals define*/
|
||||
// These are actions defined for specific meta types. They are evaluated from
|
||||
// the context of the ForgeActionButton
|
||||
define([], function() {
|
||||
var ROOT_ID = '',
|
||||
CREATE_MODEL_TXT = 'Create new model';
|
||||
|
||||
var createNewArchitecture = function(type) {
|
||||
var createNewArchitecture = function() {
|
||||
return createNew.call(this, 'Architecture');
|
||||
};
|
||||
|
||||
var createNewPipeline = function(type) {
|
||||
var createNewPipeline = function() {
|
||||
return createNew.call(this, 'Pipeline');
|
||||
};
|
||||
|
||||
@@ -28,8 +25,7 @@ define([], function() {
|
||||
var downloadButton = function() {
|
||||
var id = this._currentNodeId,
|
||||
node = this.client.getNode(id),
|
||||
hash = node.getAttribute('data'),
|
||||
url;
|
||||
hash = node.getAttribute('data');
|
||||
|
||||
if (hash) {
|
||||
return '/rest/blob/download/' + hash;
|
||||
|
||||
@@ -32,7 +32,6 @@ define([
|
||||
var baseName,
|
||||
node = this.client.getNode(nodeId),
|
||||
base = this.client.getNode(node.getMetaTypeId()),
|
||||
base,
|
||||
actions,
|
||||
i;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define */
|
||||
/*jshint browser: true*/
|
||||
/**
|
||||
* Generated by VisualizerGenerator 1.7.0 from webgme on Wed May 18 2016 12:00:46 GMT-0500 (CDT).
|
||||
|
||||
@@ -78,8 +78,7 @@ define([
|
||||
|
||||
// Add the operation definitions to the territory
|
||||
var metanodes = this._client.getAllMetaNodes(),
|
||||
operation = metanodes.find(n => n.getAttribute('name') === 'Operation'),
|
||||
operations;
|
||||
operation = metanodes.find(n => n.getAttribute('name') === 'Operation');
|
||||
|
||||
// Get all the meta nodes that are instances of Operations
|
||||
metanodes.map(n => n.getId())
|
||||
@@ -410,7 +409,7 @@ define([
|
||||
.then(result => {
|
||||
if (result.status === STORAGE_CONSTANTS.SYNCED) {
|
||||
// Throw out the changes... warn the user?
|
||||
console.log('SYNCED!');
|
||||
this._logger.info('SYNCED!');
|
||||
} else {
|
||||
// Throw out the changes... warn the user?
|
||||
this._logger.warn(`Could not create operation after ${srcOpName}`);
|
||||
@@ -418,16 +417,6 @@ define([
|
||||
})
|
||||
.fail(err => this._logger.error(`Could not create operation after ${srcOpName}: ${err}`));
|
||||
|
||||
// Create the connection between the given data ports!
|
||||
//connId = this._client.createChild({
|
||||
//parentId: parentId,
|
||||
//baseId: this.getConnectionId()
|
||||
//});
|
||||
//this._client.makePointer(connId, 'src', srcPortId);
|
||||
//this._client.makePointer(connId, 'dst', dstPortId);
|
||||
//
|
||||
//this._client.completeTransaction(`Created ${typeId} operation after ${nodeId}`);
|
||||
console.log('doing stuff with the core');
|
||||
} else if (pairs.length > 1) {
|
||||
// Else, prompt!
|
||||
// TODO
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define*/
|
||||
/*jshint browser: true*/
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ define([
|
||||
'use strict';
|
||||
|
||||
var ArchEditorWidget,
|
||||
WIDGET_CLASS = 'arch-editor',
|
||||
// WIDGET_CLASS = 'arch-editor',
|
||||
DEFAULT_COLOR = '#ffb74d',
|
||||
LAYER_COLORS = {
|
||||
Containers: '#ffb74d',
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/*globals define*/
|
||||
define([
|
||||
'widgets/EasyDAG/DAGItem'
|
||||
'widgets/EasyDAG/DAGItem',
|
||||
'underscore'
|
||||
], function(
|
||||
DAGItem
|
||||
DAGItem,
|
||||
_
|
||||
) {
|
||||
var Layer = function(parentEl, desc) {
|
||||
this.id = desc.id;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define */
|
||||
/*jshint browser: true*/
|
||||
|
||||
/**
|
||||
@@ -15,8 +15,8 @@ define([
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var OperationEditorWidget,
|
||||
WIDGET_CLASS = 'operation-editor';
|
||||
var OperationEditorWidget;
|
||||
//WIDGET_CLASS = 'operation-editor';
|
||||
|
||||
OperationEditorWidget = function (logger, container) {
|
||||
TextEditorWidget.call(this, logger, container);
|
||||
@@ -26,21 +26,21 @@ define([
|
||||
|
||||
OperationEditorWidget.prototype.getHeader = function (desc) {
|
||||
// Add comment about the inputs, attributes and references
|
||||
var inputs = desc.inputs.map(pair => `-- ${pair[0]} (${pair[1]})`).join('\n'),
|
||||
refs = desc.references.map(name => `-- ${name}`).join('\n'),
|
||||
header = [
|
||||
var inputs = desc.inputs.map(pair => `-- ${pair[0]} (${pair[1]})`).join('\n'),
|
||||
refs = desc.references.map(name => `-- ${name}`).join('\n'),
|
||||
header = [
|
||||
`-- Editing "${desc.name}"`,
|
||||
`-- `,
|
||||
`-- Defined variables:`
|
||||
];
|
||||
'-- ',
|
||||
'-- Defined variables:'
|
||||
];
|
||||
|
||||
if (inputs) {
|
||||
header.push(inputs);
|
||||
}
|
||||
}
|
||||
if (refs) {
|
||||
header.push(refs);
|
||||
}
|
||||
header.push(`--`);
|
||||
}
|
||||
header.push('--');
|
||||
return header.join('\n');
|
||||
};
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ define([
|
||||
|
||||
_.extend(OperationNode.prototype, DAGItem.prototype);
|
||||
|
||||
OperationNode.prototype.updatePort = function(desc) {
|
||||
OperationNode.prototype.updatePort = function(/*desc*/) {
|
||||
// TODO
|
||||
};
|
||||
|
||||
OperationNode.prototype.addPort = function(desc) {
|
||||
OperationNode.prototype.addPort = function(/*desc*/) {
|
||||
// TODO
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*globals define, WebGMEGlobal*/
|
||||
/*globals define*/
|
||||
/*jshint browser: true*/
|
||||
|
||||
/**
|
||||
@@ -7,9 +7,11 @@
|
||||
|
||||
define([
|
||||
'./lib/ace',
|
||||
'underscore',
|
||||
'css!./styles/TextEditorWidget.css'
|
||||
], function (
|
||||
ace
|
||||
ace,
|
||||
_
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
@@ -20,38 +22,32 @@ define([
|
||||
this._logger = logger.fork('Widget');
|
||||
|
||||
this._el = container;
|
||||
this.editor = ace.edit(this._el[0]);
|
||||
this.editor.getSession().setMode('ace/mode/lua');
|
||||
this.editor = ace.edit(this._el[0]);
|
||||
this.editor.getSession().setMode('ace/mode/lua');
|
||||
|
||||
// Get the config from component settings for themes
|
||||
// TODO
|
||||
this.editor.setOptions({
|
||||
// Get the config from component settings for themes
|
||||
// TODO
|
||||
this.editor.setOptions({
|
||||
fontSize: '12pt'
|
||||
});
|
||||
this.editor.$blockScrolling = Infinity;
|
||||
this.DELAY = 250;
|
||||
// this.editor.setTheme('ace/theme/monokai');
|
||||
this.editor.$blockScrolling = Infinity;
|
||||
this.DELAY = 250;
|
||||
// this.editor.setTheme('ace/theme/monokai');
|
||||
|
||||
this.editor.on('input', _.debounce(this.saveText.bind(this), this.DELAY));
|
||||
this.currentHeader = '';
|
||||
this.activeNode = null;
|
||||
this.currentHeader = '';
|
||||
this.activeNode = null;
|
||||
this._initialize();
|
||||
|
||||
this._logger.debug('ctor finished');
|
||||
};
|
||||
|
||||
TextEditorWidget.prototype._initialize = function () {
|
||||
var width = this._el.width(),
|
||||
height = this._el.height(),
|
||||
self = this;
|
||||
|
||||
// set widget class
|
||||
this._el.addClass(WIDGET_CLASS);
|
||||
};
|
||||
|
||||
TextEditorWidget.prototype.onWidgetContainerResize = function (width, height) {
|
||||
// TODO
|
||||
//this.editor.setSize(width, height);
|
||||
TextEditorWidget.prototype.onWidgetContainerResize = function () {
|
||||
};
|
||||
|
||||
// Adding/Removing/Updating items
|
||||
@@ -61,21 +57,21 @@ define([
|
||||
|
||||
TextEditorWidget.prototype.addNode = function (desc) {
|
||||
// Set the current text based on the given
|
||||
// Create the header
|
||||
// Create the header
|
||||
var header = this.getHeader(desc) + '\n';
|
||||
|
||||
this.activeNode = desc.id;
|
||||
this.activeNode = desc.id;
|
||||
this.editor.setValue(header + desc.text, -1);
|
||||
this.currentHeader = header;
|
||||
this.currentHeader = header;
|
||||
};
|
||||
|
||||
TextEditorWidget.prototype.saveText = function () {
|
||||
var text = this.editor.getValue().replace(this.currentHeader, '');
|
||||
if (this.activeNode) {
|
||||
this.saveTextFor(this.activeNode, text);
|
||||
} else {
|
||||
} else {
|
||||
this._logger.error(`Active node is invalid! (${this.activeNode})`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TextEditorWidget.prototype.removeNode = function (gmeId) {
|
||||
@@ -85,10 +81,10 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
TextEditorWidget.prototype.updateNode = function (desc) {
|
||||
TextEditorWidget.prototype.updateNode = function (/*desc*/) {
|
||||
// TODO: Handle concurrent editing... Currently, last save wins and there are no
|
||||
// updates after opening the node. Supporting multiple users editing the same
|
||||
// operation/layer is important but more work than it is worth for now
|
||||
// updates after opening the node. Supporting multiple users editing the same
|
||||
// operation/layer is important but more work than it is worth for now
|
||||
//var currentText = this.editor.getValue().replace(this.currentHeader, '');
|
||||
//if (this.activeNode === desc.id && desc.text !== currentText) {
|
||||
//this.addNode(desc);
|
||||
|
||||
+7
-9
@@ -1,5 +1,4 @@
|
||||
// This is used by the test/plugins tests
|
||||
/*globals requireJS*/
|
||||
/*jshint node:true*/
|
||||
/**
|
||||
* @author pmeijer / https://github.com/pmeijer
|
||||
@@ -16,14 +15,13 @@ var testFixture = require('webgme/test/_globals'),
|
||||
var WebGME = testFixture.WebGME,
|
||||
gmeConfig = require(WEBGME_CONFIG_PATH),
|
||||
getGmeConfig = function getGmeConfig() {
|
||||
'use strict';
|
||||
// makes sure that for each request it returns with a unique object and tests will not interfere
|
||||
if (!gmeConfig) {
|
||||
// if some tests are deleting or unloading the config
|
||||
gmeConfig = require(WEBGME_CONFIG_PATH);
|
||||
}
|
||||
return JSON.parse(JSON.stringify(gmeConfig));
|
||||
};
|
||||
// makes sure that for each request it returns with a unique object and tests will not interfere
|
||||
if (!gmeConfig) {
|
||||
// if some tests are deleting or unloading the config
|
||||
gmeConfig = require(WEBGME_CONFIG_PATH);
|
||||
}
|
||||
return JSON.parse(JSON.stringify(gmeConfig));
|
||||
};
|
||||
|
||||
WebGME.addToRequireJsPaths(gmeConfig);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('CreateExecution', function () {
|
||||
project: project,
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/1',
|
||||
activeNode: '/1'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('CreateTorchMeta', function () {
|
||||
project: project,
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/960660211',
|
||||
activeNode: '/960660211'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
@@ -90,7 +90,7 @@ describe('CreateTorchMeta', function () {
|
||||
project: project,
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/960660211',
|
||||
activeNode: '/960660211'
|
||||
},
|
||||
META_NAMES = [ // Some Torch layer names to look up
|
||||
'ReLU',
|
||||
@@ -136,7 +136,7 @@ describe('CreateTorchMeta', function () {
|
||||
project: project,
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/960660211',
|
||||
activeNode: '/960660211'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
@@ -186,7 +186,7 @@ describe('CreateTorchMeta', function () {
|
||||
project: project,
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/960660211',
|
||||
activeNode: '/960660211'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
|
||||
@@ -68,7 +68,7 @@ describe.skip('ExecutePipeline', function () {
|
||||
commitHash: commitHash,
|
||||
namespace: 'pipeline',
|
||||
branchName: 'test',
|
||||
activeNode: '/s',
|
||||
activeNode: '/s'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
var testFixture = require('../../globals'),
|
||||
path = testFixture.path,
|
||||
jszip = require('jszip'),
|
||||
fs = require('fs'),
|
||||
TEST_CASE_DIR = path.join(__dirname, '..', '..', 'test-cases', 'generated-code'),
|
||||
SEED_DIR = path.join(testFixture.DF_SEED_DIR, 'devTests');
|
||||
@@ -68,7 +67,7 @@ describe('GenerateArchitecture', function () {
|
||||
namespace: 'nn',
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '/4',
|
||||
activeNode: '/4'
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
@@ -105,7 +104,7 @@ describe('GenerateArchitecture', function () {
|
||||
namespace: 'nn',
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: id,
|
||||
activeNode: id
|
||||
},
|
||||
expected = fs.readFileSync(path.join(TEST_CASE_DIR, name), 'utf8')
|
||||
.replace(/\n$/, '');
|
||||
@@ -120,16 +119,6 @@ describe('GenerateArchitecture', function () {
|
||||
var blobClient = new BlobClient(gmeConfig, logger);
|
||||
|
||||
blobClient.getObjectAsString(codeHash, (err, actual) => {
|
||||
// Unzip first...
|
||||
var zip = new jszip(),
|
||||
filename,
|
||||
actual;
|
||||
|
||||
//zip.load(obj);
|
||||
//filename = Object.keys(zip.files)
|
||||
//.filter(name => name.indexOf('.lua') > -1)[0];
|
||||
|
||||
//actual = zip.files[filename].asText();
|
||||
expect(actual).to.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -13,7 +13,6 @@ describe('GenerateYaml', function () {
|
||||
expect = testFixture.expect,
|
||||
logger = testFixture.logger.fork('GenerateYaml'),
|
||||
PluginCliManager = testFixture.WebGME.PluginCliManager,
|
||||
GraphChecker = testFixture.requirejs('deepforge/GraphChecker'),
|
||||
projectName = 'testProject',
|
||||
pluginName = 'GenerateYaml',
|
||||
project,
|
||||
@@ -31,7 +30,7 @@ describe('GenerateYaml', function () {
|
||||
})
|
||||
.then(function () {
|
||||
var importParam = {
|
||||
projectSeed: testFixture.path.join(BASE_DIR, 'devTests', 'devTests.webgmex'),
|
||||
projectSeed: path.join(BASE_DIR, 'devTests', 'devTests.webgmex'),
|
||||
projectName: projectName,
|
||||
branchName: 'master',
|
||||
logger: logger,
|
||||
|
||||
@@ -34,7 +34,6 @@ describe('ImportTorch', function () {
|
||||
blobClient = new BlobClient(gmeConfig, logger),
|
||||
projectName = 'testProject',
|
||||
pluginName = 'ImportTorch',
|
||||
rootNode,
|
||||
checker,
|
||||
core,
|
||||
project,
|
||||
@@ -65,7 +64,6 @@ describe('ImportTorch', function () {
|
||||
project = importResult.project;
|
||||
commitHash = importResult.commitHash;
|
||||
core = importResult.core;
|
||||
rootNode = importResult.rootNode;
|
||||
checker = new GraphChecker({
|
||||
core: core,
|
||||
ignore: {
|
||||
@@ -101,7 +99,7 @@ describe('ImportTorch', function () {
|
||||
namespace: 'nn',
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '',
|
||||
activeNode: ''
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
@@ -119,7 +117,7 @@ describe('ImportTorch', function () {
|
||||
namespace: 'nn',
|
||||
project: project,
|
||||
branchName: 'test',
|
||||
activeNode: '',
|
||||
activeNode: ''
|
||||
},
|
||||
data = fs.readFileSync(path.join(TEST_CASE_DIR, name), 'utf8'),
|
||||
ymlFile = path.join(YAML_DIR, name.replace(/lua$/, 'yml')),
|
||||
|
||||
@@ -13,7 +13,6 @@ describe('ImportYaml', function () {
|
||||
var gmeConfig = testFixture.getGmeConfig(),
|
||||
Q = testFixture.Q,
|
||||
GraphChecker = testFixture.requirejs('deepforge/GraphChecker'),
|
||||
TEST_CASE_DIR = path.join(__dirname, '..', '..', 'test-cases', 'code'),
|
||||
YAML_DIR = path.join(__dirname, '..', '..', 'test-cases', 'models'),
|
||||
expect = testFixture.expect,
|
||||
logger = testFixture.logger.fork('ImportYaml'),
|
||||
@@ -22,7 +21,6 @@ describe('ImportYaml', function () {
|
||||
blobClient = new BlobClient(gmeConfig, logger),
|
||||
projectName = 'testProject',
|
||||
pluginName = 'ImportYaml',
|
||||
rootNode,
|
||||
checker,
|
||||
core,
|
||||
project,
|
||||
@@ -53,7 +51,6 @@ describe('ImportYaml', function () {
|
||||
project = importResult.project;
|
||||
commitHash = importResult.commitHash;
|
||||
core = importResult.core;
|
||||
rootNode = importResult.rootNode;
|
||||
checker = new GraphChecker({
|
||||
core: core,
|
||||
ignore: {
|
||||
@@ -85,7 +82,7 @@ describe('ImportYaml', function () {
|
||||
namespace: 'nn',
|
||||
commitHash: commitHash,
|
||||
branchName: 'test',
|
||||
activeNode: '',
|
||||
activeNode: ''
|
||||
};
|
||||
|
||||
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
||||
@@ -103,7 +100,7 @@ describe('ImportYaml', function () {
|
||||
namespace: 'nn',
|
||||
project: project,
|
||||
branchName: 'test',
|
||||
activeNode: '',
|
||||
activeNode: ''
|
||||
},
|
||||
data = fs.readFileSync(path.join(YAML_DIR, name), 'utf8'),
|
||||
ymlFile = path.join(YAML_DIR, name.replace(/lua$/, 'yml')),
|
||||
|
||||
@@ -13,10 +13,7 @@ var testFixture = require('../globals'),
|
||||
describe('utils', function () {
|
||||
var gmeConfig = testFixture.getGmeConfig(),
|
||||
GraphChecker = testFixture.requirejs('deepforge/GraphChecker'),
|
||||
expect = testFixture.expect,
|
||||
path = testFixture.path,
|
||||
MODELS_DIR = path.join(__dirname, '..', 'test-cases', 'models'),
|
||||
BASE_DIR = path.join(__dirname, '..', 'common'),
|
||||
logger = testFixture.logger.fork('utils'),
|
||||
projectName = 'testProject',
|
||||
Q = testFixture.Q,
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário