From: Afreen Misbah Date: Tue, 7 Jul 2026 12:58:32 +0000 (+0530) Subject: mgr/dashboard: fix cancel button X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b35999b6435cf4bf10ebdfa0204621836d76bcf0;p=ceph.git mgr/dashboard: fix cancel button Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts index 6860134b3b9..63dfd3d58b2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts @@ -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() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts index 2be126ef689..2874b164e74 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/tearsheet/tearsheet.component.ts @@ -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) {