diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index b76715c9..3def8002 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -35,6 +35,7 @@ import { NgSelectModule } from '@ng-select/ng-select';
import {HTTP_CLIENT_TOKEN} from "./dependency-injection";
import {WidgetsModule} from './widgets/widgets.module';
import { ExploreComponent } from './pages/explore/explore.component';
+import {DirectivesModule} from './directives/directives.module';
@NgModule({
declarations: [
@@ -69,7 +70,8 @@ import { ExploreComponent } from './pages/explore/explore.component';
PipesModule,
InfiniteScrollModule,
NgSelectModule,
- WidgetsModule
+ WidgetsModule,
+ DirectivesModule
],
providers: [
{
@@ -94,6 +96,7 @@ import { ExploreComponent } from './pages/explore/explore.component';
}
}
],
+ exports: [],
bootstrap: [AppComponent]
})
export class AppModule {
diff --git a/frontend/src/app/components/footer/footer.component.html b/frontend/src/app/components/footer/footer.component.html
index 728fd440..a28d4c33 100644
--- a/frontend/src/app/components/footer/footer.component.html
+++ b/frontend/src/app/components/footer/footer.component.html
@@ -2,7 +2,7 @@
diff --git a/frontend/src/app/components/glossary-lookup/glossary-lookup.component.html b/frontend/src/app/components/glossary-lookup/glossary-lookup.component.html
index 77cb149d..c45c2cf2 100644
--- a/frontend/src/app/components/glossary-lookup/glossary-lookup.component.html
+++ b/frontend/src/app/components/glossary-lookup/glossary-lookup.component.html
@@ -1,6 +1,6 @@
diff --git a/frontend/src/app/components/glossary-lookup/glossary-lookup.component.ts b/frontend/src/app/components/glossary-lookup/glossary-lookup.component.ts
index ea2aac2e..bcb64e69 100644
--- a/frontend/src/app/components/glossary-lookup/glossary-lookup.component.ts
+++ b/frontend/src/app/components/glossary-lookup/glossary-lookup.component.ts
@@ -4,10 +4,11 @@ import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
import {LoadingSpinnerComponent} from "../loading-spinner/loading-spinner.component";
import {AuthService} from "../../services/auth.service";
import {CommonModule} from "@angular/common";
+import {DirectivesModule} from '../../directives/directives.module';
@Component({
standalone: true,
- imports: [LoadingSpinnerComponent, CommonModule],
+ imports: [LoadingSpinnerComponent, CommonModule, DirectivesModule],
providers: [FastenApiService, AuthService],
selector: 'app-glossary-lookup',
templateUrl: './glossary-lookup.component.html',
diff --git a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html
index 5f306da3..1d19695c 100644
--- a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html
+++ b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html
@@ -8,7 +8,7 @@
You can click on a row to see the raw data.
- If you have any feedback regarding the data displayed, please file a ticket
+ If you have any feedback regarding the data displayed, please file a ticket
{
+ it('should create an instance', () => {
+ const directive = new ExternalLinkDirective();
+ expect(directive).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/directives/external-link.directive.ts b/frontend/src/app/directives/external-link.directive.ts
new file mode 100644
index 00000000..203e5e67
--- /dev/null
+++ b/frontend/src/app/directives/external-link.directive.ts
@@ -0,0 +1,51 @@
+import {Directive, HostBinding, HostListener, Input} from '@angular/core';
+import {environment} from '../../environments/environment';
+
+// In desktop mode external links can allow the user to navigate away from the app, without any means to return.
+// We can prevent this by forcing all external links to open in a new tab
+//
+// references:
+// https://www.educative.io/answers/how-to-open-a-link-in-a-new-tab-with-html-and-javascript
+// https://stackoverflow.com/questions/42775017/angular-2-redirect-to-an-external-url-and-open-in-a-new-tab
+// https://coryrylan.com/blog/managing-external-links-safely-in-angular
+// https://stackoverflow.com/questions/58862558/angular-directive-cannot-attach-event-listener-to-element
+// https://github.com/wailsapp/wails/issues/2691
+@Directive({
+ selector: '[externalLink]'
+})
+export class ExternalLinkDirective {
+ // @HostBinding('attr.rel') relAttr = '';
+ // @HostBinding('attr.target') targetAttr = '';
+ // @HostBinding('attr.href') hrefAttr = '';
+ // @Input() href: string;
+
+ // ngOnChanges() {
+ // this.hrefAttr = this.href;
+ //
+ // if (this.isLinkExternal()) {
+ // this.relAttr = 'noopener';
+ // this.targetAttr = '_blank';
+ // }
+ // console.log("Checking if link is external", this.href)
+ // }
+ //
+ // private isLinkExternal() {
+ // return !this.href.includes(location.hostname);
+ // }
+
+ @HostListener("click", ["$event"])
+ onClick(event: MouseEvent) {
+ event.preventDefault();
+
+ let url: string = (event.currentTarget).getAttribute("href");
+
+ //check if wails exists and is defined
+
+ if(typeof wails !== "undefined" && environment.environment_desktop){
+ wails.CallByName("pkg.AppService.BrowserOpenURL", url)
+ } else{
+ window.open(url, "_blank");
+ }
+ }
+
+}
diff --git a/frontend/src/app/pages/auth-signup/auth-signup.component.html b/frontend/src/app/pages/auth-signup/auth-signup.component.html
index 9eb6f1d9..20f8b995 100644
--- a/frontend/src/app/pages/auth-signup/auth-signup.component.html
+++ b/frontend/src/app/pages/auth-signup/auth-signup.component.html
@@ -9,7 +9,7 @@
Build one consolidated health record of your full health history, supports multiple users, create accounts for your whole family
- Learn More
+ Learn More
@@ -74,10 +74,10 @@
Users can create personalized dashboards tracking the information they care about, by querying their own medical records using a SQL-like syntax.
- Fasten comes with a few pre-built dashboards to get you started. You can also add your own dashboards by providing a link to a Github Gist containing a JSON representation of your dashboard.
+ Fasten comes with a few pre-built dashboards to get you started. You can also add your own dashboards by providing a link to a Github Gist containing a JSON representation of your dashboard.
- See Dashboard Configuration Documentation for more information.
+ See Dashboard Configuration Documentation for more information.