diff options
author | dartcafe <github@dartcafe.de> | 2020-08-20 22:46:17 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-08-20 22:46:17 +0300 |
commit | 6b73deac12a2dabc4d94b92ce91eebd04620e3bb (patch) | |
tree | 94b2353067dd4e50fdde5ebb650467a3fa247ff0 | |
parent | c7f111b583bc1a27c2654c94d2c067fab329ce23 (diff) |
migrate to @nextcloud/dialogs
-rw-r--r-- | src/js/App.vue | 10 | ||||
-rw-r--r-- | src/js/components/Base/PersonalLink.vue | 4 | ||||
-rw-r--r-- | src/js/components/Base/PublicRegisterModal.vue | 3 | ||||
-rw-r--r-- | src/js/components/Comments/CommentAdd.vue | 5 | ||||
-rw-r--r-- | src/js/components/Comments/Comments.vue | 5 | ||||
-rw-r--r-- | src/js/components/Create/CreateDlg.vue | 5 | ||||
-rw-r--r-- | src/js/components/Navigation/Navigation.vue | 11 | ||||
-rw-r--r-- | src/js/components/PollList/PollItem.vue | 11 | ||||
-rw-r--r-- | src/js/components/SideBar/SideBarTabConfiguration.vue | 15 | ||||
-rw-r--r-- | src/js/components/VoteTable/VoteTable.vue | 10 | ||||
-rw-r--r-- | src/js/store/modules/polls.js | 1 |
11 files changed, 44 insertions, 36 deletions
diff --git a/src/js/App.vue b/src/js/App.vue index 3ca736e1..b1561772 100644 --- a/src/js/App.vue +++ b/src/js/App.vue @@ -30,9 +30,10 @@ <script> import Navigation from './components/Navigation/Navigation' -import { Content } from '@nextcloud/vue' import SideBar from './components/SideBar/SideBar' import { getCurrentUser } from '@nextcloud/auth' +import { showError } from '@nextcloud/dialogs' +import { Content } from '@nextcloud/vue' import { subscribe, unsubscribe } from '@nextcloud/event-bus' export default { @@ -85,11 +86,8 @@ export default { if (getCurrentUser()) { this.$store.dispatch('polls/load') - .then(() => { - }) - .catch((error) => { - console.error('refresh poll: ', error.response) - OC.Notification.showTemporary(t('polls', 'Error loading poll list'), { type: 'error' }) + .catch(() => { + showError(t('polls', 'Error loading poll list')) }) } }, diff --git a/src/js/components/Base/PersonalLink.vue b/src/js/components/Base/PersonalLink.vue index 198f408c..d78e4fb3 100644 --- a/src/js/components/Base/PersonalLink.vue +++ b/src/js/components/Base/PersonalLink.vue @@ -80,10 +80,10 @@ export default { copyLink() { this.$copyText(this.personalLink).then( function() { - OC.Notification.showTemporary(t('polls', 'Link copied to clipboard'), { type: 'success' }) + showSuccess(t('polls', 'Link copied to clipboard')) }, function() { - OC.Notification.showTemporary(t('polls', 'Error while copying link to clipboard'), { type: 'error' }) + showError(t('polls', 'Error while copying link to clipboard')) } ) }, diff --git a/src/js/components/Base/PublicRegisterModal.vue b/src/js/components/Base/PublicRegisterModal.vue index 03e83655..478468a6 100644 --- a/src/js/components/Base/PublicRegisterModal.vue +++ b/src/js/components/Base/PublicRegisterModal.vue @@ -62,6 +62,7 @@ import debounce from 'lodash/debounce' import axios from '@nextcloud/axios' import ButtonDiv from '../Base/ButtonDiv' +import { showError } from '@nextcloud/dialogs' import { generateUrl } from '@nextcloud/router' import { Modal } from '@nextcloud/vue' import { mapState } from 'vuex' @@ -170,7 +171,7 @@ export default { } }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error saving username', 1, this.poll.title), { type: 'error' }) + showError(t('polls', 'Error saving username', 1, this.poll.title)) }) } }, diff --git a/src/js/components/Comments/CommentAdd.vue b/src/js/components/Comments/CommentAdd.vue index 8bc29082..ebc723a9 100644 --- a/src/js/components/Comments/CommentAdd.vue +++ b/src/js/components/Comments/CommentAdd.vue @@ -30,6 +30,7 @@ <script> import { mapState } from 'vuex' +import { showSuccess, showError } from '@nextcloud/dialogs' import InputDiv from '../Base/InputDiv' export default { @@ -60,13 +61,13 @@ export default { this.$store.dispatch('poll/comments/add', { message: this.comment }) .then(() => { this.isLoading = false - OC.Notification.showTemporary(t('polls', 'Your comment was added'), { type: 'success' }) + showSuccess(t('polls', 'Your comment was added')) this.comment = '' }) .catch((error) => { this.isLoading = false console.error('Error while saving comment - Error: ', error.response) - OC.Notification.showTemporary(t('polls', 'Error while saving comment'), { type: 'error' }) + showError(t('polls', 'Error while saving comment')) }) } diff --git a/src/js/components/Comments/Comments.vue b/src/js/components/Comments/Comments.vue index 280d9de5..e61cdfc5 100644 --- a/src/js/components/Comments/Comments.vue +++ b/src/js/components/Comments/Comments.vue @@ -55,6 +55,7 @@ import CommentAdd from './CommentAdd' import sortBy from 'lodash/sortBy' import moment from '@nextcloud/moment' +import { showSuccess, showError } from '@nextcloud/dialogs' import { Actions, ActionButton } from '@nextcloud/vue' import { mapState, mapGetters } from 'vuex' @@ -97,10 +98,10 @@ export default { this.$store .dispatch({ type: 'poll/comments/delete', comment: comment }) .then(() => { - OC.Notification.showTemporary(t('polls', 'Comment deleted'), { type: 'success' }) + showSuccess(t('polls', 'Comment deleted')) }) .catch((error) => { - OC.Notification.showTemporary(t('polls', 'Error while deleting the comment'), { type: 'error' }) + showError(t('polls', 'Error while deleting the comment')) console.error(error.response) }) }, diff --git a/src/js/components/Create/CreateDlg.vue b/src/js/components/Create/CreateDlg.vue index f86131c2..c825fd29 100644 --- a/src/js/components/Create/CreateDlg.vue +++ b/src/js/components/Create/CreateDlg.vue @@ -63,6 +63,7 @@ <script> import { mapState } from 'vuex' +import { showSuccess, showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import ConfigBox from '../Base/ConfigBox' @@ -103,11 +104,11 @@ export default { .then((response) => { emit('update-polls') this.cancel() - OC.Notification.showTemporary(t('polls', 'Poll "{pollTitle}" added', { pollTitle: response.data.id }), { type: 'success' }) + showSuccess(t('polls', 'Poll "{pollTitle}" added', { pollTitle: response.data.id })) this.$router.push({ name: 'vote', params: { id: response.data.id } }) }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error while creating Poll "{pollTitle}"', { pollTitle: this.title }), { type: 'error' }) + showError(t('polls', 'Error while creating Poll "{pollTitle}"', { pollTitle: this.title })) }) }, diff --git a/src/js/components/Navigation/Navigation.vue b/src/js/components/Navigation/Navigation.vue index 9e1226b0..d64751f1 100644 --- a/src/js/components/Navigation/Navigation.vue +++ b/src/js/components/Navigation/Navigation.vue @@ -43,11 +43,12 @@ <script> -import { AppNavigation, AppNavigationNew, AppNavigationItem } from '@nextcloud/vue' -import { mapGetters } from 'vuex' import CreateDlg from '../Create/CreateDlg' import PollNavigationItems from './PollNavigationItems' +import { showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' +import { AppNavigation, AppNavigationNew, AppNavigationItem } from '@nextcloud/vue' +import { mapGetters } from 'vuex' export default { name: 'Navigation', @@ -146,7 +147,7 @@ export default { this.$router.push({ name: 'vote', params: { id: response.pollId } }) }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error cloning poll.'), { type: 'error' }) + showError(t('polls', 'Error cloning poll.')) }) }, @@ -157,7 +158,7 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error deleting poll.'), { type: 'error' }) + showError(t('polls', 'Error deleting poll.')) }) }, @@ -174,7 +175,7 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error deleting poll.'), { type: 'error' }) + showError(t('polls', 'Error deleting poll.')) }) }, diff --git a/src/js/components/PollList/PollItem.vue b/src/js/components/PollList/PollItem.vue index 88fe996c..2bad02e2 100644 --- a/src/js/components/PollList/PollItem.vue +++ b/src/js/components/PollList/PollItem.vue @@ -110,8 +110,9 @@ </template> <script> -import { Actions, ActionButton } from '@nextcloud/vue' +import { showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' +import { Actions, ActionButton } from '@nextcloud/vue' import moment from '@nextcloud/moment' export default { @@ -190,7 +191,7 @@ export default { }) .catch((error) => { console.error(error) - OC.Notification.showTemporary(t('polls', 'Error loading poll'), { type: 'error' }) + showError(t('polls', 'Error loading poll')) }) }, @@ -210,7 +211,7 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error deleting poll.'), { type: 'error' }) + showError(t('polls', 'Error deleting poll.')) }) this.hideMenu() }, @@ -222,7 +223,7 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error deleting poll.'), { type: 'error' }) + showError(t('polls', 'Error deleting poll.')) }) this.hideMenu() }, @@ -234,7 +235,7 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error cloning poll.'), { type: 'error' }) + showError(t('polls', 'Error cloning poll.')) }) this.hideMenu() }, diff --git a/src/js/components/SideBar/SideBarTabConfiguration.vue b/src/js/components/SideBar/SideBarTabConfiguration.vue index 2e6a3f6f..5339b250 100644 --- a/src/js/components/SideBar/SideBarTabConfiguration.vue +++ b/src/js/components/SideBar/SideBarTabConfiguration.vue @@ -109,12 +109,13 @@ </template> <script> -import { mapState } from 'vuex' -import { DatetimePicker } from '@nextcloud/vue' -import { emit } from '@nextcloud/event-bus' import ConfigBox from '../Base/ConfigBox' import debounce from 'lodash/debounce' +import { mapState } from 'vuex' +import { showSuccess, showError } from '@nextcloud/dialogs' +import { emit } from '@nextcloud/event-bus' import moment from '@nextcloud/moment' +import { DatetimePicker } from '@nextcloud/vue' export default { name: 'SideBarTabConfiguration', @@ -296,21 +297,21 @@ export default { emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error deleting poll.'), { type: 'error' }) + showError(t('polls', 'Error deleting poll.')) }) }, updatePoll() { if (this.titleEmpty) { - OC.Notification.showTemporary(t('polls', 'Title must not be empty!'), { type: 'success' }) + showError(t('polls', 'Title must not be empty!')) } else { this.$store.dispatch('poll/update') .then((response) => { - OC.Notification.showTemporary(t('polls', '"{pollTitle}" successfully saved', 1, { pollTitle: response.data.title }), { type: 'success' }) + showSuccess(t('polls', '"{pollTitle}" successfully saved', 1, { pollTitle: response.data.title })) emit('update-polls') }) .catch(() => { - OC.Notification.showTemporary(t('polls', 'Error writing poll'), { type: 'error' }) + showError(t('polls', 'Error writing poll')) }) this.writingPoll = false } diff --git a/src/js/components/VoteTable/VoteTable.vue b/src/js/components/VoteTable/VoteTable.vue index f6063976..3837e27c 100644 --- a/src/js/components/VoteTable/VoteTable.vue +++ b/src/js/components/VoteTable/VoteTable.vue @@ -87,12 +87,13 @@ </template> <script> +import VoteTableVoteItem from './VoteTableVoteItem' +import { confirmOption } from '../../mixins/optionMixins' +import VoteTableHeaderItem from './VoteTableHeaderItem' import { mapState, mapGetters } from 'vuex' +import { showSuccess } from '@nextcloud/dialogs' import { Actions, ActionButton, Modal } from '@nextcloud/vue' import orderBy from 'lodash/orderBy' -import VoteTableVoteItem from './VoteTableVoteItem' -import VoteTableHeaderItem from './VoteTableHeaderItem' -import { confirmOption } from '../../mixins/optionMixins' export default { name: 'VoteTable', @@ -146,6 +147,9 @@ export default { this.$store.dispatch('poll/votes/delete', { userId: this.userToRemove, }) + .then(() => { + showSuccess(t('polls', 'User {userId} removed', { userId: this.userToRemove} )) + }) this.modal = false this.userToRemove = '' }, diff --git a/src/js/store/modules/polls.js b/src/js/store/modules/polls.js index e52a4c00..719b6f26 100644 --- a/src/js/store/modules/polls.js +++ b/src/js/store/modules/polls.js @@ -78,7 +78,6 @@ const actions = { context.commit('set', { list: response.data }) }) .catch((error) => { - OC.Notification.showTemporary(t('polls', 'Error loading polls'), { type: 'error' }) console.error('Error loading polls', { error: error.response }) }) }, |