Skip to content

Commit

Permalink
% added in title
Browse files Browse the repository at this point in the history
  • Loading branch information
GarvitSinghal47 committed Jan 4, 2024
1 parent 63d2f8d commit fc8b8cf
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,48 @@
});
},
},
watch: {
taskPercentage(newPercentage) {
if (newPercentage !== null) {
const formattedPercentage = (newPercentage * 100).toFixed(2) + '%';
const channelName = this.task.extra_metadata.channel_name || this.$tr('unknownChannelName');
let titlePrefix = '';
if (this.task.type === TaskTypes.REMOTECONTENTIMPORT ||
this.task.type === TaskTypes.DISKCONTENTIMPORT) {
titlePrefix = this.$tr('importChannelWhole', { channelName });
} else if (this.task.type === TaskTypes.DELETECHANNEL
|| this.task.type === TaskTypes.DELETECONTENT) {
titlePrefix = this.$tr('deleteChannelWhole', { channelName });
}
document.title = `${formattedPercentage} - ${titlePrefix}`;
}
},
'task.status': {
immediate: true,
handler(newStatus) {
const channelName = this.task.extra_metadata.channel_name || this.$tr('unknownChannelName');
if (newStatus === TaskStatuses.CANCELED) {
document.title = 'Cancelled - ' + channelName;
} else if (newStatus === TaskStatuses.FAILED) {
document.title = 'Failed - ' + channelName;
} else if (newStatus === TaskStatuses.COMPLETED) {
document.title = 'Completed - ' + channelName;
} else {
document.title = "Task manager";
}
},
},
},
methods: {
handleClick() {
if (this.taskIsCompleted || this.taskIsFailed) {
this.$emit('clickclear');
document.title = 'Task Manager';
} else {
this.$emit('clickcancel');
}
Expand Down

0 comments on commit fc8b8cf

Please sign in to comment.