Skip to content

Commit 1cb649a

Browse files
authored
Merge pull request #5716 from AlexVelezLl/new-channel-details
Add submission details page
2 parents 59a13aa + 37147dd commit 1cb649a

33 files changed

Lines changed: 1582 additions & 196 deletions

contentcuration/contentcuration/frontend/administration/components/sidePanels/ReviewSubmissionSidePanel.vue

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22

33
<SidePanelModal
4+
v-if="isModalVisible"
45
alignment="right"
56
sidePanelWidth="700px"
67
@closePanel="$emit('close')"
@@ -20,7 +21,15 @@
2021
class="submission-info-text"
2122
>
2223
<span class="author-name">{{ authorName }}</span>
23-
<div class="editor-chip">Editor</div>
24+
<div
25+
class="editor-chip"
26+
:style="{
27+
color: chipTextColor,
28+
backgroundColor: chipColor,
29+
}"
30+
>
31+
Editor
32+
</div>
2433
<span>
2534
submitted
2635
<ActionLink
@@ -39,7 +48,10 @@
3948
<div v-else>Error loading submission data.</div>
4049

4150
<div class="details">
42-
<span class="detail-annotation">Country(s)</span>
51+
<span
52+
class="detail-annotation"
53+
:style="{ color: annotationColor }"
54+
>Country(s)</span>
4355
<span
4456
v-if="countriesString"
4557
data-test="countries"
@@ -49,7 +61,10 @@
4961
<template v-else>
5062
<KEmptyPlaceholder />
5163
</template>
52-
<span class="detail-annotation">Language(s)</span>
64+
<span
65+
class="detail-annotation"
66+
:style="{ color: annotationColor }"
67+
>Language(s)</span>
5368
<span
5469
v-if="languagesString"
5570
data-test="languages"
@@ -59,7 +74,10 @@
5974
<template v-else>
6075
<KEmptyPlaceholder />
6176
</template>
62-
<span class="detail-annotation">Categories</span>
77+
<span
78+
class="detail-annotation"
79+
:style="{ color: annotationColor }"
80+
>Categories</span>
6381
<span
6482
v-if="categoriesString"
6583
data-test="categories"
@@ -69,7 +87,10 @@
6987
<template v-else>
7088
<KEmptyPlaceholder />
7189
</template>
72-
<span class="detail-annotation">License(s)</span>
90+
<span
91+
class="detail-annotation"
92+
:style="{ color: annotationColor }"
93+
>License(s)</span>
7394
<span
7495
v-if="licensesString"
7596
data-test="licenses"
@@ -79,7 +100,10 @@
79100
<template v-else>
80101
<KEmptyPlaceholder />
81102
</template>
82-
<span class="detail-annotation">Status</span>
103+
<span
104+
class="detail-annotation"
105+
:style="{ color: annotationColor }"
106+
>Status</span>
83107
<div
84108
v-if="submissionIsFinished"
85109
style="display: flex"
@@ -91,8 +115,16 @@
91115
</template>
92116
</div>
93117

