diff --git a/src/app/app.component.html b/src/app/app.component.html
index e3737be..7aedc3b 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -2,7 +2,7 @@
@@ -47,4 +47,4 @@
account_circle
-
\ No newline at end of file
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 1be626d..9ab6b35 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,5 +1,7 @@
-import { Component, OnInit,
- ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'
+import {
+ Component, OnInit,
+ ChangeDetectionStrategy, ChangeDetectorRef
+} from '@angular/core'
import { Title } from '@angular/platform-browser'
import { BootstrapService } from './_services/bootstrap.service'
import { ConfigService } from './_services/config.service'
@@ -8,80 +10,87 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog'
import { AuthenticationService } from './_services/authentication.service'
import { LoginDialogComponent } from './login/login.component'
+import versionJson from '../version.json'
+
+export class Version {
+ public backend: string
+ public frontend: string
+}
@Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css'],
- changeDetection: ChangeDetectionStrategy.OnPush,
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.css'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent implements OnInit {
- title = 'Gisaf'
- version: string
+ title: string = 'Gisaf'
+ version: Version = new Version()
- routes = [
- {
- 'target': 'dashboard',
- 'icon': 'home',
- 'text': 'Home',
- },
- {
- 'target': 'map',
- 'icon': 'map',
- 'text': 'Map',
- },
- {
- 'target': 'measures',
- 'icon': 'insert_chart',
- 'text': 'Measures',
- },
- ]
+ routes = [
+ {
+ 'target': 'dashboard',
+ 'icon': 'home',
+ 'text': 'Home',
+ },
+ {
+ 'target': 'map',
+ 'icon': 'map',
+ 'text': 'Map',
+ },
+ {
+ 'target': 'measures',
+ 'icon': 'insert_chart',
+ 'text': 'Measures',
+ },
+ ]
- constructor(
- public configService: ConfigService,
- private titleService: Title,
- private bootstrapService: BootstrapService,
- public authenticationService: AuthenticationService,
- private snackBar: MatSnackBar,
- private cdr: ChangeDetectorRef,
- public dialogRef: MatDialogRef,
- public dialog: MatDialog
- ) {}
+ constructor(
+ public configService: ConfigService,
+ private titleService: Title,
+ private bootstrapService: BootstrapService,
+ public authenticationService: AuthenticationService,
+ private snackBar: MatSnackBar,
+ private cdr: ChangeDetectorRef,
+ public dialogRef: MatDialogRef,
+ public dialog: MatDialog
+ ) { }
- ngOnInit() {
- // Bootstrap: set app wide configuration
- this.bootstrapService.get().subscribe({
- next: res => {
- this.version = res.version
- this.title = res.title || this.title
- this.titleService.setTitle(res.windowTitle || this.title)
- this.configService.setConf(res)
- if (res.redirect && (window != window.top)) {
- // Refusing to be embedded in an iframe
- let loc = res.redirect + window.location.pathname
- window.document.body.innerHTML = `
+ ngOnInit() {
+ // Bootstrap: set app wide configuration
+ this.bootstrapService.get().subscribe({
+ next: res => {
+ this.version.backend = res.version
+ this.version.frontend = versionJson["version"]
+ this.title = res.title || this.title
+ this.titleService.setTitle(res.windowTitle || this.title)
+ this.configService.setConf(res)
+ if (res.redirect && (window != window.top)) {
+ // Refusing to be embedded in an iframe
+ let loc = res.redirect + window.location.pathname
+ window.document.body.innerHTML = `
The web site you are visiting is trying to embed Gisaf (${this.title}) in an iFrame, it isn't a nice thing to do.
Please click this link to go to the real site: ${loc}
`
- }
- },
- error: err => {
- this.snackBar.open(
- 'Cannot connect to the server (' + err.statusText + '). Please retry later.',
- 'OK'
- )
- }
- })
- }
+ }
+ },
+ error: err => {
+ this.snackBar.open(
+ 'Cannot connect to the server (' + err.statusText + '). Please retry later.',
+ 'OK'
+ )
+ }
+ })
+ }
- openLoginDialog() {
- const dialogRef = this.dialog.open(LoginDialogComponent, {
- height: '24em',
- width: '21em'
- })
+ openLoginDialog() {
+ const dialogRef = this.dialog.open(LoginDialogComponent, {
+ height: '24em',
+ width: '21em'
+ })
- // dialogRef.afterClosed().subscribe(
- // result => {}
- // )
- }
+ // dialogRef.afterClosed().subscribe(
+ // result => {}
+ // )
+ }
}
diff --git a/src/version.json b/src/version.json
new file mode 100644
index 0000000..1be1b18
--- /dev/null
+++ b/src/version.json
@@ -0,0 +1,3 @@
+{
+ "version": "0.0.0"
+}
diff --git a/tsconfig.json b/tsconfig.json
index d8eccc2..3b4a837 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,27 +1,28 @@
{
"compileOnSave": false,
"compilerOptions": {
- "importHelpers": true,
- "module": "es2020",
- "esModuleInterop": true,
- "outDir": "./dist/out-tsc",
- "sourceMap": true,
"declaration": false,
- "moduleResolution": "node",
+ "esModuleInterop": true,
"experimentalDecorators": true,
- "target": "ES2022",
- "typeRoots": [
- "node_modules/@types",
- "@types"
- ],
+ "importHelpers": true,
"lib": [
"es2019",
"dom",
"esnext.asynciterable"
],
+ "module": "es2020",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "outDir": "./dist/out-tsc",
+ "sourceMap": true,
+ "target": "ES2022",
+ "typeRoots": [
+ "node_modules/@types",
+ "@types"
+ ],
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"strictTemplates": true
}
-}
\ No newline at end of file
+}