Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] mgr/dashboard: support editing block mirror pools
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
- Loading branch information
Jason Dillaman
committed
Nov 21, 2018
1 parent
7a1b5f6
commit 10e09be
Showing
13 changed files
with
373 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...end/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<cd-modal> | ||
<ng-container i18n | ||
class="modal-title">Edit pool mirror mode</ng-container> | ||
|
||
<ng-container class="modal-content"> | ||
<form name="editModeForm" | ||
class="form" | ||
#formDir="ngForm" | ||
[formGroup]="editModeForm" | ||
novalidate> | ||
<div class="modal-body"> | ||
<p> | ||
<ng-container i18n>To edit the mirror mode for pool</ng-container> | ||
<kbd>{{ poolName }}</kbd> | ||
<ng-container i18n>, select a new mode from the list and click</ng-container> | ||
<kbd i18n>Update</kbd>. | ||
</p> | ||
|
||
<div class="form-group" | ||
[ngClass]="{'has-error': editModeForm.showError('mirrorMode', formDir)}"> | ||
<label class="control-label" | ||
for="mirrorMode"> | ||
<span i18n>Mode</span> | ||
</label> | ||
<select id="mirrorMode" | ||
name="mirrorMode" | ||
class="form-control" | ||
formControlName="mirrorMode"> | ||
<option *ngFor="let mirrorMode of mirrorModes" | ||
[value]="mirrorMode.id">{{ mirrorMode.name }}</option> | ||
</select> | ||
<span class="help-block" | ||
*ngIf="editModeForm.showError('mirrorMode', formDir, 'cannotDisable')" | ||
i18n>Peer clusters must be removed prior to disabling mirror.</span> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<div class="button-group text-right"> | ||
<cd-submit-button i18n | ||
[form]="editModeForm" | ||
(submitAction)="update()">Update</cd-submit-button> | ||
<button i18n | ||
type="button" | ||
class="btn btn-sm btn-default" | ||
(click)="modalRef.hide()">Cancel</button> | ||
</div> | ||
</div> | ||
</form> | ||
</ng-container> | ||
</cd-modal> |
Empty file.
Empty file.
63 changes: 63 additions & 0 deletions
63
...ntend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FormControl, Validators } from '@angular/forms'; | ||
|
||
import * as moment from 'moment'; | ||
import { BsModalRef } from 'ngx-bootstrap/modal'; | ||
|
||
import { RbdService } from '../../../../shared/api/rbd.service'; | ||
import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder'; | ||
import { CdFormGroup } from '../../../../shared/forms/cd-form-group'; | ||
import { CdValidators } from '../../../../shared/forms/cd-validators'; | ||
import { ExecutingTask } from '../../../../shared/models/executing-task'; | ||
import { FinishedTask } from '../../../../shared/models/finished-task'; | ||
import { TaskWrapperService } from '../../../../shared/services/task-wrapper.service'; | ||
|
||
@Component({ | ||
selector: 'cd-pool-edit-mode-modal', | ||
templateUrl: './pool-edit-mode-modal.component.html', | ||
styleUrls: ['./pool-edit-mode-modal.component.scss'] | ||
}) | ||
export class PoolEditModeModalComponent implements OnInit { | ||
metaType: string; | ||
poolName: string; | ||
mirrorMode: string; | ||
executingTasks: ExecutingTask[]; | ||
|
||
editModeForm: CdFormGroup; | ||
bsConfig = { | ||
containerClass: 'theme-default' | ||
}; | ||
pattern: string; | ||
|
||
mirrorModes: Array<{id: string, name: string}> = [ | ||
{id: 'disabled', name: 'Disabled'}, | ||
{id: 'pool', name: 'Pool'}, | ||
{id: 'image', name: 'Image'} | ||
]; | ||
|
||
constructor( | ||
private rbdService: RbdService, | ||
public modalRef: BsModalRef, | ||
private fb: CdFormBuilder, | ||
private taskWrapper: TaskWrapperService | ||
) { | ||
this.createForm(); | ||
} | ||
|
||
createForm() { | ||
this.editModeForm = new CdFormGroup({ | ||
mirrorMode: new FormControl('', { | ||
validators: [Validators.required] | ||
}) | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
this.pattern = `${this.poolName}/${this.mirrorMode}`; | ||
} | ||
|
||
update() { | ||
// TODO | ||
this.modalRef.hide(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...end/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<cd-modal> | ||
<ng-container i18n | ||
class="modal-title">Edit pool mirror peer</ng-container> | ||
|
||
<ng-container class="modal-content"> | ||
<form name="editPeerForm" | ||
class="form" | ||
#formDir="ngForm" | ||
[formGroup]="editPeerForm" | ||
novalidate> | ||
<div class="modal-body"> | ||
<p> | ||
<ng-container i18n>To edit the mirror mode for pool</ng-container> | ||
<kbd>{{ poolName }}</kbd> | ||
<ng-container i18n>, select a new mode from the list and click</ng-container> | ||
<kbd i18n>Update</kbd>. | ||
</p> | ||
|
||
<div class="form-group" | ||
[ngClass]="{'has-error': editPeerForm.showError('mirrorMode', formDir)}"> | ||
<label class="control-label" | ||
for="mirrorMode"> | ||
<span i18n>Mode</span> | ||
</label> | ||
<select id="mirrorMode" | ||
name="mirrorMode" | ||
class="form-control" | ||
formControlName="mirrorMode"> | ||
<option *ngFor="let mirrorMode of mirrorModes" | ||
[value]="mirrorMode.id">{{ mirrorMode.name }}</option> | ||
</select> | ||
<span class="help-block" | ||
*ngIf="editPeerForm.showError('mirrorMode', formDir, 'cannotDisable')" | ||
i18n>Peer clusters must be removed prior to disabling mirror.</span> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<div class="button-group text-right"> | ||
<cd-submit-button i18n | ||
[form]="editPeerForm" | ||
(submitAction)="update()">Update</cd-submit-button> | ||
<button i18n | ||
type="button" | ||
class="btn btn-sm btn-default" | ||
(click)="modalRef.hide()">Cancel</button> | ||
</div> | ||
</div> | ||
</form> | ||
</ng-container> | ||
</cd-modal> |
Empty file.
Empty file.
63 changes: 63 additions & 0 deletions
63
...ntend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FormControl, Validators } from '@angular/forms'; | ||
|
||
import * as moment from 'moment'; | ||
import { BsModalRef } from 'ngx-bootstrap/modal'; | ||
|
||
import { RbdService } from '../../../../shared/api/rbd.service'; | ||
import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder'; | ||
import { CdFormGroup } from '../../../../shared/forms/cd-form-group'; | ||
import { CdValidators } from '../../../../shared/forms/cd-validators'; | ||
import { ExecutingTask } from '../../../../shared/models/executing-task'; | ||
import { FinishedTask } from '../../../../shared/models/finished-task'; | ||
import { TaskWrapperService } from '../../../../shared/services/task-wrapper.service'; | ||
|
||
@Component({ | ||
selector: 'cd-pool-edit-peer-modal', | ||
templateUrl: './pool-edit-peer-modal.component.html', | ||
styleUrls: ['./pool-edit-peer-modal.component.scss'] | ||
}) | ||
export class PoolEditPeerModalComponent implements OnInit { | ||
metaType: string; | ||
poolName: string; | ||
mirrorMode: string; | ||
executingTasks: ExecutingTask[]; | ||
|
||
editPeerForm: CdFormGroup; | ||
bsConfig = { | ||
containerClass: 'theme-default' | ||
}; | ||
pattern: string; | ||
|
||
mirrorModes: Array<{id: string, name: string}> = [ | ||
{id: 'disabled', name: 'Disabled'}, | ||
{id: 'pool', name: 'Pool'}, | ||
{id: 'image', name: 'Image'} | ||
]; | ||
|
||
constructor( | ||
private rbdService: RbdService, | ||
public modalRef: BsModalRef, | ||
private fb: CdFormBuilder, | ||
private taskWrapper: TaskWrapperService | ||
) { | ||
this.createForm(); | ||
} | ||
|
||
createForm() { | ||
this.editPeerForm = new CdFormGroup({ | ||
mirrorMode: new FormControl('', { | ||
validators: [Validators.required] | ||
}) | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
this.pattern = `${this.poolName}/${this.mirrorMode}`; | ||
} | ||
|
||
update() { | ||
// TODO | ||
this.modalRef.hide(); | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
...nd/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.