github.com/hernad/nomad@v1.6.112/ui/app/routes/jobs/run/templates/manage.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Route from '@ember/routing/route'; 7 import { inject as service } from '@ember/service'; 8 9 export default class JobsRunTemplatesManageRoute extends Route { 10 @service can; 11 @service router; 12 @service store; 13 14 beforeModel() { 15 const hasPermissions = this.can.can('write variable', null, { 16 namespace: '*', 17 path: '*', 18 }); 19 20 if (!hasPermissions) { 21 this.router.transitionTo('jobs'); 22 } 23 } 24 25 model() { 26 return this.store.adapterFor('variable').getJobTemplates(); 27 } 28 }