Compare commits

..

No commits in common. "main" and "0.5.0-alpha.10" have entirely different histories.

5 changed files with 107 additions and 96 deletions

View file

@ -1,7 +1,31 @@
# Gisaf frontend # GisafApp
The web app (front-end, user interface) for Gisaf, This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.24.
a web based GIS initially developed for CSR Geomatics, Auroville.
See the [Gisaf server repository](https://code.philo.ydns.eu/philorg/gisaf-backend) ## Development server
for information about this project. Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.
## Deploying to Github Pages
Run `ng github-pages:deploy` to deploy to Github Pages.
## Further help
To get more help on the `angular-cli` use `ng help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View file

@ -2,7 +2,7 @@
<mat-toolbar fxFlex="2em" id='top-toolbar'> <mat-toolbar fxFlex="2em" id='top-toolbar'>
<span <span
style='font-family:GisafSymbols' style='font-family:GisafSymbols'
matTooltip="Gisaf version: backend {{ version.backend }}, frontend {{ version.frontend }}" matTooltip="Gisaf v. {{ (configService.conf | async).bsData?.version }}"
matTooltipPosition="below" matTooltipPosition="below"
class='gisafIcon' class='gisafIcon'
> >

View file

@ -1,7 +1,5 @@
import { import { Component, OnInit,
Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'
ChangeDetectionStrategy, ChangeDetectorRef
} from '@angular/core'
import { Title } from '@angular/platform-browser' import { Title } from '@angular/platform-browser'
import { BootstrapService } from './_services/bootstrap.service' import { BootstrapService } from './_services/bootstrap.service'
import { ConfigService } from './_services/config.service' import { ConfigService } from './_services/config.service'
@ -10,87 +8,80 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog'
import { AuthenticationService } from './_services/authentication.service' import { AuthenticationService } from './_services/authentication.service'
import { LoginDialogComponent } from './login/login.component' import { LoginDialogComponent } from './login/login.component'
import versionJson from '../version.json'
export class Version {
public backend: string
public frontend: string
}
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'], styleUrls: ['./app.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
title: string = 'Gisaf' title = 'Gisaf'
version: Version = new Version() version: string
routes = [ routes = [
{ {
'target': 'dashboard', 'target': 'dashboard',
'icon': 'home', 'icon': 'home',
'text': 'Home', 'text': 'Home',
}, },
{ {
'target': 'map', 'target': 'map',
'icon': 'map', 'icon': 'map',
'text': 'Map', 'text': 'Map',
}, },
{ {
'target': 'measures', 'target': 'measures',
'icon': 'insert_chart', 'icon': 'insert_chart',
'text': 'Measures', 'text': 'Measures',
}, },
] ]
constructor( constructor(
public configService: ConfigService, public configService: ConfigService,
private titleService: Title, private titleService: Title,
private bootstrapService: BootstrapService, private bootstrapService: BootstrapService,
public authenticationService: AuthenticationService, public authenticationService: AuthenticationService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
public dialogRef: MatDialogRef<LoginDialogComponent>, public dialogRef: MatDialogRef<LoginDialogComponent>,
public dialog: MatDialog public dialog: MatDialog
) { } ) {}
ngOnInit() { ngOnInit() {
// Bootstrap: set app wide configuration // Bootstrap: set app wide configuration
this.bootstrapService.get().subscribe({ this.bootstrapService.get().subscribe({
next: res => { next: res => {
this.version.backend = res.version this.version = res.version
this.version.frontend = versionJson["version"] this.title = res.title || this.title
this.title = res.title || this.title this.titleService.setTitle(res.windowTitle || this.title)
this.titleService.setTitle(res.windowTitle || this.title) this.configService.setConf(res)
this.configService.setConf(res) if (res.redirect && (window != window.top)) {
if (res.redirect && (window != window.top)) { // Refusing to be embedded in an iframe
// Refusing to be embedded in an iframe let loc = res.redirect + window.location.pathname
let loc = res.redirect + window.location.pathname window.document.body.innerHTML = `
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.</br> The web site you are visiting is trying to embed Gisaf (${this.title}) in an iFrame, it isn't a nice thing to do.</br>
Please click this link to go to the real site: <span style='cursor:pointer' onclick="window.open('${loc}')"><b>${loc}</b></span> Please click this link to go to the real site: <span style='cursor:pointer' onclick="window.open('${loc}')"><b>${loc}</b></span>
` `
} }
}, },
error: err => { error: err => {
this.snackBar.open( this.snackBar.open(
'Cannot connect to the server (' + err.statusText + '). Please retry later.', 'Cannot connect to the server (' + err.statusText + '). Please retry later.',
'OK' 'OK'
) )
} }
}) })
} }
openLoginDialog() { openLoginDialog() {
const dialogRef = this.dialog.open(LoginDialogComponent, { const dialogRef = this.dialog.open(LoginDialogComponent, {
height: '24em', height: '24em',
width: '21em' width: '21em'
}) })
// dialogRef.afterClosed().subscribe( // dialogRef.afterClosed().subscribe(
// result => {} // result => {}
// ) // )
} }
} }

View file

@ -1,3 +0,0 @@
{
"version": "0.0.0"
}

View file

@ -1,25 +1,24 @@
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"declaration": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"lib": [
"es2019",
"dom",
"esnext.asynciterable"
],
"module": "es2020", "module": "es2020",
"moduleResolution": "node", "esModuleInterop": true,
"resolveJsonModule": true,
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"experimentalDecorators": true,
"target": "ES2022", "target": "ES2022",
"typeRoots": [ "typeRoots": [
"node_modules/@types", "node_modules/@types",
"@types" "@types"
], ],
"lib": [
"es2019",
"dom",
"esnext.asynciterable"
],
"useDefineForClassFields": false "useDefineForClassFields": false
}, },
"angularCompilerOptions": { "angularCompilerOptions": {