2020-09-11 20:08:44 -04:00
|
|
|
<script>
|
2020-10-14 14:08:47 -04:00
|
|
|
import { GlAlert } from '@gitlab/ui';
|
2021-02-14 13:09:20 -05:00
|
|
|
import { mapState, mapMutations } from 'vuex';
|
2021-02-01 10:08:56 -05:00
|
|
|
import { scrollToElement } from '~/lib/utils/common_utils';
|
|
|
|
import { HIDE_ERROR } from '../store/mutation_types';
|
2021-01-21 07:09:05 -05:00
|
|
|
import FilterSortContainer from './filter_sort/filter_sort_container.vue';
|
2021-02-14 13:09:20 -05:00
|
|
|
import MembersTable from './table/members_table.vue';
|
2020-09-22 11:09:37 -04:00
|
|
|
|
2020-09-11 20:08:44 -04:00
|
|
|
export default {
|
2021-01-21 07:09:05 -05:00
|
|
|
name: 'MembersApp',
|
2020-12-03 01:09:47 -05:00
|
|
|
components: { MembersTable, FilterSortContainer, GlAlert },
|
2021-05-19 20:10:36 -04:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
namespace: this.namespace,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
namespace: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-10-14 14:08:47 -04:00
|
|
|
computed: {
|
2021-04-13 17:11:25 -04:00
|
|
|
...mapState({
|
|
|
|
showError(state) {
|
|
|
|
return state[this.namespace].showError;
|
|
|
|
},
|
|
|
|
errorMessage(state) {
|
|
|
|
return state[this.namespace].errorMessage;
|
|
|
|
},
|
|
|
|
}),
|
2020-10-14 14:08:47 -04:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
showError(value) {
|
|
|
|
if (value) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
scrollToElement(this.$refs.errorAlert.$el);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapMutations({
|
2021-04-13 17:11:25 -04:00
|
|
|
hideError(commit) {
|
|
|
|
return commit(`${this.namespace}/${HIDE_ERROR}`);
|
|
|
|
},
|
2020-10-14 14:08:47 -04:00
|
|
|
}),
|
|
|
|
},
|
2020-09-11 20:08:44 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-14 14:08:47 -04:00
|
|
|
<div>
|
|
|
|
<gl-alert v-if="showError" ref="errorAlert" variant="danger" @dismiss="hideError">{{
|
|
|
|
errorMessage
|
|
|
|
}}</gl-alert>
|
2021-01-13 04:10:52 -05:00
|
|
|
<filter-sort-container />
|
2020-10-14 14:08:47 -04:00
|
|
|
<members-table />
|
|
|
|
</div>
|
2020-09-11 20:08:44 -04:00
|
|
|
</template>
|