Skip to content

Commit

Permalink
NAS-132227: Fix enable change in SMB table
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Vasilenko committed Nov 11, 2024
1 parent 6925da8 commit 25b16e9
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/app/pages/sharing/smb/smb-list/smb-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,7 @@ export class SmbListComponent implements OnInit {
title: this.translate.instant('Enabled'),
propertyName: 'enabled',
requiredRoles: this.requiredRoles,
onRowToggle: (row) => {
this.ws.call('sharing.smb.update', [row.id, { enabled: row.enabled }]).pipe(
this.appLoader.withLoader(),
untilDestroyed(this),
).subscribe({
next: (share) => {
row.enabled = share.enabled;
},
error: (error: unknown) => {
this.dataProvider.load();
this.dialog.error(this.errorHandler.parseError(error));
},
});
},
onRowToggle: (row) => this.onChangeEnabledState(row),
}),
yesNoColumn({
title: this.translate.instant('Audit Logging'),
Expand Down Expand Up @@ -233,4 +220,19 @@ export class SmbListComponent implements OnInit {
message: this.translate.instant('The path <i>{path}</i> is in a locked dataset.', { path }),
});
}

private onChangeEnabledState(row: SmbShare): void {
this.ws.call('sharing.smb.update', [row.id, { enabled: !row.enabled }]).pipe(
this.appLoader.withLoader(),
untilDestroyed(this),
).subscribe({
next: () => {
this.dataProvider.load();
},
error: (error: unknown) => {
this.dataProvider.load();
this.dialog.error(this.errorHandler.parseError(error));
},
});
}
}

0 comments on commit 25b16e9

Please sign in to comment.