From 15875c5a7598e89f4b85f7a67fa93b00c43a4f31 Mon Sep 17 00:00:00 2001 From: jaden <noreply@example.com> Date: Fri, 2 Jun 2017 11:02:03 +0200 Subject: [PATCH] rm unused report dialogs #41 --- beat/web/ui/static/ui/js/reportdialog.js | 436 ----------------------- 1 file changed, 436 deletions(-) diff --git a/beat/web/ui/static/ui/js/reportdialog.js b/beat/web/ui/static/ui/js/reportdialog.js index fc52a0834..9ec8ca571 100644 --- a/beat/web/ui/static/ui/js/reportdialog.js +++ b/beat/web/ui/static/ui/js/reportdialog.js @@ -120,439 +120,3 @@ beat.ui.report.add_experiments = function(dialog_id, received_data, experiments_ // Display the dialog $('#' + dialog_id).dialog("open"); } - -beat.ui.report.lock_report = function(dialog_id, scope) -{ - 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++; - - scope.reportFactory.lockReport(scope.user, scope.report_id, scope.url_prefix) - .then(function (reportData) - { - $(".explanation_text").hide(); - $("#report_lock .warnings").show(); - $("#report_lock .errors").hide(); - $("#button-report_lock-cancel").hide(); - }) - .catch(function (error) - { - scope.status = 'Unable to lock report data: ' + error; - $(".explanation_text").hide(); - $("#report_lock .warnings").hide(); - $("#report_lock .errors").show(); - if(error.detail != undefined) - scope.status = 'Unable to lock report data: ' + error.detail; - $("#report_lock .errors .errorslist").append(scope.status); - $("#button-report_lock-cancel").hide(); - }); - } - else - { - $('#' + dialog_id).dialog("close"); - $(".explanation_text").show(); - $("#report_lock .warnings").hide(); - $("#report_lock .errors").hide(); - $("#report_lock .errors .errorslist").empty(); - num_click = 0; - location.reload(); - } - - } - }, - { - id: 'button-' + dialog_id + '-cancel', - text: 'Cancel', - click: function() { - var data = {}; - $.ajaxSetup({ - beforeSend: function(xhr, settings) { - xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); - } - }); - $('#' + dialog_id).dialog("close"); - } - }, - ] - }); - - // Display the dialog - $('#' + dialog_id).dialog("open"); -} - -beat.ui.report.publish_report = function(dialog_id, scope, algorithms_list) -{ - 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++; - - if(algorithms_list.length > 0) - { - var data = { - visible_algorithms: [], - }; - - var inputs = $('#' + dialog_id + ' div.algorithms ul.algorithmslist input'); - - for (var i = 0; i < inputs.length; ++i) - { - if (!inputs[i].checked) - data.visible_algorithms.push(inputs[i].value); - } - - var send_data = JSON.stringify(data); - - scope.reportFactory.publishReport(scope.url_prefix, scope.user, scope.report_id, send_data) - .then(function (reportData) - { - $(".explanation_text").hide(); - $("#report_publish .warnings").show(); - $("#report_publish .errors").hide(); - $("#button-report_publish-cancel").hide(); - }) - .catch(function (error) - { - scope.status = 'Unable to publish report data: ' + error; - $(".explanation_text").hide(); - $("#report_publish .warnings").hide(); - $("#report_publish .errors").show(); - if(error.detail != undefined) - scope.status = 'Unable to publish report data: ' + error.detail; - $("#report_publish .errors .errorslist").append(scope.status); - $("#button-report_publish-cancel").hide(); - }); - - } - else - { - scope.reportFactory.publishReport(scope.url_prefix, scope.user, scope.report_id) - .then(function (reportData) - { - $(".explanation_text").hide(); - $("#report_publish .warnings").show(); - $("#report_publish .errors").hide(); - $("#button-report_publish-cancel").hide(); - }) - .catch(function (error) - { - scope.status = 'Unable to publish report data: ' + error; - $(".explanation_text").hide(); - $("#report_publish .warnings").hide(); - $("#report_publish .errors").show(); - if(error.detail != undefined) - scope.status = 'Unable to publish report data: ' + error.detail; - $("#report_publish .errors .errorslist").append(scope.status); - $("#button-report_publish-cancel").hide(); - }); - } - - - } - else - { - $('#' + dialog_id).dialog("close"); - $(".explanation_text").show(); - $("#report_publish .warnings").hide(); - $("#report_publish .errors").hide(); - $("#report_publish .errors .errorslist").empty(); - num_click = 0; - location.reload(); - } - } - }, - { - id: 'button-' + dialog_id + '-cancel', - text: 'Cancel', - click: function() { - var data = {}; - $.ajaxSetup({ - beforeSend: function(xhr, settings) { - xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); - } - }); - $('#' + dialog_id).dialog("close"); - } - }, - ] - }); - - if(algorithms_list.length > 0 && num_click == 0) - { - // Initialise the dialog content - $('#' + dialog_id + ' div.explanation_text .algorithms ul.algorithmslist').empty(); - - - // Populate the list of algorithms - parent = $('#' + dialog_id + ' div.explanation_text .algorithms ul.algorithmslist')[0]; - - for (var i = 0; i < algorithms_list.length; ++i) - { - var li = document.createElement('li'); - - var input = document.createElement('input'); - input.type = 'checkbox'; - input.className = 'algorithm'; - input.value = algorithms_list[i]; - input.checked = true; - - li.appendChild(input); - - var a = document.createElement('a'); - a.href = scope.url_prefix + '/algorithms/' + algorithms_list[i] + '/'; - a.target = '_blank'; - a.textContent = algorithms_list[i]; - - li.appendChild(a); - - parent.appendChild(li); - } - - $('#' + dialog_id + ' div.explanation_text .algorithms').show(); - - - } - - // Display the dialog - $('#' + dialog_id).dialog("open"); -} - -beat.ui.report.remove_experiment = function(dialog_id, experiment_id, scope) -{ - 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++; - - var data_to_send = {}; - data_to_send['experiments'] = [experiment_id]; - scope.reportFactory.removeExperiment(scope.user, scope.report_id, data_to_send, scope.url_prefix) - .then(function (reportData) - { - $(".explanation_text").hide(); - $("#report_remove_experiment .warnings").show(); - $("#report_remove_experiment .errors").hide(); - $("#button-report_remove_experiment-cancel").hide(); - }) - .catch(function (error) - { - scope.status = 'Unable to remove experiment from report: ' + error; - $(".explanation_text").hide(); - $("#report_remove_experiment .warnings").hide(); - $("#report_remove_experiment .errors").show(); - if(error.detail != undefined) - scope.status = 'Unable to remove experiment from report: ' + error.detail; - $("#report_remove_experiment .errors .errorslist").append(scope.status); - $("#button-report_remove_experiment-cancel").hide(); - }); - } - else - { - $('#' + dialog_id).dialog("close"); - $(".explanation_text").show(); - $("#report_remove_experiment .warnings").hide(); - $("#report_remove_experiment .errors").hide(); - $("#report_remove_experiment .errors .errorslist").empty(); - num_click = 0; - location.reload(); - } - - } - }, - { - id: 'button-' + dialog_id + '-cancel', - text: 'Cancel', - click: function() { - var data = {}; - $.ajaxSetup({ - beforeSend: function(xhr, settings) { - xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); - } - }); - $('#' + dialog_id).dialog("close"); - } - }, - ] - }); - - // Display the dialog - $('#' + dialog_id).dialog("open"); -} - -beat.ui.report.remove_item = function(dialog_id, elementToRemove, scope) -{ - 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++; - - if(elementToRemove.id.split("_")[0] == 'table') - { - delete scope.tables_details[elementToRemove.id]; - } - else - { - delete scope.plots_details[elementToRemove.id]; - } - - var index = scope.report.orderedcontent.indexOf(elementToRemove.id); - if(index > -1) - { - scope.report.orderedcontent.splice(index, 1); - } - - delete scope.report.content[elementToRemove.id]; - - - $("#" + elementToRemove.id).remove(); - - $('#' + dialog_id).dialog("close"); - } - } - }, - { - id: 'button-' + dialog_id + '-cancel', - text: 'Cancel', - click: function() { - var data = {}; - $.ajaxSetup({ - beforeSend: function(xhr, settings) { - xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); - } - }); - $('#' + dialog_id).dialog("close"); - } - }, - ] - }); - - // Display the dialog - $('#' + dialog_id).dialog("open"); -} - -beat.ui.report.report_saved = function(dialog_id, scope) -{ - 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"); -} -- GitLab