This commit is contained in:
phil 2025-06-28 03:58:17 +02:00
parent 4c4dc3fc5c
commit bbffcd5aed
10 changed files with 116 additions and 119 deletions

View file

@ -6,29 +6,28 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'
import { Role } from './models' import { Role } from './models'
export interface DialogData { export interface DialogData {
role: Role role: Role
} }
@Component({ @Component({
selector: 'gisaf-admin-access-role-dialog', selector: 'gisaf-admin-access-role-dialog',
templateUrl: 'role-dialog.component.html', templateUrl: 'role-dialog.component.html',
styleUrls: ['role-dialog.component.css'],
}) })
export class GisafAdminAccessRoleDialogComponent implements OnInit { export class GisafAdminAccessRoleDialogComponent implements OnInit {
formGroup: UntypedFormGroup = new UntypedFormGroup({}) formGroup: UntypedFormGroup = new UntypedFormGroup({})
constructor( constructor(
public dialogRef: MatDialogRef<GisafAdminAccessRoleDialogComponent>, public dialogRef: MatDialogRef<GisafAdminAccessRoleDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogData @Inject(MAT_DIALOG_DATA) public data: DialogData
) {} ) { }
ngOnInit() { ngOnInit() {
let role: Role = this.data['role'] || new Role(undefined, '', '') let role: Role = this.data['role'] || new Role(undefined, '', '')
this.formGroup.addControl('id', new UntypedFormControl(role.id)) this.formGroup.addControl('id', new UntypedFormControl(role.id))
this.formGroup.addControl('name', new UntypedFormControl(role.name, [Validators.required])) this.formGroup.addControl('name', new UntypedFormControl(role.name, [Validators.required]))
this.formGroup.addControl('description', new UntypedFormControl(role.description, [Validators.required])) this.formGroup.addControl('description', new UntypedFormControl(role.description, [Validators.required]))
} }
save() { save() {
this.dialogRef.close(this.formGroup.value); this.dialogRef.close(this.formGroup.value);
} }
} }

View file

