TRIX-22 fixed illegible memory/disk filters

This commit is contained in:
Dragos 2021-05-31 17:19:33 +03:00
parent 386b3593eb
commit 0a6a8b1eeb
4 changed files with 44 additions and 54 deletions

View File

@ -142,7 +142,8 @@
<!-- Volumes and disks --> <!-- Volumes and disks -->
<div class="mt-3 d-flex flex-column"> <div class="mt-3 d-flex flex-column">
<button class="btn btn-outline-info text-start mb-2" (click)="showVolumes = !showVolumes"> <button class="btn text-start mb-2" [class.btn-outline-info]="!showVolumes" [class.btn-info]="showVolumes"
(click)="showVolumes = !showVolumes">
Volumes Volumes
<fa-icon icon="angle-right" [fixedWidth]="true" [rotate]="showVolumes ? 90 : 0" class="float-end"></fa-icon> <fa-icon icon="angle-right" [fixedWidth]="true" [rotate]="showVolumes ? 90 : 0" class="float-end"></fa-icon>
</button> </button>
@ -192,60 +193,37 @@
<!-- Affinity settings --> <!-- Affinity settings -->
<div class="mt-3 d-flex flex-column" *ngIf="instances && instances.length"> <div class="mt-3 d-flex flex-column" *ngIf="instances && instances.length">
<button class="btn btn-outline-info text-start w-100 mb-2" (click)="showAffinity = !showAffinity"> <button class="btn text-start w-100 mb-2" [class.btn-outline-info]="!showAffinity" [class.btn-info]="showAffinity"
Affinity (click)="showAffinity = !showAffinity">
Affinity rules
<fa-icon icon="angle-right" [fixedWidth]="true" [rotate]="showAffinity ? 90 : 0" class="float-end"></fa-icon> <fa-icon icon="angle-right" [fixedWidth]="true" [rotate]="showAffinity ? 90 : 0" class="float-end"></fa-icon>
</button> </button>
<div [collapse]="!showAffinity"> <div [collapse]="!showAffinity">
<div class="row"> <div class="row">
<div class="col-sm-6" formGroupName="affinity"> <div class="col-sm-4">
<h5>Place close to</h5> <select class="form-select" name="operator">
<option></option>
<div class="select-list" tabindex="0"> <option value="==">Must be close to instances</option>
<div class="form-check"> <option value="==~">Should be close to instances</option>
<input class="form-check-input" type="radio" id="closeTo" [value]="null" formControlName="closeTo"> <option value="!=">Must be far from instances</option>
<label class="form-check-label" for="closeTo"> <option value="!=~">Should be far from instances</option>
(no preference) </select>
</label>
</div> </div>
<div class="col-sm-3">
<div class="form-check" *ngFor="let instance of instances"> <select class="form-select" name="target">
<input class="form-check-input" type="radio" id="closeTo-{{ instance.id }}" [value]="instance.id" formControlName="closeTo"> <option></option>
<label class="form-check-label" for="closeTo-{{ instance.id }}"> <option value="instance">Named like</option>
{{ instance.name }} <option value="tagName">Tagged with</option>
</label> </select>
</div> </div>
<div class="col-sm-4">
<input type="text" class="form-control" placeholder="Value">
</div> </div>
</div> <div class="col-sm-1">
<button class="btn btn-outline-info">
<div class="col-sm-6" formGroupName="affinity"> <fa-icon icon="plus"></fa-icon>
<h5>Place far from</h5> </button>
<div class="select-list" tabindex="0">
<div class="form-check">
<input class="form-check-input" type="radio" id="farFrom" [value]="null" formControlName="farFrom">
<label class="form-check-label" for="farFrom">
(no preference)
</label>
</div>
<div class="form-check" *ngFor="let instance of instances">
<input class="form-check-input" type="radio" id="farFrom-{{ instance.id }}" [value]="instance.id" formControlName="farFrom">
<label class="form-check-label" for="farFrom-{{ instance.id }}">
{{ instance.name }}
</label>
</div>
</div>
</div>
<div class="col-sm" formGroupName="affinity">
<div class="form-check ms-0">
<input class="form-check-input" type="checkbox" id="strict" formControlName="strict">
<label class="form-check-label" for="strict">
Provision only when the affinity criteria are met
</label>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -372,6 +372,8 @@ export class InstanceWizardComponent implements OnInit, OnDestroy
mountpoint: volume.mountpoint mountpoint: volume.mountpoint
})); }));
console.log(this.editorForm.get('affinity'));
this.instancesService.add(instance) this.instancesService.add(instance)
.subscribe(x => .subscribe(x =>
{ {

View File

@ -276,7 +276,7 @@
<fieldset class="filters"> <fieldset class="filters">
<ng-container formGroupName="filters"> <ng-container formGroupName="filters">
<div class="dropdown-header">{{ 'dashboard.list.filterByState' | translate }}</div> <div class="dropdown-header">{{ 'dashboard.list.filterByState' | translate }}</div>
<div class="btn-group w-100 mb-3" dropdown> <div class="btn-group w-100" dropdown>
<button class="btn btn-state-filter dropdown-toggle d-flex justify-content-between align-items-center" <button class="btn btn-state-filter dropdown-toggle d-flex justify-content-between align-items-center"
dropdownToggle> dropdownToggle>
<span *ngIf="!editorForm.get(['filters', 'stateFilter']).value"> <span *ngIf="!editorForm.get(['filters', 'stateFilter']).value">
@ -313,13 +313,18 @@
</ul> </ul>
</div> </div>
<ng-container *ngIf="memoryFilterOptions.stepsArray.length > 1">
<div class="dropdown-header">{{ 'dashboard.list.filterByMemory' | translate }}</div> <div class="dropdown-header">{{ 'dashboard.list.filterByMemory' | translate }}</div>
<ngx-slider class="mb-4" formControlName="memoryFilter" [options]="memoryFilterOptions"></ngx-slider> <ngx-slider class="mb-4" formControlName="memoryFilter" [options]="memoryFilterOptions"></ngx-slider>
</ng-container>
<ng-container *ngIf="diskFilterOptions.stepsArray.length > 1">
<div class="dropdown-header">{{ 'dashboard.list.filterByDisk' | translate }}</div> <div class="dropdown-header">{{ 'dashboard.list.filterByDisk' | translate }}</div>
<ngx-slider class="mb-3" formControlName="diskFilter" [options]="diskFilterOptions"></ngx-slider> <ngx-slider class="mb-3" formControlName="diskFilter" [options]="diskFilterOptions"></ngx-slider>
</ng-container>
<button class="btn btn-outline-dark w-100 mt-3" (click)="clearFilters()"> <button *ngIf="memoryFilterOptions.stepsArray.length > 1 && diskFilterOptions.stepsArray.length > 1"
class="btn btn-outline-dark w-100 mt-3" (click)="clearFilters()">
{{ 'dashboard.list.resetFilters' | translate }} {{ 'dashboard.list.resetFilters' | translate }}
</button> </button>
</ng-container> </ng-container>

View File

@ -109,6 +109,11 @@
.filters .filters
{ {
width: 240px; width: 240px;
.btn-group + *
{
margin-top: 1rem;
}
} }
.form-check-label .form-check-label