2020-09-12 00:08:44 +00:00
|
|
|
<script>
|
2020-10-14 18:08:47 +00:00
|
|
|
import { GlAlert } from '@gitlab/ui';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { mapState, mapMutations } from 'vuex';
|
2021-02-01 15:08:56 +00:00
|
|
|
import { scrollToElement } from '~/lib/utils/common_utils';
|
|
|
|
import { HIDE_ERROR } from '../store/mutation_types';
|
2021-01-21 12:09:05 +00:00
|
|
|
import FilterSortContainer from './filter_sort/filter_sort_container.vue';
|
2021-02-14 18:09:20 +00:00
|
|
|
import MembersTable from './table/members_table.vue';
|
2020-09-22 15:09:37 +00:00
|
|
|
|
2020-09-12 00:08:44 +00:00
|
|
|
export default {
|
2021-01-21 12:09:05 +00:00
|
|
|
name: 'MembersApp',
|
2020-12-03 06:09:47 +00:00
|
|
|
components: { MembersTable, FilterSortContainer, GlAlert },
|
2021-05-20 00:10:36 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
2021-11-06 06:10:07 +00:00
|
|
|
// We can't use this.namespace due to bug in vue-apollo when
|
|
|
|
// provide is called in beforeCreate
|
|
|
|
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
|
|
|
|
namespace: this.$options.propsData.namespace,
|
2021-05-20 00:10:36 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
namespace: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2021-06-23 03:07:43 +00:00
|
|
|
tabQueryParamValue: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-05-20 00:10:36 +00:00
|
|
|
},
|
2020-10-14 18:08:47 +00:00
|
|
|
computed: {
|
2021-04-13 21:11:25 +00:00
|
|
|
...mapState({
|
|
|
|
showError(state) {
|
|
|
|
return state[this.namespace].showError;
|
|
|
|
},
|
|
|
|
errorMessage(state) {
|
|
|
|
return state[this.namespace].errorMessage;
|
|
|
|
},
|
|
|
|
}),
|
2020-10-14 18:08:47 +00:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
showError(value) {
|
|
|
|
if (value) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
scrollToElement(this.$refs.errorAlert.$el);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapMutations({
|
2021-04-13 21:11:25 +00:00
|
|
|
hideError(commit) {
|
|
|
|
return commit(`${this.namespace}/${HIDE_ERROR}`);
|
|
|
|
},
|
2020-10-14 18:08:47 +00:00
|
|
|
}),
|
|
|
|
},
|
2020-09-12 00:08:44 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-14 18:08:47 +00:00
|
|
|
<div>
|
|
|
|
<gl-alert v-if="showError" ref="errorAlert" variant="danger" @dismiss="hideError">{{
|
|
|
|
errorMessage
|
|
|
|
}}</gl-alert>
|
2021-01-13 09:10:52 +00:00
|
|
|
<filter-sort-container />
|
2021-06-23 03:07:43 +00:00
|
|
|
<members-table :tab-query-param-value="tabQueryParamValue" />
|
2020-10-14 18:08:47 +00:00
|
|
|
</div>
|
2020-09-12 00:08:44 +00:00
|
|
|
</template>
|