2020-10-12 21:08:56 +00:00
|
|
|
<script>
|
|
|
|
import { GlButton, GlForm, GlTooltipDirective } from '@gitlab/ui';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { mapState } from 'vuex';
|
2020-10-12 21:08:56 +00:00
|
|
|
import csrf from '~/lib/utils/csrf';
|
|
|
|
import { __ } from '~/locale';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ApproveAccessRequestButton',
|
|
|
|
csrf,
|
|
|
|
title: __('Grant access'),
|
|
|
|
components: { GlButton, GlForm },
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
2021-04-13 21:11:25 +00:00
|
|
|
inject: ['namespace'],
|
2020-10-12 21:08:56 +00:00
|
|
|
props: {
|
|
|
|
memberId: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
2021-04-13 21:11:25 +00:00
|
|
|
...mapState({
|
|
|
|
memberPath(state) {
|
|
|
|
return state[this.namespace].memberPath;
|
|
|
|
},
|
|
|
|
}),
|
2020-10-12 21:08:56 +00:00
|
|
|
approvePath() {
|
|
|
|
return this.memberPath.replace(/:id$/, `${this.memberId}/approve_access_request`);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-form :action="approvePath" method="post">
|
|
|
|
<input :value="$options.csrf.token" type="hidden" name="authenticity_token" />
|
|
|
|
<gl-button
|
|
|
|
v-gl-tooltip.hover
|
|
|
|
:title="$options.title"
|
|
|
|
:aria-label="$options.title"
|
|
|
|
icon="check"
|
|
|
|
variant="success"
|
|
|
|
type="submit"
|
|
|
|
/>
|
|
|
|
</gl-form>
|
|
|
|
</template>
|