94-
<div class="box">
95-
<h3 class="box-title">Submission notes</h3>
118+
<div
119+
class="box"
120+
:style="{ backgroundColor: boxBackgroundColor }"
121+
>
122+
<h3
123+
class="box-title"
124+
:style="{ color: boxTitleColor }"
125+
>
126+
Submission notes
127+
</h3>
96128
<span
97129
v-if="submissionNotes"
98130
data-test="submission-notes"
@@ -239,6 +271,7 @@
239271
CommunityLibraryStatusChip,
240272
},
241273
setup(props, { emit }) {
274+
const isModalVisible = ref(true);
242275
const tokensTheme = themeTokens();
243276
const paletteTheme = themePalette();
244277
@@ -476,6 +509,8 @@
476509
477510
showSnackbar({ text: snackbarText });
478511
updateStatusInStore(statusChoice.value);
512+
emit('change');
513+
emit('close');
479514
} catch (error) {
480515
showSnackbar({ text: 'Changing channel status failed' });
481516
} finally {
@@ -489,13 +524,19 @@
489524
actionText: 'Cancel',
490525
actionCallback: () => {
491526
clearTimeout(timer);
527+
// Do not emit close just yet, so that the component isn't unmounted
528+
// this will keep the component live until the submit function finishes, allowing
529+
// to keep communicating with the parent component, and in particular allowing the
530+
// "change" event to be emitted. It also allows us to keep the working information
531+
// on the component, and show the side panel in the same state if the user cancels
532+
isModalVisible.value = true;
533+
currentlySubmitting.value = false;
492534
showSnackbar({
493535
text: 'Action cancelled',
494536
});
495537
},
496538
});
497-
498-
emit('close');
539+
isModalVisible.value = false;
499540
}
500541
501542
const chipColor = computed(() => paletteTheme.grey.v_200);
@@ -519,6 +560,7 @@
519560
520561
return {
521562
isLoading,
563+
isModalVisible,
522564
chipColor,
523565
chipTextColor,
524566
annotationColor,
@@ -596,8 +638,6 @@
596638
height: 20px;
597639
padding: 2px 5px;
598640
font-size: 10px;
599-
color: v-bind('chipTextColor');
600-
background-color: v-bind('chipColor');
601641
border-radius: 16px;
602642
}
603643
@@ -612,15 +652,13 @@
612652
613653
.detail-annotation {
614654
grid-column-start: 1;
615-
color: v-bind('annotationColor');
616655
}
617656
618657
.box {
619658
display: flex;
620659
flex-direction: column;
621660
gap: 8px;
622661
padding: 12px;
623-
background-color: v-bind('boxBackgroundColor');
624662
border-radius: 8px;
625663
}
626664
@@ -634,7 +672,6 @@
634672
.box-title {
635673
font-size: 12px;
636674
font-weight: 600;
637-
color: v-bind('boxTitleColor');
638675
}
639676
640677
.details-box-title {

contentcuration/contentcuration/frontend/administration/components/sidePanels/__tests__/ReviewSubmissionSidePanel.spec.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,6 @@ describe('ReviewSubmissionSidePanel', () => {
344344
jest.useRealTimers();
345345
});
346346

347-
it('the panel closes', async () => {
348-
jest.useFakeTimers();
349-
350-
const confirmButton = wrapper.findComponent({ ref: 'confirmButtonRef' });
351-
await confirmButton.trigger('click');
352-
353-
expect(wrapper.emitted('close')).toBeTruthy();
354-
});
355-
356347
it('a submission snackbar is shown', async () => {
357348
jest.useFakeTimers();
358349
const confirmButton = wrapper.findComponent({ ref: 'confirmButtonRef' });
@@ -403,6 +394,22 @@ describe('ReviewSubmissionSidePanel', () => {
403394
store.replaceState(origStoreState);
404395
});
405396

397+
it('the panel closes', async () => {
398+
const origStoreState = store.state;
399+
store.commit('channel/ADD_CHANNEL', channel);
400+
401+
jest.useFakeTimers();
402+
const confirmButton = wrapper.findComponent({ ref: 'confirmButtonRef' });
403+
await confirmButton.trigger('click');
404+
405+
jest.runAllTimers();
406+
await wrapper.vm.$nextTick();
407+
408+
store.replaceState(origStoreState);
409+
410+
expect(wrapper.emitted('close')).toBeTruthy();
411+
});
412+
406413
it('the channel latest submission status is updated in the store', async () => {
407414
const origStoreState = store.state;
408415
store.commit('channel/ADD_CHANNEL', channel);

contentcuration/contentcuration/frontend/administration/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const RouteNames = {
33
CHANNEL: 'CHANNEL',
44
USERS: 'USERS',
55
USER: 'USER',
6+
COMMUNITY_LIBRARY_SUBMISSION: 'COMMUNITY_LIBRARY_SUBMISSION',
67
};
78

89
export const rowsPerPageItems = [25, 50, 75, 100];

contentcuration/contentcuration/frontend/administration/pages/Channels/ChannelActionsDropdown.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222

2323
<BaseMenu>
2424
<template #activator="{ on }">
25-
<VBtn
26-
v-bind="$attrs"
25+
<KButton
26+
hasDropdown
27+
:primary="primary"
2728
v-on="on"
2829
>
2930
Actions
30-
<Icon
31-
icon="dropdown"
32-
class="ml-1"
33-
/>
34-
</VBtn>
31+
</KButton>
3532
</template>
3633
<VList>
3734
<template v-if="channel.deleted">
@@ -115,6 +112,10 @@
115112
type: String,
116113
required: true,
117114
},
115+
primary: {
116+
type: Boolean,
117+
default: false,
118+
},
118119
},
119120
data: () => ({
120121
activeDialog: null,

contentcuration/contentcuration/frontend/administration/pages/Channels/ChannelItem.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
<CommunityLibraryStatusButton
202202
v-if="communityLibraryStatus"
203203
:status="communityLibraryStatus"
204-
@click="submissionToReview = channel.latest_community_library_submission_id"
204+
@click="onCommunityLibraryButtonClick"
205205
/>
206206
<KEmptyPlaceholder v-else />
207207
</td>
@@ -211,12 +211,6 @@
211211
flat
212212
/>
213213
</td>
214-
<ReviewSubmissionSidePanel
215-
v-if="submissionToReview"
216-
:channel="channel"
217-
:submissionId="submissionToReview"
218-
@close="submissionToReview = null"
219-
/>
220214
</tr>
221215

222216
</template>
@@ -226,7 +220,6 @@
226220
227221
import { mapGetters, mapActions } from 'vuex';
228222
import ClipboardChip from '../../components/ClipboardChip';
229-
import ReviewSubmissionSidePanel from '../../components/sidePanels/ReviewSubmissionSidePanel';
230223
import CommunityLibraryStatusButton from '../../components/CommunityLibraryStatusButton.vue';
231224
import { RouteNames } from '../../constants';
232225
import ChannelActionsDropdown from './ChannelActionsDropdown';
@@ -241,7 +234,6 @@
241234
ClipboardChip,
242235
Checkbox,
243236
CommunityLibraryStatusButton,
244-
ReviewSubmissionSidePanel,
245237
},
246238
mixins: [fileSizeMixin],
247239
props: {
@@ -254,11 +246,6 @@
254246
required: true,
255247
},
256248
},
257-
data() {
258-
return {
259-
submissionToReview: null,
260-
};
261-
},
262249
computed: {
263250
...mapGetters('channel', ['getChannel']),
264251
selected: {
@@ -320,6 +307,15 @@
320307
this.$store.dispatch('showSnackbarSimple', 'Source URL saved');
321308
});
322309
},
310+
onCommunityLibraryButtonClick() {
311+
this.$router.push({
312+
name: RouteNames.COMMUNITY_LIBRARY_SUBMISSION,
313+
params: {
314+
channelId: this.channelId,
315+
submissionId: this.channel.latest_community_library_submission_id.toString(),
316+
},
317+
});
318+
},
323319
},
324320
};
325321

