diff --git a/main/src/com/google/refine/model/changes/DataExtensionChange.java b/main/src/com/google/refine/model/changes/DataExtensionChange.java index 4a3463174..4deebf612 100644 --- a/main/src/com/google/refine/model/changes/DataExtensionChange.java +++ b/main/src/com/google/refine/model/changes/DataExtensionChange.java @@ -293,9 +293,7 @@ public class DataExtensionChange implements Change { writer.write("columnTypeCount="); writer.write(Integer.toString(_columnTypes.size())); writer.write('\n'); for (ReconType type : _columnTypes) { try { - if(type == null) { - writer.write("null"); - } else { + if(type != null) { JSONWriter jsonWriter = new JSONWriter(writer); type.write(jsonWriter, options); } @@ -409,7 +407,9 @@ public class DataExtensionChange implements Change { columnTypes = new ArrayList(count); for (int i = 0; i < count; i++) { line = reader.readLine(); - if (line != null) { + if (line == null || line.length() == 0) { + columnTypes.add(null); + } else { columnTypes.add(ReconType.load(ParsingUtilities.evaluateJsonStringToObject(line))); } } diff --git a/main/src/com/google/refine/model/recon/ReconciledDataExtensionJob.java b/main/src/com/google/refine/model/recon/ReconciledDataExtensionJob.java index b0bffd8df..c1441bd5a 100644 --- a/main/src/com/google/refine/model/recon/ReconciledDataExtensionJob.java +++ b/main/src/com/google/refine/model/recon/ReconciledDataExtensionJob.java @@ -105,8 +105,10 @@ public class ReconciledDataExtensionJob { String s = ParsingUtilities.inputStreamToString(is); JSONObject o = ParsingUtilities.evaluateJsonStringToObject(s); - // Extract the column metadata - gatherColumnInfo(o.getJSONArray("meta"), columns); + if(columns.size() == 0) { + // Extract the column metadata + gatherColumnInfo(o.getJSONArray("meta"), columns); + } Map map = new HashMap(); if (o.has("rows")){ diff --git a/main/webapp/modules/core/MOD-INF/controller.js b/main/webapp/modules/core/MOD-INF/controller.js index 404e55070..08b76e2fc 100644 --- a/main/webapp/modules/core/MOD-INF/controller.js +++ b/main/webapp/modules/core/MOD-INF/controller.js @@ -478,7 +478,8 @@ function init() { "styles/dialogs/custom-tabular-exporter-dialog.less", "styles/reconciliation/recon-dialog.less", - "styles/reconciliation/standard-service-panel.less" + "styles/reconciliation/standard-service-panel.less", + "styles/reconciliation/extend-data-preview-dialog.less", ] ); diff --git a/main/webapp/modules/core/scripts/dialogs/extend-data-preview-dialog.js b/main/webapp/modules/core/scripts/dialogs/extend-data-preview-dialog.js index b78e1a851..622cf194c 100644 --- a/main/webapp/modules/core/scripts/dialogs/extend-data-preview-dialog.js +++ b/main/webapp/modules/core/scripts/dialogs/extend-data-preview-dialog.js @@ -165,28 +165,18 @@ ExtendReconciledDataPreviewDialog.prototype._show = function(properties) { var suggestConfig = $.extend({}, this._serviceMetadata.suggest.property); suggestConfig.key = null; suggestConfig.query_param_name = "prefix"; - /* var suggestConfig = { - filter: '(all type:/type/property)' - }; - if ((this._column.reconConfig) && (this._column.reconConfig.type)) { - suggestConfig.filter = '(all type:/type/property (any namespace:/type/object namespace:' + this._column.reconConfig.type.id + '))'; - } */ this._elmts.addPropertyInput.suggestP(suggestConfig).bind("fb-select", function(evt, data) { - var expected = data.expected_type; self._addProperty({ id : data.id, name: data.name, - /* expected: { - id: expected.id, - name: expected.name - } */ }); }); }; ExtendReconciledDataPreviewDialog.prototype._update = function() { - this._elmts.previewContainer.empty().text("Querying THE service..."); + this._elmts.previewContainer.empty().html( + '
'); var self = this; var params = { @@ -291,7 +281,9 @@ ExtendReconciledDataPreviewDialog.prototype._renderPreview = function(data) { var cell = row[c]; if (cell !== null) { if ($.isPlainObject(cell)) { - $('').attr("href", "http://www.freebase.com/view" + cell.id).text(cell.name).appendTo(td); + $('').attr("href", + this._serviceMetadata.identifierSpace + cell.id + ).attr("target", "_blank").text(cell.name).appendTo(td); } else { $('').text(cell).appendTo(td); } @@ -315,21 +307,21 @@ ExtendReconciledDataPreviewDialog.prototype._removeProperty = function(id) { ExtendReconciledDataPreviewDialog.prototype._findProperty = function(id) { var properties = this._extension.properties; for(var i = properties.length - 1; i >= 0; i--) { - if (properties[i].id == path) { + if (properties[i].id == id) { return properties[i]; } } return null; } -ExtendReconciledDataPreviewDialog.prototype._constrainProperty = function(path) { +ExtendReconciledDataPreviewDialog.prototype._constrainProperty = function(id) { var self = this; - var property = this._findProperty(path); + var property = this._findProperty(id); var frame = DialogSystem.createDialog(); frame.width("500px"); - var header = $('
').addClass("dialog-header").text("Constrain " + path.join(" > ")).appendTo(frame); + var header = $('
').addClass("dialog-header").text("Constrain " + id).appendTo(frame); var body = $('
').addClass("dialog-body").appendTo(frame); var footer = $('
').addClass("dialog-footer").appendTo(frame); diff --git a/main/webapp/modules/core/styles/views/extend-data-preview-dialog.less b/main/webapp/modules/core/styles/reconciliation/extend-data-preview-dialog.less similarity index 94% rename from main/webapp/modules/core/styles/views/extend-data-preview-dialog.less rename to main/webapp/modules/core/styles/reconciliation/extend-data-preview-dialog.less index 006e87306..220a4610a 100644 --- a/main/webapp/modules/core/styles/views/extend-data-preview-dialog.less +++ b/main/webapp/modules/core/styles/reconciliation/extend-data-preview-dialog.less @@ -69,3 +69,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. vertical-align: top; margin-left: 5px; } + +.extend-data-preview-progress { + text-align: center; +} + +.extend-data-preview-progress img { + padding: 45%; + display: inline-block; +}