Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/8909 prod link to remove duplicate record section not working #2124

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
<a
i18n="@@account.accountSettings"
[routerLink]="removeDuplicateUrl"
[queryParams]="{ section: 'remove-duplicate' }"
fragment="remove-duplicate"
class="underline"
id="cy-remove-duplicated-record"
>Account settings > Remove duplicate record
</a>
</p>
</p>
<p>
<a
href="https://support.orcid.org/hc/en-us/articles/360006896634"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
OnInit,
Output,
} from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { Subject } from 'rxjs'
import { takeUntil } from 'rxjs/operators'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
Expand All @@ -30,7 +31,8 @@ export class SettingsActionsDeactivateComponent implements OnInit, OnDestroy {
constructor(
private _platform: PlatformInfoService,
private _deactivate: AccountActionsDeactivateService,
private _togglz: TogglzService
private _togglz: TogglzService,
private activeRoute: ActivatedRoute,
) {}

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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
Expand Down
Loading