diff --git a/src/app/account-settings/components/settings-actions-deactivate/settings-actions-deactivate.component.html b/src/app/account-settings/components/settings-actions-deactivate/settings-actions-deactivate.component.html index 2867165429..4b46bd613e 100644 --- a/src/app/account-settings/components/settings-actions-deactivate/settings-actions-deactivate.component.html +++ b/src/app/account-settings/components/settings-actions-deactivate/settings-actions-deactivate.component.html @@ -49,12 +49,12 @@ Account settings > Remove duplicate record -

+

{ let component: SettingsActionsComponent @@ -10,7 +12,7 @@ describe('SettingsActionsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [SettingsActionsComponent], - providers: [WINDOW_PROVIDERS], + providers: [WINDOW_PROVIDERS, { provide: ActivatedRoute, useValue: {fragment: of({})} }], }).compileComponents() }) diff --git a/src/app/account-settings/components/settings-actions/settings-actions.component.ts b/src/app/account-settings/components/settings-actions/settings-actions.component.ts index d0a34ed2ff..5b87a88984 100644 --- a/src/app/account-settings/components/settings-actions/settings-actions.component.ts +++ b/src/app/account-settings/components/settings-actions/settings-actions.component.ts @@ -1,4 +1,6 @@ import { Component, Inject, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { set } from 'lodash' import { WINDOW } from 'src/app/cdk/window' @Component({ @@ -18,10 +20,28 @@ export class SettingsActionsComponent implements OnInit { settingDownloadLoading = false settingDuplicatedRecordLoading = false settingDeactivateLoading = false - constructor(@Inject(WINDOW) private _window: Window) {} + constructor( + @Inject(WINDOW) private _window: Window, + private activeRoute: ActivatedRoute + ) {} ngOnInit(): void { const hash = this._window.location.hash.substr(1) + this.displayPanelByHashName(hash) + this.activeRoute.fragment.subscribe((fragment) => { + if (fragment === 'remove-duplicate') { + const element = this._window.document.querySelector('#cy-remove-duplicate-panel') + this.displayPanelByHashName(fragment) + setTimeout(() => { + if (element) { + element.scrollIntoView() + } + }) + } + }) + } + + private displayPanelByHashName(hash: string) { switch (hash) { case 'download-data': this.settingDownload = true