github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/components/fs/directory-entry.js (about)

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