open-nomad/ui/app/templates/components/fs/browser.hbs
Buck Doyle 9c0f85d7b6
UI: add filesystem browsing for allocations (#7951)
This partially addresses #7799.

Task state filesystems are contained within a subdirectory of their
parent allocation, so almost everything that existed for browsing task
state filesystems was applicable to browsing allocations, just without
the task name prepended to the path. I aimed to push this differential
handling into as few contained places as possible.

The tests also have significant overlap, so this includes an extracted
behavior to run the same tests for allocations and task states.
2020-06-01 08:15:59 -05:00

48 lines
2 KiB
Handlebars

<section class="section is-closer {{if isFile "full-width-section"}}">
{{#if model.isRunning}}
{{#if isFile}}
{{#fs/file allocation=allocation task=task file=path stat=stat class="fs-explorer"}}
{{fs/breadcrumbs allocation=allocation task=task path=path}}
{{/fs/file}}
{{else}}
<div class="fs-explorer boxed-section">
<div class="boxed-section-head">
{{fs/breadcrumbs allocation=allocation task=task path=path}}
</div>
{{#if directoryEntries}}
{{#list-table
source=sortedDirectoryEntries
sortProperty=sortProperty
sortDescending=sortDescending
class="boxed-section-body is-full-bleed is-compact" as |t|}}
{{#t.head}}
{{#t.sort-by prop="Name" class="is-two-thirds"}}Name{{/t.sort-by}}
{{#t.sort-by prop="Size" class="has-text-right"}}File Size{{/t.sort-by}}
{{#t.sort-by prop="ModTime" class="has-text-right"}}Last Modified{{/t.sort-by}}
{{/t.head}}
{{#t.body as |row|}}
{{fs/directory-entry path=path allocation=allocation task=task entry=row.model}}
{{/t.body}}
{{/list-table}}
{{else}}
<div class="boxed-section-body">
<div data-test-empty-directory class="empty-message">
<h3 data-test-empty-directory-headline class="empty-message-headline">No Files</h3>
<p data-test-empty-directory-body class="empty-message-body">
Directory is currently empty.
</p>
</div>
</div>
{{/if}}
</div>
{{/if}}
{{else}}
<div data-test-not-running class="empty-message">
<h3 data-test-not-running-headline class="empty-message-headline">{{capitalize type}} is not Running</h3>
<p data-test-not-running-body class="empty-message-body">
Cannot access files of a{{if allocation 'n'}} {{type}} that is not running.
</p>
</div>
{{/if}}
</section>