|
|
@@ -365,7 +365,6 @@ var FieldAnalysis = function (vm, field_name) {
|
|
|
collection: ko.mapping.toJSON(vm.collection),
|
|
|
analysis: ko.mapping.toJSON(self)
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
if (data.terms != null) {
|
|
|
$.each(data.terms, function (key, val) {
|
|
|
@@ -380,7 +379,7 @@ var FieldAnalysis = function (vm, field_name) {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
self.isLoading(false);
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
});
|
|
|
};
|
|
|
@@ -393,7 +392,6 @@ var FieldAnalysis = function (vm, field_name) {
|
|
|
query: ko.mapping.toJSON(vm.query),
|
|
|
analysis: ko.mapping.toJSON(self)
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
if (data.stats.stats.stats_fields[self.name()] != null) {
|
|
|
$.each(data.stats.stats.stats_fields[self.name()], function (key, val) {
|
|
|
@@ -408,7 +406,7 @@ var FieldAnalysis = function (vm, field_name) {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
self.isLoading(false);
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
});
|
|
|
};
|
|
|
@@ -651,13 +649,12 @@ var Collection = function (vm, collection) {
|
|
|
logGA('add_facet/' + facet_json.widgetType);
|
|
|
|
|
|
$.post("/search/template/new_facet", {
|
|
|
- collection: ko.mapping.toJSON(self),
|
|
|
- id: facet_json.widget_id,
|
|
|
- label: facet_json.name,
|
|
|
- field: facet_json.name,
|
|
|
- widget_type: facet_json.widgetType
|
|
|
+ "collection": ko.mapping.toJSON(self),
|
|
|
+ "id": facet_json.widget_id,
|
|
|
+ "label": facet_json.name,
|
|
|
+ "field": facet_json.name,
|
|
|
+ "widget_type": facet_json.widgetType
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
var facet = ko.mapping.fromJS(data.facet);
|
|
|
facet.properties.limit.subscribe(function () {
|
|
|
@@ -678,7 +675,7 @@ var Collection = function (vm, collection) {
|
|
|
} else {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {});
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {});
|
|
|
};
|
|
|
|
|
|
self.addPivotFacetValue = function(facet) {
|
|
|
@@ -860,7 +857,6 @@ var Collection = function (vm, collection) {
|
|
|
$.post("/search/get_collection", {
|
|
|
name: self.name()
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
self.idField(data.collection.collection.idField);
|
|
|
self.template.template(data.collection.collection.template.template);
|
|
|
@@ -875,7 +871,7 @@ var Collection = function (vm, collection) {
|
|
|
|
|
|
self.syncDynamicFields();
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {});
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {});
|
|
|
};
|
|
|
|
|
|
function diff(A, B) {
|
|
|
@@ -921,7 +917,6 @@ var Collection = function (vm, collection) {
|
|
|
$.post("/search/get_collection", {
|
|
|
name: self.name()
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
self.idField(data.collection.collection.idField);
|
|
|
syncArray(self.template.fieldsAttributes, data.collection.collection.template.fieldsAttributes, false);
|
|
|
@@ -929,19 +924,18 @@ var Collection = function (vm, collection) {
|
|
|
}
|
|
|
// After sync the dynamic fields
|
|
|
self.syncDynamicFields()
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {});
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {});
|
|
|
};
|
|
|
|
|
|
self.syncDynamicFields = function () {
|
|
|
$.post("/search/index/fields/dynamic", {
|
|
|
name: self.name()
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
syncArray(self.template.fieldsAttributes, data.gridlayout_header_fields, true);
|
|
|
syncArray(self.fields, data.fields, true);
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {});
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {});
|
|
|
};
|
|
|
|
|
|
self.toggleSortColumnGridLayout = function (template_field) {
|
|
|
@@ -1092,7 +1086,6 @@ var NewTemplate = function (vm, initial) {
|
|
|
collection: ko.mapping.toJSON(vm.collection),
|
|
|
show_all: ko.mapping.toJSON(vm.showCores)
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
// Sync new and old names
|
|
|
$.each(data.collection, function(index, name) {
|
|
|
@@ -1113,7 +1106,7 @@ var NewTemplate = function (vm, initial) {
|
|
|
else {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
}).done(function() {
|
|
|
vm.isSyncingCollections(false);
|
|
|
@@ -1315,8 +1308,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
facet: ko.mapping.toJSON(facet),
|
|
|
qdata: ko.mapping.toJSON(qdata),
|
|
|
multiQ: multiQ
|
|
|
- }, function (data) { return JSON.bigdataParse(data); },
|
|
|
- "text");
|
|
|
+ }, function (data) {return data});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -1335,7 +1327,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
query: ko.mapping.toJSON(self.query),
|
|
|
layout: ko.mapping.toJSON(self.columns)
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
|
|
|
if (typeof callback != undefined && callback != null){
|
|
|
callback(data);
|
|
|
@@ -1419,7 +1410,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
}
|
|
|
self.resultsHash = _resultsHash;
|
|
|
}
|
|
|
- }, "text")
|
|
|
+ })
|
|
|
].concat(multiQs)
|
|
|
)
|
|
|
.done(function() {
|
|
|
@@ -1492,7 +1483,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
collection: ko.mapping.toJSON(self.collection),
|
|
|
id: doc.id
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
var details = [];
|
|
|
doc.details.removeAll();
|
|
|
if (data.status == 0) {
|
|
|
@@ -1522,7 +1512,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
}
|
|
|
doc.details(details);
|
|
|
doc.originalDetails(ko.toJSON(doc.details()));
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
});
|
|
|
};
|
|
|
@@ -1533,7 +1523,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
document: ko.mapping.toJSON(doc),
|
|
|
id: doc.id
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
if (data.status == 0) {
|
|
|
doc.showEdit(false);
|
|
|
doc.originalDetails(ko.toJSON(doc.details()));
|
|
|
@@ -1541,7 +1530,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
else {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
});
|
|
|
};
|
|
|
@@ -1579,8 +1568,6 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
collection: ko.mapping.toJSON(self.collection),
|
|
|
layout: ko.mapping.toJSON(self.columns)
|
|
|
}, function (data) {
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
-
|
|
|
if (data.status == 0) {
|
|
|
self.collection.id(data.id);
|
|
|
$(document).trigger("info", data.message);
|
|
|
@@ -1591,7 +1578,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
|
|
|
else {
|
|
|
$(document).trigger("error", data.message);
|
|
|
}
|
|
|
- }, "text").fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
$(document).trigger("error", xhr.responseText);
|
|
|
});
|
|
|
};
|