2019-07-02 21:42:38 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { isEmpty } from '@ember/utils';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { tagName } from '@ember-decorators/component';
|
|
|
|
import classic from 'ember-classic-decorator';
|
2019-07-02 21:42:38 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
@tagName('')
|
|
|
|
export default class DirectoryEntry extends Component {
|
|
|
|
allocation = null;
|
|
|
|
taskState = null;
|
2019-07-02 21:42:38 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('path', 'entry.Name')
|
|
|
|
get pathToEntry() {
|
2021-02-17 21:01:44 +00:00
|
|
|
const pathWithNoLeadingSlash = this.path.replace(/^\//, '');
|
2019-08-12 20:51:38 +00:00
|
|
|
const name = encodeURIComponent(this.get('entry.Name'));
|
2019-07-02 21:42:38 +00:00
|
|
|
|
|
|
|
if (isEmpty(pathWithNoLeadingSlash)) {
|
|
|
|
return name;
|
|
|
|
} else {
|
|
|
|
return `${pathWithNoLeadingSlash}/${name}`;
|
|
|
|
}
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|