diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 18:09:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 18:09:37 +0300 |
commit | a210c43e0aca0311cc1d3d381763b25979ec72dc (patch) | |
tree | 0325d173da7a6e7bd6c2cdf450d0aa1c4e142d0f /app/assets/javascripts/api.js | |
parent | c9687bdf58e9d4a9c3942f587bd4841f42e3b5de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index dc6ea148047..c85e5b68f5f 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -492,6 +492,41 @@ const Api = { buildUrl(url) { return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, + + /** + * Returns pods logs for an environment with an optional pod and container + * + * @param {Object} params + * @param {Object} param.environment - Environment object + * @param {string=} params.podName - Pod name, if not set the backend assumes a default one + * @param {string=} params.containerName - Container name, if not set the backend assumes a default one + * @param {string=} params.start - Starting date to query the logs in ISO format + * @param {string=} params.end - Ending date to query the logs in ISO format + * @returns {Promise} Axios promise for the result of a GET request of logs + */ + getPodLogs({ environment, podName, containerName, search, start, end }) { + const url = this.buildUrl(environment.logs_api_path); + + const params = {}; + + if (podName) { + params.pod_name = podName; + } + if (containerName) { + params.container_name = containerName; + } + if (search) { + params.search = search; + } + if (start) { + params.start = start; + } + if (end) { + params.end = end; + } + + return axios.get(url, { params }); + }, }; export default Api; |