WIP: [UC Backup] BackupStorageLocation UX improvements#7972
WIP: [UC Backup] BackupStorageLocation UX improvements#7972SamuAlfageme wants to merge 7 commits intokubermatic:mainfrom
Conversation
|
Adding the "do-not-merge/test-issue-needed" label because no test-issue block was detected, please add a proper test-issue block to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @SamuAlfageme. Thanks for your PR. I'm waiting for a kubermatic member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
231fbb2 to
fc501a5
Compare
|
/ok-to-test |
|
@SamuAlfageme can your run |
fc501a5 to
85b3894
Compare
85b3894 to
3d3f94e
Compare
- Filter by 'available' BackupStorageLocation. - New '+ Create Backup Storage Location' option. Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
... apply to BSL Creation and Edition: - DNS validation for 'Region' and 'Endpoint URL' (& http(s) for the latter) - Explicit "Optional" on 'Access Key ID' and 'Secret Access Key' for anonymous login - Allow to copy BSL error messages on click from the BackupStorageLocation view Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
You can expect the user knows what it's doing while using 'custom config' so,
no need to enforce string validation on the custom YAML
Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
... on the 'Edit cluster' modal: the checkbox to enable UC Backup and the BSL dropdown were split by the new 'Skip router reconciliation' on OpenStack DCs Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
Replicate the same behaviour from the cluster creation wizard: - '+ Create Backup Storage Location' (modal on top of modal) - Filter by 'available' BSLs on the dropdown Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
3b3b6f0 to
d663049
Compare
d663049 to
d0e88a8
Compare
Dynamical imports for AddBackupStorageLocationDialogComponent on the wizard and the edit-cluster dialog to fix the CI tests. Signed-off-by: Samuel Alfageme Sainz <samuel@alfage.me>
d0e88a8 to
0f3bafe
Compare
| <mat-option [value]="bsl.name">{{bsl.displayName}} | ||
| </mat-option> | ||
| } | ||
| <mat-option [value]="createBackupStorageLocationOptionValue">+ Create Backup Storage Location</mat-option> |
There was a problem hiding this comment.
Good point! I forgot this pattern exists already somewhere in the Dashboard. I'll adapt the PR to use it too 👍
There was a problem hiding this comment.
@ahmadhamzh btw, for the "edit UC" view, opening the 'Create BSL' modal over the 'Edit Cluster' modal is something that is not done somewhere else in the Dashboard IIRC, does that work for you?
There was a problem hiding this comment.
Good point — I think we shouldn’t have that at all. So for cluster editing, we shouldn’t include an option to add a storage location at least for now.
There was a problem hiding this comment.
IMO, dialog over a dialog is not a problem because i have seen this sort of behaviour in other applicaiton when supporting inline option e.g add-bsl dialog but I think what Ahmed said we shouldn't provide this option for edit cluster?
But I am also thinking what if there are existing cluster and need to backup in different locaiton how those scenario would be handled?
There was a problem hiding this comment.
I like suggestion what ahmed has suggested of adding "+ Add BSL Button" which is better instead of adding inside Dropdown option
- More clear/explicit
- And we can opt this change adding behaviour for wizard (if not going for edit dialog)
There was a problem hiding this comment.
But I am also thinking what if there are existing cluster and need to backup in different locaiton how those scenario would be handled?
users can add them from the cluster backups > Storage Locations and then use them in the edit dialog
| }); | ||
| } | ||
|
|
||
| async onBackupStorageLocationSelectionChange(event: MatSelectChange<string>): Promise<void> { |
There was a problem hiding this comment.
Async/await is working fine, but since the rest of the component uses RxJS pipelines, I think it’s better to stay consistent with that approach.
|
|
||
| const AddBackupStorageLocationDialogComponent = await DynamicModule.AddBackupStorageLocationDialogComponent; | ||
| if (!AddBackupStorageLocationDialogComponent) { | ||
| return; | ||
| } | ||
| this._matDialog | ||
| .open(AddBackupStorageLocationDialogComponent, { | ||
| data: {projectID: this.projectID}, | ||
| }) | ||
| .afterClosed() | ||
| .pipe(take(1), filter(Boolean)) |
There was a problem hiding this comment.
Maybe something like this would be more consistent with the rest of the code.
| const AddBackupStorageLocationDialogComponent = await DynamicModule.AddBackupStorageLocationDialogComponent; | |
| if (!AddBackupStorageLocationDialogComponent) { | |
| return; | |
| } | |
| this._matDialog | |
| .open(AddBackupStorageLocationDialogComponent, { | |
| data: {projectID: this.projectID}, | |
| }) | |
| .afterClosed() | |
| .pipe(take(1), filter(Boolean)) | |
| from(DynamicModule.AddBackupStorageLocationDialogComponent) | |
| .pipe( | |
| filter(Boolean), | |
| switchMap(component => | |
| this._matDialog.open(component, {data: {projectID: this.projectID}}).afterClosed() | |
| ), | |
| take(1), | |
| filter(Boolean), | |
| ) |
| } | ||
|
|
||
| private _isBackupStorageLocationAvailable(bsl: BackupStorageLocation): boolean { | ||
| const status = bsl.status?.phase || bsl.spec?.status || ''; |
There was a problem hiding this comment.
i don't think we need to check for status cause it will never be available
| const status = bsl.status?.phase || bsl.spec?.status || ''; | |
| return bsl.status?.phase.toLowerCase() === 'available' |
| return bsl; | ||
| } | ||
|
|
||
| private _dnsNameValidator(): ValidatorFn { |
There was a problem hiding this comment.
We usually add validators in src/app/shared/validators
There was a problem hiding this comment.
We do have a file shared/validators/others.ts where have defined all regex in case needed in other place IMO, regex that is reusable can be put into this file
let me wdyt?
There was a problem hiding this comment.
well after another look i don't think we need this method just to repeat the same regex check.
we can update the regex value to include the .
| return bsl; | ||
| } | ||
|
|
||
| private _dnsNameValidator(): ValidatorFn { |
There was a problem hiding this comment.
We do have a file shared/validators/others.ts where have defined all regex in case needed in other place IMO, regex that is reusable can be put into this file
let me wdyt?
| } | ||
|
|
||
| const labels = value.split('.'); | ||
| return labels.every(label => this._dnsLabelRegex.test(label)) ? null : {invalidDnsName: true}; |
There was a problem hiding this comment.
just to double confirm?
values like
- us-east-1 ✅
- us east 1 ❌
- us-east-1- ❌
- _us-east-1 ❌
are not valid DNS
| return null; | ||
| } | ||
|
|
||
| if (!/^https?:\/\//i.test(value)) { |
There was a problem hiding this comment.
Just to double confirm if following values are not valid test value?
- http://minio.local. ❌ (FQDN trailing dot rejected before)
- https://[::1]:9000 (IPv6) ❌
- https://s3_internal.lan:9000 (underscore host) ❌
| private _isBackupStorageLocationAvailable(bsl: BackupStorageLocation): boolean { | ||
| const status = bsl.status?.phase || bsl.spec?.status || ''; | ||
| return status.toLowerCase() === 'available'; | ||
| } |
There was a problem hiding this comment.
FYI:
This comment should be taken into consideraiton incase we OPT to choose to changes in (Edit Cluster Dialog
Otherwise ignore this refactoring
I see this method duplicate can we move to src/app/shared/entity/backup.ts path wdyt?
I was checking codebase something we are doing
like that usingnamespaces concept.
Ideally, i though it shouldn't be part of entity/ folder bcz IMO, we have kept all classes or interfaces but also it make sense to keep backup relateed things there even if there are shared utils as like defined here
src/app/shared/utils
something like we are doing here
as this method is used in both place
- wizard
- edit cluster dialog
| }) | ||
| export class AddBackupStorageLocationDialogComponent implements OnInit, OnDestroy { | ||
| private readonly _unsubscribe = new Subject<void>(); | ||
| private readonly _dnsLabelRegex = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i; |
There was a problem hiding this comment.
this can be change to include the . and then we don't need to use _dnsNameValidator() method.
we can add
export const DNS_VALIDATOR = Validators.pattern(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i)
to the shared/validators/others.ts file
| [Controls.Region]: this._builder.control(this._config.bslObject?.spec.config?.region ?? ''), | ||
| [Controls.Endpoints]: this._builder.control(this._config.bslObject?.spec.config?.s3Url ?? ''), | ||
| [Controls.Region]: this._builder.control(this._config.bslObject?.spec.config?.region ?? '', [ | ||
| this._dnsNameValidator(), |
There was a problem hiding this comment.
| this._dnsNameValidator(), | |
| DNS_VALIDATOR, |
|
|
||
| try { | ||
| const url = new URL(value); | ||
| if (!['http:', 'https:'].includes(url.protocol)) { |
There was a problem hiding this comment.
i think if we have this check then we don't need the the previous condition if (!/^https?:\/\//i.test(value)) cause i think both do the same check, right ?
|
@SamuAlfageme thanks for the contribution! Could you please review the feedback and let us know if anything is unclear? We’ve added a few comments for clarity and alignment. If possible, please address the requested updates. Appreciate your effort. |
|
/hold |
|
Hi @KhizerRehan, thank you for taking the time (together with @ahmadhamzh) to review this PR! I've been a bit busier than usual, but I should find some time to address your comments later this week. |

What this PR does / why we need it:
This introduces a few UX improvements on the handling of
BackupStorageLocations(BSLs) for the UC Backup feature. These apply to both, the Cluster Creation Wizard and "Edit cluster" dialogue.Edit dialog
http(s)for the latter).Which issue(s) this PR fixes: N/A
What type of PR is this?
/kind design
Special notes for your reviewer:
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: