open-nomad/ui/app/templates/components/fs/file.hbs
Buck Doyle 29de8f4f76
Add component accessibility auditing and fixes (#8679)
This continues #8455 by adding accessibility audits to component integration
tests and fixing associated errors. It adds audits to existing tests rather than
adding separate ones to facilitate auditing the various permutations a
component’s rendering can go through.

It also adds linting to ensure audits happen in component tests. This
necessitated consolidating test files that were scattered.
2020-08-25 10:56:02 -05:00

40 lines
2.1 KiB
Handlebars

{{#if this.noConnection}}
<div data-test-connection-error class="notification is-error">
<h3 class="title is-4">Cannot fetch file</h3>
<p>The files for this {{if this.task 'task' 'allocation'}} are inaccessible. Check the condition of the client the allocation is on.</p>
</div>
{{/if}}
<div data-test-header class="boxed-section-head">
{{yield}}
<span class="pull-right">
{{#unless this.fileTypeIsUnknown}}
<a data-test-log-action="raw" class="button is-white is-compact" href="{{this.catUrl}}" target="_blank" rel="noopener noreferrer">View Raw File</a>
{{/unless}}
{{#if (and this.isLarge this.isStreamable)}}
<button data-test-log-action="head" class="button is-white is-compact" onclick={{action "gotoHead"}} type="button">Head</button>
<button data-test-log-action="tail" class="button is-white is-compact" onclick={{action "gotoTail"}} type="button">Tail</button>
{{/if}}
{{#if this.isStreamable}}
<button data-test-log-action="toggle-stream" class="button is-white is-compact" onclick={{action "toggleStream"}} type="button" title="{{if this.logger.isStreaming "Pause" "Start"}} streaming">
{{x-icon (if this.logger.isStreaming "media-pause" "media-play") class="is-text"}}
</button>
{{/if}}
</span>
</div>
<div data-test-file-box class="boxed-section-body {{if (eq this.fileComponent "stream") "is-dark is-full-bleed"}}">
{{#if (eq this.fileComponent "stream")}}
<StreamingFile @logger={{this.logger}} @mode={{this.mode}} @isStreaming={{this.isStreaming}} />
{{else if (eq this.fileComponent "image")}}
<ImageFile @src={{this.catUrl}} @alt={{this.stat.Name}} @size={{this.stat.Size}} />
{{else}}
<div data-test-unsupported-type class="empty-message is-hollow">
<h3 class="empty-message-headline">Unsupported File Type</h3>
<p class="empty-message-body message">The Nomad UI could not render this file, but you can still view the file directly.</p>
<p class="empty-message-body">
<a data-test-log-action="raw" class="button is-light" href="{{this.catUrl}}" target="_blank" rel="noopener noreferrer">View Raw File</a>
</p>
</div>
{{/if}}
</div>