Files
nomad/ui/app/components/variable-paths.js
Phil Renaud 8cf81a9ee8 Secure Variables: Build a path tree and traverse it at /variables/*path (#13202)
* Recursive trie-building with variable paths

* tree structure applied to new path routes and a new util class

* Breadcrumbs for SV paths and prompt when nothing exists at a path

* Lint and test cleanup

* Pre-review cleanup

* lintfix

* Abstracted pathtree each-ins into a new component class

* Path tree component styles

* Types added and PR feedback addressed

* Path tree to variable paths

* Slightly simpler path QP mods

* More pr feedback handling

* Trim moved into a function on variable model

* Traversal and compaction tests for PathTree

* Trim Path tests

* Variable-paths component tests

* Lint fixup for tests
2022-07-11 13:34:04 -04:00

32 lines
695 B
JavaScript

// @ts-check
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class VariablePathsComponent extends Component {
@service router;
/**
* @returns {Array<Object.<string, Object>>}
*/
get folders() {
return Object.entries(this.args.branch.children).map(([name, data]) => {
return { name, data };
});
}
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);
}
}