@ -5,28 +5,27 @@ import { MatSnackBar } from '@angular/material/snack-bar'
import { AdminManageDataService } from '../data.service' import { AdminManageDataService } from '../data.service'
@Component({ @Component({
selector: 'gisaf-admin-maintenance', selector: 'gisaf-admin-maintenance',
templateUrl: './maintenance.component.html', templateUrl: './maintenance.component.html',
styleUrls: ['./maintenance.component.css'], changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AdminMaintenanceComponent implements OnInit { export class AdminMaintenanceComponent implements OnInit {
constructor( constructor(
private adminManageDataService: AdminManageDataService, private adminManageDataService: AdminManageDataService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
} }
vacuumDb() { vacuumDb() {
this.adminManageDataService.vacuumDb().subscribe( this.adminManageDataService.vacuumDb().subscribe(
resp => this.snackBar.open( resp => this.snackBar.open(
'Database vacuum OK', 'Database vacuum OK',
'Close', 'Close',
) )
) )
} }
} }

View file

@ -2,8 +2,7 @@ import { Component } from '@angular/core'
@Component({ @Component({
selector: 'gisaf-info-home', selector: 'gisaf-info-home',
templateUrl: './info-home.component.html', templateUrl: './info-home.component.html',
styleUrls: ['./info-home.component.css']
}) })
export class InfoHomeComponent {} export class InfoHomeComponent { }

View file

@ -1,5 +1,7 @@
import { Component, Input, import {
ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core' Component, Input,
ChangeDetectionStrategy, ChangeDetectorRef
} from '@angular/core'
import { Tag } from './tags.service' import { Tag } from './tags.service'
import { FullInfo, InfoDataService, FormField } from '../info-data.service' import { FullInfo, InfoDataService, FormField } from '../info-data.service'
@ -10,64 +12,63 @@ import { AuthenticationService } from '../../_services/authentication.service'
import { MapControlService } from '../../map/map-control.service' import { MapControlService } from '../../map/map-control.service'
@Component({ @Component({
selector: 'gisaf-tag-action', selector: 'gisaf-tag-action',
templateUrl: './tag-action.component.html', templateUrl: './tag-action.component.html',
styleUrls: ['./tag-action.component.css'], changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class TagActionComponent { export class TagActionComponent {
@Input() source: FullInfo @Input() source: FullInfo
@Input() action: Action @Input() action: Action
constructor( constructor(
private actionsService: ActionsService, private actionsService: ActionsService,
private infoDataService: InfoDataService, private infoDataService: InfoDataService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
public authenticationService: AuthenticationService, public authenticationService: AuthenticationService,
protected mapControlService: MapControlService, protected mapControlService: MapControlService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
) {} ) { }
execute() { execute() {
this.actionsService.execute( this.actionsService.execute(
[this.source.modelInfo.store], [this.source.modelInfo.store],
[[this.source.featureInfo.id.toString()]], [[this.source.featureInfo.id.toString()]],
[this.action.name], [this.action.name],
this.action.params, this.action.params,
).subscribe( ).subscribe(
results => { results => {
// Update the tags in the info source // Update the tags in the info source
let result = results[0].actionResults[0] let result = results[0].actionResults[0]
if (result.message) { if (result.message) {
this.snackBar.open(result.message, 'Close', {duration: 3000}) this.snackBar.open(result.message, 'Close', { duration: 3000 })
} }
if (!result.actionResults || result.actionResults.length == 0) { if (!result.actionResults || result.actionResults.length == 0) {
return return
} }
let layer = result.actionResults[0].taggedLayers.find( let layer = result.actionResults[0].taggedLayers.find(
tl => tl.store == this.source.modelInfo.store tl => tl.store == this.source.modelInfo.store
)
let feature = layer.features.find(f=>f.id == this.source.featureInfo.id)
if (feature) {
feature.tags.forEach(
tag => {
let existingTag = this.source.featureInfo.tags.find(t => t.key == tag.key)
if (existingTag) {
console.log("Tag update: test me!")
existingTag.value = tag.value
this.infoDataService.dataProviderService.next(this.source)
}
else {
this.source.featureInfo.tags.push({key: tag.key, value: tag.value})
}
}
)
this.infoDataService.dataProviderService.next(this.source)
}
// Trick to refresh the tags on the map
if (this.mapControlService.hasTags.value) {
this.mapControlService.hasTags.next(true)
}
}
) )
} let feature = layer.features.find(f => f.id == this.source.featureInfo.id)
if (feature) {
feature.tags.forEach(
tag => {
let existingTag = this.source.featureInfo.tags.find(t => t.key == tag.key)
if (existingTag) {
console.log("Tag update: test me!")
existingTag.value = tag.value
this.infoDataService.dataProviderService.next(this.source)
}
else {
this.source.featureInfo.tags.push({ key: tag.key, value: tag.value })
}
}
)
this.infoDataService.dataProviderService.next(this.source)
}
// Trick to refresh the tags on the map
if (this.mapControlService.hasTags.value) {
this.mapControlService.hasTags.next(true)
}
}
)
}
} }

View file

@ -6,25 +6,24 @@ import { FullInfo } from '../info-data.service'
import { Downloader } from '../../openapi' import { Downloader } from '../../openapi'
@Component({ @Component({
selector: 'gisaf-downloader', selector: 'gisaf-downloader',
templateUrl: './downloader.component.html', templateUrl: './downloader.component.html',
styleUrls: ['./downloader.component.css']
}) })
export class DownloaderComponent implements OnInit { export class DownloaderComponent implements OnInit {
@Input() source: FullInfo @Input() source: FullInfo
@Input() downloader: Downloader @Input() downloader: Downloader
constructor( constructor(
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
) {} ) { }
ngOnInit() { ngOnInit() {
} }
execute() { execute() {
window.open('/api/download/plugin/' window.open('/api/download/plugin/'
+ '/' + this.downloader.name + '/' + this.downloader.name
+ '/' + this.source.modelInfo.store + '/' + this.source.modelInfo.store
+ '/' + this.source.featureInfo.id) + '/' + this.source.featureInfo.id)
} }
} }