github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/app/adapters/allocation.js (about) 1 import Watchable from './watchable'; 2 import addToPath from 'nomad-ui/utils/add-to-path'; 3 4 export default Watchable.extend({ 5 stop: adapterAction('/stop'), 6 7 restart(allocation, taskName) { 8 const prefix = `${this.host || '/'}${this.urlPrefix()}`; 9 const url = `${prefix}/client/allocation/${allocation.id}/restart`; 10 return this.ajax(url, 'PUT', { 11 data: taskName && { TaskName: taskName }, 12 }); 13 }, 14 }); 15 16 function adapterAction(path, verb = 'POST') { 17 return function(allocation) { 18 const url = addToPath(this.urlForFindRecord(allocation.id, 'allocation'), path); 19 return this.ajax(url, verb); 20 }; 21 }