-
Notifications
You must be signed in to change notification settings - Fork 227
Refactor 'unsaved changes' modal to use KModal component and update tests #5306
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
base: unstable
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,29 +155,18 @@ | |
</VContainer> | ||
</VWindowItem> | ||
</VWindow> | ||
<MessageDialog | ||
v-model="showUnsavedDialog" | ||
:header="$tr('unsavedChangesHeader')" | ||
:text="$tr('unsavedChangesText')" | ||
<KModal | ||
v-if="showUnsavedDialog" | ||
:title="$tr('unsavedChangesHeader')" | ||
:submitText="$tr('saveButton')" | ||
:cancelText="$tr('closeButton')" | ||
data-test="dialog-unsaved" | ||
:data-test-visible="showUnsavedDialog" | ||
@submit="save" | ||
@cancel="confirmCancel" | ||
> | ||
<template #buttons> | ||
<VSpacer /> | ||
<VBtn | ||
flat | ||
@click="confirmCancel" | ||
> | ||
{{ $tr('closeButton') }} | ||
</VBtn> | ||
<VBtn | ||
color="primary" | ||
@click="save" | ||
> | ||
{{ $tr('saveButton') }} | ||
</VBtn> | ||
</template> | ||
</MessageDialog> | ||
{{ $tr('unsavedChangesText') }} | ||
</KModal> | ||
<template #bottom> | ||
<div class="mx-4 subheading"> | ||
{{ $tr('channelSelectedCountText', { channelCount: channels.length }) }} | ||
|
@@ -210,13 +199,13 @@ | |
import { set } from 'vue'; | ||
import { mapGetters, mapActions } from 'vuex'; | ||
import difference from 'lodash/difference'; | ||
import KModal from 'kolibri-design-system/lib/KModal'; | ||
import { RouteNames } from '../../constants'; | ||
import ChannelItem from './ChannelItem'; | ||
import ChannelSelectionList from './ChannelSelectionList'; | ||
import { ChannelListTypes, ErrorTypes } from 'shared/constants'; | ||
import { constantsTranslationMixin, routerMixin } from 'shared/mixins'; | ||
import CopyToken from 'shared/views/CopyToken'; | ||
import MessageDialog from 'shared/views/MessageDialog'; | ||
import FullscreenModal from 'shared/views/FullscreenModal'; | ||
import Tabs from 'shared/views/Tabs'; | ||
import LoadingText from 'shared/views/LoadingText'; | ||
|
@@ -226,9 +215,9 @@ | |
components: { | ||
CopyToken, | ||
ChannelSelectionList, | ||
MessageDialog, | ||
ChannelItem, | ||
FullscreenModal, | ||
KModal, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise, this line should be removed, we don't need to insert |
||
Tabs, | ||
LoadingText, | ||
}, | ||
|
@@ -433,6 +422,7 @@ | |
} | ||
}, | ||
confirmCancel() { | ||
this.showUnsavedDialog = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (this.isNew) { | ||
if (this.channelSet && this.channelSet.id) { | ||
return this.deleteChannelSet(this.channelSet).then(this.close); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to import
KModal
from KDS, this line can be removed :)