formatting, add checks for unRAID version change or empty download folder
This commit is contained in:
parent
0bfd5986b3
commit
39853fc171
|
@ -79,36 +79,43 @@ $(function(){
|
||||||
//list all available packages in a table
|
//list all available packages in a table
|
||||||
function packageQuery(force) {
|
function packageQuery(force) {
|
||||||
$('#tblPackages tbody').html("<tr><td colspan='6'><br><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving plugin information ...</em></td><tr>");
|
$('#tblPackages tbody').html("<tr><td colspan='6'><br><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving plugin information ...</em></td><tr>");
|
||||||
$.getJSON('/plugins/NerdPack/include/PackageQuery.php', {force: force}, function(packages) {
|
$.getJSON('/plugins/NerdPack/include/PackageQuery.php', {force: force}, function(data) {
|
||||||
$('#tblPackages tbody').empty();
|
$('#tblPackages tbody').empty();
|
||||||
var Ready;
|
var Ready;
|
||||||
var len = packages.length, i = 0;
|
var Count = 0;
|
||||||
|
var len = data.packages.length, i = 0;
|
||||||
for (i; i < len; i++) {
|
for (i; i < len; i++) {
|
||||||
var Update;
|
var Update;
|
||||||
if (packages[i].downloadeq == packages[i].downloaded && packages[i].installeq == packages[i].installed){
|
if (data.packages[i].downloadeq == data.packages[i].downloaded && data.packages[i].installeq == data.packages[i].installed){
|
||||||
Update = "<span><i class='uptodate fa fa-check'></i> up-to-date </span>";
|
Update = "<span><i class='uptodate fa fa-check'></i> up-to-date </span>";
|
||||||
}else{
|
}else{
|
||||||
Update = "<span ><a><i class='updateready fa fa-cloud-download'></i> update ready </a></span>";
|
Update = "<span ><a><i class='updateready fa fa-cloud-download'></i> update ready </a></span>";
|
||||||
Ready = true;
|
Ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var Downloaded = packages[i].downloaded;
|
var Downloaded = data.packages[i].downloaded;
|
||||||
if (packages[i].downloadeq != packages[i].downloaded)
|
if (data.packages[i].downloadeq != data.packages[i].downloaded)
|
||||||
Downloaded = 'old';
|
Downloaded = 'old';
|
||||||
|
|
||||||
var Installed = packages[i].installed;
|
var Installed = data.packages[i].installed;
|
||||||
if (packages[i].installeq != packages[i].installed)
|
if (data.packages[i].installeq != data.packages[i].installed)
|
||||||
Installed = 'old';
|
Installed = 'old';
|
||||||
|
|
||||||
|
var Checked = "";
|
||||||
|
if (data.packages[i].config=="yes"){
|
||||||
|
Checked = "checked";
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
|
||||||
$('#tblPackages tbody').append("<tr>"+
|
$('#tblPackages tbody').append("<tr>"+
|
||||||
"<td class='package' title='"+packages[i].desc+"'>"+packages[i].name+"</td>"+ // package name
|
"<td class='package' title='"+data.packages[i].desc+"'>"+data.packages[i].name+"</td>"+ // package name
|
||||||
"<td>"+Update+"</td>"+ // package status
|
"<td>"+Update+"</td>"+ // package status
|
||||||
"<td>"+packages[i].size+"</td>"+ // package size
|
"<td>"+data.packages[i].size+"</td>"+ // package size
|
||||||
"<td>"+Downloaded+"</td>"+ // package downloaded
|
"<td>"+Downloaded+"</td>"+ // package downloaded
|
||||||
"<td>"+Installed+"</td>"+ // package installed
|
"<td>"+Installed+"</td>"+ // package installed
|
||||||
"<td>"+packages[i].plugins+"</td>"+ // package dependents
|
"<td>"+data.packages[i].plugins+"</td>"+ // package dependents
|
||||||
"<td><input class='pkgcheckbox' id='"+packages[i].pkgname+"' type='checkbox' "+(packages[i].config=="yes"?"checked":"")+">"+
|
"<td><input class='pkgcheckbox' id='"+data.packages[i].pkgname+"' type='checkbox' "+Checked+">"+
|
||||||
"<input class='pkgvalue' type='hidden' id='"+packages[i].pkgname+"_value' name='"+packages[i].pkgnver+"' value='"+packages[i].config+"'></td>"+
|
"<input class='pkgvalue' type='hidden' id='"+data.packages[i].pkgname+"_value' name='"+data.packages[i].pkgnver+"' value='"+data.packages[i].config+"'></td>"+
|
||||||
"</tr>");
|
"</tr>");
|
||||||
}
|
}
|
||||||
if (Ready)
|
if (Ready)
|
||||||
|
@ -132,6 +139,15 @@ function packageQuery(force) {
|
||||||
var lastSearch = $('#tblPackages')[0].config.lastSearch;
|
var lastSearch = $('#tblPackages')[0].config.lastSearch;
|
||||||
$('#tblPackages').trigger('update')
|
$('#tblPackages').trigger('update')
|
||||||
.trigger('search', [lastSearch]);
|
.trigger('search', [lastSearch]);
|
||||||
|
|
||||||
|
if (data.empty == true && Count > 0) {
|
||||||
|
swal({title:'Downloaded Packages Missing!',text:'You either changed unRAID versions or deleted your downloaded packages. Click the Apply button below to download and install your selected packages.',type:'warning',closeOnConfirm: true,},function() {
|
||||||
|
$('#btnApply').prop('disabled', false);
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $("#btnApply").offset().top
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user