From a83988e45fdf163c0c058455c1da7e1c608441c4 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 23 Jun 2020 19:20:56 +0400 Subject: [PATCH] add populate button --- templates/web/thesaurus/thesaurus.html.twig | 75 ++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/templates/web/thesaurus/thesaurus.html.twig b/templates/web/thesaurus/thesaurus.html.twig index 492d69974f..148a2c6911 100644 --- a/templates/web/thesaurus/thesaurus.html.twig +++ b/templates/web/thesaurus/thesaurus.html.twig @@ -218,6 +218,17 @@

+
+ Populate +
+
+
+

{{ 'thesaurus:: confirm populate' | trans }}

+

+     +

+
+
{{ 'phraseanet:: thesaurus' | trans }} @@ -1503,8 +1514,70 @@ /* */ - + /**Populate btn action**/ + $('#populate_btn').click(function (e) { + e.preventDefault(); + $("#confirm_populate").dialog({ + modal: true, + title: "{{ 'thesaurus: Populate title' | trans }}", + autoOpen:false, + open:function () { + $(this).closest(".ui-dialog") + .find(".ui-button:first") // the first button + .addClass("close-dialog").hide(); + $('.cancel_button').click(function () { + $('.close-dialog').trigger('click'); + }); + + + } + }); + $("#confirm_populate").dialog('open'); + $('#confirm_populate_button').click(function () { + $.ajax({ + type: 'GET', + url: '/admin/worker-manager/populate-status', + data: { + sbasIds: [{{ bid }}] + }, + success: function (data) { + if (data == 0) { + $.ajax({ + url: '/thesaurus/populate', + type: 'POST', + data: { + databox_id: {{ bid }} + }, + success: function (data) { + //humane.info('{{ "thesaurus::populate: success message" |trans }}'); + $('.close-dialog').trigger('click'); + } + }); + } else { + alert('{{ "thesaurus::populate: Warning populate is in process to indexing databox" |trans }}'); + } + } + }); + }) + }); + + +