Merge pull request #1581 from OpenRefine/issue1376
Migrate "Match all filtered cells" to use standard reconciliation services
This commit is contained in:
commit
34941ce632
@ -461,7 +461,7 @@
|
||||
"valid-values": "Valid values",
|
||||
"blanks": "Blanks",
|
||||
"errors": "Errors",
|
||||
"search-fb-topic": "Search Freebase for a topic to match all filtered cells:",
|
||||
"search-fb-topic": "Search for an item to match all filtered cells:",
|
||||
"copy-recon-judg": "Copy recon judgments from column",
|
||||
"copy-to-col": "Copy to Columns",
|
||||
"copy-opt": "Copying Options",
|
||||
|
@ -504,7 +504,7 @@
|
||||
"re-trans": "Retransformer",
|
||||
"custom-text-facet": "Personnaliser la facette textuelle",
|
||||
"match-other": "Apparier les autres cellules avec le même contenu",
|
||||
"search-fb-topic": "Chercher dans Freebase un sujet qui correspond à toutes les cellules filtrées :",
|
||||
"search-fb-topic": "Chercher un item qui correspond à toutes les cellules filtrées :",
|
||||
"from-col": "De la colonne",
|
||||
"custom-numeric-label": "Facette numérique personnalisée sur la colonne",
|
||||
"start-recon": "Démarrer la réconciliation",
|
||||
|
@ -73,6 +73,20 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doSearchToMatch = function() {
|
||||
var serviceUrl = null;
|
||||
var service = null;
|
||||
var suggestOptions = {};
|
||||
if (column.reconConfig) {
|
||||
serviceUrl = column.reconConfig.service;
|
||||
}
|
||||
if (serviceUrl) {
|
||||
service = ReconciliationManager.getServiceFromUrl(serviceUrl);
|
||||
}
|
||||
if (service && service.suggest && service.suggest.entity) {
|
||||
suggestOptions = $.extend({}, service.suggest.entity);
|
||||
suggestOptions.query_param_name = "prefix";
|
||||
}
|
||||
|
||||
var frame = DialogSystem.createDialog();
|
||||
frame.width("400px");
|
||||
|
||||
@ -84,36 +98,24 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
|
||||
var input = $('<input />').appendTo($('<p></p>').appendTo(body));
|
||||
|
||||
input.suggest({}).bind("fb-select", function(e, data) {
|
||||
var query = {
|
||||
"id" : data.id,
|
||||
"type" : []
|
||||
};
|
||||
var baseUrl = "https://www.googleapis.com/freebase/v1/mqlread?key=" + Freebase.API_KEY + "&";
|
||||
var url = baseUrl + $.param({ query: JSON.stringify(query) }) + "&callback=?";
|
||||
input.suggest(suggestOptions).bind("fb-select", function(e, data) {
|
||||
var types = data.notable ? data.notable : [];
|
||||
|
||||
$.getJSON(
|
||||
url,
|
||||
Refine.postCoreProcess(
|
||||
"recon-match-specific-topic-to-cells",
|
||||
{
|
||||
columnName: column.name,
|
||||
topicID: data.id,
|
||||
topicName: data.name,
|
||||
types: types.join(","),
|
||||
identifierSpace: service.identifierSpace,
|
||||
schemaSpace: service.schemaSpace
|
||||
},
|
||||
null,
|
||||
function(o) {
|
||||
var types = "result" in o ? o.result.type : [];
|
||||
{ cellsChanged: true, columnStatsChanged: true }
|
||||
);
|
||||
|
||||
Refine.postCoreProcess(
|
||||
"recon-match-specific-topic-to-cells",
|
||||
{
|
||||
columnName: column.name,
|
||||
topicID: data.id,
|
||||
topicGUID: data.guid,
|
||||
topicName: data.name,
|
||||
types: types.join(",")
|
||||
},
|
||||
null,
|
||||
{ cellsChanged: true, columnStatsChanged: true }
|
||||
);
|
||||
|
||||
DialogSystem.dismissUntil(level - 1);
|
||||
}
|
||||
);
|
||||
DialogSystem.dismissUntil(level - 1);
|
||||
});
|
||||
|
||||
$('<button class="button"></button>').text($.i18n._('core-buttons')["cancel"]).click(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user