Skip to content

Commit

Permalink
refactor: remove delete mixin from components and added delte-popup c…
Browse files Browse the repository at this point in the history
…omposable [WTEL-3606]
  • Loading branch information
lizacoma committed Oct 30, 2023
1 parent 5159578 commit 5cd97fe
Show file tree
Hide file tree
Showing 31 changed files with 1,056 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@close="closePopup"
/>
<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
:delete-count="deleteConfirmation.deleteCount"
:callback="deleteConfirmation.callback"
v-show="isDeleteConfirmationPopup"
:delete-count="deleteCount"
:callback="deleteCallback"
@close="closeDelete"
/>

Expand All @@ -31,7 +31,10 @@
v-if="!disableUserInput"
:class="{'hidden': anySelected}"
:selected-count="selectedRows.length"
@click="callDelete(selectedRows)"
@click="askDeleteConfirmation({
deleted: selectedRows,
callback: () => deleteData(selectedRows),
})"
/>
<wt-icon-btn
v-if="!disableUserInput"
Expand Down Expand Up @@ -87,7 +90,10 @@
<wt-icon-action
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand All @@ -110,17 +116,37 @@ import { useDummy } from '../../../../../../../app/composables/useDummy';
import openedObjectTableTabMixin
from '../../../../../../../app/mixins/objectPagesMixins/openedObjectTableTabMixin/openedObjectTableTabMixin';
import ResPopup from './opened-resource-group-resource-popup.vue';
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';
const namespace = 'ccenter/resGroups';
const subNamespace = 'res';
export default {
name: 'OpenedResourceGroupResources',
components: { ResPopup },
components: { ResPopup, DeleteConfirmationPopup },
mixins: [openedObjectTableTabMixin],
setup() {
const { dummy } = useDummy({ namespace: `${namespace}/${subNamespace}`, hiddenText: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
};
},
data: () => ({
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

<template #main>
<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
:delete-count="deleteConfirmation.deleteCount"
:callback="deleteConfirmation.callback"
v-show="isDeleteConfirmationPopup"
:delete-count="deleteCount"
:callback="deleteCallback"
@close="closeDelete"
/>

Expand All @@ -38,7 +38,10 @@
v-if="hasDeleteAccess"
:class="{'hidden': anySelected}"
:selected-count="selectedRows.length"
@click="callDelete(selectedRows)"
@click="askDeleteConfirmation({
deleted: selectedRows,
callback: () => deleteData(selectedRows),
})"
/>
</wt-table-actions>
</div>
Expand Down Expand Up @@ -92,7 +95,10 @@
v-if="hasDeleteAccess"
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand All @@ -116,16 +122,37 @@
import { useDummy } from '../../../../../app/composables/useDummy';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import RouteNames from '../../../../../app/router/_internals/RouteNames.enum';
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';
const namespace = 'ccenter/res';
export default {
name: 'TheResources',
components: { DeleteConfirmationPopup },
mixins: [tableComponentMixin],
setup() {
const { dummy } = useDummy({ namespace, showAction: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
};
},
data: () => ({
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@close="closePopup"
/>
<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
:delete-count="deleteConfirmation.deleteCount"
:callback="deleteConfirmation.callback"
v-show="isDeleteConfirmationPopup"
:delete-count="deleteCount"
:callback="deleteCallback"
@close="closeDelete"
/>

Expand All @@ -31,7 +31,10 @@
v-if="!disableUserInput"
:class="{'hidden': anySelected}"
:selected-count="selectedRows.length"
@click="callDelete(selectedRows)"
@click="askDeleteConfirmation({
deleted: selectedRows,
callback: () => deleteData(selectedRows),
})"
/>
<wt-icon-btn
v-if="!disableUserInput"
Expand Down Expand Up @@ -72,7 +75,10 @@
<wt-icon-action
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand All @@ -95,19 +101,40 @@ import { useDummy } from '../../../../../../../app/composables/useDummy';
import openedObjectTableTabMixin
from '../../../../../../../app/mixins/objectPagesMixins/openedObjectTableTabMixin/openedObjectTableTabMixin';
import NumberPopup from './opened-resource-numbers-popup.vue';
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';
const namespace = 'ccenter/res';
const subNamespace = 'numbers';
export default {
name: 'OpenedResourceNumber',
components: { NumberPopup },
components: { NumberPopup, DeleteConfirmationPopup },
mixins: [openedObjectTableTabMixin],
setup() {
const { dummy } = useDummy({ namespace: `${namespace}/${subNamespace}`, hiddenText: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
};
},
data: () => ({
namespace,
subNamespace,
Expand Down
39 changes: 33 additions & 6 deletions src/modules/contact-center/modules/teams/components/the-teams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

<template #main>
<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
:delete-count="deleteConfirmation.deleteCount"
:callback="deleteConfirmation.callback"
v-show="isDeleteConfirmationPopup"
:delete-count="deleteCount"
:callback="deleteCallback"
@close="closeDelete"
/>

Expand All @@ -38,7 +38,10 @@
v-if="hasDeleteAccess"
:class="{'hidden': anySelected}"
:selected-count="selectedRows.length"
@click="callDelete(selectedRows)"
@click="askDeleteConfirmation({
deleted: selectedRows,
callback: () => deleteData(selectedRows),
})"
/>
</wt-table-actions>
</div>
Expand Down Expand Up @@ -82,7 +85,10 @@
v-if="hasDeleteAccess"
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand All @@ -107,16 +113,37 @@ import { kebabToCamel } from '@webitel/ui-sdk/src/scripts/caseConverters';
import { useDummy } from '../../../../../app/composables/useDummy';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import RouteNames from '../../../../../app/router/_internals/RouteNames.enum';
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';
const namespace = 'ccenter/teams';
export default {
name: 'TheTeams',
components: { DeleteConfirmationPopup },
mixins: [tableComponentMixin],
setup() {
const { dummy } = useDummy({ namespace, showAction: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
};
},
data: () => ({
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
@close="closePopup"
/>
<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
:delete-count="deleteConfirmation.deleteCount"
:callback="deleteConfirmation.callback"
v-show="isDeleteConfirmationPopup"
:delete-count="deleteCount"
:callback="deleteCallback"
@close="closeDelete"
/>
<object-list-popup
Expand Down Expand Up @@ -45,7 +45,10 @@
v-if="!disableUserInput"
:class="{'hidden': anySelected}"
:selected-count="selectedRows.length"
@click="callDelete(selectedRows)"
@click="askDeleteConfirmation({
deleted: selectedRows,
callback: () => deleteData(selectedRows),
})"
/>
<wt-icon-btn
v-if="!disableUserInput"
Expand Down Expand Up @@ -109,7 +112,10 @@
<wt-icon-action
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand Down Expand Up @@ -137,18 +143,38 @@ import RouteNames from '../../../../../../../app/router/_internals/RouteNames.en
import agentStatusMixin from '../../../../../mixins/agentStatusMixin';
import agentSupervisorsAndSkillsPopupMixin from '../../../../../mixins/agentSupervisorsAndSkillsPopupMixin';
import AgentPopup from './opened-team-agent-popup.vue';
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';
const namespace = 'ccenter/teams';
const subNamespace = 'agents';
export default {
name: 'OpenedTeamAgents',
components: { AgentPopup, ObjectListPopup },
components: { AgentPopup, ObjectListPopup, DeleteConfirmationPopup },
mixins: [openedObjectTableTabMixin, agentSupervisorsAndSkillsPopupMixin, agentStatusMixin],
setup() {
const { dummy } = useDummy({ namespace: `${namespace}/${subNamespace}`, hiddenText: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
};
},
data: () => ({
namespace,
Expand Down
Loading

0 comments on commit 5cd97fe

Please sign in to comment.