github.com/hernad/nomad@v1.6.112/ui/app/controllers/allocations/allocation/task/index.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Controller from '@ember/controller'; 7 import { computed as overridable } from 'ember-overridable-computed'; 8 import { task } from 'ember-concurrency'; 9 import classic from 'ember-classic-decorator'; 10 import messageForError from 'nomad-ui/utils/message-from-adapter-error'; 11 12 @classic 13 export default class IndexController extends Controller { 14 @overridable(() => { 15 // { title, description } 16 return null; 17 }) 18 error; 19 20 onDismiss() { 21 this.set('error', null); 22 } 23 24 @task(function* () { 25 try { 26 yield this.model.restart(); 27 } catch (err) { 28 this.set('error', { 29 title: 'Could Not Restart Task', 30 description: messageForError(err, 'manage allocation lifecycle'), 31 }); 32 } 33 }) 34 restartTask; 35 }