Check for server health
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
52895cb41e
commit
5326ba0064
|
@ -65,7 +65,7 @@
|
|||
<div class="actions">
|
||||
<div class="warning" v-if="app.error">{{ app.error }}</div>
|
||||
<div class="icon icon-loading-small" v-if="loading(app.id)"></div>
|
||||
<input v-if="app.update" class="update" type="button" :value="t('settings', 'Update to %s', app.update)" v-on:click="update(app.id)" :disabled="installing || loading(app.id)" />
|
||||
<input v-if="app.update" class="update" type="button" :value="t('settings', 'Update to {update}', {update:app.update})" v-on:click="update(app.id)" :disabled="installing || loading(app.id)" />
|
||||
<input v-if="app.canUnInstall" class="uninstall" type="button" :value="t('settings', 'Remove')" v-on:click="remove(app.id)" :disabled="installing || loading(app.id)" />
|
||||
<input v-if="app.active" class="enable" type="button" :value="t('settings','Disable')" v-on:click="disable(app.id)" :disabled="installing || loading(app.id)" />
|
||||
<input v-if="!app.active" class="enable" type="button" :value="enableButtonText" v-on:click="enable(app.id)" v-tooltip.auto="enableButtonTooltip" :disabled="!app.canInstall || installing || loading(app.id)" />
|
||||
|
|
|
@ -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 })
|
||||
|
|
Loading…
Reference in New Issue