github.com/hernad/nomad@v1.6.112/ui/app/components/fs/directory-entry.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import Component from '@ember/component';
     7  import { computed } from '@ember/object';
     8  import { isEmpty } from '@ember/utils';
     9  import { tagName } from '@ember-decorators/component';
    10  import classic from 'ember-classic-decorator';
    11  
    12  @classic
    13  @tagName('')
    14  export default class DirectoryEntry extends Component {
    15    allocation = null;
    16    taskState = null;
    17  
    18    @computed('path', 'entry.Name')
    19    get pathToEntry() {
    20      const pathWithNoLeadingSlash = this.path.replace(/^\//, '');
    21      const name = encodeURIComponent(this.get('entry.Name'));
    22  
    23      if (isEmpty(pathWithNoLeadingSlash)) {
    24        return name;
    25      } else {
    26        return `${pathWithNoLeadingSlash}/${name}`;
    27      }
    28    }
    29  }