-
Notifications
You must be signed in to change notification settings - Fork 1
feat: int api remove event #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
acb81f2
fet: int api remove event
quangtuanitmo18 4710cc4
minor changes
quangtuanitmo18 2f08658
address review comments
quangtuanitmo18 3c77332
Merge branch 'master' into feat-remove-event
quangtuanitmo18 73a8e91
address comments review
quangtuanitmo18 40598a5
address commit review
quangtuanitmo18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| <template> | ||
| <ContextMenu | ||
| class="event-actions-menu" | ||
| :items="menuItems" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { REMOVE_EVENT } from '@/store/modules/events/actionTypes'; | ||
| import { ContextMenu, type ContextMenuItem } from '@codexteam/ui/vue'; | ||
| import notifier from 'codex-notifier'; | ||
| import { computed, getCurrentInstance } from 'vue'; | ||
| import { useRouter } from 'vue-router'; | ||
| import { useStore } from 'vuex'; | ||
| import { i18n } from '../../i18n'; | ||
| import { ActionType } from '../utils/ConfirmationWindow/types'; | ||
|
|
||
| interface Props { | ||
| /** | ||
| * Project id the event belongs to | ||
| */ | ||
| projectId: string; | ||
| /** | ||
| * Original event id to remove | ||
| */ | ||
| eventId: string; | ||
| /** | ||
| * Callback to close popover | ||
| */ | ||
| onClose?: () => void; | ||
| } | ||
|
|
||
| const props = defineProps<Props>(); | ||
|
|
||
| const store = useStore(); | ||
| const router = useRouter(); | ||
| const instance = getCurrentInstance(); | ||
|
|
||
| /** | ||
| * Show confirmation dialog and remove event on confirm | ||
| */ | ||
| function confirmRemoveEvent(): void { | ||
| if (!instance?.appContext.config.globalProperties.$confirm) { | ||
| return; | ||
| } | ||
|
|
||
| instance.appContext.config.globalProperties.$confirm.open({ | ||
| description: i18n.global.t('event.removeConfirmation').toString(), | ||
| actionType: ActionType.DELETION, | ||
| continueButtonText: i18n.global.t('event.removeButton').toString(), | ||
| onConfirm: async () => { | ||
| const isRemoved = await store.dispatch(REMOVE_EVENT, { | ||
| projectId: props.projectId, | ||
| eventId: props.eventId, | ||
| }); | ||
|
|
||
| if (isRemoved) { | ||
| notifier.show({ | ||
| message: i18n.global.t('event.removeSuccess').toString(), | ||
| style: 'success', | ||
| time: 5000, | ||
| }); | ||
| router.push({ | ||
| name: 'project-overview', | ||
| params: { projectId: props.projectId }, | ||
| query: { reload: String(Date.now()) }, | ||
| }); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| notifier.show({ | ||
| message: i18n.global.t('errors.Something went wrong').toString(), | ||
| style: 'error', | ||
| time: 5000, | ||
| }); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Actions available in event context menu | ||
| */ | ||
| const menuItems = computed<ContextMenuItem[]>(() => { | ||
| return [ | ||
| { | ||
| type: 'default', | ||
| title: i18n.global.t('event.remove') as string, | ||
| icon: 'Trash', | ||
| onActivate: () => { | ||
| props.onClose?.(); | ||
| confirmRemoveEvent(); | ||
| }, | ||
| }, | ||
| ]; | ||
| }); | ||
| </script> | ||
|
|
||
| <style scoped> | ||
|
neSpecc marked this conversation as resolved.
|
||
| .event-actions-menu { | ||
| min-width: 140px; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.