open-nomad/ui/app/components/variable-paths.hbs
Phil Renaud da4cb6422e 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

37 lines
949 B
Handlebars

<ListTable class="path-tree" @source={{@branch}} as |t|>
<t.head>
<th>
Path
</th>
</t.head>
<tbody>
{{#each this.folders as |folder|}}
<tr data-test-folder-row {{on "click" (fn this.handleFolderClick folder.data.absolutePath)}}>
<td>
<span>
<FlightIcon @name="folder" />
<LinkTo @route="variables.path" @model={{folder.data.absolutePath}}>
{{trim-path folder.name}}
</LinkTo>
</span>
</td>
</tr>
{{/each}}
{{#each this.files as |file|}}
<tr data-test-file-row {{on "click" (fn this.handleFileClick file.absoluteFilePath)}}>
<td>
<FlightIcon @name="file-text" />
<LinkTo
@route="variables.variable"
@model={{file.absoluteFilePath}}
>
{{file.name}}
</LinkTo>
</td>
</tr>
{{/each}}
</tbody>
</ListTable>