Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/alerts_settings/services/index.js')
-rw-r--r--app/assets/javascripts/alerts_settings/services/index.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/assets/javascripts/alerts_settings/services/index.js b/app/assets/javascripts/alerts_settings/services/index.js
new file mode 100644
index 00000000000..c49992d4f57
--- /dev/null
+++ b/app/assets/javascripts/alerts_settings/services/index.js
@@ -0,0 +1,36 @@
+/* eslint-disable @gitlab/require-i18n-strings */
+import axios from '~/lib/utils/axios_utils';
+
+export default {
+ updateGenericKey({ endpoint, params }) {
+ return axios.put(endpoint, params);
+ },
+ updatePrometheusKey({ endpoint }) {
+ return axios.post(endpoint);
+ },
+ updateGenericActive({ endpoint, params }) {
+ return axios.put(endpoint, params);
+ },
+ updatePrometheusActive({ endpoint, params: { token, config, url, redirect } }) {
+ const data = new FormData();
+ data.set('_method', 'put');
+ data.set('authenticity_token', token);
+ data.set('service[manual_configuration]', config);
+ data.set('service[api_url]', url);
+ data.set('redirect_to', redirect);
+
+ return axios.post(endpoint, data, {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ });
+ },
+ updateTestAlert({ endpoint, data, authKey }) {
+ return axios.post(endpoint, data, {
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: `Bearer ${authKey}`,
+ },
+ });
+ },
+};