-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Rothenbücher
committed
Feb 3, 2017
1 parent
e8c90ba
commit 52b111c
Showing
18 changed files
with
2,193 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//WebContent/assets/lang=UTF-8 | ||
encoding//WebContent/assets/lang/de.json=UTF-8 | ||
encoding//WebContent/assets/lang/en.json=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,80 @@ | ||
$(document).ready(function() { | ||
(function() { | ||
$(document).ready(function() { | ||
|
||
$('#add').click(function() { | ||
if (!$('#cron').find('#url').val()) { | ||
toastr['warning']("Please insert url"); | ||
}else if (!$('#cron').find('#pattern').val()) { | ||
toastr['warning']("Please insert pattern"); | ||
}else if (!$('#cron').find('#name').val()) { | ||
toastr['warning']("Please insert name"); | ||
}else { | ||
var $option = $('#cron').find('#receiver-ip').find('option:selected'); | ||
if ($option) { | ||
$.post("rest/cron/add/" + $option.val(), { | ||
url : $('#cron').find('#url').val(), | ||
reload : $('#cron').find('#refresh').val(), | ||
pattern : $('#cron').find('#pattern').val(), | ||
name : $('#cron').find('#name').val() | ||
}).done(function() { | ||
toastr['info']("added cronjob for " + $option.text() + " successfully"); | ||
}).fail(function(xhr, status, error) { | ||
toastr['error']("error on " + $option.text()); | ||
}); | ||
} else { | ||
toastr['warning']("Please select chromecast"); | ||
} | ||
$('#add').click(function() { | ||
if (!$('#cron').find('#url').val()) { | ||
toastr['warning']("Please insert url"); | ||
} else if (!$('#cron').find('#pattern').val()) { | ||
toastr['warning']("Please insert pattern"); | ||
} else if (!$('#cron').find('#name').val()) { | ||
toastr['warning']("Please insert name"); | ||
} else { | ||
var $option = $('#cron').find('#receiver-ip').find('option:selected'); | ||
if ($option) { | ||
$.post("rest/cron/add/" + $option.val(), { | ||
url: $('#cron').find('#url').val(), | ||
reload: $('#cron').find('#refresh').val(), | ||
pattern: $('#cron').find('#pattern').val(), | ||
name: $('#cron').find('#name').val() | ||
}).done(function() { | ||
toastr['info']("added cronjob for " + $option.text() + " successfully"); | ||
}).fail(function(xhr, status, error) { | ||
toastr['error']("error on " + $option.text()); | ||
}); | ||
} else { | ||
toastr['warning']("Please select chromecast"); | ||
} | ||
|
||
} | ||
}); | ||
|
||
$('#refreshjobs').click(function(ev){ | ||
ev.preventDefault(); | ||
var $cjobs = $('#cron').find('#currentjobs'); | ||
$cjobs.html(""); | ||
$.ajax({ | ||
type : "GET", | ||
url : "rest/cron/get" | ||
}).done(function(data, textStatus, jqXHR) { | ||
var obj = JSON.parse(data); | ||
$.each(obj, function(i, elem){ | ||
var row = '<div class="col-xs-12"><div class="col-xs-2">'; | ||
row += elem.name; | ||
row+="</div>"; | ||
row +='<div class="col-xs-4">'; | ||
row += '<a href="'+elem.url+'+" target="_blank">'+elem.url+'</a>'; | ||
row+="</div>"; | ||
row +='<div class="col-xs-2">'; | ||
row += elem.desc+" ("+elem.pattern+")"; | ||
row+="</div>"; | ||
row +='<div class="col-xs-2">'; | ||
row += '<button data-target="'+elem.target+'" data-name="'+elem.name+'" class="btn btn-default del-cron">delete</button>'; | ||
row+="</div></div>"; | ||
$cjobs.append(row); | ||
}); | ||
|
||
$('.del-cron').click(function(ev){ | ||
ev.preventDefault(); | ||
var name = $(this).data("name"); | ||
var target = $(this).data("target"); | ||
var $this = $(this); | ||
$.ajax({ | ||
type : "DELETE", | ||
url : "rest/cron/remove/"+target+"/"+name | ||
}).done(function(data, textStatus, jqXHR) { | ||
toastr['info']("deleted "+name); | ||
$this.parent().parent().hide(); | ||
}).fail(function(jqXHR, textStatus, errorThrown) { | ||
toastr['error']("error"); | ||
}); | ||
}); | ||
|
||
}).fail(function(jqXHR, textStatus, errorThrown) { | ||
// TODO error | ||
toastr['error']("error"); | ||
}).always(function() { | ||
|
||
}); | ||
}); | ||
}); | ||
} | ||
}); | ||
|
||
$('#refreshjobs').click(function(ev) { | ||
ev.preventDefault(); | ||
var $cjobs = $('#cron').find('#currentjobs'); | ||
$cjobs.html(""); | ||
$.ajax({ | ||
type: "GET", | ||
url: "rest/cron/get" | ||
}).done(function(data, textStatus, jqXHR) { | ||
var obj = JSON.parse(data); | ||
$.each(obj, function(i, elem) { | ||
var row = '<div class="col-xs-12"><div class="col-xs-2">'; | ||
row += elem.name; | ||
row += "</div>"; | ||
row += '<div class="col-xs-4">'; | ||
row += '<a href="' + elem.url + '+" target="_blank">' + elem.url + '</a>'; | ||
row += "</div>"; | ||
row += '<div class="col-xs-2">'; | ||
row += elem.desc + " (" + elem.pattern + ")"; | ||
row += "</div>"; | ||
row += '<div class="col-xs-2">'; | ||
row += '<button data-target="' + elem.target + '" data-name="' + elem.name + '" class="btn btn-default del-cron">delete</button>'; | ||
row += "</div></div>"; | ||
$cjobs.append(row); | ||
}); | ||
|
||
$('.del-cron').click(function(ev) { | ||
ev.preventDefault(); | ||
var name = $(this).data("name"); | ||
var target = $(this).data("target"); | ||
var $this = $(this); | ||
$.ajax({ | ||
type: "DELETE", | ||
url: "rest/cron/remove/" + target + "/" + name | ||
}).done(function(data, textStatus, jqXHR) { | ||
toastr['info']("deleted " + name); | ||
$this.parent().parent().hide(); | ||
}).fail(function(jqXHR, textStatus, errorThrown) { | ||
toastr['error']("error"); | ||
}); | ||
}); | ||
|
||
}).fail(function(jqXHR, textStatus, errorThrown) { | ||
// TODO error | ||
toastr['error']("error"); | ||
}).always(function() { | ||
|
||
}); | ||
}); | ||
}); | ||
})(); |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.