Skip to content
Snippets Groups Projects

Add ability to clean up stale environments

Merged Allen Cook requested to merge 19724-ui-stop-stale-environments into master
4 files
+ 159
0
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 26
0
import { DEFAULT_PER_PAGE } from '~/api';
import axios from '../lib/utils/axios_utils';
import { buildApiUrl } from './api_utils';
const STOP_STALE_ENVIRONMENTS_PATH =
'/api/:version/projects/:id/environments/stop_stale?before=:before';
export function stopStaleEnvironments(projectId, before, query, options, callback = () => {}) {
const url = buildApiUrl(STOP_STALE_ENVIRONMENTS_PATH)
.replace(':id', projectId)
.replace(':before', before.toISOString());
const defaults = {
search: query,
per_page: DEFAULT_PER_PAGE,
simple: true,
};
return axios
.post(url, {
params: Object.assign(defaults, options),
})
.then(({ data, headers }) => {
callback(data);
return { data, headers };
});
}
Loading