Skip to content

Commit d06d9b0

Browse files
committed
Use KModal for deploy dialog
1 parent c15fb32 commit d06d9b0

2 files changed

Lines changed: 43 additions & 68 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.spec.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ const getDeployDialogStagedResources = wrapper => {
166166
return wrapper.find('[data-test="deploy-dialog-staged-resources"]');
167167
};
168168

169-
const getDeployBtn = wrapper => {
170-
return wrapper.find('[data-test="deploy-btn"]');
171-
};
172-
173169
describe('StagingTreePage', () => {
174170
it('renders back to viewing link leading to a root tree page in the toolbar', () => {
175171
const wrapper = initWrapper();
@@ -389,12 +385,10 @@ describe('StagingTreePage', () => {
389385
expect(getSummaryDetailsDialog(wrapper).isVisible()).toBe(true);
390386
});
391387

392-
it('deploy dialog is not visible by default', () => {
393-
expect(getDeployDialog(wrapper).isVisible()).toBe(false);
394-
});
395-
396388
it('opens deploy dialog when deploy button is clicked', () => {
389+
expect(getDeployDialog(wrapper).exists()).toBe(false);
397390
getDisplayDeployDialogBtn(wrapper).trigger('click');
391+
398392
expect(getDeployDialog(wrapper).isVisible()).toBe(true);
399393
});
400394

@@ -414,12 +408,13 @@ describe('StagingTreePage', () => {
414408
});
415409

416410
it('dispatches deploy channel action on deploy channel button click', () => {
417-
getDeployBtn(wrapper).trigger('click');
411+
getDeployDialog(wrapper).vm.$emit('submit');
412+
418413
expect(mockDeployCurrentChannel).toHaveBeenCalledTimes(1);
419414
});
420415

421416
it('redirects to a root tree page after deploy channel button click', async () => {
422-
getDeployBtn(wrapper).trigger('click');
417+
getDeployDialog(wrapper).vm.$emit('submit');
423418
await flushPromises();
424419

425420
expect(wrapper.vm.$router.currentRoute.name).toBe(RouteNames.TREE_VIEW);

contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.vue

Lines changed: 38 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -178,65 +178,13 @@
178178
{{ $tr('openSummaryDetailsDialogBtn') }}
179179
</VBtn>
180180

181-
<VDialog
182-
v-model="displayDeployDialog"
183-
width="500"
181+
<VBtn
182+
color="primary"
183+
data-test="display-deploy-dialog-btn"
184+
@click="displayDeployDialog = true"
184185
>
185-
<template v-slot:activator="{ on }">
186-
<VBtn
187-
color="primary"
188-
data-test="display-deploy-dialog-btn"
189-
v-on="on"
190-
>
191-
{{ $tr('deployChannel') }}
192-
</VBtn>
193-
</template>
194-
195-
<VCard data-test="deploy-dialog">
196-
<VCardTitle primary-title class="font-weight-bold title">
197-
{{ $tr('deployChannel') }}
198-
</VCardTitle>
199-
<VCardText>
200-
<p>{{ $tr('deployDialogDescription') }}</p>
201-
202-
<VLayout data-test="deploy-dialog-live-resources">
203-
<VFlex xs4 class="font-weight-bold">
204-
{{ $tr('liveResources') }}:
205-
</VFlex>
206-
<VFlex>
207-
{{ $tr('topicsCount', { count: topicsCountLive }) }},
208-
{{ $tr('resourcesCount', { count: resourcesCountLive }) }}
209-
</VFlex>
210-
</VLayout>
211-
212-
<VLayout data-test="deploy-dialog-staged-resources">
213-
<VFlex xs4 class="font-weight-bold">
214-
{{ $tr('stagedResources') }}:
215-
</VFlex>
216-
<VFlex>
217-
{{ $tr('topicsCount', { count: topicsCountStaged }) }},
218-
{{ $tr('resourcesCount', { count: resourcesCountStaged }) }}
219-
</VFlex>
220-
</VLayout>
221-
</VCardText>
222-
<VCardActions>
223-
<VSpacer />
224-
<VBtn
225-
flat
226-
@click="displayDeployDialog = false"
227-
>
228-
{{ $tr('cancelDeployBtn') }}
229-
</VBtn>
230-
<VBtn
231-
color="primary"
232-
data-test="deploy-btn"
233-
@click="onDeployChannelClick"
234-
>
235-
{{ $tr('confirmDeployBtn') }}
236-
</VBtn>
237-
</VCardActions>
238-
</VCard>
239-
</VDialog>
186+
{{ $tr('deployChannel') }}
187+
</VBtn>
240188
</VFLex>
241189
</VLayout>
242190
</BottomBar>
@@ -250,6 +198,38 @@
250198
>
251199
<DiffTable :stagingDiff="stagingDiff" @reload="reloadCurrentChannelStagingDiff" />
252200
</KModal>
201+
202+
<KModal
203+
v-if="displayDeployDialog"
204+
data-test="deploy-dialog"
205+
:title="$tr('deployChannel')"
206+
:submitText="$tr('confirmDeployBtn')"
207+
:cancelText="$tr('cancelDeployBtn')"
208+
@submit="onDeployChannelClick"
209+
@cancel="displayDeployDialog = false"
210+
>
211+
<p>{{ $tr('deployDialogDescription') }}</p>
212+
213+
<VLayout data-test="deploy-dialog-live-resources">
214+
<VFlex xs4 class="font-weight-bold">
215+
{{ $tr('liveResources') }}:
216+
</VFlex>
217+
<VFlex>
218+
{{ $tr('topicsCount', { count: topicsCountLive }) }},
219+
{{ $tr('resourcesCount', { count: resourcesCountLive }) }}
220+
</VFlex>
221+
</VLayout>
222+
223+
<VLayout data-test="deploy-dialog-staged-resources">
224+
<VFlex xs4 class="font-weight-bold">
225+
{{ $tr('stagedResources') }}:
226+
</VFlex>
227+
<VFlex>
228+
{{ $tr('topicsCount', { count: topicsCountStaged }) }},
229+
{{ $tr('resourcesCount', { count: resourcesCountStaged }) }}
230+
</VFlex>
231+
</VLayout>
232+
</KModal>
253233
</template>
254234
</div>
255235

0 commit comments

Comments
 (0)