github.com/hernad/nomad@v1.6.112/ui/app/controllers/variables/variable.js (about)

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