Merge pull request #1293 from ostephens/fix-regex-filter-error

Fix regex filter error
This commit is contained in:
Jacky 2017-10-27 19:22:47 -04:00 committed by GitHub
commit 88f6e1b8d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 9 deletions

View File

@ -178,7 +178,7 @@ Refine.reinitializeProjectData = function(f, fError) {
$.getJSON( $.getJSON(
"command/core/get-project-metadata?" + $.param({ project: theProject.id }), null, "command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
function(data) { function(data) {
if (data.status == 'error') { if (data.status == "error") {
alert(data.message); alert(data.message);
if (fError) { if (fError) {
fError(); fError();
@ -220,7 +220,7 @@ Refine._renameProject = function() {
data: { "project" : theProject.id, "name" : name }, data: { "project" : theProject.id, "name" : name },
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data && typeof data.code != 'undefined' && data.code == "ok") { if (data && typeof data.code != "undefined" && data.code == "ok") {
theProject.metadata.name = name; theProject.metadata.name = name;
Refine.setTitle(); Refine.setTitle();
} else { } else {
@ -425,9 +425,12 @@ Refine.fetchRows = function(start, limit, onDone, sorting) {
} }
$.post( $.post(
"command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?", "command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }),
body, body,
function(data) { function(data) {
if(data.code === "error") {
data = theProject.rowModel;
}
theProject.rowModel = data; theProject.rowModel = data;
// Un-pool objects // Un-pool objects
@ -445,7 +448,7 @@ Refine.fetchRows = function(start, limit, onDone, sorting) {
onDone(); onDone();
} }
}, },
"jsonp" "json"
); );
}; };

View File

@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function BrowsingEngine(div, facetConfigs) { function BrowsingEngine(div, facetConfigs) {
this._div = div; this._div = div;
this._mode = theProject.recordModel.hasRecords ? 'record-based' : 'row-based'; this._mode = theProject.recordModel.hasRecords ? "record-based" : "row-based";
this._facets = []; this._facets = [];
this._initializeUI(); this._initializeUI();
@ -101,6 +101,7 @@ BrowsingEngine.prototype._initializeUI = function() {
'<p>'+$.i18n._('core-project')["not-sure"]+'<br /><a href="https://github.com/OpenRefine/OpenRefine/wiki/Screencasts" target="_blank"><b>'+$.i18n._('core-project')["watch-cast"]+'</b></a></p>' + '<p>'+$.i18n._('core-project')["not-sure"]+'<br /><a href="https://github.com/OpenRefine/OpenRefine/wiki/Screencasts" target="_blank"><b>'+$.i18n._('core-project')["watch-cast"]+'</b></a></p>' +
'</div>' + '</div>' +
'<div class="browsing-panel-header" bind="header">' + '<div class="browsing-panel-header" bind="header">' +
'<div class="browsing-panel-errors" bind="errors"></div>' +
'<div class="browsing-panel-indicator" bind="indicator">' + '<div class="browsing-panel-indicator" bind="indicator">' +
'<img src="images/small-spinner.gif" /> '+$.i18n._('core-project')["refreshing-facet"]+'' + '<img src="images/small-spinner.gif" /> '+$.i18n._('core-project')["refreshing-facet"]+'' +
'</div>' + '</div>' +
@ -240,19 +241,31 @@ BrowsingEngine.prototype.update = function(onDone) {
this._elmts.header.show(); this._elmts.header.show();
this._elmts.controls.css("visibility", "hidden"); this._elmts.controls.css("visibility", "hidden");
this._elmts.indicator.css("visibility", "visible"); this._elmts.indicator.css("display", "block");
$.post( $.post(
"command/core/compute-facets?" + $.param({ project: theProject.id }), "command/core/compute-facets?" + $.param({ project: theProject.id }),
{ engine: JSON.stringify(this.getJSON(true)) }, { engine: JSON.stringify(this.getJSON(true)) },
function(data) { function(data) {
if(data.code === "error") {
var clearErr = $('#err-text').remove();
var err = $('<div id="err-text">')
.text(data.message)
.appendTo(self._elmts.errors);
self._elmts.errors.css("display", "block");
if (onDone) {
onDone();
}
return;
}
var facetData = data.facets; var facetData = data.facets;
for (var i = 0; i < facetData.length; i++) { for (var i = 0; i < facetData.length; i++) {
self._facets[i].facet.updateState(facetData[i]); self._facets[i].facet.updateState(facetData[i]);
} }
self._elmts.indicator.css("visibility", "hidden"); self._elmts.indicator.css("display", "none");
self._elmts.errors.css("display", "none");
if (self._facets.length > 0) { if (self._facets.length > 0) {
self._elmts.header.show(); self._elmts.header.show();
self._elmts.controls.css("visibility", "visible"); self._elmts.controls.css("visibility", "visible");

View File

@ -38,9 +38,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
display: none; display: none;
} }
.browsing-panel-errors {
display: none;
position: relative;
height: auto;
margin: 5px;
text-align: center;
background: #fff0f4;
color: #c51244;
padding: 4px 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border: 1px solid #ccc;
}
.browsing-panel-indicator { .browsing-panel-indicator {
visibility: hidden; display: none;
position: absolute; position: relative;
width: 50%; width: 50%;
margin: 5px; margin: 5px;
top: 0em; top: 0em;