Skip to content
Snippets Groups Projects

Draft: Connect overage modal to account

Closed Laura Callahan requested to merge 363498-overage-modal_data into master
4 unresolved threads
8 files
+ 178
96
Compare changes
  • Side-by-side
  • Inline
Files
8
@@ -3,6 +3,10 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
@@ -3,6 +3,10 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { mapActions } from 'vuex';
import { mapActions } from 'vuex';
import { s__ } from '~/locale';
import { s__ } from '~/locale';
 
import {
 
userOverageConfirmAction,
 
guestOverageConfirmAction,
 
} from 'ee_else_ce/members/guest_overage_confirm_action';
export default {
export default {
name: 'RoleDropdown',
name: 'RoleDropdown',
@@ -50,22 +54,31 @@ export default {
@@ -50,22 +54,31 @@ export default {
return dispatch(`${this.namespace}/updateMemberRole`, payload);
return dispatch(`${this.namespace}/updateMemberRole`, payload);
},
},
}),
}),
handleSelect(value, name) {
async handleSelect(value, name) {
if (value === this.member.accessLevel.integerValue) {
if (value === this.member.accessLevel.integerValue) {
return;
return;
}
}
this.busy = true;
this.busy = true;
 
const confirmed = await guestOverageConfirmAction({
 
dropdownIntValue: value,
 
subscriptionSeats: 0,
 
totalUsers: 0,
 
groupName: __('a name'),
 
});
 
if (!confirmed) {
 
return;
 
}
 
this.updateMemberRole({
this.updateMemberRole({
memberId: this.member.id,
memberId: this.member.id,
accessLevel: { integerValue: value, stringValue: name },
accessLevel: { integerValue: value, stringValue: name },
})
})
.then(() => {
.then(() => {
this.$toast.show(s__('Members|Role updated successfully.'));
this.$toast.show(s__('Members|Role updated successfully.'));
this.busy = false;
})
})
.catch(() => {
.finally(() => {
this.busy = false;
this.busy = false;
});
});
},
},
Loading