Merge "Lint for javascript files"
This commit is contained in:
commit
5dd32b97f3
|
@ -1,196 +0,0 @@
|
||||||
function dashboard(id, fData){
|
|
||||||
var barColor = '#006CCF';
|
|
||||||
function segColor(c){ return {binary:"#807dba", text:"#e08214",media:"#41ab5d"}[c]; }
|
|
||||||
|
|
||||||
// compute total for each state.
|
|
||||||
fData.forEach(function(d){d.total=d.freq.binary+d.freq.text+d.freq.media;});
|
|
||||||
|
|
||||||
// function to handle histogram.
|
|
||||||
function histoGram(fD){
|
|
||||||
var hG={}, hGDim = {t: 60, r: 0, b: 30, l: 0};
|
|
||||||
hGDim.w = 500 - hGDim.l - hGDim.r,
|
|
||||||
hGDim.h = 300 - hGDim.t - hGDim.b;
|
|
||||||
|
|
||||||
//create svg for histogram.
|
|
||||||
var hGsvg = d3.select(id).append("svg")
|
|
||||||
.attr("width", hGDim.w + hGDim.l + hGDim.r)
|
|
||||||
.attr("height", hGDim.h + hGDim.t + hGDim.b).append("g")
|
|
||||||
.attr("transform", "translate(" + hGDim.l + "," + hGDim.t + ")");
|
|
||||||
|
|
||||||
// create function for x-axis mapping.
|
|
||||||
var x = d3.scale.ordinal().rangeRoundBands([0, hGDim.w], 0.1)
|
|
||||||
.domain(fD.map(function(d) { return d[0]; }));
|
|
||||||
|
|
||||||
// Add x-axis to the histogram svg.
|
|
||||||
hGsvg.append("g").attr("class", "x axis")
|
|
||||||
.attr("transform", "translate(0," + hGDim.h + ")")
|
|
||||||
.call(d3.svg.axis().scale(x).orient("bottom"));
|
|
||||||
|
|
||||||
// Create function for y-axis map.
|
|
||||||
var y = d3.scale.linear().range([hGDim.h, 0])
|
|
||||||
.domain([0, d3.max(fD, function(d) { return d[1]; })]);
|
|
||||||
|
|
||||||
// Create bars for histogram to contain rectangles and freq labels.
|
|
||||||
var bars = hGsvg.selectAll(".bar").data(fD).enter()
|
|
||||||
.append("g").attr("class", "bar");
|
|
||||||
|
|
||||||
//create the rectangles.
|
|
||||||
bars.append("rect")
|
|
||||||
.attr("x", function(d) { return x(d[0]); })
|
|
||||||
.attr("y", function(d) { return y(d[1]); })
|
|
||||||
.attr("width", x.rangeBand())
|
|
||||||
.attr("height", function(d) { return hGDim.h - y(d[1]); })
|
|
||||||
.attr('fill',barColor)
|
|
||||||
.on("mouseover",mouseover)// mouseover is defined below.
|
|
||||||
.on("mouseout",mouseout);// mouseout is defined below.
|
|
||||||
|
|
||||||
//Create the frequency labels above the rectangles.
|
|
||||||
bars.append("text").text(function(d){ return d3.format(",")(d[1])})
|
|
||||||
.attr("x", function(d) { return x(d[0])+x.rangeBand()/2; })
|
|
||||||
.attr("y", function(d) { return y(d[1])-5; })
|
|
||||||
.attr("text-anchor", "middle");
|
|
||||||
|
|
||||||
function mouseover(d){ // utility function to be called on mouseover.
|
|
||||||
// filter for selected state.
|
|
||||||
var st = fData.filter(function(s){ return s.State == d[0];})[0],
|
|
||||||
nD = d3.keys(st.freq).map(function(s){ return {type:s, freq:st.freq[s]};});
|
|
||||||
|
|
||||||
// call update functions of pie-chart and legend.
|
|
||||||
pC.update(nD);
|
|
||||||
leg.update(nD);
|
|
||||||
}
|
|
||||||
|
|
||||||
function mouseout(d){ // utility function to be called on mouseout.
|
|
||||||
// reset the pie-chart and legend.
|
|
||||||
pC.update(tF);
|
|
||||||
leg.update(tF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create function to update the bars. This will be used by pie-chart.
|
|
||||||
hG.update = function(nD, color){
|
|
||||||
// update the domain of the y-axis map to reflect change in frequencies.
|
|
||||||
y.domain([0, d3.max(nD, function(d) { return d[1]; })]);
|
|
||||||
|
|
||||||
// Attach the new data to the bars.
|
|
||||||
var bars = hGsvg.selectAll(".bar").data(nD);
|
|
||||||
|
|
||||||
// transition the height and color of rectangles.
|
|
||||||
bars.select("rect").transition().duration(500)
|
|
||||||
.attr("y", function(d) {return y(d[1]); })
|
|
||||||
.attr("height", function(d) { return hGDim.h - y(d[1]); })
|
|
||||||
.attr("fill", color);
|
|
||||||
|
|
||||||
// transition the frequency labels location and change value.
|
|
||||||
bars.select("text").transition().duration(500)
|
|
||||||
.text(function(d){ return d3.format(",")(d[1])})
|
|
||||||
.attr("y", function(d) {return y(d[1])-5; });
|
|
||||||
}
|
|
||||||
return hG;
|
|
||||||
}
|
|
||||||
|
|
||||||
// function to handle pieChart.
|
|
||||||
function pieChart(pD){
|
|
||||||
var pC ={}, pieDim ={w:250, h: 250};
|
|
||||||
pieDim.r = Math.min(pieDim.w, pieDim.h) / 2;
|
|
||||||
|
|
||||||
// create svg for pie chart.
|
|
||||||
var piesvg = d3.select(id).append("svg")
|
|
||||||
.attr("width", pieDim.w).attr("height", pieDim.h).append("g")
|
|
||||||
.attr("transform", "translate("+pieDim.w/2+","+pieDim.h/2+")");
|
|
||||||
|
|
||||||
// create function to draw the arcs of the pie slices.
|
|
||||||
var arc = d3.svg.arc().outerRadius(pieDim.r - 10).innerRadius(0);
|
|
||||||
|
|
||||||
// create a function to compute the pie slice angles.
|
|
||||||
var pie = d3.layout.pie().sort(null).value(function(d) { return d.freq; });
|
|
||||||
|
|
||||||
// Draw the pie slices.
|
|
||||||
piesvg.selectAll("path").data(pie(pD)).enter().append("path").attr("d", arc)
|
|
||||||
.each(function(d) { this._current = d; })
|
|
||||||
.style("fill", function(d) { return segColor(d.data.type); })
|
|
||||||
.on("mouseover",mouseover).on("mouseout",mouseout);
|
|
||||||
|
|
||||||
// create function to update pie-chart. This will be used by histogram.
|
|
||||||
pC.update = function(nD){
|
|
||||||
piesvg.selectAll("path").data(pie(nD)).transition().duration(500)
|
|
||||||
.attrTween("d", arcTween);
|
|
||||||
}
|
|
||||||
// Utility function to be called on mouseover a pie slice.
|
|
||||||
function mouseover(d){
|
|
||||||
// call the update function of histogram with new data.
|
|
||||||
hG.update(fData.map(function(v){
|
|
||||||
return [v.State,v.freq[d.data.type]];}),segColor(d.data.type));
|
|
||||||
}
|
|
||||||
//Utility function to be called on mouseout a pie slice.
|
|
||||||
function mouseout(d){
|
|
||||||
// call the update function of histogram with all data.
|
|
||||||
hG.update(fData.map(function(v){
|
|
||||||
return [v.State,v.total];}), barColor);
|
|
||||||
}
|
|
||||||
// Animating the pie-slice requiring a custom function which specifies
|
|
||||||
// how the intermediate paths should be drawn.
|
|
||||||
function arcTween(a) {
|
|
||||||
var i = d3.interpolate(this._current, a);
|
|
||||||
this._current = i(0);
|
|
||||||
return function(t) { return arc(i(t)); };
|
|
||||||
}
|
|
||||||
return pC;
|
|
||||||
}
|
|
||||||
|
|
||||||
// function to handle legend.
|
|
||||||
function legend(lD){
|
|
||||||
var leg = {};
|
|
||||||
|
|
||||||
// create table for legend.
|
|
||||||
var legend = d3.select(id).append("table").attr('class','legend');
|
|
||||||
|
|
||||||
// create one row per segment.
|
|
||||||
var tr = legend.append("tbody").selectAll("tr").data(lD).enter().append("tr");
|
|
||||||
|
|
||||||
// create the first column for each segment.
|
|
||||||
tr.append("td").append("svg").attr("width", '16').attr("height", '16').append("rect")
|
|
||||||
.attr("width", '16').attr("height", '16')
|
|
||||||
.attr("fill",function(d){ return segColor(d.type); });
|
|
||||||
|
|
||||||
// create the second column for each segment.
|
|
||||||
tr.append("td").text(function(d){ return d.type;});
|
|
||||||
|
|
||||||
// create the third column for each segment.
|
|
||||||
tr.append("td").attr("class",'legendFreq')
|
|
||||||
.text(function(d){ return d3.format(",")(d.freq);});
|
|
||||||
|
|
||||||
// create the fourth column for each segment.
|
|
||||||
tr.append("td").attr("class",'legendPerc')
|
|
||||||
.text(function(d){ return getLegend(d,lD);});
|
|
||||||
|
|
||||||
// Utility function to be used to update the legend.
|
|
||||||
leg.update = function(nD){
|
|
||||||
// update the data attached to the row elements.
|
|
||||||
var l = legend.select("tbody").selectAll("tr").data(nD);
|
|
||||||
|
|
||||||
// update the frequencies.
|
|
||||||
l.select(".legendFreq").text(function(d){ return d3.format(",")(d.freq);});
|
|
||||||
|
|
||||||
// update the percentage column.
|
|
||||||
l.select(".legendPerc").text(function(d){ return getLegend(d,nD);});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLegend(d,aD){ // Utility function to compute percentage.
|
|
||||||
return d3.format("%")(d.freq/d3.sum(aD.map(function(v){ return v.freq; })));
|
|
||||||
}
|
|
||||||
|
|
||||||
return leg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate total frequency by segment for all state.
|
|
||||||
var tF = ['binary','text','media'].map(function(d){
|
|
||||||
return {type:d, freq: d3.sum(fData.map(function(t){ return t.freq[d];}))};
|
|
||||||
});
|
|
||||||
|
|
||||||
// calculate total frequency by state for all segment.
|
|
||||||
var sF = fData.map(function(d){return [d.State,d.total];});
|
|
||||||
|
|
||||||
var hG = histoGram(sF), // create the histogram.
|
|
||||||
pC = pieChart(tF), // create the pie-chart.
|
|
||||||
leg= legend(tF); // create the legend.
|
|
||||||
}
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/*global $*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function hideEverything() {
|
function hideEverything() {
|
||||||
// Common controls
|
// Common controls
|
||||||
$("#id_backup_name").closest(".form-group").hide();
|
$("#id_backup_name").closest(".form-group").hide();
|
||||||
|
@ -69,7 +73,7 @@ function showCinderOptions() {
|
||||||
$("#id_container").closest(".form-group").show();
|
$("#id_container").closest(".form-group").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSSHOptions(){
|
function showSSHOptions() {
|
||||||
$("#id_ssh_key").closest(".form-group").show();
|
$("#id_ssh_key").closest(".form-group").show();
|
||||||
$("#id_ssh_username").closest(".form-group").show();
|
$("#id_ssh_username").closest(".form-group").show();
|
||||||
$("#id_ssh_host").closest(".form-group").show();
|
$("#id_ssh_host").closest(".form-group").show();
|
||||||
|
@ -77,86 +81,81 @@ function showSSHOptions(){
|
||||||
|
|
||||||
hideEverything();
|
hideEverything();
|
||||||
|
|
||||||
$("#id_action").change(function() {
|
$("#id_action").change(function () {
|
||||||
// Update the inputs according freezer action
|
// Update the inputs according freezer action
|
||||||
|
|
||||||
if ($("#id_action").val() == 'backup') {
|
if ($("#id_action").val() === 'backup') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
}
|
} else if ($("#id_action").val() === 'restore') {
|
||||||
else if ($("#id_action").val() == 'restore') {
|
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showRestoreOptions();
|
showRestoreOptions();
|
||||||
}
|
} else if ($("#id_action").val() === 'admin') {
|
||||||
else if ($("#id_action").val() == 'admin') {
|
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showAdminOptions();
|
showAdminOptions();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
hideEverything();
|
hideEverything();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#id_storage").change(function() {
|
$("#id_storage").change(function () {
|
||||||
// Update the inputs according freezer action
|
// Update the inputs according freezer storage backend
|
||||||
|
|
||||||
if ($("#id_storage").val() == 'swift') {
|
if ($("#id_storage").val() === 'swift') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
}
|
$("#id_mode").closest(".form-group").hide();
|
||||||
else if ($("#id_storage").val() == 'ssh') {
|
} else if ($("#id_storage").val() === 'ssh') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
|
$("#id_mode").closest(".form-group").hide();
|
||||||
showSSHOptions();
|
showSSHOptions();
|
||||||
}
|
} else if ($("#id_storage").val() === 'local') {
|
||||||
else if ($("#id_storage").val() == 'local') {
|
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
}
|
$("#id_mode").closest(".form-group").hide();
|
||||||
else {
|
} else {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#id_mode").change(function() {
|
$("#id_mode").change(function () {
|
||||||
if ($("#id_action").val() == 'backup') {
|
// Update the inputs according freezer mode
|
||||||
if ($("#id_mode").val() == 'fs') {
|
if ($("#id_action").val() === 'backup') {
|
||||||
|
if ($("#id_mode").val() === 'fs') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else if ($("#id_mode").val() == 'mysql') {
|
} else if ($("#id_mode").val() === 'mysql') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
$("#id_mysql_conf").closest(".form-group").show();
|
$("#id_mysql_conf").closest(".form-group").show();
|
||||||
$("#id_sql_server_conf").closest(".form-group").hide();
|
$("#id_sql_server_conf").closest(".form-group").hide();
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else if ($("#id_mode").val() == 'mssql') {
|
} else if ($("#id_mode").val() === 'mssql') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
$("#id_sql_server_conf").closest(".form-group").show();
|
$("#id_sql_server_conf").closest(".form-group").show();
|
||||||
$("#id_mysql_conf").closest(".form-group").hide();
|
$("#id_mysql_conf").closest(".form-group").hide();
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else if ($("#id_mode").val() == 'mongo') {
|
} else if ($("#id_mode").val() === 'mongo') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showBackupOptions();
|
showBackupOptions();
|
||||||
$("#id_sql_server_conf").closest(".form-group").hide();
|
$("#id_sql_server_conf").closest(".form-group").hide();
|
||||||
$("#id_mysql_conf").closest(".form-group").hide();
|
$("#id_mysql_conf").closest(".form-group").hide();
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else if ($("#id_mode").val() == 'cinder') {
|
} else if ($("#id_mode").val() === 'cinder') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showCinderOptions();
|
showCinderOptions();
|
||||||
$("#id_cinder_vol_id").closest(".form-group").show().addClass("required");
|
$("#id_cinder_vol_id").closest(".form-group").show().addClass("required");
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else if ($("#id_mode").val() == 'nova') {
|
} else if ($("#id_mode").val() === 'nova') {
|
||||||
hideEverything();
|
hideEverything();
|
||||||
showNovaOptions();
|
showNovaOptions();
|
||||||
$("#id_nova_inst_id").closest(".form-group").show().addClass("required");
|
$("#id_nova_inst_id").closest(".form-group").show().addClass("required");
|
||||||
}
|
$("#id_advanced_configuration").closest(".form-group").show();
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
function hideIncrementalOptions() {
|
/*global $*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function hideIncrementalOptions () {
|
||||||
$("#id_max_level").closest(".form-group").hide();
|
$("#id_max_level").closest(".form-group").hide();
|
||||||
$("#id_always_level").closest(".form-group").hide();
|
$("#id_always_level").closest(".form-group").hide();
|
||||||
$("#id_restart_always_level").closest(".form-group").hide();
|
$("#id_restart_always_level").closest(".form-group").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#id_no_incremental").click(function() {
|
$("#id_no_incremental").click(function () {
|
||||||
if ($("#id_no_incremental").is(":checked")) {
|
if ($("#id_no_incremental").is(":checked")) {
|
||||||
$("#id_max_level").closest(".form-group").hide();
|
$("#id_max_level").closest(".form-group").hide();
|
||||||
$("#id_always_level").closest(".form-group").hide();
|
$("#id_always_level").closest(".form-group").hide();
|
||||||
$("#id_restart_always_level").closest(".form-group").hide();
|
$("#id_restart_always_level").closest(".form-group").hide();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$("#id_max_level").closest(".form-group").show();
|
$("#id_max_level").closest(".form-group").show();
|
||||||
$("#id_always_level").closest(".form-group").show();
|
$("#id_always_level").closest(".form-group").show();
|
||||||
$("#id_restart_always_level").closest(".form-group").show();
|
$("#id_restart_always_level").closest(".form-group").show();
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/*global $*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function hideOptions() {
|
function hideOptions() {
|
||||||
// Snapshot specific controls
|
// Snapshot specific controls
|
||||||
$("#id_is_windows").closest(".form-group").hide();
|
$("#id_is_windows").closest(".form-group").hide();
|
||||||
|
@ -11,9 +15,9 @@ function hideOptions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_windows() {
|
function is_windows() {
|
||||||
if ($("#id_is_windows").is(":checked")) {
|
if ($("#id_is_windows").is(":checked")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showWindowsSnapshotOptions() {
|
function showWindowsSnapshotOptions() {
|
||||||
|
@ -53,8 +57,7 @@ function showSnapshotOptions() {
|
||||||
if (is_windows()) {
|
if (is_windows()) {
|
||||||
hideLinuxSnapshotOptions();
|
hideLinuxSnapshotOptions();
|
||||||
showWindowsSnapshotOptions();
|
showWindowsSnapshotOptions();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
hideWindowsSnapshotOptions();
|
hideWindowsSnapshotOptions();
|
||||||
showLinuxSnapshotOptions();
|
showLinuxSnapshotOptions();
|
||||||
}
|
}
|
||||||
|
@ -62,20 +65,18 @@ function showSnapshotOptions() {
|
||||||
|
|
||||||
hideOptions();
|
hideOptions();
|
||||||
|
|
||||||
$("#id_use_snapshot").click(function() {
|
$("#id_use_snapshot").click(function () {
|
||||||
if ($("#id_use_snapshot").is(":checked")) {
|
if ($("#id_use_snapshot").is(":checked")) {
|
||||||
showSnapshotOptions();
|
showSnapshotOptions();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
hideSnapshotOptions();
|
hideSnapshotOptions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#id_is_windows").click(function() {
|
$("#id_is_windows").click(function () {
|
||||||
if ($("#id_use_snapshot").is(":checked")) {
|
if ($("#id_use_snapshot").is(":checked")) {
|
||||||
showSnapshotOptions();
|
showSnapshotOptions();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
hideSnapshotOptions();
|
hideSnapshotOptions();
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -1,5 +1,9 @@
|
||||||
$(function() {
|
/*global $, location*/
|
||||||
$( "#sortable1, #sortable2" ).sortable({
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$("#sortable1, #sortable2").sortable({
|
||||||
connectWith: ".connectedSortable"
|
connectWith: ".connectedSortable"
|
||||||
}).disableSelection();
|
}).disableSelection();
|
||||||
});
|
});
|
||||||
|
@ -11,13 +15,12 @@ var siblings = parent.siblings();
|
||||||
siblings.remove();
|
siblings.remove();
|
||||||
|
|
||||||
|
|
||||||
$("form").submit(function(event){
|
$("form").submit(function (event) {
|
||||||
var ids = "";
|
var ids = "";
|
||||||
$("#sortable2 li").each(function(index) {
|
$("#sortable2 li").each(function (index) {
|
||||||
ids += ($(this).attr('id'));
|
ids += ($(this).attr('id'));
|
||||||
ids += "==="
|
ids += "===";
|
||||||
});
|
});
|
||||||
console.log(ids);
|
|
||||||
$('#id_actions').val(ids);
|
$('#id_actions').val(ids);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,55 +28,56 @@ $("form").submit(function(event){
|
||||||
function get_actions_url() {
|
function get_actions_url() {
|
||||||
var url = $(location).attr("origin");
|
var url = $(location).attr("origin");
|
||||||
url += '/freezer_ui/api/actions';
|
url += '/freezer_ui/api/actions';
|
||||||
return url
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
var job_id = $('#id_original_name').val();
|
var job_id = $('#id_original_name').val();
|
||||||
if (job_id != "") {
|
|
||||||
|
|
||||||
var url_available = get_actions_url();
|
if (job_id !== "") {
|
||||||
|
var url_available = get_actions_url();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url_available,
|
url: url_available,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json; charset=utf-8',
|
contentType: 'application/json; charset=utf-8',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$.each(data, function (index, item) {
|
$.each(data, function (index, item) {
|
||||||
$("#sortable1").append(
|
$("#sortable1").append(
|
||||||
"<li class='list-group-item' id=" + item['action_id'] + ">" +
|
"<li class='list-group-item' id=" + item.action_id + ">" +
|
||||||
item['freezer_action']['backup_name'] +
|
item.freezer_action.backup_name + "</li>"
|
||||||
"</li>"
|
);
|
||||||
);
|
});
|
||||||
});
|
},
|
||||||
},
|
error: function (request, error) {
|
||||||
error: function (request, error) {
|
$("#sortable1").append(
|
||||||
console.error(error);
|
'<tr><td>Error getting action list</td></tr>'
|
||||||
}
|
);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
} else {
|
||||||
|
var url = get_actions_url();
|
||||||
|
|
||||||
else {
|
$.ajax({
|
||||||
var url = get_actions_url();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json; charset=utf-8' ,
|
contentType: 'application/json; charset=utf-8' ,
|
||||||
success: function(data) {
|
success: function (data) {
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function (index, item) {
|
||||||
$("#sortable1").append(
|
$("#sortable1").append(
|
||||||
"<li class='list-group-item' id=" + item['action_id'] + ">" +
|
"<li class='list-group-item' id=" + item.action_id + ">" +
|
||||||
item['freezer_action']['backup_name'] +
|
item.freezer_action.backup_name +
|
||||||
"</li>"
|
"</li>"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(request, error) {
|
error: function (request, error) {
|
||||||
console.error(error);
|
$("#sortable1").append(
|
||||||
|
'<tr><td>Error getting action list</td></tr>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,14 +1,16 @@
|
||||||
|
/*global angular*/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('hz').controller('DestinationCtrl', function ($scope, $http, $location) {
|
angular.module('hz').controller('DestinationCtrl', function ($scope, $http, $location) {
|
||||||
$scope.query = '';
|
$scope.query = '';
|
||||||
|
|
||||||
$http.get($location.protocol() + "://" + $location.host() + ":" + $location.port() + "/freezer_ui/api/clients").
|
$http.get($location.protocol() + "://" + $location.host() + ":" + $location.port() + "/freezer_ui/api/clients").
|
||||||
success(function(data, status, headers, config) {
|
success(function (data) {
|
||||||
$scope.clients = data
|
$scope.clients = data;
|
||||||
});
|
});
|
||||||
$scope.searchComparator = function (actual, expected) {
|
$scope.searchComparator = function (actual, expected) {
|
||||||
return actual.description.indexOf(expected) > 0
|
return actual.description.indexOf(expected) > 0;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/*global $, location*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var url = $(location).attr("origin");
|
var url = $(location).attr("origin");
|
||||||
url += '/freezer_ui/api/clients';
|
url += '/freezer_ui/api/clients';
|
||||||
|
|
||||||
|
@ -6,21 +10,20 @@ $.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json; charset=utf-8' ,
|
contentType: 'application/json; charset=utf-8',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function (index, item) {
|
||||||
$("#available_clients").append(
|
$("#available_clients").append(
|
||||||
'<tr><td class="multi_select_column">' +
|
'<tr><td class="multi_select_column">' +
|
||||||
'<input type="radio" name="client" value=' + item["client"]["client_id"] + '></td>' +
|
'<input type="radio" name="client" value=' + item.client.client_id + '></td>' +
|
||||||
'<td>' + item["client"]["hostname"] + '</td></tr>'
|
'<td>' + item.client.hostname + '</td></tr>'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(request, error) {
|
error: function (request, error) {
|
||||||
console.error(error);
|
|
||||||
$("#available_clients").append(
|
$("#available_clients").append(
|
||||||
'<tr><td>Error getting client list</td></tr>'
|
'<tr><td>Error getting client list</td></tr>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue