]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix cancel button
authorAfreen Misbah <afreen@ibm.com>
Tue, 7 Jul 2026 12:58:32 +0000 (18:28 +0530)
committerAfreen Misbah <afreen@ibm.com>
Tue, 7 Jul 2026 12:58:32 +0000 (18:28 +0530)
Signed-off-by: Afreen Misbah <afreen@ibm.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts

index 6860134b3b916d300862c33f3451967a0061a956..63dfd3d58b2ed9fea13c7c85b5e68bdb480697b7 100644 (file)
@@ -8,7 +8,6 @@ import {
   ViewChild
 } from '@angular/core';
 import { UntypedFormControl } from '@angular/forms';
-import { Location } from '@angular/common';
 import { Router } from '@angular/router';
 
 import _ from 'lodash';
@@ -143,7 +142,6 @@ export class OsdFormComponent extends CdForm implements OnInit, OnDestroy {
     private orchService: OrchestratorService,
     private hostService: HostService,
     private router: Router,
-    private location: Location,
     private formatterService: FormatterService,
     private modalService: ModalService,
     private osdService: OsdService,
@@ -502,34 +500,15 @@ export class OsdFormComponent extends CdForm implements OnInit, OnDestroy {
       this.cancelled.emit();
       return;
     }
-    this.location.back();
+    this.router.navigate(['osd', { outlets: { modal: null } }]);
   }
 
   private navigateAfterCreate() {
-    const returnUrl = window.history.state?.returnUrl;
-
     if (this.osdCreated.observers.length > 0) {
       this.osdCreated.emit();
       return;
     }
-
-    if (returnUrl === '/add-storage') {
-      this.router.navigate(['/add-storage']);
-      return;
-    }
-
-    const hasSafeReturnUrl =
-      typeof returnUrl === 'string' &&
-      returnUrl.startsWith('/') &&
-      !returnUrl.startsWith('//') &&
-      returnUrl !== '/osd/create';
-
-    if (hasSafeReturnUrl) {
-      this.router.navigateByUrl(returnUrl);
-      return;
-    }
-
-    this.router.navigate(['/osd']);
+    this.router.navigate(['osd', { outlets: { modal: null } }]);
   }
 
   submit() {
index 2be126ef6897dc6a31f16f1d129108481b3e8f29..2874b164e747967a6cf67e2baaa065cf6eb98bbf 100644 (file)
@@ -183,9 +183,9 @@ export class TearsheetComponent implements OnInit, AfterViewInit, OnDestroy, OnC
   }
 
   closeWideTearsheet() {
-    this.closeRequested.emit();
     this.isOpen = false;
     if (this.closeRequested.observers.length > 0) {
+      this.closeRequested.emit();
       return;
     }
     if (this.hasModalOutlet) {