github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/routes/variables/path.js (about)

     1  import Route from '@ember/routing/route';
     2  import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
     3  import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
     4  export default class VariablesPathRoute extends Route.extend(
     5    WithForbiddenState
     6  ) {
     7    model({ absolutePath }) {
     8      if (this.modelFor('variables').errors) {
     9        notifyForbidden(this)(this.modelFor('variables'));
    10      } else {
    11        const treeAtPath =
    12          this.modelFor('variables').pathTree.findPath(absolutePath);
    13        if (treeAtPath) {
    14          return { treeAtPath, absolutePath };
    15        } else {
    16          return { absolutePath };
    17        }
    18      }
    19    }
    20  }