diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e28e7b3c0391fbf512d8e54102a1d3176583cd04..fca859d154fcec160124aa2c6d25daf96f6e4b8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ py27-linux: script: - git clean -ffdx - export TMPDIR=/var/tmp - - /idiap/project/beat/environments/staging/usr/bin/python bootstrap-buildout.py + - /idiap/project/beat/environments/staging/usr/bin/python bootstrap-buildout.py --setuptools-version=`/idiap/project/beat/environments/staging/usr/bin/python -c 'import setuptools; print(setuptools.__version__)'` - ./bin/buildout - ./bin/python --version - unset TMPDIR @@ -27,7 +27,7 @@ py27-linux: py27-macosx: script: - git clean -ffdx - - /Users/buildbot/work/environments/beat/py27/bin/python bootstrap-buildout.py + - /Users/buildbot/work/environments/beat/py27/bin/python bootstrap-buildout.py --setuptools-version=`/Users/buildbot/work/environments/beat/py27/bin/python -c 'import setuptools; print(setuptools.__version__)'` - ./bin/buildout - ./bin/python --version - export NOSE_WITH_COVERAGE=1 diff --git a/beat/web/experiments/static/experiments/js/utils.js b/beat/web/experiments/static/experiments/js/utils.js index 681018d338d85e29713c747384fe7cb870b70a90..ac71620ef6ed60efe53c7fc3247ae1e0d003caf1 100644 --- a/beat/web/experiments/static/experiments/js/utils.js +++ b/beat/web/experiments/static/experiments/js/utils.js @@ -424,11 +424,11 @@ beat.experiments.utils.displayPlot = function(prefix, container, value, availabl value[other_what], available_plotter_parameter, false); else plotter_selector = _create_selector_with_merge_button(what, value[what], available_plotters, other_what, - value[other_what], available_plotter_parameter, true); + value[other_what], available_plotter_parameter, true, !value["merged"]); _regenerate_multiple_graph(plotter_selector); if (callback) - callback(value[what], $(selector_plotterparameter).val()); + callback(value[what], $(selector_plotterparameter).val(), value["merged"]); }); var button_merge = document.createElement('a'); @@ -468,7 +468,8 @@ beat.experiments.utils.displayPlot = function(prefix, container, value, availabl value.merged = state_merged; _regenerate_multiple_graph(plotter_selector); if (callback) - callback(value["plotter"], $(plotter_selector).val()); + callback(value["plotter"], value["parameter"], value["merged"]); + //callback(value["plotter"], $(plotter_selector).val()); }); diff --git a/beat/web/reports/static/reports/app/controllers/reportController.js b/beat/web/reports/static/reports/app/controllers/reportController.js index eb94a86ae0b9ecf4c7da185b7ed3f3e26ead5226..751359cdbd305413a51cf5d87ceb661d8d831d37 100644 --- a/beat/web/reports/static/reports/app/controllers/reportController.js +++ b/beat/web/reports/static/reports/app/controllers/reportController.js @@ -43,6 +43,7 @@ app.controller('reportController',['$scope', 'reportFactory', 'experimentFactory $scope.report_experiments_blocks_computation_times = {}; $scope.report_experiments_alias = {}; + $scope.report_experiments_alias_from_content = {}; $scope.floating_point_precision = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; $scope.floating_point_precision.selected = 10; $scope.report_algorithm_parameters = {}; @@ -448,11 +449,13 @@ app.controller('reportController',['$scope', 'reportFactory', 'experimentFactory function setExperimentAlias(experiment_id) { $scope.report_experiments_alias[experiment_id] = experiment_id.split("/").pop(); + $scope.report_experiments_alias_from_content[experiment_id] = experiment_id.split("/").pop(); } function setExperimentAliasFromContent(experiment_id, experiment_alias) { $scope.report_experiments_alias[experiment_id] = experiment_alias; + $scope.report_experiments_alias_from_content[experiment_id] = experiment_alias; } function unique(list) diff --git a/beat/web/reports/static/reports/app/directives/reportItemView.js b/beat/web/reports/static/reports/app/directives/reportItemView.js index 03ecae9eb087d13340346a6f4b2ebf85ba4cf652..b4f0c3a315f96265ea49b5d39cafdfa859c16221 100644 --- a/beat/web/reports/static/reports/app/directives/reportItemView.js +++ b/beat/web/reports/static/reports/app/directives/reportItemView.js @@ -103,6 +103,11 @@ app.directive("savereportitems", function($compile) mydict["experiments"] = scope.report.experiments; mydict["content"] = savecontent; + for(var i = 0; i < scope.report.experiments.length; i++) + { + scope.report_experiments_alias_from_content[scope.report.experiments[i]] = scope.report_experiments_alias[scope.report.experiments[i]]; + } + updateReport(mydict); }); @@ -112,7 +117,9 @@ app.directive("savereportitems", function($compile) scope.reportFactory.updateReport(scope.user, scope.report_id, data, scope.url_prefix) .success(function (reportData) { - alert("The report "+ scope.report_id +" has been saved."); + //alert("The report "+ scope.report_id +" has been saved."); + + beat.ui.report.report_saved('report_saved', scope); }) .error(function (error) { @@ -265,7 +272,6 @@ app.directive("addreportitem", function($compile) - content_detail["name"] = plot_details.data.output[0]; //content_detail["description"] = scope.report.content[chart_id].data.plotter; if(plot_details.data.plotter != undefined) @@ -280,6 +286,10 @@ app.directive("addreportitem", function($compile) { content_detail["merged"] = plot_details.data.merged; } + if(plot_details.merged != undefined) + { + content_detail["merged"] = plot_details.merged; + } var html_div_code = '<div class="panel panel-default" id="' + chart_id + '"><div class="panel-heading" role="tab"><h4 class="panel-title"><a role="button" data-toggle="collapse" data-parent="#info-heading" href="#collapse-' + chart_id + '" aria-expanded="true" aria-controls="collapse-info"><i class="fa fa-area-chart"> ' + content_detail.name + '</i></a></h4></div><div id="collapse-' + chart_id + '" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="info-heading"><div id="'+chart_id+'" class="panel-body chart {$ report.status $}"></div></div></div>'; generate_element(scope, "plot", html_div_code); @@ -950,7 +960,10 @@ app.directive("addreportitem", function($compile) else legend_experiments = legend_experiments+ "&" +scope.report_experiments_alias[scope.report.experiments[i]]; - alias_experiments.push(scope.report_experiments_alias[scope.report.experiments[i]]); + if(Object.keys(scope.$parent.report_experiments_alias_from_content).length === 0) + alias_experiments.push(scope.report_experiments_alias[scope.report.experiments[i]]); + else + alias_experiments.push(scope.report_experiments_alias_from_content[scope.report.experiments[i]]); } var request_data = { @@ -998,7 +1011,6 @@ app.directive("addreportitem", function($compile) request_data.merged = plot_detail["merged"]; } - scope.plots_details[container.id]= plot_detail; if(scope.report.status == "editable" && scope.report.number != scope.report_number) @@ -1006,9 +1018,10 @@ app.directive("addreportitem", function($compile) beat.experiments.utils.displayPlot(base_url, $(container).find('.panel-body')[0], request_data, required_plotter, plotterparameter, false, - function(r_plotter, r_plotterparameter) { + function(r_plotter, r_plotterparameter, r_merged) { scope.plots_details[container.id]["data"]["plotter"] = r_plotter; scope.plots_details[container.id]["selected_template"] = r_plotterparameter; + scope.plots_details[container.id]["merged"] = r_merged; } ); } @@ -1017,7 +1030,7 @@ app.directive("addreportitem", function($compile) beat.experiments.utils.displayPlot(base_url, $(container).find('.panel-body')[0], request_data, [], [], false, - function(r_plotter, r_plotterparameter) { + function(r_plotter, r_plotterparameter, r_merged) { } ); } diff --git a/beat/web/reports/templates/reports/dialogs/report_saved.html b/beat/web/reports/templates/reports/dialogs/report_saved.html new file mode 100644 index 0000000000000000000000000000000000000000..ec97e677216732586740f73eb9822f3b9024185e --- /dev/null +++ b/beat/web/reports/templates/reports/dialogs/report_saved.html @@ -0,0 +1,29 @@ +{% comment %} + * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ + * Contact: beat.support@idiap.ch + * + * This file is part of the beat.web module of the BEAT platform. + * + * Commercial License Usage + * Licensees holding valid commercial BEAT licenses may use this file in + * accordance with the terms contained in a written agreement between you + * and Idiap. For further information contact tto@idiap.ch + * + * Alternatively, this file may be used under the terms of the GNU Affero + * Public License version 3 as published by the Free Software and appearing + * in the file LICENSE.AGPL included in the packaging of this file. + * The BEAT platform is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero Public License along + * with the BEAT platform. If not, see http://www.gnu.org/licenses/. +{% endcomment %} +<div id="{{ dialog_id }}" class="report_remove_experiment" title="Report" style="display:none"> + <p class="explanation">Report status</p> + + + <div class="explanation_text"> + <p>Your report has been successfully saved</p> + </div> +</div> diff --git a/beat/web/reports/templates/reports/report.html b/beat/web/reports/templates/reports/report.html index 0d4e922cc09abfcc7df7908598aa3df4fef80b88..44463c09faff8ce3d138e2279df140815593377a 100644 --- a/beat/web/reports/templates/reports/report.html +++ b/beat/web/reports/templates/reports/report.html @@ -165,6 +165,7 @@ {% report_publish "report_publish" %} {% report_remove_experiment "report_remove_experiment" %} {% report_remove_item "report_remove_item" %} +{% report_saved "report_saved" %} <script type="text/javascript"> var smart_selector = new beat.ui.SmartSelector('smart_selector'); diff --git a/beat/web/reports/templatetags/report_tags.py b/beat/web/reports/templatetags/report_tags.py index 381194bdc574d3fd27bd5b3cd632d32b765d97d3..d6a3f1b8140b4726e164026e842a5b4a92a3d0f4 100644 --- a/beat/web/reports/templatetags/report_tags.py +++ b/beat/web/reports/templatetags/report_tags.py @@ -232,3 +232,15 @@ def report_remove_item(id): register.inclusion_tag('reports/dialogs/report_remove_item.html')(report_remove_item) + + +#-------------------------------------------------- + + +def report_saved(id): + return { 'dialog_id': id, + 'URL_PREFIX': settings.URL_PREFIX + } + + +register.inclusion_tag('reports/dialogs/report_saved.html')(report_saved) diff --git a/beat/web/ui/static/ui/js/reportdialog.js b/beat/web/ui/static/ui/js/reportdialog.js index 230d5526119b26d372614f5a5582652d46b2ac8b..4a206950d72f4b9d89ca0eb230ac749c36535fc3 100644 --- a/beat/web/ui/static/ui/js/reportdialog.js +++ b/beat/web/ui/static/ui/js/reportdialog.js @@ -514,3 +514,46 @@ beat.ui.report.remove_item = function(dialog_id, elementToRemove, scope) // Display the dialog $('#' + dialog_id).dialog("open"); } + +beat.ui.report.report_saved = function(dialog_id, scope) +{ + console.log("ici"); + var num_click = 0; + // Create the dialog + $('#' + dialog_id).dialog({ + autoOpen: false, + resizable: false, + width: Math.min($(window).width() * 0.6, 700), + position: { my: "center", at: "center", of: window }, + modal: true, + closeOnEscape: true, + buttons: [ + { + id: 'button-' + dialog_id + '-ok', + text: 'Ok', + click: function() { + var data = {}; + $.ajaxSetup({ + beforeSend: function(xhr, settings) { + xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); + } + }); + + //$('#' + dialog_id).dialog("close"); + if(num_click == 0) + { + num_click++; + $(".explanation_text").hide(); + $('#' + dialog_id).dialog("close"); + $(".explanation_text").show(); + num_click = 0; + location.reload(); + } + } + }, + ] + }); + + // Display the dialog + $('#' + dialog_id).dialog("open"); +} diff --git a/setup.py b/setup.py index 5b3a979219fb6a031e27b6db7ef6caee7fc1eda5..4d1c8124403db6ae02f0ef85f9db224c430edae5 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ from setuptools import setup, find_packages setup( name='beat.web', - version='1.0.2rc1', + version='1.0.3', description='Biometrics Evaluation and Testing Platform (Web Modules)', url='https://gitlab.idiap.ch/beat/beat.web', license='AGPLv3',