diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-08 10:01:54 +0200 |
---|---|---|
committer | npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com> | 2020-05-11 12:06:29 +0000 |
commit | 7daced619b8307838aed2a1cf40608b7485d136d (patch) | |
tree | 3ed0fd4b570c16e2478118ebb67508051ae614ee /apps/settings/src | |
parent | 09c209d4683ce844da5e0319acc6dc83c00f372a (diff) | |
download | nextcloud-server-7daced619b8307838aed2a1cf40608b7485d136d.tar.gz nextcloud-server-7daced619b8307838aed2a1cf40608b7485d136d.zip |
Fix some linter warnings in settings
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/AdminTwoFactor.vue | 5 | ||||
-rw-r--r-- | apps/settings/src/components/AppList/AppScore.vue | 4 | ||||
-rw-r--r-- | apps/settings/src/components/AuthTokenSection.vue | 3 | ||||
-rw-r--r-- | apps/settings/src/components/AuthTokenSetupDialogue.vue | 5 | ||||
-rw-r--r-- | apps/settings/src/components/WebAuthn/AddDevice.vue | 4 | ||||
-rw-r--r-- | apps/settings/src/components/WebAuthn/Section.vue | 2 | ||||
-rw-r--r-- | apps/settings/src/mixins/UserRowMixin.js | 4 | ||||
-rw-r--r-- | apps/settings/src/router.js | 3 | ||||
-rw-r--r-- | apps/settings/src/store/api.js | 26 | ||||
-rw-r--r-- | apps/settings/src/store/apps.js | 17 | ||||
-rw-r--r-- | apps/settings/src/store/oc.js | 3 | ||||
-rw-r--r-- | apps/settings/src/store/users.js | 37 |
12 files changed, 62 insertions, 51 deletions
diff --git a/apps/settings/src/components/AdminTwoFactor.vue b/apps/settings/src/components/AdminTwoFactor.vue index 3470ebfc2f8..4d34f8ab937 100644 --- a/apps/settings/src/components/AdminTwoFactor.vue +++ b/apps/settings/src/components/AdminTwoFactor.vue @@ -69,6 +69,7 @@ import axios from '@nextcloud/axios' import { Multiselect } from '@nextcloud/vue' import _ from 'lodash' +import { generateUrl, generateOcsUrl } from '@nextcloud/router' export default { name: 'AdminTwoFactor', @@ -124,7 +125,7 @@ export default { methods: { searchGroup: _.debounce(function(query) { this.loadingGroups = true - axios.get(OC.linkToOCS(`cloud/groups?offset=0&search=${encodeURIComponent(query)}&limit=20`, 2)) + axios.get(generateOcsUrl(`cloud/groups?offset=0&search=${encodeURIComponent(query)}&limit=20`, 2)) .then(res => res.data.ocs) .then(ocs => ocs.data.groups) .then(groups => { this.groups = _.sortedUniq(_.uniq(this.groups.concat(groups))) }) @@ -140,7 +141,7 @@ export default { enforcedGroups: this.enforcedGroups, excludedGroups: this.excludedGroups, } - axios.put(OC.generateUrl('/settings/api/admin/twofactorauth'), data) + axios.put(generateUrl('/settings/api/admin/twofactorauth'), data) .then(resp => resp.data) .then(state => { this.state = state diff --git a/apps/settings/src/components/AppList/AppScore.vue b/apps/settings/src/components/AppList/AppScore.vue index f3ff80b7792..0569d687e88 100644 --- a/apps/settings/src/components/AppList/AppScore.vue +++ b/apps/settings/src/components/AppList/AppScore.vue @@ -24,6 +24,8 @@ <img :src="scoreImage" class="app-score-image"> </template> <script> +import { imagePath } from '@nextcloud/router' + export default { name: 'AppScore', props: ['score'], @@ -31,7 +33,7 @@ export default { scoreImage() { const score = Math.round(this.score * 10) const imageName = 'rating/s' + score + '.svg' - return OC.imagePath('core', imageName) + return imagePath('core', imageName) }, }, } diff --git a/apps/settings/src/components/AuthTokenSection.vue b/apps/settings/src/components/AuthTokenSection.vue index 6e574c86cab..9c59d749e96 100644 --- a/apps/settings/src/components/AuthTokenSection.vue +++ b/apps/settings/src/components/AuthTokenSection.vue @@ -37,6 +37,7 @@ <script> import axios from '@nextcloud/axios' import confirmPassword from '@nextcloud/password-confirmation' +import { generateUrl } from '@nextcloud/router' import AuthTokenList from './AuthTokenList' import AuthTokenSetupDialogue from './AuthTokenSetupDialogue' @@ -80,7 +81,7 @@ export default { }, data() { return { - baseUrl: OC.generateUrl('/settings/personal/authtokens'), + baseUrl: generateUrl('/settings/personal/authtokens'), } }, methods: { diff --git a/apps/settings/src/components/AuthTokenSetupDialogue.vue b/apps/settings/src/components/AuthTokenSetupDialogue.vue index eaf58734530..410b0073c0b 100644 --- a/apps/settings/src/components/AuthTokenSetupDialogue.vue +++ b/apps/settings/src/components/AuthTokenSetupDialogue.vue @@ -29,7 +29,7 @@ <button class="button" :disabled="loading" @click="submit"> - {{ t('settings', 'Create new app password') }} + {{ t('settings', 'Create new app password') }} </button> </div> <div v-else> @@ -79,6 +79,7 @@ <script> import QR from '@chenfengyuan/vue-qrcode' import confirmPassword from '@nextcloud/password-confirmation' +import { getRootUrl } from '@nextcloud/router' export default { name: 'AuthTokenSetupDialogue', @@ -141,7 +142,7 @@ export default { this.loginName = token.loginName this.appPassword = token.token - const server = window.location.protocol + '//' + window.location.host + OC.getRootPath() + const server = window.location.protocol + '//' + window.location.host + getRootUrl() this.qrUrl = `nc://login/user:${token.loginName}&password:${token.token}&server:${server}` this.$nextTick(() => { diff --git a/apps/settings/src/components/WebAuthn/AddDevice.vue b/apps/settings/src/components/WebAuthn/AddDevice.vue index ad57b3b55ba..722c28b5147 100644 --- a/apps/settings/src/components/WebAuthn/AddDevice.vue +++ b/apps/settings/src/components/WebAuthn/AddDevice.vue @@ -87,8 +87,8 @@ export default { httpWarning: Boolean, isHttps: { type: Boolean, - default: false - } + default: false, + }, }, data() { return { diff --git a/apps/settings/src/components/WebAuthn/Section.vue b/apps/settings/src/components/WebAuthn/Section.vue index a0cef9f753a..672ff3b44cb 100644 --- a/apps/settings/src/components/WebAuthn/Section.vue +++ b/apps/settings/src/components/WebAuthn/Section.vue @@ -40,7 +40,7 @@ {{ t('settings', 'Your browser does not support WebAuthn.') }} </p> - <AddDevice v-if="hasPublicKeyCredential" :isHttps="isHttps" @added="deviceAdded" /> + <AddDevice v-if="hasPublicKeyCredential" :is-https="isHttps" @added="deviceAdded" /> </div> </template> diff --git a/apps/settings/src/mixins/UserRowMixin.js b/apps/settings/src/mixins/UserRowMixin.js index c997d2ea945..7d7ef44d77d 100644 --- a/apps/settings/src/mixins/UserRowMixin.js +++ b/apps/settings/src/mixins/UserRowMixin.js @@ -20,6 +20,8 @@ * */ +import { generateUrl } from '@nextcloud/router' + export default { props: { user: { @@ -158,7 +160,7 @@ export default { * @returns {string} */ generateAvatar(user, size = 32) { - return OC.generateUrl( + return generateUrl( '/avatar/{user}/{size}?v={version}', { user: user, diff --git a/apps/settings/src/router.js b/apps/settings/src/router.js index d292719d384..e46947e7987 100644 --- a/apps/settings/src/router.js +++ b/apps/settings/src/router.js @@ -23,6 +23,7 @@ import Vue from 'vue' import Router from 'vue-router' +import { generateUrl } from '@nextcloud/router' // Dynamic loading const Users = () => import('./views/Users') @@ -43,7 +44,7 @@ export default new Router({ mode: 'history', // if index.php is in the url AND we got this far, then it's working: // let's keep using index.php in the url - base: OC.generateUrl(''), + base: generateUrl(''), linkActiveClass: 'active', routes: [ { diff --git a/apps/settings/src/store/api.js b/apps/settings/src/store/api.js index 5679ada52ae..37d9a268607 100644 --- a/apps/settings/src/store/api.js +++ b/apps/settings/src/store/api.js @@ -35,15 +35,15 @@ export default { * you'll need to be careful when using it. * e.g * // store - * action(context) { - * return api.requireAdmin().then((response) => { - * return api.get('url') - * .then((response) => {API success}) - * .catch((error) => {API failure}); - * }).catch((error) => {requireAdmin failure}); - * } + * action(context) { + * return api.requireAdmin().then((response) => { + * return api.get('url') + * .then((response) => {API success}) + * .catch((error) => {API failure}); + * }).catch((error) => {requireAdmin failure}); + * } * // vue - * this.$store.dispatch('action').then(() => {always executed}) + * this.$store.dispatch('action').then(() => {always executed}) * * Since Promise.then().catch().then() will always execute the last then * this.$store.dispatch('action').then will always be executed @@ -52,11 +52,11 @@ export default { * you will need to throw a new error in the api.get.catch() * * e.g - * api.requireAdmin().then((response) => { - * api.get('url') - * .then((response) => {API success}) - * .catch((error) => {throw error;}); - * }).catch((error) => {requireAdmin OR API failure}); + * api.requireAdmin().then((response) => { + * api.get('url') + * .then((response) => {API success}) + * .catch((error) => {throw error;}); + * }).catch((error) => {requireAdmin OR API failure}); * * @returns {Promise} */ diff --git a/apps/settings/src/store/apps.js b/apps/settings/src/store/apps.js index 309932ada08..a65861d6b7c 100644 --- a/apps/settings/src/store/apps.js +++ b/apps/settings/src/store/apps.js @@ -22,6 +22,7 @@ import api from './api' import Vue from 'vue' +import { generateUrl } from '@nextcloud/router' const state = { apps: [], @@ -165,7 +166,7 @@ const actions = { return api.requireAdmin().then((response) => { context.commit('startLoading', apps) context.commit('startLoading', 'install') - return api.post(OC.generateUrl(`settings/apps/enable`), { appIds: apps, groups: groups }) + return api.post(generateUrl(`settings/apps/enable`), { appIds: apps, groups: groups }) .then((response) => { context.commit('stopLoading', apps) context.commit('stopLoading', 'install') @@ -174,7 +175,7 @@ const actions = { }) // check for server health - return api.get(OC.generateUrl('apps/files')) + return api.get(generateUrl('apps/files')) .then(() => { if (response.data.update_required) { OC.dialogs.info( @@ -223,7 +224,7 @@ const actions = { return api.requireAdmin().then(() => { context.commit('startLoading', apps) context.commit('startLoading', 'install') - return api.post(OC.generateUrl(`settings/apps/force`), { appId }) + return api.post(generateUrl(`settings/apps/force`), { appId }) .then((response) => { // TODO: find a cleaner solution location.reload() @@ -248,7 +249,7 @@ const actions = { } return api.requireAdmin().then((response) => { context.commit('startLoading', apps) - return api.post(OC.generateUrl(`settings/apps/disable`), { appIds: apps }) + return api.post(generateUrl(`settings/apps/disable`), { appIds: apps }) .then((response) => { context.commit('stopLoading', apps) apps.forEach(_appId => { @@ -265,7 +266,7 @@ const actions = { uninstallApp(context, { appId }) { return api.requireAdmin().then((response) => { context.commit('startLoading', appId) - return api.get(OC.generateUrl(`settings/apps/uninstall/${appId}`)) + return api.get(generateUrl(`settings/apps/uninstall/${appId}`)) .then((response) => { context.commit('stopLoading', appId) context.commit('uninstallApp', appId) @@ -282,7 +283,7 @@ const actions = { return api.requireAdmin().then((response) => { context.commit('startLoading', appId) context.commit('startLoading', 'install') - return api.get(OC.generateUrl(`settings/apps/update/${appId}`)) + return api.get(generateUrl(`settings/apps/update/${appId}`)) .then((response) => { context.commit('stopLoading', 'install') context.commit('stopLoading', appId) @@ -299,7 +300,7 @@ const actions = { getAllApps(context) { context.commit('startLoading', 'list') - return api.get(OC.generateUrl(`settings/apps/list`)) + return api.get(generateUrl(`settings/apps/list`)) .then((response) => { context.commit('setAllApps', response.data.apps) context.commit('stopLoading', 'list') @@ -310,7 +311,7 @@ const actions = { getCategories(context) { context.commit('startLoading', 'categories') - return api.get(OC.generateUrl('settings/apps/categories')) + return api.get(generateUrl('settings/apps/categories')) .then((response) => { if (response.data.length > 0) { context.commit('appendCategories', response.data) diff --git a/apps/settings/src/store/oc.js b/apps/settings/src/store/oc.js index b416d684e63..f7fdd413554 100644 --- a/apps/settings/src/store/oc.js +++ b/apps/settings/src/store/oc.js @@ -21,6 +21,7 @@ */ import api from './api' +import { generateOcsUrl } from '@nextcloud/router' const state = {} const mutations = {} @@ -38,7 +39,7 @@ const actions = { */ setAppConfig(context, { app, key, value }) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), { value: value }) + return api.post(generateOcsUrl(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), { value: value }) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { app, key, value, error })) }, diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js index 83bc32d7b6a..8e586492a9b 100644 --- a/apps/settings/src/store/users.js +++ b/apps/settings/src/store/users.js @@ -21,6 +21,7 @@ */ import api from './api' +import { generateOcsUrl } from '@nextcloud/router' const orderGroups = function(groups, orderBy) { /* const SORT_USERCOUNT = 1; @@ -205,7 +206,7 @@ const actions = { search = typeof search === 'string' ? search : '' group = typeof group === 'string' ? group : '' if (group !== '') { - return api.get(OC.linkToOCS(`cloud/groups/${encodeURIComponent(encodeURIComponent(group))}/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) + return api.get(generateOcsUrl(`cloud/groups/${encodeURIComponent(encodeURIComponent(group))}/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) .then((response) => { if (Object.keys(response.data.ocs.data.users).length > 0) { context.commit('appendUsers', response.data.ocs.data.users) @@ -216,7 +217,7 @@ const actions = { .catch((error) => context.commit('API_FAILURE', error)) } - return api.get(OC.linkToOCS(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) + return api.get(generateOcsUrl(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) .then((response) => { if (Object.keys(response.data.ocs.data.users).length > 0) { context.commit('appendUsers', response.data.ocs.data.users) @@ -230,7 +231,7 @@ const actions = { getGroups(context, { offset, limit, search }) { search = typeof search === 'string' ? search : '' const limitParam = limit === -1 ? '' : `&limit=${limit}` - return api.get(OC.linkToOCS(`cloud/groups?offset=${offset}&search=${search}${limitParam}`, 2)) + return api.get(generateOcsUrl(`cloud/groups?offset=${offset}&search=${search}${limitParam}`, 2)) .then((response) => { if (Object.keys(response.data.ocs.data.groups).length > 0) { response.data.ocs.data.groups.forEach(function(group) { @@ -254,7 +255,7 @@ const actions = { */ getUsersFromList(context, { offset, limit, search }) { search = typeof search === 'string' ? search : '' - return api.get(OC.linkToOCS(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) + return api.get(generateOcsUrl(`cloud/users/details?offset=${offset}&limit=${limit}&search=${search}`, 2)) .then((response) => { if (Object.keys(response.data.ocs.data.users).length > 0) { context.commit('appendUsers', response.data.ocs.data.users) @@ -275,7 +276,7 @@ const actions = { * @returns {Promise} */ getUsersFromGroup(context, { groupid, offset, limit }) { - return api.get(OC.linkToOCS(`cloud/users/${encodeURIComponent(encodeURIComponent(groupid))}/details?offset=${offset}&limit=${limit}`, 2)) + return api.get(generateOcsUrl(`cloud/users/${encodeURIComponent(encodeURIComponent(groupid))}/details?offset=${offset}&limit=${limit}`, 2)) .then((response) => context.commit('getUsersFromList', response.data.ocs.data.users)) .catch((error) => context.commit('API_FAILURE', error)) }, @@ -297,7 +298,7 @@ const actions = { */ addGroup(context, gid) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/groups`, 2), { groupid: gid }) + return api.post(generateOcsUrl(`cloud/groups`, 2), { groupid: gid }) .then((response) => { context.commit('addGroup', { gid: gid, displayName: gid }) return { gid: gid, displayName: gid } @@ -320,7 +321,7 @@ const actions = { */ removeGroup(context, gid) { return api.requireAdmin().then((response) => { - return api.delete(OC.linkToOCS(`cloud/groups/${encodeURIComponent(encodeURIComponent(gid))}`, 2)) + return api.delete(generateOcsUrl(`cloud/groups/${encodeURIComponent(encodeURIComponent(gid))}`, 2)) .then((response) => context.commit('removeGroup', gid)) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { gid, error })) @@ -337,7 +338,7 @@ const actions = { */ addUserGroup(context, { userid, gid }) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/users/${userid}/groups`, 2), { groupid: gid }) + return api.post(generateOcsUrl(`cloud/users/${userid}/groups`, 2), { groupid: gid }) .then((response) => context.commit('addUserGroup', { userid, gid })) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -354,7 +355,7 @@ const actions = { */ removeUserGroup(context, { userid, gid }) { return api.requireAdmin().then((response) => { - return api.delete(OC.linkToOCS(`cloud/users/${userid}/groups`, 2), { groupid: gid }) + return api.delete(generateOcsUrl(`cloud/users/${userid}/groups`, 2), { groupid: gid }) .then((response) => context.commit('removeUserGroup', { userid, gid })) .catch((error) => { throw error }) }).catch((error) => { @@ -376,7 +377,7 @@ const actions = { */ addUserSubAdmin(context, { userid, gid }) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/users/${userid}/subadmins`, 2), { groupid: gid }) + return api.post(generateOcsUrl(`cloud/users/${userid}/subadmins`, 2), { groupid: gid }) .then((response) => context.commit('addUserSubAdmin', { userid, gid })) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -393,7 +394,7 @@ const actions = { */ removeUserSubAdmin(context, { userid, gid }) { return api.requireAdmin().then((response) => { - return api.delete(OC.linkToOCS(`cloud/users/${userid}/subadmins`, 2), { groupid: gid }) + return api.delete(generateOcsUrl(`cloud/users/${userid}/subadmins`, 2), { groupid: gid }) .then((response) => context.commit('removeUserSubAdmin', { userid, gid })) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -408,7 +409,7 @@ const actions = { */ wipeUserDevices(context, userid) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/users/${userid}/wipe`, 2)) + return api.post(generateOcsUrl(`cloud/users/${userid}/wipe`, 2)) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) }, @@ -422,7 +423,7 @@ const actions = { */ deleteUser(context, userid) { return api.requireAdmin().then((response) => { - return api.delete(OC.linkToOCS(`cloud/users/${userid}`, 2)) + return api.delete(generateOcsUrl(`cloud/users/${userid}`, 2)) .then((response) => context.commit('deleteUser', userid)) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -444,7 +445,7 @@ const actions = { */ addUser({ commit, dispatch }, { userid, password, displayName, email, groups, subadmin, quota, language }) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/users`, 2), { userid, password, displayName, email, groups, subadmin, quota, language }) + return api.post(generateOcsUrl(`cloud/users`, 2), { userid, password, displayName, email, groups, subadmin, quota, language }) .then((response) => dispatch('addUserData', userid || response.data.ocs.data.id)) .catch((error) => { throw error }) }).catch((error) => { @@ -462,7 +463,7 @@ const actions = { */ addUserData(context, userid) { return api.requireAdmin().then((response) => { - return api.get(OC.linkToOCS(`cloud/users/${userid}`, 2)) + return api.get(generateOcsUrl(`cloud/users/${userid}`, 2)) .then((response) => context.commit('addUserData', response)) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -479,7 +480,7 @@ const actions = { enableDisableUser(context, { userid, enabled = true }) { const userStatus = enabled ? 'enable' : 'disable' return api.requireAdmin().then((response) => { - return api.put(OC.linkToOCS(`cloud/users/${userid}/${userStatus}`, 2)) + return api.put(generateOcsUrl(`cloud/users/${userid}/${userStatus}`, 2)) .then((response) => context.commit('enableDisableUser', { userid, enabled })) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -506,7 +507,7 @@ const actions = { ) ) { return api.requireAdmin().then((response) => { - return api.put(OC.linkToOCS(`cloud/users/${userid}`, 2), { key: key, value: value }) + return api.put(generateOcsUrl(`cloud/users/${userid}`, 2), { key: key, value: value }) .then((response) => context.commit('setUserData', { userid, key, value })) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) @@ -524,7 +525,7 @@ const actions = { */ sendWelcomeMail(context, userid) { return api.requireAdmin().then((response) => { - return api.post(OC.linkToOCS(`cloud/users/${userid}/welcome`, 2)) + return api.post(generateOcsUrl(`cloud/users/${userid}/welcome`, 2)) .then(response => true) .catch((error) => { throw error }) }).catch((error) => context.commit('API_FAILURE', { userid, error })) |