sc-portal/app/src/app/volumes/volumes.component.html

114 lines
5.1 KiB
HTML

<div class="d-flex flex-column h-100">
<div class="container text-center mt-1">
<div class="btn-toolbar pt-2" [formGroup]="editorForm">
<div class="btn-group flex-grow-1 flex-grow-sm-0">
<button class="btn btn-lg btn-info" (click)="showEditor()" [disabled]="loadingIndicator">
Create a new volume
</button>
</div>
<span class="d-none d-sm-block flex-grow-1"></span>
<ng-container *ngIf="volumes && volumes.length">
<div class="input-group input-group-pill flex-grow-1 flex-grow-sm-0 me-sm-3 w-sm-auto w-100">
<input type="text" class="form-control" placeholder="Search by name..." formControlName="searchTerm" appAlphaOnly="^[A-Za-z0-9_-]+$">
<button class="btn btn-outline-info" type="button" (click)="clearSearch()" [disabled]="!editorForm.get('searchTerm').value"
tooltip="Clear search" container="body" placement="top" [adaptivePosition]="false">
<fa-icon icon="times" size="sm" [fixedWidth]="true"></fa-icon>
</button>
</div>
<div class="btn-group flex-grow-1 flex-grow-sm-0 w-sm-auto w-100" dropdown placement="bottom left">
<button class="btn btn-outline-info dropdown-toggle" dropdownToggle>
Sort by {{ editorForm.get('sortProperty').value === 'vlan_id' ? 'id' : editorForm.get('sortProperty').value }}
</button>
<ul id="dropdown-split" *dropdownMenu class="dropdown-menu dropdown-menu-right" role="menu">
<li role="menuitem">
<button class="dropdown-item" [class.active]="editorForm.get('sortProperty').value === 'name'" (click)="setSortProperty('name')">
Name
</button>
</li>
<li role="menuitem">
<button class="dropdown-item" [class.active]="editorForm.get('sortProperty').value === 'size'" (click)="setSortProperty('size')">
Size
</button>
</li>
</ul>
</div>
</ng-container>
</div>
<div class="spinner-border text-center text-info text-faded" role="status" *ngIf="loadingIndicator">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<div class="overflow-auto flex-grow-1 my-3">
<div class="container my-2">
<div class="table-responsive" *ngIf="!loadingIndicator">
<p *ngIf="!volumes.length" class="text-center text-info text-faded p-3 mb-0">
There are no volumes yet.
</p>
<table class="table table-hover" *ngIf="volumes.length">
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Networks</th>
<th>Tags</th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let volume of listItems">
<td>
<b>{{ volume.name }}</b>
</td>
<td>
{{ volume.size * 1024 * 1024 | fileSize}}
</td>
<td>
<ul class="list-inline mb-0">
<li class="list-inline-item" *ngFor="let network of volume.networks">{{ networks[network] || network }}</li>
</ul>
</td>
<td>
<span class="badge badge-discreet" *ngFor="let tag of volume.tags | keyvalue">
{{ tag.key }}:{{ tag.value }}
</span>
</td>
<td class="text-end">
<div class="btn-group btn-group-sm" dropdown placement="bottom right" container="body" [isDisabled]="volume.working"
*ngIf="!volume.refs || !volume.refs.length">
<button class="btn btn-link text-info" [disabled]="volume.working" (click)="renameVolume(volume)"
tooltip="Rename this volume" container="body" placement="top" [adaptivePosition]="false">
<fa-icon icon="pen" [fixedWidth]="true" size="sm"></fa-icon>
</button>
<button class="btn btn-link text-info" dropdownToggle
tooltip="More options" container="body" placement="top" [adaptivePosition]="false">
<fa-icon icon="ellipsis-v" [fixedWidth]="true" size="sm"></fa-icon>
</button>
<ul id="dropdown-split" *dropdownMenu class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="button-split">
<li role="menuitem">
<button class="dropdown-item" (click)="deleteVolume(volume)">
<fa-icon icon="trash" [fixedWidth]="true"></fa-icon>
Delete this volume
</button>
</li>
</ul>
</div>
<fa-icon icon="lock" class="in-use text-danger text-faded" *ngIf="volume.refs && volume.refs.length"
tooltip="In use by one or more machines" container="body" placement="top" [adaptivePosition]="false">
</fa-icon>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>