contentcuration/contentcuration/frontend/administration/pages/Channels/__tests__/channelItem.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { mount } from '@vue/test-utils';
22
import CommunityLibraryStatusButton from '../../../components/CommunityLibraryStatusButton.vue';
3-
import ReviewSubmissionSidePanel from '../../../components/sidePanels/ReviewSubmissionSidePanel';
43
import router from '../../../router';
54
import { factory } from '../../../store';
65
import { RouteNames } from '../../../constants';
@@ -185,10 +184,11 @@ describe('channelItem', () => {
185184
const statusCell = wrapper.find('[data-test="community-library-status"]');
186185
const statusButton = statusCell.findComponent(CommunityLibraryStatusButton);
187186

188-
expect(wrapper.findComponent(ReviewSubmissionSidePanel).exists()).toBe(false);
189-
190187
await statusButton.trigger('click');
188+
await wrapper.vm.$nextTick();
191189

192-
expect(wrapper.findComponent(ReviewSubmissionSidePanel).exists()).toBe(true);
190+
// assert that page is redirected to PageNames.COMMUNITY_LIBRARY_SUBMISSION
191+
expect(wrapper.vm.$route.name).toEqual(RouteNames.COMMUNITY_LIBRARY_SUBMISSION);
192+
expect(wrapper.vm.$route.params.submissionId).toEqual(submissionId);
193193
});
194194
});

contentcuration/contentcuration/frontend/administration/router.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ChannelTable from './pages/Channels/ChannelTable';
44
import ChannelDetails from './pages/Channels/ChannelDetails';
55
import UserTable from './pages/Users/UserTable';
66
import UserDetails from './pages/Users/UserDetails';
7+
import SubmissionDetailsModal from 'shared/views/communityLibrary/SubmissionDetailsModal/index.vue';
78

89
const router = new VueRouter({
910
routes: [
@@ -29,6 +30,16 @@ const router = new VueRouter({
2930
props: true,
3031
component: UserDetails,
3132
},
33+
{
34+
name: RouteNames.COMMUNITY_LIBRARY_SUBMISSION,
35+
path: '/community-library/:channelId/:submissionId',
36+
component: SubmissionDetailsModal,
37+
props: route => ({
38+
channelId: route.params.channelId,
39+
submissionId: route.params.submissionId,
40+
adminReview: true,
41+
}),
42+
},
3243
// Catch-all redirect to channels tab
3344
{
3445
path: '*',

contentcuration/contentcuration/frontend/channelList/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const RouteNames = {
2626
CATALOG_DETAILS: 'CATALOG_DETAILS',
2727
CATALOG_FAQ: 'CATALOG_FAQ',
2828
NEW_CHANNEL: 'NEW_CHANNEL',
29+
COMMUNITY_LIBRARY_SUBMISSION: 'COMMUNITY_LIBRARY_SUBMISSION',
2930
};
3031

3132
export const ListTypeToRouteMapping = {

0 commit comments

Comments
 (0)