chore: Move agent availability to Account level (#3074)
- Move agent availability to the account level
This commit is contained in:
parent
1c6a539c0a
commit
c54aae21ff
84 changed files with 618 additions and 148 deletions
|
@ -26,7 +26,9 @@
|
|||
color-scheme="secondary"
|
||||
class-names="status-change--dropdown-button"
|
||||
:is-disabled="status.disabled"
|
||||
@click="changeAvailabilityStatus(status.value)"
|
||||
@click="
|
||||
changeAvailabilityStatus(status.value, currentAccountId)
|
||||
"
|
||||
>
|
||||
<availability-status-badge :status="status.value" />
|
||||
{{ status.label }}
|
||||
|
@ -75,7 +77,8 @@ export default {
|
|||
|
||||
computed: {
|
||||
...mapGetters({
|
||||
currentUser: 'getCurrentUser',
|
||||
getCurrentUserAvailabilityStatus: 'getCurrentUserAvailabilityStatus',
|
||||
getCurrentAccountId: 'getCurrentAccountId',
|
||||
}),
|
||||
availabilityDisplayLabel() {
|
||||
const availabilityIndex = AVAILABILITY_STATUS_KEYS.findIndex(
|
||||
|
@ -85,8 +88,11 @@ export default {
|
|||
availabilityIndex
|
||||
];
|
||||
},
|
||||
currentAccountId() {
|
||||
return this.getCurrentAccountId;
|
||||
},
|
||||
currentUserAvailabilityStatus() {
|
||||
return this.currentUser.availability_status;
|
||||
return this.getCurrentUserAvailabilityStatus;
|
||||
},
|
||||
availabilityStatuses() {
|
||||
return this.$t('PROFILE_SETTINGS.FORM.AVAILABILITY.STATUSES_LIST').map(
|
||||
|
@ -108,16 +114,16 @@ export default {
|
|||
closeStatusMenu() {
|
||||
this.isStatusMenuOpened = false;
|
||||
},
|
||||
changeAvailabilityStatus(availability) {
|
||||
changeAvailabilityStatus(availability, accountId) {
|
||||
if (this.isUpdating) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isUpdating = true;
|
||||
|
||||
this.$store
|
||||
.dispatch('updateAvailability', {
|
||||
availability,
|
||||
availability: availability,
|
||||
account_id: accountId,
|
||||
})
|
||||
.finally(() => {
|
||||
this.isUpdating = false;
|
||||
|
|
|
@ -17,7 +17,8 @@ const i18nConfig = new VueI18n({
|
|||
});
|
||||
|
||||
describe('AvailabilityStatus', () => {
|
||||
const currentUser = { availability_status: 'online' };
|
||||
const currentAvailabilityStatus = 'online' ;
|
||||
const currentAccountId = '1';
|
||||
let store = null;
|
||||
let actions = null;
|
||||
let modules = null;
|
||||
|
@ -33,7 +34,8 @@ describe('AvailabilityStatus', () => {
|
|||
modules = {
|
||||
auth: {
|
||||
getters: {
|
||||
getCurrentUser: () => currentUser,
|
||||
getCurrentUserAvailabilityStatus: () => currentAvailabilityStatus,
|
||||
getCurrentAccountId: () => currentAccountId,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -77,7 +79,7 @@ describe('AvailabilityStatus', () => {
|
|||
|
||||
expect(actions.updateAvailability).toBeCalledWith(
|
||||
expect.any(Object),
|
||||
{ availability: 'offline' },
|
||||
{ availability: 'offline', account_id: currentAccountId },
|
||||
undefined
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue