From 1ee31003fdfe901fd53c46a408eef6715eb814e7 Mon Sep 17 00:00:00 2001 From: Tim Coker Date: Wed, 24 Apr 2019 10:09:32 -0400 Subject: [PATCH] fix for middle clicking links (#937) * fix for middle clicking links * Found another link in the app * Converted all links to use externaUrl decorator * Missing semicolon * Minor fixes for compilation/linting * Changed help link back to embedded in html * trigger builds * trigger build for agreement removal --- .../app/components/agent/about/about.component.html | 4 ++-- .../src/app/components/agent/about/about.component.ts | 11 ++--------- .../contributor-badge.component.html | 2 +- .../contributor-badge/contributor-badge.component.ts | 7 ------- .../device/firmware/device-firmware.component.html | 2 +- .../device/firmware/device-firmware.component.ts | 8 ++------ .../directives/external-url/external-url.directive.ts | 9 +++++++++ 7 files changed, 17 insertions(+), 26 deletions(-) diff --git a/packages/uhk-web/src/app/components/agent/about/about.component.html b/packages/uhk-web/src/app/components/agent/about/about.component.html index 7df1e8f0..c8e7500d 100644 --- a/packages/uhk-web/src/app/components/agent/about/about.component.html +++ b/packages/uhk-web/src/app/components/agent/about/about.component.html @@ -12,7 +12,7 @@
Agent version: {{ version }}
- Agent on GitHub + Agent on GitHub
@@ -35,7 +35,7 @@ Loading...
- We experienced a problem while fetching contributor list. Check Contributors page on GitHub! + We experienced a problem while fetching contributor list. Check Contributors page on GitHub!
diff --git a/packages/uhk-web/src/app/components/agent/about/about.component.ts b/packages/uhk-web/src/app/components/agent/about/about.component.ts index 0c2277ef..c38c0d0c 100644 --- a/packages/uhk-web/src/app/components/agent/about/about.component.ts +++ b/packages/uhk-web/src/app/components/agent/about/about.component.ts @@ -8,7 +8,6 @@ import { getVersions } from '../../../util'; import { AppState, contributors } from '../../../store'; import { State } from '../../../store/reducers/contributors.reducer'; -import { OpenUrlInNewWindowAction } from '../../../store/actions/app'; import { GetAgentContributorsAction } from '../../../store/actions/contributors.action'; @Component({ @@ -21,8 +20,8 @@ import { GetAgentContributorsAction } from '../../../store/actions/contributors. }) export class AboutComponent implements OnInit { version: string = getVersions().version; - agentGithubUrl = Constants.AGENT_GITHUB_URL; - agentContributorsUrl = Constants.AGENT_CONTRIBUTORS_GITHUB_PAGE_URL; + agentGithubUrl: string = Constants.AGENT_GITHUB_URL; + agentContributorsUrl: string = Constants.AGENT_CONTRIBUTORS_GITHUB_PAGE_URL; state$: Observable; constructor(private store: Store) { @@ -33,10 +32,4 @@ export class AboutComponent implements OnInit { this.store.dispatch(new GetAgentContributorsAction()); } - - openUrlInBrowser(event: Event): void { - event.preventDefault(); - - this.store.dispatch(new OpenUrlInNewWindowAction((event.target as Element).getAttribute('href'))); - } } diff --git a/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.html b/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.html index 163ee5ea..20b62bff 100644 --- a/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.html +++ b/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.html @@ -1,2 +1,2 @@ {{ name }} on GitHub -{{ name }} \ No newline at end of file +{{ name }} diff --git a/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.ts b/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.ts index e3ccfb1b..149b33c5 100644 --- a/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.ts +++ b/packages/uhk-web/src/app/components/agent/about/contributor-badge/contributor-badge.component.ts @@ -2,7 +2,6 @@ import { Component, Input, ViewChild, ElementRef, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; import { AppState } from '../../../../store/index'; -import { OpenUrlInNewWindowAction } from '../../../../store/actions/app'; import { UHKContributor } from '../../../../models/uhk-contributor'; @@ -33,10 +32,4 @@ export class ContributorBadgeComponent implements OnInit { ngOnInit(): void { (this.badge.nativeElement as HTMLImageElement).src = URL.createObjectURL(this.contributor.avatar); } - - openUrlInBrowser(event: Event): void { - event.preventDefault(); - - this.store.dispatch(new OpenUrlInNewWindowAction((event.target as Element).getAttribute('href'))); - } } diff --git a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html index 594dc053..b71d0959 100644 --- a/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html +++ b/packages/uhk-web/src/app/components/device/firmware/device-firmware.component.html @@ -32,7 +32,7 @@ role="alert">

Firmware update failed. Disconnect every USB device from your computer (including USB hubs, KVM switches, USB dongles, and everything else), then connect only your UHK and retry.

-

If you've tried the above and the update still keeps failing, please create a GitHub issue, and attach the update log.

+

If you've tried the above and the update still keeps failing, please create a GitHub issue, and attach the update log.

; firmwareUpgradeFailed$: Observable; firmwareUpgradeSuccess$: Observable; + firmwareGithubIssueUrl: string; constructor(private store: Store) { this.flashFirmwareButtonDisbabled$ = store.select(flashFirmwareButtonDisbabled); @@ -49,6 +49,7 @@ export class DeviceFirmwareComponent implements OnDestroy { this.firmwareUpgradeAllowed$ = store.select(firmwareUpgradeAllowed); this.firmwareUpgradeFailed$ = store.select(firmwareUpgradeFailed); this.firmwareUpgradeSuccess$ = store.select(firmwareUpgradeSuccess); + this.firmwareGithubIssueUrl = Constants.FIRMWARE_GITHUB_ISSUE_URL; } ngOnDestroy(): void { @@ -62,9 +63,4 @@ export class DeviceFirmwareComponent implements OnDestroy { changeFile(data: UploadFileData): void { this.store.dispatch(new UpdateFirmwareWithAction(data.data)); } - - openFirmwareGitHubIssuePage(event): void { - event.preventDefault(); - this.store.dispatch(new OpenUrlInNewWindowAction(Constants.FIRMWARE_GITHUB_ISSUE_URL)); - } } diff --git a/packages/uhk-web/src/app/directives/external-url/external-url.directive.ts b/packages/uhk-web/src/app/directives/external-url/external-url.directive.ts index 320fa4ef..daf5f8da 100644 --- a/packages/uhk-web/src/app/directives/external-url/external-url.directive.ts +++ b/packages/uhk-web/src/app/directives/external-url/external-url.directive.ts @@ -14,6 +14,15 @@ export class ExternalUrlDirective { @HostListener('click', ['$event']) onClick($event: MouseEvent): void { + this.openUrl($event); + } + + @HostListener('auxclick', ['$event']) + onAuxClick($event: MouseEvent): void { + this.openUrl($event); + } + + openUrl($event: MouseEvent): void { $event.preventDefault(); $event.stopPropagation();