github.com/hernad/nomad@v1.6.112/ui/app/routes/variables/path.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 WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; 8 import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; 9 export default class VariablesPathRoute extends Route.extend( 10 WithForbiddenState 11 ) { 12 model({ absolutePath }) { 13 if (this.modelFor('variables').errors) { 14 notifyForbidden(this)(this.modelFor('variables')); 15 } else { 16 const treeAtPath = 17 this.modelFor('variables').pathTree.findPath(absolutePath); 18 if (treeAtPath) { 19 return { treeAtPath, absolutePath }; 20 } else { 21 return { absolutePath }; 22 } 23 } 24 } 25 }