Skip to content

Commit

Permalink
fix(playground): resolve bugs (#1718)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrone44 authored Jan 15, 2025
1 parent ce2b40a commit 44f62ae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
import { UntypedFormControl, Validators } from "@angular/forms";
import { MatSnackBar } from "@angular/material/snack-bar";
import { SqlPlaygroundService } from "../../service/sql-playground.service";
import { Store } from "@ngrx/store";
import { loadDatabases } from "../../page-components/sql-playground/db-control-panel/state/databases.actions";

/**
* Updates course information in dialog
Expand All @@ -21,6 +23,7 @@ export class NewDbDialogComponent {
private sqlPlaygroundService: SqlPlaygroundService,
@Inject(MAT_DIALOG_DATA) public data: any,
public dialogRef: MatDialogRef<NewDbDialogComponent>,
private store: Store,
private snackbar: MatSnackBar
) {}

Expand All @@ -39,6 +42,7 @@ export class NewDbDialogComponent {
.createDatabase(this.data.token.id, this.name.value)
.subscribe(
() => {
this.store.dispatch(loadDatabases());
this.dialogRef.close({ success: true });
},
(error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class CollaborativeBackend implements Backend {
url:
window.location.hostname === "localhost"
? "ws://127.0.0.1:1234"
: "wss://feedback.mni.thm.de/collab",
: "/collab/",
name: id,
token,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ export class LocalBackend implements Backend {
}

private loadLocalStorage(): QueryTab[] {
const loadedData = localStorage.getItem("tabs");
return JSON.parse(loadedData)?.tabs ?? [];
return (JSON.parse(localStorage.getItem("tabs"))?.tabs ?? []).map(
(tab) => ({ id: crypto.randomUUID(), ...tab })
);
}

streamMetaChanges(): Observable<{ key: string; value: any }> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ export class SqlPlaygroundEffects {
.getResults(token.id, activeDb, result.id)
.pipe(
retry(),
map((res) =>
SqlPlaygroundActions.submitStatementSuccess({
resultset: res,
})
mergeMap((res) =>
of(
SqlPlaygroundActions.submitStatementSuccess({
resultset: res,
}),
SqlPlaygroundActions.updateScheme()
)
),
catchError((error) =>
of(SqlPlaygroundActions.submitStatementFailure({ error }))
Expand Down

0 comments on commit 44f62ae

Please sign in to comment.