Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
84de54b
Replaced ConfirmationDialog to KModal and added respectively and add…
Prashant-thakur77 Oct 1, 2025
ab4e683
Updated unit test for channelActionsDropdown
Prashant-thakur77 Oct 1, 2025
809ee72
Updated channelActionsDropdown.spec.js for KModal considerations
Prashant-thakur77 Oct 1, 2025
b9fedd3
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Oct 1, 2025
ebda238
Updated test for channel Action dropdown
Prashant-thakur77 Oct 12, 2025
a35a798
Updated channelActionsDropdown.spec.js for KModal considerations
Prashant-thakur77 Oct 1, 2025
dd81d82
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Oct 1, 2025
2994c33
Made required changes to channelAcitonsDropdown
Prashant-thakur77 Oct 30, 2025
fd166b0
Used VTL here and updated to focus on UI
Prashant-thakur77 Oct 30, 2025
e7ec0e4
added error handling
Prashant-thakur77 Oct 31, 2025
13a1378
updated test file
Prashant-thakur77 Oct 31, 2025
39747fd
Updated to handle the public dialog error display
Prashant-thakur77 Oct 31, 2025
68039dd
Updated to handle the public dialog error display
Prashant-thakur77 Oct 31, 2025
d0ec314
Removed configure from test case andused default
Prashant-thakur77 Oct 31, 2025
4c1dacd
updated test
Prashant-thakur77 Nov 1, 2025
5324333
added snackbar test
Prashant-thakur77 Nov 1, 2025
b3d84f0
Updated
Prashant-thakur77 Nov 1, 2025
548c851
Updated
Prashant-thakur77 Nov 1, 2025
37f480b
Added download pdf and csv check
Prashant-thakur77 Nov 1, 2025
eac5b8a
updated the check the use action rather than channelexportmixin methods
Prashant-thakur77 Nov 1, 2025
2fbe067
updated the check the use action rather than channelexportmixin methods
Prashant-thakur77 Nov 1, 2025
194aa5c
updated mockrouter
Prashant-thakur77 Nov 1, 2025
ff30a88
Added studiobanner for error
Prashant-thakur77 Nov 4, 2025
acdd36a
Added text color red to Studio Bannner
Prashant-thakur77 Nov 5, 2025
cd6039b
formatted the test better
Prashant-thakur77 Nov 7, 2025
cd8bf31
ORDERED TEST
Prashant-thakur77 Nov 7, 2025
6a94956
formatted the test better
Prashant-thakur77 Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
<template>

<div>
<ConfirmationDialog
v-model="restoreDialog"
title="Restore channel"
:text="`Are you sure you want to restore ${name} and make it active again?`"
data-test="confirm-restore"
confirmButtonText="Restore"
@confirm="restoreHandler"
/>
<KModal
v-if="activeDialog"
:title="dialogConfig.title"
:submitText="dialogConfig.submitText"
cancelText="Cancel"
data-test="confirm-dialog"
:submitDisabled="dialogConfig.submitDisabled"
@submit="handleSubmit"
@cancel="activeDialog = null"
>
<p>{{ dialogConfig.message }}</p>
<StudioBanner
v-if="dialogConfig.errorMessage"
error
>
{{ dialogConfig.errorMessage }}
</StudioBanner>
</KModal>

<ConfirmationDialog
v-model="makePublicDialog"
title="Make channel public"
:text="`All users will be able to view and import content from ${name}.`"
:error-text="communityChannelErrorMessage"
:disable-submit="isCommunityChannel"
data-test="confirm-public"
confirmButtonText="Make public"
@confirm="makePublicHandler"
/>
<ConfirmationDialog
v-model="makePrivateDialog"
title="Make channel private"
:text="`Only users with view-only or edit permissions will be able to access ${name}.`"
data-test="confirm-private"
confirmButtonText="Make private"
@confirm="makePrivateHandler"
/>
<ConfirmationDialog
v-model="deleteDialog"
title="Permanently delete channel"
:text="`Are you sure you want to permanently delete ${name}? This can not be undone.`"
data-test="confirm-delete"
confirmButtonText="Delete permanently"
@confirm="deleteHandler"
/>
<ConfirmationDialog
v-model="softDeleteDialog"
title="Permanently delete channel"
:text="`Are you sure you want to delete ${name}?`"
data-test="confirm-softdelete"
confirmButtonText="Delete"
@confirm="softDeleteHandler"
/>
<BaseMenu>
<template #activator="{ on }">
<VBtn
v-bind="$attrs"
v-on="on"
>
actions
Actions
<Icon
icon="dropdown"
class="ml-1"
Expand All @@ -61,13 +37,13 @@
<template v-if="channel.deleted">
<VListTile
data-test="restore"
@click="restoreDialog = true"
@click="openDialog('restore')"
>
<VListTileTitle>Restore</VListTileTitle>
</VListTile>
<VListTile
data-test="delete"
@click="deleteDialog = true"
@click="openDialog('permanentDelete')"
>
<VListTileTitle>Delete permanently</VListTileTitle>
</VListTile>
Expand All @@ -94,21 +70,21 @@
<VListTile
v-if="channel.public"
data-test="private"
@click="makePrivateDialog = true"
@click="openDialog('makePrivate')"
>
<VListTileTitle>Make private</VListTileTitle>
</VListTile>
<VListTile
v-else
data-test="public"
@click="makePublicDialog = true"
@click="openDialog('makePublic')"
>
<VListTileTitle>Make public</VListTileTitle>
</VListTile>
<VListTile
v-if="!channel.public"
data-test="softdelete"
@click="softDeleteDialog = true"
@click="openDialog('softDelete')"
>
<VListTileTitle>Delete channel</VListTileTitle>
</VListTile>
Expand All @@ -123,15 +99,15 @@
<script>

