2022-06-07 01:42:23 +00:00
|
|
|
// @ts-check
|
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { action } from '@ember/object';
|
|
|
|
import { inject as service } from '@ember/service';
|
2022-06-17 18:03:43 +00:00
|
|
|
import compactPath from '../utils/compact-path';
|
2022-06-07 01:42:23 +00:00
|
|
|
export default class VariablePathsComponent extends Component {
|
|
|
|
@service router;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {Array<Object.<string, Object>>}
|
|
|
|
*/
|
|
|
|
get folders() {
|
2022-06-17 18:03:43 +00:00
|
|
|
return Object.entries(this.args.branch.children).map(([name]) => {
|
|
|
|
return compactPath(this.args.branch.children[name], name);
|
2022-06-07 01:42:23 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
get files() {
|
|
|
|
return this.args.branch.files;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
async handleFolderClick(path) {
|
|
|
|
this.router.transitionTo('variables.path', path);
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
async handleFileClick(path) {
|
|
|
|
this.router.transitionTo('variables.variable', path);
|
|
|
|
}
|
|
|
|
}
|