Skip to content

Commit

Permalink
Change default attribute names; remove default project seed. Closes #13
Browse files Browse the repository at this point in the history
… (#14)

* Change default attribute names; remove default project seed. Closes #13

* WIP- remove defaultMetaNodeName for panel options
  • Loading branch information
umesh-timalsina authored Aug 21, 2020
1 parent 5cc9d5e commit bab0ae5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ To use it in your own visualizer to visualize plotly JSON from your project node
panel parameters.
```
params = {
activeNodeMetaName: The active node meta name for PlotlyGraph panel to be applied
plotlyDataAttribute: The active node attribute which stores plotly JSON
embedded: If true, the visualizer will expect a parent visualizer to call "selectedObjectChanged". If false, it will subscribe to WebGME events.
}
Expand Down
2 changes: 0 additions & 2 deletions config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ var config = require('./config.webgme'),
// Add/overwrite any additional settings here
// config.server.port = 8080;
// config.mongo.uri = 'mongodb://127.0.0.1:27017/webgme_my_app';
config.seedProjects.basePaths = ['src/seeds/project'];
config.seedProjects.defaultProject = 'project';

validateConfig(config);
module.exports = config;
Binary file removed src/seeds/project/project.webgmex
Binary file not shown.
16 changes: 2 additions & 14 deletions src/visualizers/panels/PlotlyGraph/PlotlyGraphControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ define([
) {
'use strict';

const GRAPH = 'Graph',
DATA = 'data';

function PlotlyGraphControl(options) {

this._logger = options.logger.fork('Control');
Expand All @@ -20,8 +17,7 @@ define([
this._widget = options.widget;

this._embedded = options.embedded;
this._activeNodeMetaName = options.activeNodeMetaName || GRAPH;
this._plotlyDataAttribute = options.plotlyDataAttribute || DATA;
this._plotlyDataAttribute = options.plotlyDataAttribute;
this._currentNodeId = null;
this._currentNodeParentId = undefined;
this._logger.debug('ctor finished');
Expand Down Expand Up @@ -64,15 +60,7 @@ define([
PlotlyGraphControl.prototype._getObjectDescriptor = function (nodeId) {
let node = this._client.getNode(nodeId),
desc;
const isGraph = node => {
if(node) {
const metaNode = this._client.getNode(node.getMetaTypeId());
return metaNode ?
metaNode.getAttribute('name') === this._activeNodeMetaName :
false;
}
};
if(isGraph(node)){
if(node){
const plotlyData = node.getAttribute(this._plotlyDataAttribute);
if(plotlyData){
desc = { plotlyData: JSON.parse(plotlyData) };
Expand Down
6 changes: 3 additions & 3 deletions src/visualizers/panels/PlotlyGraph/PlotlyGraphPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ define([
) {
'use strict';

const DEFAULT_PLOTLY_DATA_ATTRIBUTE = 'data';

function PlotlyGraphPanel(layoutManager, params) {
let options = {};
//set properties from options
Expand All @@ -27,8 +29,7 @@ define([

this._client = params.client;
this._embedded = params.embedded;
this._activeNodeMetaName = params.activeNodeMetaName;
this._plotlyDataAttribute = params.plotlyDataAttribute;
this._plotlyDataAttribute = params.plotlyDataAttribute || DEFAULT_PLOTLY_DATA_ATTRIBUTE;

//initialize UI
this._initialize();
Expand Down Expand Up @@ -57,7 +58,6 @@ define([
client: this._client,
embedded: this._embedded,
widget: this.widget,
activeNodeMetaName: this._activeNodeMetaName,
plotlyDataAttribute: this._plotlyDataAttribute
});

Expand Down

0 comments on commit bab0ae5

Please sign in to comment.