* WIP #961 Updated the config dialog to run the pipeline after * WIP #961 Added static inputs detection * WIP #961 Fixed linting issues
Esse commit está contido em:
@@ -26,9 +26,47 @@ define([
|
||||
|
||||
ConfigDialog.prototype = Object.create(PluginConfigDialog.prototype);
|
||||
|
||||
ConfigDialog.prototype.show = function(globalOptions, pluginMetadata, extMetadata, callback) {
|
||||
this._extMetadata = extMetadata;
|
||||
return PluginConfigDialog.prototype.show.call(this, globalOptions, pluginMetadata, {}, callback);
|
||||
ConfigDialog.prototype.getFormatOptions = function() {
|
||||
this._exportFormats = Object.keys(ExportFormats);
|
||||
|
||||
this._formatOptions = [];
|
||||
if (this._exportFormats.length > 1) {
|
||||
this._formatOptions.push({ // format options
|
||||
name: 'exportFormat',
|
||||
displayName: 'Export Format',
|
||||
valueType: 'string',
|
||||
value: this._exportFormats[0],
|
||||
valueItems: this._exportFormats,
|
||||
readOnly: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ConfigDialog.prototype.show = function(pluginMetadata, callback) {
|
||||
this._pluginMetadata = pluginMetadata;
|
||||
|
||||
this.getFormatOptions();
|
||||
this._initDialog();
|
||||
|
||||
this._dialog.on('shown', () => {
|
||||
this._dialog.find('input').first().focus();
|
||||
});
|
||||
|
||||
this._btnSave.on('click', event => {
|
||||
this.submit(callback);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
//save&run on CTRL + Enter
|
||||
this._dialog.on('keydown.PluginConfigDialog', event => {
|
||||
if (event.keyCode === 13 && (event.ctrlKey || event.metaKey)) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
this.submit(callback);
|
||||
}
|
||||
});
|
||||
this._dialog.modal('show');
|
||||
};
|
||||
|
||||
ConfigDialog.prototype._initDialog = function() {
|
||||
@@ -49,15 +87,13 @@ define([
|
||||
this._title.text(this._pluginMetadata.id + ' ' + 'v' + this._pluginMetadata.version);
|
||||
|
||||
// Generate the config options
|
||||
var formats = Object.keys(ExportFormats),
|
||||
format = formats[0],
|
||||
sectionHeader = SECTION_HEADER.clone();
|
||||
var sectionHeader = SECTION_HEADER.clone();
|
||||
|
||||
sectionHeader.text('Static Artifacts');
|
||||
this._divContainer.append(sectionHeader);
|
||||
this.generateConfigSection(this._pluginMetadata);
|
||||
|
||||
if (formats.length > 1) {
|
||||
if (this._exportFormats.length > 1) {
|
||||
this._divContainer.append($('<hr class="extension-config-divider">'));
|
||||
sectionHeader = SECTION_HEADER.clone();
|
||||
sectionHeader.text('Export Options');
|
||||
@@ -65,7 +101,7 @@ define([
|
||||
|
||||
this.generateConfigSection({
|
||||
id: 'FormatOptions',
|
||||
configStructure: this._globalOptions
|
||||
configStructure: this._formatOptions
|
||||
});
|
||||
this._widgets.FormatOptions.exportFormat.el.find('select').on('change', event => {
|
||||
var format = event.target.value;
|
||||
@@ -74,11 +110,38 @@ define([
|
||||
});
|
||||
}
|
||||
|
||||
this.updateExtConfig(format);
|
||||
this.updateExtConfig(this._exportFormats[0]);
|
||||
};
|
||||
|
||||
ConfigDialog.prototype.submit = function (callback) {
|
||||
var config = this._getAllConfigValues();
|
||||
this._dialog.modal('hide');
|
||||
|
||||
if (this._exportFormats.length === 1) {
|
||||
config.FormatOptions = {
|
||||
exportFormat: this._exportFormats[0]
|
||||
};
|
||||
}
|
||||
return callback(config);
|
||||
};
|
||||
|
||||
ConfigDialog.prototype._getAllConfigValues = function () {
|
||||
var settings = {};
|
||||
|
||||
Object.keys(this._widgets).forEach(namespace => {
|
||||
settings[namespace] = {};
|
||||
|
||||
Object.keys(this._widgets[namespace]).forEach(name => {
|
||||
settings[namespace][name] = this._widgets[namespace][name].getValue();
|
||||
});
|
||||
});
|
||||
|
||||
return settings;
|
||||
};
|
||||
|
||||
ConfigDialog.prototype.updateExtConfig = function (format) {
|
||||
var extConfig = {
|
||||
id: 'extensionConfig',
|
||||
class: 'extension-config',
|
||||
configStructure: ExportFormats[format].getConfigStructure ?
|
||||
ExportFormats[format].getConfigStructure(this._client, this._node) : []
|
||||
|
||||
@@ -456,31 +456,16 @@ define([
|
||||
var exportFormats = Object.keys(ExportFormatDict),
|
||||
configDialog = new ConfigDialog(this.client, this._currentNodeId),
|
||||
inputConfig = _.extend({}, metadata),
|
||||
extOptions = [],
|
||||
globalOpts = [];
|
||||
extOptions = [];
|
||||
|
||||
if (exportFormats.length > 1) {
|
||||
globalOpts.push({ // format options
|
||||
name: 'exportFormat',
|
||||
displayName: 'Export Format',
|
||||
valueType: 'string',
|
||||
value: exportFormats[0],
|
||||
valueItems: exportFormats,
|
||||
readOnly: false
|
||||
});
|
||||
}
|
||||
inputConfig.configStructure = inputOpts;
|
||||
|
||||
// Try to get the extension options
|
||||
if (inputOpts.length || exportFormats.length > 1|| extOptions.length) {
|
||||
configDialog.show(globalOpts, inputConfig, (formatOpts, inputOpts) => {
|
||||
configDialog.show(inputConfig, (allConfigs) => {
|
||||
var context = this.client.getCurrentPluginContext(pluginId),
|
||||
exportFormat = (globalOpts.length && formatOpts) ? formatOpts.exportFormat : exportFormats[0],
|
||||
staticInputs = Object.keys(inputOpts || {}).filter(input => inputOpts[input]);
|
||||
|
||||
if (!formatOpts) { // canceled
|
||||
return;
|
||||
}
|
||||
exportFormat = allConfigs.FormatOptions.exportFormat,
|
||||
staticInputs = Object.keys(allConfigs[pluginId]).filter(input => allConfigs[pluginId][input]);
|
||||
|
||||
this.logger.debug('Exporting pipeline to format', exportFormat);
|
||||
this.logger.debug('static inputs:', staticInputs);
|
||||
@@ -488,7 +473,8 @@ define([
|
||||
context.managerConfig.namespace = 'pipeline';
|
||||
context.pluginConfig = {
|
||||
format: exportFormat,
|
||||
staticInputs: staticInputs
|
||||
staticInputs: staticInputs,
|
||||
extensionConfig: allConfigs.extensionConfig
|
||||
};
|
||||
return Q.ninvoke(this.client, 'runBrowserPlugin', pluginId, context)
|
||||
.then(deferred.resolve)
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário