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

index.js « service « deploy_keys « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 194e95e4fca4b292beb173eaf715b9926eceb7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import Vue from 'vue';
import VueResource from 'vue-resource';

Vue.use(VueResource);

export default class DeployKeysService {
  constructor(endpoint) {
    this.endpoint = endpoint;

    this.resource = Vue.resource(
      `${this.endpoint}{/id}`,
      {},
      {
        enable: {
          method: 'PUT',
          url: `${this.endpoint}{/id}/enable`,
        },
        disable: {
          method: 'PUT',
          url: `${this.endpoint}{/id}/disable`,
        },
      },
    );
  }

  getKeys() {
    return this.resource.get().then(response => response.json());
  }

  enableKey(id) {
    return this.resource.enable({ id }, {});
  }

  disableKey(id) {
    return this.resource.disable({ id }, {});
  }
}