App management: Show proper message when no updates are available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
6f7fb2e87b
commit
a3502c5c67
|
@ -62,11 +62,13 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
var updateCategory = $.grep(jsondata, function(element, index) {
|
var updateCategory = $.grep(jsondata, function(element, index) {
|
||||||
return element.ident === 'updates'
|
return element.ident === 'updates'
|
||||||
});
|
});
|
||||||
if (updateCategory.length === 1) {
|
|
||||||
OC.Settings.Apps.State.availableUpdates = updateCategory[0].counter;
|
|
||||||
}
|
|
||||||
$('#apps-categories').html(html);
|
$('#apps-categories').html(html);
|
||||||
$('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active');
|
$('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active');
|
||||||
|
if (updateCategory.length === 1) {
|
||||||
|
console.log(updateCategory);
|
||||||
|
OC.Settings.Apps.State.availableUpdates = updateCategory[0].counter;
|
||||||
|
OC.Settings.Apps.refreshUpdateCounter();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('#app-navigation').removeClass('icon-loading');
|
$('#app-navigation').removeClass('icon-loading');
|
||||||
|
@ -142,9 +144,14 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
$update.val(t('settings', 'Update to %s').replace(/%s/g, app.update));
|
$update.val(t('settings', 'Update to %s').replace(/%s/g, app.update));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (categoryId === 'updates') {
|
||||||
|
OC.Settings.Apps.showEmptyUpdates();
|
||||||
} else {
|
} else {
|
||||||
$('#apps-list').addClass('hidden');
|
$('#apps-list').addClass('hidden');
|
||||||
$('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
|
$('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
|
||||||
|
$('#app-list-empty-icon').addClass('icon-search').removeClass('icon-download');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.enable.needs-download').tooltip({
|
$('.enable.needs-download').tooltip({
|
||||||
|
@ -518,6 +525,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showEmptyUpdates: function() {
|
||||||
|
$('#apps-list').addClass('hidden');
|
||||||
|
$('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No app updates available'));
|
||||||
|
$('#app-list-empty-icon').removeClass('icon-search').addClass('icon-download');
|
||||||
|
},
|
||||||
|
|
||||||
updateApp:function(appId, element) {
|
updateApp:function(appId, element) {
|
||||||
var oldButtonText = element.val();
|
var oldButtonText = element.val();
|
||||||
element.val(t('settings','Updating....'));
|
element.val(t('settings','Updating....'));
|
||||||
|
@ -542,6 +555,13 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
|
|
||||||
OC.Settings.Apps.State.availableUpdates--;
|
OC.Settings.Apps.State.availableUpdates--;
|
||||||
OC.Settings.Apps.refreshUpdateCounter();
|
OC.Settings.Apps.refreshUpdateCounter();
|
||||||
|
|
||||||
|
if (OC.Settings.Apps.State.currentCategory === 'updates') {
|
||||||
|
$('#app-' + appId).remove();
|
||||||
|
if (OC.Settings.Apps.State.availableUpdates === 0) {
|
||||||
|
OC.Settings.Apps.showEmptyUpdates();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},'json');
|
},'json');
|
||||||
},
|
},
|
||||||
|
@ -652,7 +672,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshUpdateCounter: function() {
|
refreshUpdateCounter: function() {
|
||||||
$('#app-category-updates').find('.app-navigation-entry-utils-counter').html(OC.Settings.Apps.State.availableUpdates);
|
var $updateCount = $('#app-category-updates').find('.app-navigation-entry-utils-counter');
|
||||||
|
if (OC.Settings.Apps.State.availableUpdates > 0) {
|
||||||
|
$updateCount.html(OC.Settings.Apps.State.availableUpdates);
|
||||||
|
} else {
|
||||||
|
$updateCount.empty();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
showErrorMessage: function(appId, message) {
|
showErrorMessage: function(appId, message) {
|
||||||
|
|
|
@ -208,7 +208,7 @@ script(
|
||||||
</svg>
|
</svg>
|
||||||
<div id="apps-list"></div>
|
<div id="apps-list"></div>
|
||||||
<div id="apps-list-empty" class="hidden emptycontent emptycontent-search">
|
<div id="apps-list-empty" class="hidden emptycontent emptycontent-search">
|
||||||
<div class="icon-search"></div>
|
<div id="app-list-empty-icon" class="icon-search"></div>
|
||||||
<h2><?php p($l->t('No apps found for your version')) ?></h2>
|
<h2><?php p($l->t('No apps found for your version')) ?></h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue