2020-11-24 15:15:51 +05:30
|
|
|
<script>
|
2021-01-03 14:25:43 +05:30
|
|
|
import { GlAlert } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { mapState, mapMutations } from 'vuex';
|
2021-01-03 14:25:43 +05:30
|
|
|
import { scrollToElement } from '~/lib/utils/common_utils';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { HIDE_ERROR } from '../store/mutation_types';
|
|
|
|
import FilterSortContainer from './filter_sort/filter_sort_container.vue';
|
|
|
|
import MembersTable from './table/members_table.vue';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
export default {
|
2021-03-11 19:13:27 +05:30
|
|
|
name: 'MembersApp',
|
2021-02-22 17:27:13 +05:30
|
|
|
components: { MembersTable, FilterSortContainer, GlAlert },
|
2021-09-04 01:27:46 +05:30
|
|
|
provide() {
|
|
|
|
return {
|
2021-12-11 22:18:48 +05:30
|
|
|
// 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-09-04 01:27:46 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
namespace: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2021-09-30 23:02:18 +05:30
|
|
|
tabQueryParamValue: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-09-04 01:27:46 +05:30
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
computed: {
|
2021-04-29 21:17:54 +05:30
|
|
|
...mapState({
|
|
|
|
showError(state) {
|
|
|
|
return state[this.namespace].showError;
|
|
|
|
},
|
|
|
|
errorMessage(state) {
|
|
|
|
return state[this.namespace].errorMessage;
|
|
|
|
},
|
|
|
|
}),
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
showError(value) {
|
|
|
|
if (value) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
scrollToElement(this.$refs.errorAlert.$el);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapMutations({
|
2021-04-29 21:17:54 +05:30
|
|
|
hideError(commit) {
|
|
|
|
return commit(`${this.namespace}/${HIDE_ERROR}`);
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
}),
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2021-01-03 14:25:43 +05:30
|
|
|
<div>
|
|
|
|
<gl-alert v-if="showError" ref="errorAlert" variant="danger" @dismiss="hideError">{{
|
|
|
|
errorMessage
|
|
|
|
}}</gl-alert>
|
2021-03-08 18:12:59 +05:30
|
|
|
<filter-sort-container />
|
2021-09-30 23:02:18 +05:30
|
|
|
<members-table :tab-query-param-value="tabQueryParamValue" />
|
2021-01-03 14:25:43 +05:30
|
|
|
</div>
|
2020-11-24 15:15:51 +05:30
|
|
|
</template>
|