Commit 0bb98b2e authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'vs-move-billable-members-api-to-ee' into 'master'

Move billable_members API to ee [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!53823
parents a43c578c f8b77141
......@@ -81,7 +81,6 @@ const Api = {
usageDataIncrementUniqueUsersPath: '/api/:version/usage_data/increment_unique_users',
featureFlagUserLists: '/api/:version/projects/:id/feature_flags_user_lists',
featureFlagUserList: '/api/:version/projects/:id/feature_flags_user_lists/:list_iid',
billableGroupMembersPath: '/api/:version/groups/:id/billable_members',
containerRegistryDetailsPath: '/api/:version/registry/repositories/:id/',
projectNotificationSettingsPath: '/api/:version/projects/:id/notification_settings',
groupNotificationSettingsPath: '/api/:version/groups/:id/notification_settings',
......@@ -883,33 +882,6 @@ const Api = {
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 = {}) {
let url = Api.buildUrl(this.notificationSettingsPath);
......
......@@ -48,6 +48,7 @@ export default {
issueMetricImagesPath: '/api/:version/projects/:id/issues/:issue_iid/metric_images',
issueMetricSingleImagePath:
'/api/:version/projects/:id/issues/:issue_iid/metric_images/:image_id',
billableGroupMembersPath: '/api/:version/groups/:id/billable_members',
userSubscription(namespaceId) {
const url = Api.buildUrl(this.subscriptionPath).replace(':id', encodeURIComponent(namespaceId));
......@@ -385,4 +386,31 @@ export default {
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 { s__ } from '~/locale';
import * as types from './mutation_types';
......
import ApiEe from 'ee/api';
import Api from '~/api';
import Api from 'ee/api';
import createFlash from '~/flash';
import { s__ } from '~/locale';
import * as types from './mutation_types';
......@@ -14,7 +13,7 @@ export const setNamespaceId = ({ commit }, namespaceId) => {
export const fetchSubscription = ({ dispatch, state }) => {
dispatch('requestSubscription');
return ApiEe.userSubscription(state.namespaceId)
return Api.userSubscription(state.namespaceId)
.then(({ data }) => dispatch('receiveSubscriptionSuccess', data))
.catch(() => dispatch('receiveSubscriptionError'));
};
......
......@@ -6,7 +6,7 @@ import * as actions from 'ee/billings/seat_usage/store/actions';
import { mockDataSeats } from 'ee_jest/billings/mock_data';
import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash';
import Api from '~/api';
import Api from 'ee/api';
jest.mock('~/flash');
......@@ -43,8 +43,6 @@ describe('seats actions', () => {
});
expect(spy).toBeCalledWith(state.namespaceId, expect.objectContaining(payload));
spy.mockRestore();
});
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