rbelavadi commented on code in PR #6493:
URL: https://github.com/apache/texera/pull/6493#discussion_r3616665326
##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts:
##########
@@ -908,6 +915,50 @@ export class DatasetDetailComponent implements OnInit {
});
}
+ onSaveDatasetName(): void {
+ if (!this.did) {
+ return;
+ }
+ // Sanitize using the same rules as dataset creation: trim leading
whitespace,
+ // collapse runs of non-alphanumeric characters to a single "-", then
lowercase.
+ const sanitizedName = this.editedDatasetName
+ .trimStart()
+ .replace(/[^a-zA-Z0-9]+/g, "-")
+ .toLowerCase();
+
+ this.datasetService
+ .updateDatasetName(this.did, sanitizedName)
+ .pipe(untilDestroyed(this))
+ .subscribe({
+ next: () => {
+ this.datasetName = sanitizedName;
+ this.editedDatasetName = sanitizedName;
+ this.notificationService.success(`Dataset name updated to
'${sanitizedName}'`);
+ },
+ error: (err: unknown) => {
+ this.notificationService.error("Failed to update dataset name");
+ },
+ });
+ }
+
+ onDeleteDataset(): void {
+ if (!this.did) {
+ return;
+ }
+ this.datasetService
+ .deleteDatasets(this.did)
+ .pipe(untilDestroyed(this))
+ .subscribe({
+ next: () => {
+ this.notificationService.success(`Dataset ${this.datasetName} was
deleted`);
+ this.router.navigate([USER_DATASET]);
+ },
+ error: (err: unknown) => {
+ this.notificationService.error("Failed to delete the dataset");
Review Comment:
Same fix applied here, extractErrorMessage(err) instead of the hardcoded
string, spec updated accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]