Skip to content

Commit

Permalink
Merge pull request #763 from webitel/fix/upload-csv-popups
Browse files Browse the repository at this point in the history
fix/upload-csv popup routes [WTEL-5057]
  • Loading branch information
RomanZaritskyi authored Sep 5, 2024
2 parents 144e25c + fe05d6b commit e956e16
Show file tree
Hide file tree
Showing 21 changed files with 19 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<wt-popup
:shown="!!isUploadPopup"
v-bind="$attrs"
:shown="file"
class="upload-popup"
@close="close"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<wt-popup
class="upload-popup"
v-bind="$attrs"
min-width="680"
@close="close"
>
Expand Down
11 changes: 4 additions & 7 deletions src/modules/_shared/upload-csv-popup/mixins/uploadCSVMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ export default {
allowSaveAction() {
return this.mappingFields.every((field) => !field.required || !isEmpty(field.csv));
},
isUploadPopup() {
return this.$route.meta.uploadCsv;
}
},
methods: {
async initUploadPopup() {
Expand Down Expand Up @@ -159,10 +156,10 @@ export default {
async separator() {
await this.handleParseOptionsChange();
},
async isUploadPopup() {
if (this.isUploadPopup) {
await this.initUploadPopup();
}
file: {
handler(file) {
if (file) this.initUploadPopup();
},
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ import { computed } from 'vue';
import { mapActions, mapState, useStore } from 'vuex';
import tableComponentMixin from '../../../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import RouteNames from '../../../../../../../app/router/_internals/RouteNames.enum';
import QueuesRoutesName from '../../../router/_internals/QueuesRoutesName.enum.js';
import TheQueueMembersFilters from '../modules/filters/components/the-queue-members-filters.vue';
import destinationsPopup from './communications/opened-queue-member-destinations-popup.vue';
import ResetPopup from './reset-members-popup.vue';
Expand Down Expand Up @@ -369,16 +368,12 @@ export default {
const file = files[0];
if (file) {
this.csvFile = file;
this.$router.push({
...this.$route,
name: QueuesRoutesName.UPLOAD_CSV,
})
}
},
closeCSVPopup() {
this.csvFile = null;
this.loadList();
this.$router.go(-1);
},
triggerFileInput() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ export default Object.freeze({
MEMBERS_GENERAL: `${RouteNames.MEMBERS}-general`,
MEMBERS_COMMUNICATION_TYPE: `${RouteNames.MEMBERS}-communication-type`,
MEMBERS_VARIABLES: `${RouteNames.MEMBERS}-variables`,
UPLOAD_CSV: `${RouteNames.MEMBERS}-uploadCSV`,
});
8 changes: 0 additions & 8 deletions src/modules/contact-center/modules/queues/router/queues.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ const QueuesRoutes = [
name: RouteNames.MEMBERS,
component: Members,
beforeEnter: checkRouteAccess,
children: [
{
path: 'uploadCSV',
name: QueuesRoutesName.UPLOAD_CSV,
meta: { uploadCSV: true },
component: Members,
}
],
},
{
path: '/contact-center/queues/:queueId/members/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export default {
dataList: [],
}),
watch: {
itemId() {
this.loadDataList();
itemId: {
handler(id) {
if(id) this.loadDataList();
},
},
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
<script>
import DeleteConfirmationPopup from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
import { useDeleteConfirmationPopup } from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
import getNamespacedState from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
import { mapActions, mapState } from 'vuex';
import UploadFileIconBtn from '../../../../../app/components/utils/upload-file-icon-btn.vue';
import { useDummy } from '../../../../../app/composables/useDummy';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
Expand Down Expand Up @@ -246,10 +244,6 @@ export default {
const file = files[0];
if (file) {
this.csvFile = file;
this.$router.push({
...this.$route,
name: DevicesRouteNames.UPLOAD_CSV,
})
}
},
openHistory(id) {
Expand All @@ -263,8 +257,8 @@ export default {
return this.$router.push({name: this.routeName});
},
closeCSVPopup() {
this.csvFile = null;
this.loadList();
this.$router.go(-1);
},
stateClass(state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ export default Object.freeze({
PERMISSIONS: `${RouteNames.DEVICES}-permissions`,
HOTDESKING: `${RouteNames.DEVICES}-hotdesking`,
HISTORY: `${RouteNames.DEVICES}-history`,
UPLOAD_CSV: `${RouteNames.DEVICES}-uploadCSV`,
});
6 changes: 0 additions & 6 deletions src/modules/directory/modules/devices/router/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ const DevicesRoutes = [
name: DevicesRouteNames.HISTORY,
component: Devices,
},
{
path: 'uploadCSV',
name: DevicesRouteNames.UPLOAD_CSV,
meta: { uploadCSV: true },
component: Devices,
},
],
},
{
Expand Down
6 changes: 1 addition & 5 deletions src/modules/directory/modules/users/components/the-users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ import UploadFileIconBtn from '../../../../../app/components/utils/upload-file-i
import { useDummy } from '../../../../../app/composables/useDummy';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import RouteNames from '../../../../../app/router/_internals/RouteNames.enum';
import UsersRouteNamesEnum from '../router/_internals/UsersRouteNames.enum.js';
import UserStatus from './_internals/user-status-chips.vue';
import UploadPopup from './upload-users-popup.vue';
Expand Down Expand Up @@ -225,15 +224,12 @@ export default {
const file = files[0];
if (file) {
this.csvFile = file;
this.$router.push({
name: UsersRouteNamesEnum.UPLOAD_CSV,
})
}
},
closeCSVPopup() {
this.csvFile = null;
this.loadList();
this.$router.go(-1);
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ export default Object.freeze({
TOKENS: `${RouteNames.USERS}-tokens`,
LOGS: `${RouteNames.USERS}-logs`,
PERMISSIONS: `${RouteNames.USERS}-permissions`,
UPLOAD_CSV: `${RouteNames.USERS}-uploadCSV`,
});
8 changes: 0 additions & 8 deletions src/modules/directory/modules/users/router/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ const UsersRoutes = [
name: RouteNames.USERS,
component: Users,
beforeEnter: checkRouteAccess,
children: [
{
path: 'uploadCSV',
name: UsersRouteNames.UPLOAD_CSV,
meta: {uploadCSV: true},
component: Users,
},
],
},
{
path: '/directory/users/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@change="processCSV"
/>
<upload-csv-preview-popup
v-if="file"
:shown="file"
:add-bulk-items="saveBulkData"
:charset="item.parameters.charset.value"
:file="file"
Expand Down Expand Up @@ -56,15 +56,10 @@ export default {
const file = files[0];
if (file) {
this.file = file;
this.$router.push({
...this.$route,
name: ImportCsvRouteNames.UPLOAD_CSV
})
}
},
close() {
this.file = null;
this.$router.go(-1);
},
handleSave() {
if (this.item.parameters.clearMembers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ export default Object.freeze({
GENERAL: `${RouteNames.IMPORT_CSV}-general`,
SETTINGS: `${RouteNames.IMPORT_CSV}-settings`,
PERMISSIONS: `${RouteNames.IMPORT_CSV}-permissions`,
UPLOAD_CSV: `${RouteNames.IMPORT_CSV}-upload-csv`,
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ const ImportCsvRoutes = [
name: RouteNames.IMPORT_CSV,
component: ImportCsv,
beforeEnter: checkRouteAccess,
children: [
{
path: 'uploadCSV',
meta: { uploadCsv: true},
name: ImportCsvRouteNames.UPLOAD_CSV,
component: ImportCsv,
},
],
},
{
path: '/integrations/import-csv/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@close="closePopup"
/>
<upload-popup
v-if="isUploadPopup"
:file="csvFile"
:parent-id="parentId"
@close="closeCSVPopup"
Expand Down Expand Up @@ -167,7 +166,6 @@ export default {
return {
namespace,
subNamespace,
isUploadPopup: false,
csvFile: null,
};
},
Expand All @@ -183,12 +181,11 @@ export default {
const file = files[0];
if (file) {
this.csvFile = file;
this.isUploadPopup = true;
}
},
closeCSVPopup() {
this.csvFile = null;
this.loadDataList();
this.isUploadPopup = false;
},
closePopup() {
this.resetItemState();
Expand Down
8 changes: 1 addition & 7 deletions src/modules/routing/modules/flow/components/the-flow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ import FilterSearch from '@webitel/ui-sdk/src/modules/QueryFilters/components/fi
import UploadFileIconBtn from '../../../../../app/components/utils/upload-file-icon-btn.vue';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import RouteNames from '../../../../../app/router/_internals/RouteNames.enum';
import FlowRouteNames from '../router/_internals/FlowRouteNames.enum.js';
import { downloadAsJSON } from '../../../../../app/utils/download';
import FlowsAPI from '../api/flow';
import FlowEditor from '../enums/FlowEditor.enum';
Expand All @@ -195,7 +194,6 @@ export default {
data: () => ({
namespace,
routeName: RouteNames.FLOW,
isUploadPopup: false,
jsonFile: null,
isCreateFlowPopup: false,
}),
Expand Down Expand Up @@ -251,15 +249,11 @@ export default {
const file = files[0];
if (file) {
this.jsonFile = file;
this.openUploadPopup();
}
},
openUploadPopup() {
this.$router.push({name: FlowRouteNames.UPLOAD_CSV})
},
closeUploadPopup() {
this.jsonFile = null;
this.loadList();
this.$router.go(-1);
},
async download({ id, name }) {
const flow = await FlowsAPI.get({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<wt-popup
v-bind="$attrs"
:shown="isUploadPopup"
:shown="file"
size="sm"
overflow
@close="close"
Expand Down Expand Up @@ -68,8 +68,8 @@ export default {
},
},
watch: {
isUploadPopup() {
if (this.isUploadPopup) {
file() {
if (this.file) {
this.initFileReader();
this.processJSON();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ import RouteNames from '../../../../../../app/router/_internals/RouteNames.enum.

export default Object.freeze({
GENERAL: `${RouteNames.FLOW}-general`,
UPLOAD_CSV: `${RouteNames.FLOW}-uploadCSV`,
});
8 changes: 0 additions & 8 deletions src/modules/routing/modules/flow/router/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ const FlowRoutes= [
name: RouteNames.FLOW,
component: Flow,
beforeEnter: checkRouteAccess,
children: [
{
path: 'uploadCSV',
name: FlowRouteNames.UPLOAD_CSV,
meta: { uploadCSV: true },
component: Flow,
}
],
},
{
path: '/routing/flow/:id',
Expand Down

0 comments on commit e956e16

Please sign in to comment.