From 503cca6d3bdf0f339ecf6a69a05e986c1e5fffed Mon Sep 17 00:00:00 2001 From: David Huynh Date: Fri, 16 Sep 2011 00:19:14 +0000 Subject: [PATCH] More error handling in file selection panel. git-svn-id: http://google-refine.googlecode.com/svn/trunk@2241 7d457c2a-affb-35e4-300a-418c747d4874 --- .../file-selection-panel.html | 2 +- .../file-selection-panel.js | 26 ++++++++----------- .../modules/core/scripts/util/dialog.js | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.html b/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.html index 248f9b354..0643016b1 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.html +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.html @@ -1,7 +1,7 @@
- +
Select Files to Import
diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.js b/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.js index 539ab6085..a985d132b 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.js +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/file-selection-panel.js @@ -280,7 +280,7 @@ Refine.DefaultImportingController.prototype._commitFileSelection = function() { } var self = this; - var dismissBusy = DialogSystem.showBusy("Inspecting selected files ..."); + var dismissBusy = DialogSystem.showBusy("Inspecting
selected files ..."); $.post( "/command/core/importing-controller?" + $.param({ "controller": "core/default-importing-controller", @@ -291,23 +291,19 @@ Refine.DefaultImportingController.prototype._commitFileSelection = function() { "fileSelection" : JSON.stringify(this._job.config.fileSelection) }, function(data) { - if (!(data)) { - self._showImportJobError("Unknown error"); - window.clearInterval(timerID); - return; - } else if (data.code == "error" || !("job" in data)) { - self._showImportJobError(data.message || "Unknown error"); - window.clearInterval(timerID); - return; - } - dismissBusy(); - // Different files might be selected. We start over again. - delete this._parserOptions; + if (!(data)) { + self._createProjectUI.showImportJobError("Unknown error"); + } else if (data.code == "error" || !("job" in data)) { + self._createProjectUI.showImportJobError((data.message) ? ("Error: " + data.message) : "Unknown error"); + } else { + // Different files might be selected. We start over again. + delete this._parserOptions; - self._job = data.job; - self._showParsingPanel(true); + self._job = data.job; + self._showParsingPanel(true); + } }, "json" ); diff --git a/main/webapp/modules/core/scripts/util/dialog.js b/main/webapp/modules/core/scripts/util/dialog.js index f337c1ed0..54f748137 100644 --- a/main/webapp/modules/core/scripts/util/dialog.js +++ b/main/webapp/modules/core/scripts/util/dialog.js @@ -113,7 +113,7 @@ DialogSystem.showBusy = function(message) { var body = $('
').attr('id', 'loading-message').appendTo(frame); $('').attr("src", "images/large-spinner.gif").appendTo(body); - $('').text(" " + (message || "Working...")).appendTo(body); + $('').html(" " + (message || "Working...")).appendTo(body); var level = DialogSystem.showDialog(frame);