github.com/hernad/nomad@v1.6.112/ui/app/adapters/node-pool.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import ApplicationAdapter from './application'; 7 import classic from 'ember-classic-decorator'; 8 import { pluralize } from 'ember-inflector'; 9 10 @classic 11 export default class NodePoolAdapter extends ApplicationAdapter { 12 urlForFindAll(modelName) { 13 let [relationshipResource, resource] = modelName.split('-'); 14 resource = pluralize(resource); 15 return `/v1/${relationshipResource}/${resource}`; 16 } 17 18 findAll() { 19 return super.findAll(...arguments).catch((error) => { 20 // Handle the case where the node pool request is sent to a region that 21 // doesn't have node pools and the request is handled by the nodes 22 // endpoint. 23 const isNodeRequest = error.message.includes( 24 'node lookup failed: index error: UUID must be 36 characters' 25 ); 26 if (isNodeRequest) { 27 return []; 28 } 29 30 // Rethrow to be handled downstream. 31 throw error; 32 }); 33 } 34 }