Add nicer spinning gif while preview is loading.

Fix bug of multiple ColumnInfo being generated.
This commit is contained in:
Antonin Delpeuch 2017-07-14 11:30:17 +01:00
parent d99128c330
commit cc991cab21
5 changed files with 28 additions and 24 deletions

View File

@ -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<ReconType>(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)));
}
}

View File

@ -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<String, ReconciledDataExtensionJob.DataExtension> map = new HashMap<String, ReconciledDataExtensionJob.DataExtension>();
if (o.has("rows")){

View File

@ -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",
]
);

View File

@ -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(
'<div bind="progressPanel" class="extend-data-preview-progress"><img src="images/large-spinner.gif" /></div>');
var self = this;
var params = {
@ -291,7 +281,9 @@ ExtendReconciledDataPreviewDialog.prototype._renderPreview = function(data) {
var cell = row[c];
if (cell !== null) {
if ($.isPlainObject(cell)) {
$('<a>').attr("href", "http://www.freebase.com/view" + cell.id).text(cell.name).appendTo(td);
$('<a>').attr("href",
this._serviceMetadata.identifierSpace + cell.id
).attr("target", "_blank").text(cell.name).appendTo(td);
} else {
$('<span>').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 = $('<div></div>').addClass("dialog-header").text("Constrain " + path.join(" > ")).appendTo(frame);
var header = $('<div></div>').addClass("dialog-header").text("Constrain " + id).appendTo(frame);
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);

View File

@ -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;
}