New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mgr/dashboard: rbd mirroring promotion/demotion UI #46524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a few comments over there.
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html
Outdated
Show resolved
Hide resolved
| <span *ngIf="row.primary === true" | ||
| class="badge badge-info">primary</span> | ||
| <span *ngIf="row.primary === false" | ||
| class="badge badge-info">non-primary</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add the i18n property, since Dashboard is officially internationalized. BTW Bootstrap has a primary/secondary style for the badges. The following example uses the ngIf-Else clause (the else is often skipped, but I like to highlight that only one value is displayed):
<span i18n *ngIf="row.primary === true else secondary" class="badge badge-primary">
primary
</span>
<ng-template #secondary>
<span i18n class="badge badge-secondary">
secondary
</span>
</ng-template>Or with ngClass and ICU plural:
<span i18n class="badge" [ngClass]="row.primary ? 'badge-primary' : 'badge-secondary'">
{row.primary, plural, =1 {primary}, =0 {secondary}}
</span>| const promoteAction: CdTableAction = { | ||
| permission: 'update', | ||
| icon: Icons.edit, | ||
| click: () => this.actionPrimary(true), | ||
| name: this.actionLabels.PROMOTE, | ||
| visible: () => (this.selection.first() != null && !this.selection.first().primary) | ||
| ? true : false | ||
| }; | ||
| const demoteAction: CdTableAction = { | ||
| permission: 'update', | ||
| icon: Icons.edit, | ||
| click: () => this.actionPrimary(false), | ||
| name: this.actionLabels.DEMOTE, | ||
| visible: () => (this.selection.first() != null && this.selection.first().primary) | ||
| ? true : false | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than creating a couple of actions for promoting/demoting (imperative approach), what about adding a checkbox primary in the RBD edit form (declarative)? This is a question open to everyone, @ceph/dashboard ?
In this very case I may see the point for each approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it felt right to have these as actions, because I feel like a user that knows how this works would try to click on an action first. I prefer them as actions tbh but I understand why you want to go full declarative here.
| @@ -502,6 +520,24 @@ export class RbdListComponent extends ListWithDetails implements OnInit { | |||
| }); | |||
| } | |||
|
|
|||
| actionPrimary(primary: boolean) { | |||
| const request = new RbdFormEditRequestModel(); | |||
| request.primary = primary; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so in the back-end we're doing the declarative approach, right?
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
846d45d
to
b084e02
Compare
I'll do the rebase later, when the branches are merged.
Development of interface for rbd image promotion/demotion actions.
Having issues updating primary attribute for rbd image journal mode.
Updating rbd image snapshot mode, working as intended:
screen-capture.1.mp4
When updating rbd image journal mode, I'm getting errno 22 as a response. Video and image of the issue:
screen-capture.mp4
Fixes: https://tracker.ceph.com/issues/55860
Signed-off-by: Pedro Gonzalez Gomez pegonzal@redhat.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows