Skip to content

Commit

Permalink
Merge pull request #6158 from hashicorp/f-ui/alloc-fs-empty-dir-state
Browse files Browse the repository at this point in the history
UI: Use the standard empty message when an fs dir is empty
  • Loading branch information
DingoEatingFuzz authored Aug 20, 2019
2 parents 354da0f + 65aa475 commit 1783a7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
36 changes: 18 additions & 18 deletions ui/app/templates/allocations/allocation/task/fs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<div class="boxed-section-head">
{{fs-breadcrumbs task=task path=path}}
</div>
{{#list-table
source=sortedDirectoryEntries
sortProperty=sortProperty
sortDescending=sortDescending
class="boxed-section-body is-full-bleed is-compact" as |t|}}
{{#if directoryEntries}}
{{#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}}
Expand All @@ -25,17 +25,17 @@
{{#t.body as |row|}}
{{fs-directory-entry path=path task=task entry=row.model}}
{{/t.body}}
{{else}}
<tbody>
<tr data-test-entry>
<td colspan="3">
{{x-icon "alert-circle-outline"}}
<span class="name" data-test-name>Directory is empty</span>
</td>
</tr>
</tbody>
{{/if}}
{{/list-table}}
{{/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}}
Expand All @@ -46,4 +46,4 @@
</p>
</div>
{{/if}}
</section>
</section>
3 changes: 1 addition & 2 deletions ui/tests/acceptance/task-fs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ module('Acceptance | task fs', function(hooks) {
test('viewing an empty directory', async function(assert) {
await FS.visitPath({ id: allocation.id, name: task.name, path: '/empty-directory' });

assert.equal(FS.directoryEntries.length, 1);
assert.ok(FS.directoryEntries[0].isEmpty);
assert.ok(FS.isEmptyDirectory);
});

test('viewing paths that produce stat API errors', async function(assert) {
Expand Down
3 changes: 2 additions & 1 deletion ui/tests/pages/allocations/task/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default create({

isFile: isPresent('.icon-is-file-outline'),
isDirectory: isPresent('.icon-is-folder-outline'),
isEmpty: isPresent('.icon-is-alert-circle-outline'),

size: text('[data-test-size]'),
lastModified: text('[data-test-last-modified]'),
Expand All @@ -51,6 +50,8 @@ export default create({
path: attribute('href', 'a'),
}),

isEmptyDirectory: isPresent('[data-test-empty-directory]'),

directoryEntryNames() {
return this.directoryEntries.toArray().mapBy('name');
},
Expand Down

0 comments on commit 1783a7a

Please sign in to comment.