diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-03-06 19:59:15 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-03-20 15:16:11 +0100 |
commit | 769cb629aebd368fbddd6ea04067fdcfaa262e3e (patch) | |
tree | 432bfb3aca1d60128e79da57c2053bf7f19291a2 /settings/src | |
parent | 1c8779dc6e34a89ea9181b3cb252101e457c1543 (diff) | |
download | nextcloud-server-769cb629aebd368fbddd6ea04067fdcfaa262e3e.tar.gz nextcloud-server-769cb629aebd368fbddd6ea04067fdcfaa262e3e.zip |
allow enforcing apps to ignore the max version
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'settings/src')
-rw-r--r-- | settings/src/components/appDetails.vue | 17 | ||||
-rw-r--r-- | settings/src/components/appList/appItem.vue | 17 | ||||
-rw-r--r-- | settings/src/components/appManagement.vue | 22 | ||||
-rw-r--r-- | settings/src/main-apps-users-management.js | 4 | ||||
-rw-r--r-- | settings/src/store/apps.js | 26 |
5 files changed, 82 insertions, 4 deletions
diff --git a/settings/src/components/appDetails.vue b/settings/src/components/appDetails.vue index 804ed8e441e..a20d0c13f82 100644 --- a/settings/src/components/appDetails.vue +++ b/settings/src/components/appDetails.vue @@ -50,7 +50,8 @@ <input v-if="app.update" class="update primary" type="button" :value="t('settings', 'Update to {version}', {version: 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 primary" type="button" :value="enableButtonText" v-on:click="enable(app.id)" v-tooltip.auto="enableButtonTooltip" :disabled="!app.canInstall || installing || loading(app.id)" /> + <input v-if="!app.active && (app.canInstall || app.isCompatible)" class="enable primary" type="button" :value="enableButtonText" v-on:click="enable(app.id)" v-tooltip.auto="enableButtonTooltip" :disabled="!app.canInstall || installing || loading(app.id)" /> + <input v-else-if="!app.active" class="enable force" type="button" :value="forceEnableButtonText" v-on:click="forceEnable(app.id)" v-tooltip.auto="forceEnableButtonTooltip" :disabled="installing || loading(app.id)" /> </div> <div class="app-groups"> <div class="groups-enable" v-if="app.active && canLimitToGroups(app)"> @@ -226,3 +227,17 @@ export default { } } </script> + +<style scoped> + .force { + background: var(--color-main-background); + border-color: var(--color-error); + color: var(--color-error); + } + .force:hover, + .force:active { + background: var(--color-error); + border-color: var(--color-error) !important; + color: var(--color-main-background); + } +</style> diff --git a/settings/src/components/appList/appItem.vue b/settings/src/components/appList/appItem.vue index 39e892bb866..e583a279554 100644 --- a/settings/src/components/appList/appItem.vue +++ b/settings/src/components/appList/appItem.vue @@ -54,7 +54,8 @@ <input v-if="app.update" class="update primary" type="button" :value="t('settings', 'Update to {update}', {update:app.update})" v-on:click.stop="update(app.id)" :disabled="installing || loading(app.id)" /> <input v-if="app.canUnInstall" class="uninstall" type="button" :value="t('settings', 'Remove')" v-on:click.stop="remove(app.id)" :disabled="installing || loading(app.id)" /> <input v-if="app.active" class="enable" type="button" :value="t('settings','Disable')" v-on:click.stop="disable(app.id)" :disabled="installing || loading(app.id)" /> - <input v-if="!app.active" class="enable" type="button" :value="enableButtonText" v-on:click.stop="enable(app.id)" v-tooltip.auto="enableButtonTooltip" :disabled="!app.canInstall || installing || loading(app.id)" /> + <input v-if="!app.active && (app.canInstall || app.isCompatible)" class="enable" type="button" :value="enableButtonText" v-on:click.stop="enable(app.id)" v-tooltip.auto="enableButtonTooltip" :disabled="!app.canInstall || installing || loading(app.id)" /> + <input v-else-if="!app.active" class="enable force" type="button" :value="forceEnableButtonText" v-on:click.stop="forceEnable(app.id)" v-tooltip.auto="forceEnableButtonTooltip" :disabled="installing || loading(app.id)" /> </div> </div> </template> @@ -116,3 +117,17 @@ } } </script> + +<style scoped> + .force { + background: var(--color-main-background); + border-color: var(--color-error); + color: var(--color-error); + } + .force:hover, + .force:active { + background: var(--color-error); + border-color: var(--color-error) !important; + color: var(--color-main-background); + } +</style> diff --git a/settings/src/components/appManagement.vue b/settings/src/components/appManagement.vue index bced657bb9f..79fa0bc75d5 100644 --- a/settings/src/components/appManagement.vue +++ b/settings/src/components/appManagement.vue @@ -42,15 +42,28 @@ }, enableButtonText() { if (this.app.needsDownload) { - return t('settings','Download and enable'); + return t('settings', 'Download and enable'); } - return t('settings','Enable'); + return t('settings', 'Enable'); + }, + forceEnableButtonText() { + if (this.app.needsDownload) { + return t('settings', 'Enable untested app'); + } + return t('settings', 'Enable untested app'); }, enableButtonTooltip() { if (this.app.needsDownload) { return t('settings','The app will be downloaded from the app store'); } return false; + }, + forceEnableButtonTooltip() { + const base = t('settings', 'This app is not marked as compatible with your Nextcloud version. If you continue you will still be able to install the app. Note that the app might not work as expected.'); + if (this.app.needsDownload) { + return base + ' ' + t('settings','The app will be downloaded from the app store'); + } + return base; } }, methods: { @@ -90,6 +103,11 @@ } this.$store.dispatch('enableApp', { appId: this.app.id, groups: currentGroups}); }, + forceEnable(appId) { + this.$store.dispatch('forceEnableApp', { appId: appId, groups: [] }) + .then((response) => { OC.Settings.Apps.rebuildNavigation(); }) + .catch((error) => { OC.Notification.show(error)}); + }, enable(appId) { this.$store.dispatch('enableApp', { appId: appId, groups: [] }) .then((response) => { OC.Settings.Apps.rebuildNavigation(); }) diff --git a/settings/src/main-apps-users-management.js b/settings/src/main-apps-users-management.js index 587451069e8..e3149cabaf2 100644 --- a/settings/src/main-apps-users-management.js +++ b/settings/src/main-apps-users-management.js @@ -21,11 +21,15 @@ */ import Vue from 'vue'; +import VTooltip from 'v-tooltip'; import { sync } from 'vuex-router-sync'; + import App from './App.vue'; import router from './router'; import store from './store'; +Vue.use(VTooltip); + sync(store, router); // CSP config for webpack dynamic chunk loading diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js index 287a1c13505..8074eac2e00 100644 --- a/settings/src/store/apps.js +++ b/settings/src/store/apps.js @@ -213,6 +213,32 @@ const actions = { }) }).catch((error) => context.commit('API_FAILURE', { appId, error })); }, + forceEnableApp(context, { appId, groups }) { + let apps; + if (Array.isArray(appId)) { + apps = appId; + } else { + apps = [appId]; + } + return api.requireAdmin().then(() => { + context.commit('startLoading', apps); + context.commit('startLoading', 'install'); + return api.post(OC.generateUrl(`settings/apps/force`), {appId}) + .then((response) => { + // TODO: find a cleaner solution + location.reload(); + }) + .catch((error) => { + context.commit('stopLoading', apps); + context.commit('stopLoading', 'install'); + context.commit('setError', { + appId: apps, + error: error.response.data.data.message + }); + context.commit('APPS_API_FAILURE', { appId, error}); + }) + }).catch((error) => context.commit('API_FAILURE', { appId, error })); + }, disableApp(context, { appId }) { let apps; if (Array.isArray(appId)) { |