Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.classed('invisibleClass', true)
.classed('leftMetaBox', true)
.append('div')
.style('width', this.boxWidth + 'px')
.style('height', this.boxHeight + 'px');
this.$rightMetaBox = this.$node
.append('div')
.classed('invisibleClass', true)
.classed('rightMetaBox', true)
.append('div')
.style('width', this.boxWidth + 'px')
.style('height', this.boxHeight + 'px');
// wrap view ids from package.json as plugin and load the necessary files
get(AppConstants.VIEW, 'Histogram2D')
.load()
.then((plugin) => {
const view = plugin.factory(
this.$node.node(), // parent node
{} // options
);
return view.init();
});
}
.map((d) => plugins.get(AppConstants.VIEW, d.view))
.filter((d) => d !== undefined) // filter views that does not exists
const existingView: ViewWrapper = inputs[1].value;
const oldParams = {
viewId: existingView.desc.id,
idtype: existingView.selection.idtype,
selection: existingView.selection.range,
options: existingView.options
};
const viewId: string = parameter.viewId;
const idtype = parameter.idtype ? resolve(parameter.idtype) : null; // creates a new object
const selection = parameter.selection ? parse(parameter.selection) : none(); // creates a new object
const options = parameter.options;
// create new (inner) view
const view = getPlugin(EXTENSION_POINT_TDP_VIEW, viewId);
await replaceViewWrapper(existingView, {idtype, range: selection}, view, options);
app.update();
return {
inverse: replaceView(inputs[0], inputs[1], oldParams.viewId, oldParams.idtype, oldParams.selection, oldParams.options)
};
}
export function createView(app: IObjectRef, viewId: string, idtype: IDType, selection: Range, options?): IAction {
const view = getPlugin(EXTENSION_POINT_TDP_VIEW, viewId);
// assert view
return action(meta('Add ' + view.name, cat.visual, op.create), CMD_CREATE_VIEW, createViewImpl, [app], {
viewId,
idtype: idtype ? idtype.id : null,
selection: selection ? selection.toString() : none().toString(),
options
});
}
.map((d) => plugins.get(AppConstants.VIEW, d.view))
.filter((d) => d !== undefined) // filter views that does not exists
export async function createViewImpl(inputs: IObjectRef[], parameter: any, graph: ProvenanceGraph): Promise {
const app: OrdinoApp = inputs[0].value;
const viewId: string = parameter.viewId;
const idtype = parameter.idtype ? resolve(parameter.idtype) : null; // creates a new object
const selection = parameter.selection ? parse(parameter.selection) : none(); // creates a new object
const options = parameter.options;
const view = getPlugin(EXTENSION_POINT_TDP_VIEW, viewId);
const viewWrapperInstance = await createViewWrapper(graph, {idtype, range: selection}, app.node, view, options);
if (viewWrapperInstance.built) {
await viewWrapperInstance.built;
}
const oldFocus = await app.pushImpl(viewWrapperInstance);
return {
created: [viewWrapperInstance.ref],
inverse: (inputs, created, removed) => removeView(inputs[0], created[0], oldFocus)
};
}
async function addScoreLogic(waitForScore: boolean, inputs:IObjectRef[], parameter:any) {
const scoreId: string = parameter.id;
const pluginDesc = getPlugin(EXTENSION_POINT_SCORE_IMPL, scoreId);
const plugin = await pluginDesc.load();
const view = await inputs[0].v.then((vi) => vi.getInstance());
const score: IScore|IScore[] = plugin.factory(parameter.params, pluginDesc);
const scores = Array.isArray(score) ? score : [score];
const results = await Promise.all(scores.map((s) => view.addTrackedScoreColumn(s)));
const col = waitForScore ? await Promise.all(results.map((r) => r.loaded)) : results.map((r) => r.col);
return {
inverse: removeScore(inputs[0], scoreId, parameter.params, col.map((c) => c.id))
};
}