Skip to content

Commit

Permalink
NAS-131332: TrueCloud Backup Folder field with new bucket errors (#10856
Browse files Browse the repository at this point in the history
)

(cherry picked from commit c7b7168)

Co-authored-by: Alex Karpov <[email protected]>
  • Loading branch information
bugclerk and AlexKarpov98 authored Oct 13, 2024
1 parent 8e83301 commit ccd8372
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,23 @@
></ix-input>
}
@if (form.controls.folder.enabled) {
<ix-explorer
formControlName="folder"
root="/"
[label]="helptext.folder_placeholder | translate"
[tooltip]="helptext.folder_tooltip | translate"
[nodeProvider]="bucketNodeProvider"
[required]="true"
></ix-explorer>
@if (isNewBucketOptionSelected) {
<ix-input
formControlName="folder"
[label]="helptext.folder_placeholder | translate"
[tooltip]="helptext.folder_tooltip | translate"
[required]="true"
></ix-input>
} @else {
<ix-explorer
formControlName="folder"
root="/"
[label]="helptext.folder_placeholder | translate"
[tooltip]="helptext.folder_tooltip | translate"
[nodeProvider]="bucketNodeProvider"
[required]="true"
></ix-explorer>
}
}
</ix-fieldset>
<ix-fieldset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class CloudBackupFormComponent implements OnInit {
return !this.editingTask;
}

get isNewBucketOptionSelected(): boolean {
return this.form.value.bucket === newOption;
}

get title(): string {
return this.isNew
? this.translate.instant('Add TrueCloud Backup Task')
Expand Down Expand Up @@ -245,7 +249,7 @@ export class CloudBackupFormComponent implements OnInit {
this.isLoading = true;

let createBucket$: Observable<unknown> = of(null);
if (!!this.form.value.bucket_input && this.form.value.bucket === newOption) {
if (!!this.form.value.bucket_input && this.isNewBucketOptionSelected) {
createBucket$ = this.ws.call('cloudsync.create_bucket', [this.form.value.credentials, this.form.value.bucket_input]);
}

Expand Down Expand Up @@ -279,7 +283,7 @@ export class CloudBackupFormComponent implements OnInit {
private prepareData(formValue: FormValue): CloudBackupUpdate {
const attributes: CloudBackupUpdate['attributes'] = {
folder: formValue.folder,
bucket: this.form.value.bucket_input && this.form.value.bucket === newOption
bucket: this.form.value.bucket_input && this.isNewBucketOptionSelected
? this.form.value.bucket_input
: formValue.bucket,
};
Expand Down

0 comments on commit ccd8372

Please sign in to comment.