diff options
author | Raimund Schlüßler <raimund.schluessler@mailbox.org> | 2020-04-10 22:43:20 +0300 |
---|---|---|
committer | Raimund Schlüßler <raimund.schluessler@mailbox.org> | 2020-04-10 22:43:20 +0300 |
commit | e51c6437c6b789ebe7d9a9844a6dcf6fe38ceefc (patch) | |
tree | 7489a7ba90b6c367346d5599f1b0bdb94b67bcb8 | |
parent | b05dd7efc202acea4ceb073e9e4fcb224c7203a9 (diff) |
Don't use deprecated globals
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
See https://github.com/nextcloud/documentation/pull/1950
-rw-r--r-- | package-lock.json | 25 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/components/AppNavigation/CalendarSharee.vue | 5 | ||||
-rw-r--r-- | src/components/AppNavigation/ListItemCalendar.vue | 10 | ||||
-rw-r--r-- | src/components/TaskBody.vue | 3 | ||||
-rw-r--r-- | src/main.js | 8 | ||||
-rw-r--r-- | src/services/cdav.js | 3 | ||||
-rw-r--r-- | src/store/collections.js | 5 | ||||
-rw-r--r-- | src/store/settings.js | 5 | ||||
-rw-r--r-- | src/store/tasks.js | 3 |
10 files changed, 50 insertions, 19 deletions
diff --git a/package-lock.json b/package-lock.json index 6e15b3de..b5ff51f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4106,6 +4106,22 @@ "integrity": "sha512-f+sKpdLZXkODV+OY39K1M+Spmd4RgxmtEXmNn4Bviv4R7uBFHXuw+JX9ZdfDeOryfHjJ/TRQxQEp0GMpBwZFUw==", "dev": true }, + "@nextcloud/dialogs": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-1.2.2.tgz", + "integrity": "sha512-N8A8J8UKSvz/hqNcm7gwpm70uAAsx0wurjhdYZ989jaMho+H/Hinjd2jkbV8UnsYYw0x/vWvEX5t6Lwbv08K0g==", + "requires": { + "core-js": "3.6.4", + "toastify-js": "^1.7.0" + }, + "dependencies": { + "core-js": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz", + "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==" + } + } + }, "@nextcloud/eslint-config": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@nextcloud/eslint-config/-/eslint-config-2.0.0.tgz", @@ -5871,7 +5887,7 @@ }, "mkdirp": { "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", "dev": true, "requires": { @@ -16458,7 +16474,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -21915,6 +21931,11 @@ } } }, + "toastify-js": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.7.0.tgz", + "integrity": "sha512-GmPy4zJ/ulCfmCHlfCtgcB+K2xhx2AXW3T/ZZOSjyjaIGevhz+uvR8HSCTay/wBq4tt2mUnBqlObP1sSWGlsnQ==" + }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", diff --git a/package.json b/package.json index f0e958eb..c0174fc0 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,8 @@ "contributors": [], "dependencies": { "@nextcloud/axios": "^1.3.2", + "@nextcloud/dialogs": "1.2.2", + "@nextcloud/router": "1.0.2", "@nextcloud/vue": "1.4.1", "@vue/test-utils": "^1.0.0-beta.32", "cdav-library": "github:nextcloud/cdav-library", diff --git a/src/components/AppNavigation/CalendarSharee.vue b/src/components/AppNavigation/CalendarSharee.vue index e968b48a..f6276396 100644 --- a/src/components/AppNavigation/CalendarSharee.vue +++ b/src/components/AppNavigation/CalendarSharee.vue @@ -61,6 +61,7 @@ import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox' import AppNavigationItem from '@nextcloud/vue/dist/Components/AppNavigationItem' import Avatar from '@nextcloud/vue/dist/Components/Avatar' +import { showError } from '@nextcloud/dialogs' export default { name: 'CalendarSharee', @@ -107,7 +108,7 @@ export default { }) } catch (error) { console.error(error) - this.$OC.Notification.showTemporary(this.$t('tasks', 'Unable to delete the share.')) + showError(this.$t('tasks', 'Unable to delete the share.')) } finally { this.loading = false } @@ -125,7 +126,7 @@ export default { }) } catch (error) { console.error(error) - this.$OC.Notification.showTemporary(this.$t('tasks', 'Unable to change permissions.')) + showError(this.$t('tasks', 'Unable to change permissions.')) } finally { this.loading = false } diff --git a/src/components/AppNavigation/ListItemCalendar.vue b/src/components/AppNavigation/ListItemCalendar.vue index fa6133b2..f5ab2e06 100644 --- a/src/components/AppNavigation/ListItemCalendar.vue +++ b/src/components/AppNavigation/ListItemCalendar.vue @@ -136,6 +136,8 @@ import AppNavigationIconBullet from '@nextcloud/vue/dist/Components/AppNavigatio import Actions from '@nextcloud/vue/dist/Components/Actions' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import ActionLink from '@nextcloud/vue/dist/Components/ActionLink' +import { generateRemoteUrl } from '@nextcloud/router' +import { showSuccess, showError } from '@nextcloud/dialogs' const CD_DURATION = 7 @@ -227,7 +229,7 @@ export default { return url }, url() { - const rootURL = this.$OC.linkToRemote('dav') + const rootURL = generateRemoteUrl('dav') return new URL(this.calendar.url, rootURL) }, hasShares() { @@ -400,11 +402,11 @@ export default { this.copySuccess = true this.copied = true // Notify calendar url was copied - this.$OC.Notification.showTemporary(this.$t('tasks', 'Calendar link copied to clipboard.')) + showSuccess(this.$t('tasks', 'Calendar link copied to clipboard.')) }, e => { this.copySuccess = false this.copied = true - this.$OC.Notification.showTemporary(this.$t('tasks', 'Calendar link could not be copied to clipboard.')) + showError(this.$t('tasks', 'Calendar link could not be copied to clipboard.')) }).then(() => { setTimeout(() => { // stop loading status regardless of outcome @@ -473,7 +475,7 @@ export default { try { await this.deleteCalendar(this.calendar) } catch (error) { - this.$toast.error(this.$t('tasks', 'An error occurred, unable to delete the calendar.')) + showError(this.$t('tasks', 'An error occurred, unable to delete the calendar.')) console.error(error) } finally { clearInterval(this.deleteInterval) diff --git a/src/components/TaskBody.vue b/src/components/TaskBody.vue index 0590d561..c3a73040 100644 --- a/src/components/TaskBody.vue +++ b/src/components/TaskBody.vue @@ -160,6 +160,7 @@ import TaskDragContainer from './TaskDragContainer' import Actions from '@nextcloud/vue/dist/Components/Actions' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' +import { showError } from '@nextcloud/dialogs' const CD_DURATION = 7 @@ -402,7 +403,7 @@ export default { } await this.deleteTask({ task: this.task, dav: true }) } catch (error) { - this.$toast.error(this.$t('tasks', 'An error occurred, unable to delete the task.')) + showError(this.$t('tasks', 'An error occurred, unable to delete the task.')) console.error(error) } finally { clearInterval(this.deleteInterval) diff --git a/src/main.js b/src/main.js index 036d95c2..b5c22bdd 100644 --- a/src/main.js +++ b/src/main.js @@ -29,6 +29,7 @@ import store from './store/store' import { sync } from 'vuex-router-sync' import VTooltip from 'v-tooltip' import VueClipboard from 'vue-clipboard2' +import { linkTo } from '@nextcloud/router' // Disable on production Vue.config.devtools = true @@ -39,11 +40,11 @@ Vue.config.performance = true __webpack_nonce__ = btoa(OC.requestToken) // Correct the root of the app for chunk loading -// OC.linkTo matches the apps folders -// OC.generateUrl ensure the index.php (or not) +// linkTo matches the apps folders +// generateUrl ensure the index.php (or not) // We do not want the index.php since we're loading files // eslint-disable-next-line -__webpack_public_path__ = OC.linkTo('tasks', 'js/') +__webpack_public_path__ = linkTo('tasks', 'js/') sync(store, router) @@ -68,7 +69,6 @@ Vue.prototype.n = Vue.prototype.$n Vue.prototype.$OC = OC Vue.prototype.$OCA = OCA Vue.prototype.$appVersion = $appVersion -Vue.prototype.$toast = OCP.Toast // eslint-disable-line no-undef OCA.Tasks.$t = Vue.prototype.$t OCA.Tasks.$n = Vue.prototype.$n diff --git a/src/services/cdav.js b/src/services/cdav.js index 2a8de950..64541ab7 100644 --- a/src/services/cdav.js +++ b/src/services/cdav.js @@ -21,6 +21,7 @@ */ import DavClient from 'cdav-library' +import { generateRemoteUrl } from '@nextcloud/router' function xhrProvider() { const headers = { @@ -43,5 +44,5 @@ function xhrProvider() { } export default new DavClient({ - rootUrl: OC.linkToRemote('dav'), + rootUrl: generateRemoteUrl('dav'), }, xhrProvider) diff --git a/src/store/collections.js b/src/store/collections.js index 0645b0ac..c975772a 100644 --- a/src/store/collections.js +++ b/src/store/collections.js @@ -22,6 +22,7 @@ import Vue from 'vue' import Vuex from 'vuex' +import { generateUrl } from '@nextcloud/router' import Requests from '../services/requests' import { isTaskInList, searchSubTasks } from './storeHelper' @@ -100,7 +101,7 @@ const actions = { */ loadCollections({ commit }) { return new Promise(function(resolve) { - Requests.get(OC.generateUrl('apps/tasks/collections')) + Requests.get(generateUrl('apps/tasks/collections')) .then(response => { commit('setCollections', { collections: response.data.data.collections, @@ -120,7 +121,7 @@ const actions = { setVisibility(context, collection) { context.commit('setVisibility', collection) return new Promise(function() { - Requests.post(OC.generateUrl('apps/tasks/collection/{id}/visibility/{show}', collection), {}) + Requests.post(generateUrl('apps/tasks/collection/{id}/visibility/{show}', collection), {}) }) }, } diff --git a/src/store/settings.js b/src/store/settings.js index f7b86075..d998e802 100644 --- a/src/store/settings.js +++ b/src/store/settings.js @@ -24,6 +24,7 @@ import Vue from 'vue' import Vuex from 'vuex' import Requests from '../services/requests' +import { generateUrl } from '@nextcloud/router' Vue.use(Vuex) @@ -90,7 +91,7 @@ const actions = { setSetting(context, payload) { context.commit('setSetting', payload) return new Promise(function() { - Requests.post(OC.generateUrl('apps/tasks/settings/{type}/{value}', payload), {}) + Requests.post(generateUrl('apps/tasks/settings/{type}/{value}', payload), {}) }) }, @@ -102,7 +103,7 @@ const actions = { */ loadSettings({ commit }) { return new Promise(function(resolve) { - Requests.get(OC.generateUrl('apps/tasks/settings')) + Requests.get(generateUrl('apps/tasks/settings')) .then(response => { commit('setSettings', { settings: response.data.data.settings, diff --git a/src/store/tasks.js b/src/store/tasks.js index ef4e5688..f834141b 100644 --- a/src/store/tasks.js +++ b/src/store/tasks.js @@ -28,6 +28,7 @@ import ICAL from 'ical.js' import TaskStatus from '../models/taskStatus' import router from '../router' import { findVTODObyUid } from './cdav-requests' +import { showError } from '@nextcloud/dialogs' Vue.use(Vuex) @@ -1205,7 +1206,7 @@ const actions = { }) .catch((error) => { console.error(error) - OC.Notification.showTemporary(OCA.Tasks.$t('tasks', 'An error occurred')) + showError(OCA.Tasks.$t('tasks', 'An error occurred')) }) } |