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

     1  import Controller from '@ember/controller';
     2  
     3  export default class VariablesVariableController extends Controller {
     4    get breadcrumbs() {
     5      let crumbs = [];
     6      let id = decodeURI(this.params.id.split('@').slice(0, -1).join('@')); // remove namespace
     7      let namespace = this.params.id.split('@').slice(-1)[0];
     8      id.split('/').reduce((m, n) => {
     9        crumbs.push({
    10          label: n,
    11          args:
    12            m + n === id // If the last crumb, link to the var itself
    13              ? [`variables.variable`, `${m + n}@${namespace}`]
    14              : [`variables.path`, m + n],
    15        });
    16        return m + n + '/';
    17      }, []);
    18      return crumbs;
    19    }
    20  }