[importer] Add SQL editor to the importer for RDBMS
@@ -667,6 +667,16 @@ ${ assist.assistPanel() }
<div class="card step">
<h4 class="show-edit-on-hover">${_('Fields')} <!-- ko if: $root.createWizard.isGuessingFieldTypes --><i class="fa fa-spinner fa-spin"></i><!-- /ko --> <a class="inactive-action pointer" data-bind="visible: columns().length > 0" href="#fieldsBulkEditor" data-toggle="modal"><i class="fa fa-edit"></i></a></h4>
<div class="card-body no-margin-top columns-form">
+ <!-- ko if: $root.createWizard.source.inputFormat() === 'rdbms' -->
+ <!-- ko ifnot: rdbmsEditor -->
+ <a href="javascript:void(0)" data-bind="click: toggleRdbmsEditor" class="inactive-action pointer margin-left-5">${ _('Define manually') }</a>
+ <!-- /ko -->
+ <!-- ko if: rdbmsEditor -->
+ <a href="javascript:void(0)" data-bind="click: toggleRdbmsEditor" class="inactive-action pointer margin-left-5">${ _('Show fields') }</a>
+ <!-- /ko -->
+ <!-- /ko -->
+
+ <!-- ko ifnot: rdbmsEditor -->
<!-- ko if: $root.createWizard.source.inputFormat() === 'manual' -->
<form class="form-inline inline-table" data-bind="foreach: columns">
<!-- ko if: $parent.outputFormat() == 'table' -->
@@ -702,7 +712,11 @@ ${ assist.assistPanel() }
<div class="clearfix"></div>
<!-- /ko -->
+ <!-- /ko -->
+ <!-- ko if: rdbmsEditor -->
+ <div data-bind="ace: rdbmsEditorContent, aceOptions: { mode: 'sql' }" style="height: 200px" class="margin-top-30"></div>
+ <!-- /ko -->
</div>
</div>
@@ -1280,6 +1294,7 @@ ${ assist.assistPanel() }
self.rdbmsTableName.subscribe(function (val) {
if (val != '') {
wizard.guessFieldTypes();
+ wizard.destination.rdbmsEditorContent('SELECT * FROM ' + val);
}
});
self.rdbmsTableNames = ko.observableArray();
@@ -1527,6 +1542,12 @@ ${ assist.assistPanel() }
self.columns = ko.observableArray();
// UI
+ self.rdbmsEditor = ko.observable(false);
+ self.rdbmsEditorContent = ko.observable('');
+ self.toggleRdbmsEditor = function () {
+ self.rdbmsEditor(!self.rdbmsEditor());
+ }
+
self.bulkColumnNames = ko.observable('');
self.showProperties = ko.observable(false);
