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
Files
15
@@ -3,6 +3,7 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { mapActions } from 'vuex';
import { s__ } from '~/locale';
import { guestOverageConfirmAction } from 'ee_else_ce/members/guest_overage_confirm_action';
export default {
name: 'RoleDropdown',
@@ -11,7 +12,7 @@ export default {
GlDropdownItem,
LdapDropdownItem: () => import('ee_component/members/components/ldap/ldap_dropdown_item.vue'),
},
inject: ['namespace'],
inject: ['namespace', 'guestAccessLevel'],
props: {
member: {
type: Object,
@@ -50,22 +51,38 @@ export default {
return dispatch(`${this.namespace}/updateMemberRole`, payload);
},
}),
handleSelect(value, name) {
if (value === this.member.accessLevel.integerValue) {
async handleOverageConfirm(currentAccessLevel, value) {
return guestOverageConfirmAction({
currentAccessIntValue: currentAccessLevel,
dropdownIntValue: value,
guestAccessLevel,
});
},
async handleSelect(value, name) {
const currentAccessLevel = this.member.accessLevel.integerValue;
if (value === currentAccessLevel) {
return;
}
this.busy = true;
const confirmed = await this.handleOverageConfirm(currentAccessLevel, value);
if (!confirmed) {
this.busy = false;
return;
}
this.updateMemberRole({
memberId: this.member.id,
accessLevel: { integerValue: value, stringValue: name },
})
.then(() => {
this.$toast.show(s__('Members|Role updated successfully.'));
this.busy = false;
})
.catch(() => {
// log?
})
.finally(() => {
this.busy = false;
});
},
Loading