Skip to content

Commit 396614d

Browse files
mathis-marcotteMathis Marcotte
and
Mathis Marcotte
authored
namespace change url bug (#286)
* added navigate in form * added namespace sub to details page --------- Co-authored-by: Mathis Marcotte <[email protected]>
1 parent 6450e32 commit 396614d

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

frontend/jupyter/src/app/pages/form/form-new/form-new.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class FormNewComponent
6464
if (Array.isArray(namespace)) {
6565
this.goToNotebooks();
6666
} else {
67+
if (this.currNamespace && this.currNamespace !== namespace) {
68+
this.router.navigate(['/']);
69+
}
6770
this.currNamespace = namespace;
6871
this.formCtrl.controls.namespace.setValue(this.currNamespace);
6972
}

frontend/jupyter/src/app/pages/notebook-page/notebook-page.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class NotebookPageComponent implements OnInit, OnDestroy {
3232

3333
pollSubNotebook = new Subscription();
3434
pollSubPod = new Subscription();
35+
namespaceSub = new Subscription();
3536

3637
constructor(
3738
public ns: NamespaceService,
@@ -46,7 +47,6 @@ export class NotebookPageComponent implements OnInit, OnDestroy {
4647
ngOnInit(): void {
4748
this.route.params.subscribe(params => {
4849
this.ns.updateSelectedNamespace(params.namespace);
49-
5050
this.notebookName = params.notebookName;
5151
this.namespace = params.namespace;
5252

@@ -58,11 +58,20 @@ export class NotebookPageComponent implements OnInit, OnDestroy {
5858
this.selectedTab.index = this.switchTab(this.selectedTab.name).index;
5959
this.selectedTab.name = this.switchTab(this.selectedTab.name).name;
6060
});
61+
62+
this.namespaceSub.add(
63+
this.ns.getSelectedNamespace().subscribe(namespace => {
64+
if (this.namespace && this.namespace !== namespace) {
65+
this.router.navigate(['/']);
66+
}
67+
}),
68+
);
6169
}
6270

6371
ngOnDestroy() {
6472
this.pollSubNotebook.unsubscribe();
6573
this.pollSubPod.unsubscribe();
74+
this.namespaceSub.unsubscribe();
6675
}
6776

6877
private poll(namespace: string, notebook: string) {

frontend/jupyter/src/app/pages/volume-details-page/volume-details-page.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class VolumeDetailsPageComponent implements OnInit, OnDestroy {
3939
} = { index: 0, name: 'overview' };
4040

4141
pollSub = new Subscription();
42+
namespaceSub = new Subscription();
4243

4344
constructor(
4445
public ns: NamespaceService,
@@ -52,7 +53,6 @@ export class VolumeDetailsPageComponent implements OnInit, OnDestroy {
5253
ngOnInit(): void {
5354
this.route.params.subscribe(params => {
5455
this.ns.updateSelectedNamespace(params.namespace);
55-
5656
this.name = params.pvcName;
5757
this.namespace = params.namespace;
5858

@@ -62,10 +62,19 @@ export class VolumeDetailsPageComponent implements OnInit, OnDestroy {
6262
this.route.queryParams.subscribe(params => {
6363
this.selectedTab = this.newTab(params.tab);
6464
});
65+
66+
this.namespaceSub.add(
67+
this.ns.getSelectedNamespace().subscribe(namespace => {
68+
if (this.namespace && this.namespace !== namespace) {
69+
this.router.navigate(['/']);
70+
}
71+
}),
72+
);
6573
}
6674

6775
ngOnDestroy() {
6876
this.pollSub.unsubscribe();
77+
this.namespaceSub.unsubscribe();
6978
}
7079

7180
private poll(namespace: string, name: string) {

0 commit comments

Comments
 (0)