diff options
author | Julius Härtl <jus@bitgrid.net> | 2017-10-03 18:15:14 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-10-10 12:34:38 +0200 |
commit | a3502c5c670456e1c3ea2476b31f681a37839e8d (patch) | |
tree | 43cc49e3dea90f1c1188d909042ae72916351e6f /settings/js | |
parent | 6f7fb2e87b031e7a1e8c93ef79e1c17aeae1c461 (diff) | |
download | nextcloud-server-a3502c5c670456e1c3ea2476b31f681a37839e8d.tar.gz nextcloud-server-a3502c5c670456e1c3ea2476b31f681a37839e8d.zip |
App management: Show proper message when no updates are available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/apps.js | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js index 9dd27bcd5e1..ea6bd6ea5c6 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -62,11 +62,13 @@ OC.Settings.Apps = OC.Settings.Apps || { var updateCategory = $.grep(jsondata, function(element, index) { return element.ident === 'updates' }); + $('#apps-categories').html(html); + $('#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(); } - $('#apps-categories').html(html); - $('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active'); }, complete: function() { $('#app-navigation').removeClass('icon-loading'); @@ -143,8 +145,13 @@ OC.Settings.Apps = OC.Settings.Apps || { } }); } else { - $('#apps-list').addClass('hidden'); - $('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version')); + if (categoryId === 'updates') { + OC.Settings.Apps.showEmptyUpdates(); + } else { + $('#apps-list').addClass('hidden'); + $('#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({ @@ -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) { var oldButtonText = element.val(); element.val(t('settings','Updating....')); @@ -542,6 +555,13 @@ OC.Settings.Apps = OC.Settings.Apps || { OC.Settings.Apps.State.availableUpdates--; 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'); }, @@ -652,7 +672,12 @@ OC.Settings.Apps = OC.Settings.Apps || { }, 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) { |