summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-12-05 10:38:38 +0100
committerJoas Schilling <coding@schilljs.com>2016-12-05 10:50:28 +0100
commit3a653b56eeadf9fed84469e5ffd0cd0ec50e51ce (patch)
treeff08acbbb1e455e9a00231cf887f757626fddbd6 /settings/js
parenteeb81ec783e6e555aa8f1ac3eaa806b3c9dacaf7 (diff)
downloadnextcloud-server-3a653b56eeadf9fed84469e5ffd0cd0ec50e51ce.tar.gz
nextcloud-server-3a653b56eeadf9fed84469e5ffd0cd0ec50e51ce.zip
Remove the update warning and the notification after an successful update
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/apps.js53
1 files changed, 30 insertions, 23 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 451becc67a0..b52fb3d11ab 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -27,7 +27,9 @@ OC.Settings.Apps = OC.Settings.Apps || {
State: {
currentCategory: null,
- apps: null
+ apps: null,
+ $updateNotification: null,
+ availableUpdates: 0
},
loadCategories: function() {
@@ -77,8 +79,9 @@ OC.Settings.Apps = OC.Settings.Apps || {
$('#app-category-' + OC.Settings.Apps.State.currentCategory).removeClass('active');
$('#app-category-' + categoryId).addClass('active');
OC.Settings.Apps.State.currentCategory = categoryId;
+ OC.Settings.Apps.State.availableUpdates = 0;
- this._loadCategoryCall = $.ajax(OC.generateUrl('settings/apps/list?category={categoryId}&includeUpdateInfo=0', {
+ this._loadCategoryCall = $.ajax(OC.generateUrl('settings/apps/list?category={categoryId}', {
categoryId: categoryId
}), {
type:'GET',
@@ -109,7 +112,18 @@ OC.Settings.Apps = OC.Settings.Apps || {
} else {
OC.Settings.Apps.renderApp(app, template, null, false);
}
+
+ if (app.update) {
+ 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'));
@@ -138,28 +152,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
});
},
complete: function() {
- var availableUpdates = 0;
$('#apps-list').removeClass('icon-loading');
- $.ajax(OC.generateUrl('settings/apps/list?category={categoryId}&includeUpdateInfo=1', {
- categoryId: categoryId
- }), {
- type: 'GET',
- success: function (apps) {
- _.each(apps.apps, function(app) {
- if (app.update) {
- var $update = $('#app-' + app.id + ' .update');
- $update.removeClass('hidden');
- $update.val(t('settings', 'Update to %s').replace(/%s/g, app.update));
- availableUpdates++;
- OC.Settings.Apps.State.apps[app.id].update = true;
- }
- });
-
- if (availableUpdates > 0) {
- OC.Notification.show(n('settings', 'You have %n app update pending', 'You have %n app updates pending', availableUpdates));
- }
- }
- });
}
});
},
@@ -390,6 +383,20 @@ OC.Settings.Apps = OC.Settings.Apps || {
else {
element.val(t('settings','Updated'));
element.hide();
+
+ var $update = $('#app-' + appId + ' .update');
+ $update.addClass('hidden');
+ 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));
+ }
}
},'json');
},