Skip to content

Move EE differences for `app/assets/javascripts/api.js`

Differences

diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/api.js b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/api.js
index d1396b6c4bc..81d273a40f5 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/api.js
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/api.js
@@ -17,6 +17,7 @@ const Api = {
   projectRunnersPath: '/api/:version/projects/:id/runners',
   mergeRequestsPath: '/api/:version/merge_requests',
   groupLabelsPath: '/groups/:namespace_path/-/labels',
+  ldapGroupsPath: '/api/:version/ldap/:provider/groups.json',
   issuableTemplatePath: '/:namespace_path/:project_path/templates/:type/:key',
   projectTemplatePath: '/api/:version/projects/:id/templates/:type/:key',
   projectTemplatesPath: '/api/:version/projects/:id/templates/:type',
@@ -29,6 +30,8 @@ const Api = {
   commitPipelinesPath: '/:project_id/commit/:sha/pipelines',
   branchSinglePath: '/api/:version/projects/:id/repository/branches/:branch',
   createBranchPath: '/api/:version/projects/:id/repository/branches',
+  geoNodesPath: '/api/:version/geo_nodes',
+  subscriptionPath: '/api/:version/namespaces/:id/gitlab_subscription',
   releasesPath: '/api/:version/projects/:id/releases',
 
   group(groupId, callback) {
@@ -308,6 +311,48 @@ const Api = {
     });
   },
 
+  approverUsers(search, options, callback = $.noop) {
+    const url = Api.buildUrl('/autocomplete/users.json');
+    return axios
+      .get(url, {
+        params: Object.assign(
+          {
+            search,
+            per_page: 20,
+          },
+          options,
+        ),
+      })
+      .then(({ data }) => {
+        callback(data);
+
+        return data;
+      });
+  },
+
+  ldap_groups(query, provider, callback) {
+    const url = Api.buildUrl(this.ldapGroupsPath).replace(':provider', provider);
+    return axios
+      .get(url, {
+        params: {
+          search: query,
+          per_page: 20,
+          active: true,
+        },
+      })
+      .then(({ data }) => {
+        callback(data);
+
+        return data;
+      });
+  },
+
+  userSubscription(namespaceId) {
+    const url = Api.buildUrl(this.subscriptionPath).replace(':id', encodeURIComponent(namespaceId));
+
+    return axios.get(url);
+  },
+
   releases(id) {
     const url = Api.buildUrl(this.releasesPath).replace(':id', encodeURIComponent(id));

What needs to be done

  1. Extend the API class in EE