summaryrefslogtreecommitdiffstats
path: root/settings/js/apps.js
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-10-03 14:56:41 +0200
committerJulius Härtl <jus@bitgrid.net>2017-10-10 12:34:37 +0200
commit8d1b32e59788633dc6ab77e736a72f00625a389d (patch)
tree5bd0a1d386863d15c9b84e654580e8515e5739d4 /settings/js/apps.js
parent968d4f6396e30321a4f05f867edd581ba50c9e81 (diff)
downloadnextcloud-server-8d1b32e59788633dc6ab77e736a72f00625a389d.tar.gz
nextcloud-server-8d1b32e59788633dc6ab77e736a72f00625a389d.zip
App management: add update section
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings/js/apps.js')
-rw-r--r--settings/js/apps.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 39e800636cb..ab0a4da5585 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -42,6 +42,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
var categories = [
{displayName: t('settings', 'Your apps'), ident: 'installed', id: '0'},
+ {displayName: t('settings', 'Updates'), ident: 'updates', id: '3'},
{displayName: t('settings', 'Enabled apps'), ident: 'enabled', id: '1'},
{displayName: t('settings', 'Disabled apps'), ident: 'disabled', id: '2'}
];
@@ -58,6 +59,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
type:'GET',
success:function (jsondata) {
var html = template(jsondata);
+ var updateCategory = $.grep(jsondata, function(element, index) {
+ return element.ident === 'updates'
+ });
+ if (updateCategory.length === 1) {
+ OC.Settings.Apps.State.availableUpdates = updateCategory[0].counter;
+ }
$('#apps-categories').html(html);
$('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active');
},
@@ -99,7 +106,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
return _.extend({level: 0}, app);
});
var source;
- if (categoryId === 'enabled' || categoryId === 'disabled' || categoryId === 'installed' || categoryId === 'app-bundles') {
+ if (categoryId === 'enabled' || categoryId === 'updates' || categoryId === 'disabled' || categoryId === 'installed' || categoryId === 'app-bundles') {
source = $("#app-template-installed").html();
$('#apps-list').addClass('installed');
} else {
@@ -134,13 +141,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
var $update = $('#app-' + app.id + ' .update');
$update.removeClass('hidden');
$update.val(t('settings', 'Update to %s').replace(/%s/g, app.update));
- OC.Settings.Apps.State.availableUpdates++;
}
});
-
- if (OC.Settings.Apps.State.availableUpdates > 0) {
- OC.Settings.Apps.State.$updateNotification = OC.Notification.show(n('settings', 'You have %n app update pending', 'You have %n app updates pending', OC.Settings.Apps.State.availableUpdates));
- }
} else {
$('#apps-list').addClass('hidden');
$('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
@@ -539,14 +541,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
var $version = $('#app-' + appId + ' .app-version');
$version.text(OC.Settings.Apps.State.apps[appId]['update']);
- if (OC.Settings.Apps.State.$updateNotification) {
- OC.Notification.hide(OC.Settings.Apps.State.$updateNotification);
- }
-
OC.Settings.Apps.State.availableUpdates--;
- if (OC.Settings.Apps.State.availableUpdates > 0) {
- OC.Settings.Apps.State.$updateNotification = OC.Notification.show(n('settings', 'You have %n app update pending', 'You have %n app updates pending', OC.Settings.Apps.State.availableUpdates));
- }
+ OC.Settings.Apps.refreshUpdateCounter();
}
},'json');
},
@@ -656,6 +652,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
});
},
+ refreshUpdateCounter: function() {
+ $('#app-category-updates').find('.app-navigation-entry-utils-counter').html(OC.Settings.Apps.State.availableUpdates);
+ },
+
showErrorMessage: function(appId, message) {
$('div#app-'+appId+' .warning')
.show()