open-vault/ui/app/templates/components/raft-storage-overview.hbs

110 lines
3.1 KiB
Handlebars
Raw Normal View History

UI - raft config and snapshotting (#7410) * add storage route * template out the routes and new raft storage overview * fetch raft config and add new server model * pngcrush the favicon * add view components and binary-file component * add form-save-buttons component * adjust rawRequest so that it can send a request body and returns the response on errors * hook up restore * rename binary-file to file-to-array-buffer * add ember-service-worker * use forked version of ember-service-worker for now * scope the service worker to a single endpoint * show both download buttons for now * add service worker download with a fallback to JS in-mem download * add remove peer functionality * lint go file * add storage-type to the cluster and node models * update edit for to take a cancel action * separate out a css table styles to be used by http-requests-table and on the raft-overview component * add raft-join adapter, model, component and use on the init page * fix styling and gate the menu item on the cluster using raft storage * style tweaks to the raft-join component * fix linting * add form-save-buttons component to storybook * add cancel functionality for backup uploads, and add a success message for successful uploads * add component tests * add filesize.js * add filesize and modified date to file-to-array-buffer * fix linting * fix server section showing in the cluster nav * don't use babel transforms in service worker lib because we don't want 2 copies of babel polyfill * add file-to-array-buffer to storybook * add comments and use removeObjectURL to raft-storage-overview * update alert-banner markdown * messaging change for upload alert banner * Update ui/app/templates/components/raft-storage-restore.hbs Co-Authored-By: Joshua Ogle <joshua@joshuaogle.com> * more comments * actually render the label if passed and update stories with knobs
2019-10-14 18:23:29 +00:00
<PageHeader as |p|>
<p.levelLeft>
<h1 class="title is-3">
Raft Storage
</h1>
</p.levelLeft>
</PageHeader>
<Toolbar>
<ToolbarActions>
<BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
as |D|
>
<D.trigger
data-test-popup-menu-trigger="true"
@class={{concat "toolbar-link" (if D.isOpen " is-active")}}
@tagName="button"
>
Snapshots
<Chevron @direction="down" @isButton={{true}} />
</D.trigger>
<D.content @class="popup-menu-content">
<nav class="box menu">
<ul class="menu-list">
<li class="action">
{{#if this.useServiceWorker}}
<a href="/v1/sys/storage/raft/snapshot" onclick={{queue (action "downloadViaServiceWorker") (action D.actions.close)}}>
Download
</a>
{{else}}
<button type="button" class="link is-ghost" onclick={{queue (action "downloadSnapshot") (action D.actions.close)}}>
Download
</button>
{{/if}}
</li>
<li class="action">
{{#link-to "vault.cluster.storage-restore"}}
Restore
{{/link-to}}
</li>
</ul>
</nav>
</D.content>
</BasicDropdown>
</ToolbarActions>
</Toolbar>
<table class="vlt-table is-fullwidth">
<caption class="is-collapsed">Raft servers</caption>
<thead class="has-text-weight-semibold">
<tr>
<th scope="col">Address</th>
<th scope="col">Voter</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{{#each @model as |server|}}
<tr data-raft-row>
<td>
{{server.address}}
{{#if server.leader}}
<span class="tag">Leader</span>
{{/if}}
</td>
<td>
{{#if server.voter}}
<Icon
aria-label="Yes"
class="icon-true has-text-success"
@size="l"
@glyph="check-circle-outline"
/>
{{else}}
<Icon
aria-label="No"
class="icon-false"
@size="l"
@glyph="cancel-square-outline"
/>
{{/if}}
</td>
<td class="middle no-padding has-text-right">
<PopupMenu>
<Confirm as |c|>
<nav>
<ul>
<li class="action">
<c.Message
@id={{server.nodeId}}
@onConfirm={{action "removePeer" server}}
@triggerText="Remove Peer"
@confirmButtonText="Remove"
@title={{concat "Remove " server.nodeId "?"}}
@message="This will remove the server from the raft cluster."
/>
</li>
</ul>
</nav>
</Confirm>
</PopupMenu>
</td>
</tr>
{{/each}}
</tbody>
</table>