Commit f8b77141 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Move billable_members API to ee

Billable members is a feature for GitLab.com only
so it should live in EE folder.
parent 993d99dc
...@@ -81,7 +81,6 @@ const Api = { ...@@ -81,7 +81,6 @@ const Api = {
usageDataIncrementUniqueUsersPath: '/api/:version/usage_data/increment_unique_users', usageDataIncrementUniqueUsersPath: '/api/:version/usage_data/increment_unique_users',
featureFlagUserLists: '/api/:version/projects/:id/feature_flags_user_lists', featureFlagUserLists: '/api/:version/projects/:id/feature_flags_user_lists',
featureFlagUserList: '/api/:version/projects/:id/feature_flags_user_lists/:list_iid', featureFlagUserList: '/api/:version/projects/:id/feature_flags_user_lists/:list_iid',
billableGroupMembersPath: '/api/:version/groups/:id/billable_members',
containerRegistryDetailsPath: '/api/:version/registry/repositories/:id/', containerRegistryDetailsPath: '/api/:version/registry/repositories/:id/',
projectNotificationSettingsPath: '/api/:version/projects/:id/notification_settings', projectNotificationSettingsPath: '/api/:version/projects/:id/notification_settings',
groupNotificationSettingsPath: '/api/:version/groups/:id/notification_settings', groupNotificationSettingsPath: '/api/:version/groups/:id/notification_settings',
...@@ -883,33 +882,6 @@ const Api = { ...@@ -883,33 +882,6 @@ const Api = {
return axios.delete(url); return axios.delete(url);
}, },
fetchBillableGroupMembersList(namespaceId, options = {}, callback = () => {}) {
const url = Api.buildUrl(this.billableGroupMembersPath).replace(':id', namespaceId);
const defaults = {
per_page: DEFAULT_PER_PAGE,
page: 1,
};
const passedOptions = options;
// calling search API with empty string will not return results
if (!passedOptions.search) {
passedOptions.search = undefined;
}
return axios
.get(url, {
params: {
...defaults,
...passedOptions,
},
})
.then(({ data, headers }) => {
callback(data);
return { data, headers };
});
},
async updateNotificationSettings(projectId, groupId, data = {}) { async updateNotificationSettings(projectId, groupId, data = {}) {
let url = Api.buildUrl(this.notificationSettingsPath); let url = Api.buildUrl(this.notificationSettingsPath);
......
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
issueMetricImagesPath: '/api/:version/projects/:id/issues/:issue_iid/metric_images', issueMetricImagesPath: '/api/:version/projects/:id/issues/:issue_iid/metric_images',
issueMetricSingleImagePath: issueMetricSingleImagePath:
'/api/:version/projects/:id/issues/:issue_iid/metric_images/:image_id', '/api/:version/projects/:id/issues/:issue_iid/metric_images/:image_id',
billableGroupMembersPath: '/api/:version/groups/:id/billable_members',
userSubscription(namespaceId) { userSubscription(namespaceId) {
const url = Api.buildUrl(this.subscriptionPath).replace(':id', encodeURIComponent(namespaceId)); const url = Api.buildUrl(this.subscriptionPath).replace(':id', encodeURIComponent(namespaceId));
...@@ -385,4 +386,31 @@ export default { ...@@ -385,4 +386,31 @@ export default {
return axios.delete(individualMetricImageUrl); return axios.delete(individualMetricImageUrl);
}, },
fetchBillableGroupMembersList(namespaceId, options = {}, callback = () => {}) {
const url = Api.buildUrl(this.billableGroupMembersPath).replace(':id', namespaceId);
const defaults = {
per_page: Api.DEFAULT_PER_PAGE,
page: 1,
};
const passedOptions = options;
// calling search API with empty string will not return results
if (!passedOptions.search) {
passedOptions.search = undefined;
}
return axios
.get(url, {
params: {
...defaults,
...passedOptions,
},
})
.then(({ data, headers }) => {
callback(data);
return { data, headers };
});
},
}; };
import Api from '~/api'; import Api from 'ee/api';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
......
import ApiEe from 'ee/api'; import Api from 'ee/api';
import Api from '~/api';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -14,7 +13,7 @@ export const setNamespaceId = ({ commit }, namespaceId) => { ...@@ -14,7 +13,7 @@ export const setNamespaceId = ({ commit }, namespaceId) => {
export const fetchSubscription = ({ dispatch, state }) => { export const fetchSubscription = ({ dispatch, state }) => {
dispatch('requestSubscription'); dispatch('requestSubscription');
return ApiEe.userSubscription(state.namespaceId) return Api.userSubscription(state.namespaceId)
.then(({ data }) => dispatch('receiveSubscriptionSuccess', data)) .then(({ data }) => dispatch('receiveSubscriptionSuccess', data))
.catch(() => dispatch('receiveSubscriptionError')); .catch(() => dispatch('receiveSubscriptionError'));
}; };
......
...@@ -6,7 +6,7 @@ import * as actions from 'ee/billings/seat_usage/store/actions'; ...@@ -6,7 +6,7 @@ import * as actions from 'ee/billings/seat_usage/store/actions';
import { mockDataSeats } from 'ee_jest/billings/mock_data'; import { mockDataSeats } from 'ee_jest/billings/mock_data';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash'; import createFlash from '~/flash';
import Api from '~/api'; import Api from 'ee/api';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -43,8 +43,6 @@ describe('seats actions', () => { ...@@ -43,8 +43,6 @@ describe('seats actions', () => {
}); });
expect(spy).toBeCalledWith(state.namespaceId, expect.objectContaining(payload)); expect(spy).toBeCalledWith(state.namespaceId, expect.objectContaining(payload));
spy.mockRestore();
}); });
describe('on success', () => { describe('on success', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment