-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
WIP #369 Removed criterion filter WIP #396 Added criterion layers to nn seed WIP #369 Added GenerateCriterion plugin WIP #369 Added GenerateCriterion to criterion meta WIP #369 Filtered criterion from the ArchEditor WIP Removed old css WIP #369 filtered criterion types WIP #369. Fixed criterion pointer assignment WIP #369 Fixed criterion execution problems WIP #369 Updated seeds WIP #369 Fixed failing test
- Loading branch information
Showing
13 changed files
with
201 additions
and
8,197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/*globals define*/ | ||
/*jshint node:true, browser:true*/ | ||
|
||
define([ | ||
'text!./metadata.json', | ||
'plugin/PluginBase' | ||
], function ( | ||
pluginMetadata, | ||
PluginBase | ||
) { | ||
'use strict'; | ||
|
||
pluginMetadata = JSON.parse(pluginMetadata); | ||
|
||
/** | ||
* Initializes a new instance of GenerateCriterion. | ||
* @class | ||
* @augments {PluginBase} | ||
* @classdesc This class represents the plugin GenerateCriterion. | ||
* @constructor | ||
*/ | ||
var GenerateCriterion = function () { | ||
// Call base class' constructor. | ||
PluginBase.call(this); | ||
this.pluginMetadata = pluginMetadata; | ||
}; | ||
|
||
/** | ||
* Metadata associated with the plugin. Contains id, name, version, description, icon, configStructue etc. | ||
* This is also available at the instance at this.pluginMetadata. | ||
* @type {object} | ||
*/ | ||
GenerateCriterion.metadata = pluginMetadata; | ||
|
||
// Prototypical inheritance from PluginBase. | ||
GenerateCriterion.prototype = Object.create(PluginBase.prototype); | ||
GenerateCriterion.prototype.constructor = GenerateCriterion; | ||
|
||
/** | ||
* Main function for the plugin to execute. This will perform the execution. | ||
* Notes: | ||
* - Always log with the provided logger.[error,warning,info,debug]. | ||
* - Do NOT put any user interaction logic UI, etc. inside this method. | ||
* - callback always has to be called even if error happened. | ||
* | ||
* @param {function(string, plugin.PluginResult)} callback - the result callback | ||
*/ | ||
GenerateCriterion.prototype.main = function (callback) { | ||
// Generate the code for the criterion layer and return a file | ||
var name = this.core.getAttribute(this.activeNode, 'name'), | ||
code = `require 'nn'\nreturn nn.${name}()`, | ||
filename = `${name}.lua`; | ||
|
||
// Using the logger. | ||
this.logger.debug(`Generating code for ${name} criterion layer.`); | ||
|
||
// Save the file | ||
this.blobClient.putFile(filename, code) | ||
.then(hash => { | ||
this.result.setSuccess(true); | ||
this.result.addArtifact(hash); | ||
callback(null, this.result); | ||
}) | ||
.catch(err => callback(err, this.result)); | ||
|
||
}; | ||
|
||
return GenerateCriterion; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "GenerateCriterion", | ||
"name": "Generate Criterion Code", | ||
"version": "0.1.0", | ||
"description": "", | ||
"icon": { | ||
"class": "glyphicon glyphicon-cog", | ||
"src": "" | ||
}, | ||
"disableServerSideExecution": false, | ||
"disableBrowserSideExecution": false, | ||
"writeAccessRequired": false, | ||
"configStructure": [] | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.