Skip to content

Commit

Permalink
refactor: used delete-popup composable and removed delete mixin in pr…
Browse files Browse the repository at this point in the history
…ogress [WTEL-3606]
  • Loading branch information
lizacoma committed Oct 25, 2023
1 parent bd246c1 commit 2e6a88a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/app/mixins/baseMixins/baseTableMixin/baseTableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import tableActionsHandlerMixin from './tableActionsMixin';
*/
export default {
mixins: [
deleteMixin,
// deleteMixin,
itemLinkMixin,
tableActionsHandlerMixin,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default {
}),
methods: {
askDeleteConfirmation({ deleted, callback }) {
console.log('askDeleteConfirmation');
if (Array.isArray(deleted)) this.deleteConfirmation.deleteCount = deleted.length;
else this.deleteConfirmation.deleteCount = 1;
this.deleteConfirmation.isDeleteConfirmationPopup = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import deleteConfirmationMixin from './deleteConfirmationMixin';

export default {
mixins: [deleteConfirmationMixin],
// mixins: [deleteConfirmationMixin],
methods: {
callDelete(deleted) {
if (this.isDeleteConfirmation) {
this.askDeleteConfirmation({
deleted,
callback: this.makeDelete.bind(this, deleted),
});
} else this.makeDelete(deleted);
},
// callDelete(deleted) {
// if (this.isDeleteConfirmation) {
// this.askDeleteConfirmation({
// deleted,
// callback: this.makeDelete.bind(this, deleted),
// });
// } else this.makeDelete(deleted);
// },
makeDelete(deleted) {
return this.dispatchDelete(deleted);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
@close="isQueueSelectPopup = false"
/>
<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 @@ -44,7 +44,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 @@ -123,7 +126,10 @@
v-if="hasDeleteAccess"
action="delete"
class="table-action"
@click="callDelete(item)"
@click="askDeleteConfirmation({
deleted: [item],
callback: () => deleteData(item),
})"
/>
</template>
</wt-table>
Expand All @@ -149,17 +155,41 @@ import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/obj
import RouteNames from '../../../../../app/router/_internals/RouteNames.enum';
import QueueTypeProperties from '../lookups/QueueTypeProperties.lookup';
import QueuePopup from './create-queue-popup.vue';
import { useDeleteConfirmationPopup } from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
import { useTableStore } from '@webitel/ui-sdk/src/modules/TableStoreModule/composables/useTableStore';
import DeleteConfirmationPopup
from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
const namespace = 'ccenter/queues';
export default {
name: 'TheQueues',
components: { QueuePopup },
components: { QueuePopup, DeleteConfirmationPopup },
mixins: [tableComponentMixin],
setup() {
const { dummy } = useDummy({ namespace, showAction: true });
return { dummy };
const {
isVisible: isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
} = useDeleteConfirmationPopup();
const { deleteData } = useTableStore(namespace);
return {
dummy,
isDeleteConfirmationPopup,
deleteCount,
deleteCallback,
askDeleteConfirmation,
closeDelete,
deleteData,
};
},
data: () => ({
namespace,
Expand Down

0 comments on commit 2e6a88a

Please sign in to comment.