summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/api')
-rw-r--r--app/assets/javascripts/api/environments_api.js15
-rw-r--r--app/assets/javascripts/api/groups_api.js9
-rw-r--r--app/assets/javascripts/api/projects_api.js13
3 files changed, 37 insertions, 0 deletions
diff --git a/app/assets/javascripts/api/environments_api.js b/app/assets/javascripts/api/environments_api.js
new file mode 100644
index 00000000000..9912b1ab696
--- /dev/null
+++ b/app/assets/javascripts/api/environments_api.js
@@ -0,0 +1,15 @@
+import axios from '../lib/utils/axios_utils';
+import { buildApiUrl } from './api_utils';
+
+export const STOP_STALE_ENVIRONMENTS_PATH = '/api/:version/projects/:id/environments/stop_stale';
+
+export function stopStaleEnvironments(projectId, before, query, options) {
+ const url = buildApiUrl(STOP_STALE_ENVIRONMENTS_PATH).replace(':id', projectId);
+ const defaults = {
+ before: before.toISOString(),
+ };
+
+ return axios.post(url, null, {
+ params: Object.assign(defaults, options),
+ });
+}
diff --git a/app/assets/javascripts/api/groups_api.js b/app/assets/javascripts/api/groups_api.js
index e859160c2e7..1b216e6f721 100644
--- a/app/assets/javascripts/api/groups_api.js
+++ b/app/assets/javascripts/api/groups_api.js
@@ -4,6 +4,8 @@ import { buildApiUrl } from './api_utils';
const GROUP_PATH = '/api/:version/groups/:id';
const GROUPS_PATH = '/api/:version/groups.json';
+const GROUP_MEMBERS_PATH = '/api/:version/groups/:id/members';
+const GROUP_ALL_MEMBERS_PATH = '/api/:version/groups/:id/members/all';
const DESCENDANT_GROUPS_PATH = '/api/:version/groups/:id/descendant_groups';
const GROUP_TRANSFER_LOCATIONS_PATH = 'api/:version/groups/:id/transfer_locations';
@@ -45,3 +47,10 @@ export const getGroupTransferLocations = (groupId, params = {}) => {
return axios.get(url, { params: { ...defaultParams, ...params } });
};
+
+export const getGroupMembers = (groupId, inherited = false) => {
+ const path = inherited ? GROUP_ALL_MEMBERS_PATH : GROUP_MEMBERS_PATH;
+ const url = buildApiUrl(path).replace(':id', groupId);
+
+ return axios.get(url);
+};
diff --git a/app/assets/javascripts/api/projects_api.js b/app/assets/javascripts/api/projects_api.js
index 5b5abbdf50b..5c0d101ef5b 100644
--- a/app/assets/javascripts/api/projects_api.js
+++ b/app/assets/javascripts/api/projects_api.js
@@ -3,6 +3,8 @@ import axios from '../lib/utils/axios_utils';
import { buildApiUrl } from './api_utils';
const PROJECTS_PATH = '/api/:version/projects.json';
+const PROJECT_MEMBERS_PATH = '/api/:version/projects/:id/members';
+const PROJECT_ALL_MEMBERS_PATH = '/api/:version/projects/:id/members/all';
const PROJECT_IMPORT_MEMBERS_PATH = '/api/:version/projects/:id/import_project_members/:project_id';
const PROJECT_REPOSITORY_SIZE_PATH = '/api/:version/projects/:id/repository_size';
const PROJECT_TRANSFER_LOCATIONS_PATH = 'api/:version/projects/:id/transfer_locations';
@@ -19,6 +21,10 @@ export function getProjects(query, options, callback = () => {}) {
defaults.membership = true;
}
+ if (gon.features.fullPathProjectSearch && query?.includes('/')) {
+ defaults.search_namespaces = true;
+ }
+
return axios
.get(url, {
params: Object.assign(defaults, options),
@@ -50,3 +56,10 @@ export const getTransferLocations = (projectId, params = {}) => {
return axios.get(url, { params: { ...defaultParams, ...params } });
};
+
+export const getProjectMembers = (projectId, inherited = false) => {
+ const path = inherited ? PROJECT_ALL_MEMBERS_PATH : PROJECT_MEMBERS_PATH;
+ const url = buildApiUrl(path).replace(':id', projectId);
+
+ return axios.get(url);
+};