github.com/outbrain/consul@v1.4.5/ui-v2/app/adapters/coordinate.js (about)

     1  import ApplicationAdapter from './application';
     2  
     3  import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/coordinate';
     4  
     5  import { OK as HTTP_OK } from 'consul-ui/utils/http/status';
     6  
     7  export default ApplicationAdapter.extend({
     8    urlForQuery: function(query, modelName) {
     9      // https://www.consul.io/api/coordinate.html#read-lan-coordinates-for-all-nodes
    10      return this.appendURL('coordinate/nodes', [], this.cleanQuery(query));
    11    },
    12    isQueryRecord: function(url) {
    13      return true;
    14    },
    15    handleResponse: function(status, headers, payload, requestData) {
    16      let response = payload;
    17      if (status === HTTP_OK) {
    18        const url = this.parseURL(requestData.url);
    19        response = this.handleBatchResponse(url, response, PRIMARY_KEY, SLUG_KEY);
    20      }
    21      return this._super(status, headers, response, requestData);
    22    },
    23  });