import { mapActions, mapGetters } from 'vuex';
import ConfirmationDialog from '../../components/ConfirmationDialog';
import { RouteNames } from '../../constants';
import { channelExportMixin } from 'shared/views/channel/mixins';
import { CommunityLibraryStatus } from 'shared/constants';
import StudioBanner from 'shared/views/StudioBanner';

export default {
name: 'ChannelActionsDropdown',
components: {
ConfirmationDialog,
StudioBanner,
},
mixins: [channelExportMixin],
props: {
Expand All @@ -141,11 +117,7 @@
},
},
data: () => ({
deleteDialog: false,
makePublicDialog: false,
makePrivateDialog: false,
restoreDialog: false,
softDeleteDialog: false,
activeDialog: null,
}),
computed: {
...mapGetters('channel', ['getChannel']),
Expand All @@ -163,6 +135,43 @@
},
};
},
dialogConfig() {
const configs = {
restore: {
title: 'Restore channel',
submitText: 'Restore',
message: `Are you sure you want to restore ${this.name} and make it active again?`,
handler: this.restoreHandler,
},
makePublic: {
title: 'Make channel public',
submitText: 'Make public',
message: `All users will be able to view and import content from ${this.name}.`,
handler: this.makePublicHandler,
errorMessage: this.communityChannelErrorMessage,
submitDisabled: this.isCommunityChannel,
},
makePrivate: {
title: 'Make channel private',
submitText: 'Make private',
message: `Only users with view-only or edit permissions will be able to access ${this.name}.`,
handler: this.makePrivateHandler,
},
permanentDelete: {
title: 'Permanently delete channel',
submitText: 'Delete permanently',
message: `Are you sure you want to permanently delete ${this.name}? This can not be undone.`,
handler: this.deleteHandler,
},
softDelete: {
title: 'Delete channel',
submitText: 'Delete',
message: `Are you sure you want to delete ${this.name}?`,
handler: this.softDeleteHandler,
},
};
return configs[this.activeDialog] || {};
},
isCommunityChannel() {
const status = this.channel.latest_community_library_submission_status;
return status === CommunityLibraryStatus.APPROVED || status === CommunityLibraryStatus.LIVE;
Expand All @@ -180,6 +189,15 @@
'deleteChannel',
'updateChannel',
]),
openDialog(type) {
this.activeDialog = type;
},
handleSubmit() {
if (this.dialogConfig.handler) {
this.dialogConfig.handler();
}
this.activeDialog = null;
},
async downloadPDF() {
this.$store.dispatch('showSnackbarSimple', 'Generating PDF...');
const channelList = await this.getAdminChannelListDetails([this.channel.id]);
Expand All @@ -191,7 +209,6 @@
return this.generateChannelsCSV(channelList);
},
restoreHandler() {
this.restoreDialog = false;
this.updateChannel({
id: this.channelId,
deleted: false,
Expand All @@ -200,7 +217,6 @@
});
},
softDeleteHandler() {
this.softDeleteDialog = false;
this.updateChannel({
id: this.channelId,
deleted: true,
Expand All @@ -209,14 +225,12 @@
});
},
deleteHandler() {
this.deleteDialog = false;
this.$emit('deleted');
return this.deleteChannel(this.channelId).then(() => {
this.$store.dispatch('showSnackbarSimple', 'Channel deleted permanently');
});
},
makePublicHandler() {
this.makePublicDialog = false;
this.updateChannel({
id: this.channelId,
isPublic: true,
Expand All @@ -225,7 +239,6 @@
});
},
makePrivateHandler() {
this.makePrivateDialog = false;
this.updateChannel({
id: this.channelId,
isPublic: false,
Expand Down
Loading