From 5326ba00648949c535f009a72d8d8be4a544cac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 30 May 2018 11:56:32 +0200 Subject: [PATCH] Check for server health MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- settings/src/components/appList/appItem.vue | 2 +- settings/src/store/apps.js | 26 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/settings/src/components/appList/appItem.vue b/settings/src/components/appList/appItem.vue index 9c784c11de6..72cf8b4e3ee 100644 --- a/settings/src/components/appList/appItem.vue +++ b/settings/src/components/appList/appItem.vue @@ -65,7 +65,7 @@
{{ app.error }}
- + diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js index eb584443935..f19f894309b 100644 --- a/settings/src/store/apps.js +++ b/settings/src/store/apps.js @@ -174,9 +174,33 @@ const actions = { apps.forEach(_appId => { context.commit('enableApp', {appId: _appId, groups: groups}); }); - return true; + + // check for server health + return api.get(OC.generateUrl('apps/files')) + .then(() => { + if (response.data.update_required) { + OC.dialogs.info( + t( + 'settings', + 'The app has been enabled but needs to be updated. You will be redirected to the update page in 5 seconds.' + ), + t('settings','App update'), + function () { + window.location.reload(); + }, + true + ); + setTimeout(function() { + location.reload(); + }, 5000); + } + }) + .catch((error) => { + context.commit('setError', {appId: apps, error: t('settings', 'Error: This app can not be enabled because it makes the server unstable')}); + }); }) .catch((error) => { + context.commit('setError', {appId: apps, error: t('settings', 'Error while enabling app')}); context.commit('stopLoading', apps); context.commit('stopLoading', 'install'); context.commit('APPS_API_FAILURE', { appId, error })