Cleanup
This commit is contained in:
parent
4c4dc3fc5c
commit
bbffcd5aed
10 changed files with 116 additions and 119 deletions
|
@ -6,29 +6,28 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'
|
|||
import { Role } from './models'
|
||||
|
||||
export interface DialogData {
|
||||
role: Role
|
||||
role: Role
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-admin-access-role-dialog',
|
||||
templateUrl: 'role-dialog.component.html',
|
||||
styleUrls: ['role-dialog.component.css'],
|
||||
selector: 'gisaf-admin-access-role-dialog',
|
||||
templateUrl: 'role-dialog.component.html',
|
||||
})
|
||||
export class GisafAdminAccessRoleDialogComponent implements OnInit {
|
||||
formGroup: UntypedFormGroup = new UntypedFormGroup({})
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<GisafAdminAccessRoleDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData
|
||||
) {}
|
||||
formGroup: UntypedFormGroup = new UntypedFormGroup({})
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<GisafAdminAccessRoleDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
let role: Role = this.data['role'] || new Role(undefined, '', '')
|
||||
this.formGroup.addControl('id', new UntypedFormControl(role.id))
|
||||
this.formGroup.addControl('name', new UntypedFormControl(role.name, [Validators.required]))
|
||||
this.formGroup.addControl('description', new UntypedFormControl(role.description, [Validators.required]))
|
||||
}
|
||||
ngOnInit() {
|
||||
let role: Role = this.data['role'] || new Role(undefined, '', '')
|
||||
this.formGroup.addControl('id', new UntypedFormControl(role.id))
|
||||
this.formGroup.addControl('name', new UntypedFormControl(role.name, [Validators.required]))
|
||||
this.formGroup.addControl('description', new UntypedFormControl(role.description, [Validators.required]))
|
||||
}
|
||||
|
||||
save() {
|
||||
this.dialogRef.close(this.formGroup.value);
|
||||
}
|
||||
}
|
||||
save() {
|
||||
this.dialogRef.close(this.formGroup.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,28 +5,27 @@ import { MatSnackBar } from '@angular/material/snack-bar'
|
|||
import { AdminManageDataService } from '../data.service'
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-admin-maintenance',
|
||||
templateUrl: './maintenance.component.html',
|
||||
styleUrls: ['./maintenance.component.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
selector: 'gisaf-admin-maintenance',
|
||||
templateUrl: './maintenance.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AdminMaintenanceComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private adminManageDataService: AdminManageDataService,
|
||||
private snackBar: MatSnackBar,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) { }
|
||||
constructor(
|
||||
private adminManageDataService: AdminManageDataService,
|
||||
private snackBar: MatSnackBar,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
vacuumDb() {
|
||||
this.adminManageDataService.vacuumDb().subscribe(
|
||||
resp => this.snackBar.open(
|
||||
'Database vacuum OK',
|
||||
'Close',
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
vacuumDb() {
|
||||
this.adminManageDataService.vacuumDb().subscribe(
|
||||
resp => this.snackBar.open(
|
||||
'Database vacuum OK',
|
||||
'Close',
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ import { Component } from '@angular/core'
|
|||
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-info-home',
|
||||
templateUrl: './info-home.component.html',
|
||||
styleUrls: ['./info-home.component.css']
|
||||
selector: 'gisaf-info-home',
|
||||
templateUrl: './info-home.component.html',
|
||||
})
|
||||
export class InfoHomeComponent {}
|
||||
export class InfoHomeComponent { }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { Component, Input,
|
||||
ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'
|
||||
import {
|
||||
Component, Input,
|
||||
ChangeDetectionStrategy, ChangeDetectorRef
|
||||
} from '@angular/core'
|
||||
|
||||
import { Tag } from './tags.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'
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-tag-action',
|
||||
templateUrl: './tag-action.component.html',
|
||||
styleUrls: ['./tag-action.component.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
selector: 'gisaf-tag-action',
|
||||
templateUrl: './tag-action.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class TagActionComponent {
|
||||
@Input() source: FullInfo
|
||||
@Input() action: Action
|
||||
constructor(
|
||||
private actionsService: ActionsService,
|
||||
private infoDataService: InfoDataService,
|
||||
private snackBar: MatSnackBar,
|
||||
public authenticationService: AuthenticationService,
|
||||
protected mapControlService: MapControlService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) {}
|
||||
@Input() source: FullInfo
|
||||
@Input() action: Action
|
||||
constructor(
|
||||
private actionsService: ActionsService,
|
||||
private infoDataService: InfoDataService,
|
||||
private snackBar: MatSnackBar,
|
||||
public authenticationService: AuthenticationService,
|
||||
protected mapControlService: MapControlService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) { }
|
||||
|
||||
execute() {
|
||||
this.actionsService.execute(
|
||||
[this.source.modelInfo.store],
|
||||
[[this.source.featureInfo.id.toString()]],
|
||||
[this.action.name],
|
||||
this.action.params,
|
||||
).subscribe(
|
||||
results => {
|
||||
// Update the tags in the info source
|
||||
let result = results[0].actionResults[0]
|
||||
if (result.message) {
|
||||
this.snackBar.open(result.message, 'Close', {duration: 3000})
|
||||
}
|
||||
if (!result.actionResults || result.actionResults.length == 0) {
|
||||
return
|
||||
}
|
||||
let layer = result.actionResults[0].taggedLayers.find(
|
||||
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)
|
||||
}
|
||||
}
|
||||
execute() {
|
||||
this.actionsService.execute(
|
||||
[this.source.modelInfo.store],
|
||||
[[this.source.featureInfo.id.toString()]],
|
||||
[this.action.name],
|
||||
this.action.params,
|
||||
).subscribe(
|
||||
results => {
|
||||
// Update the tags in the info source
|
||||
let result = results[0].actionResults[0]
|
||||
if (result.message) {
|
||||
this.snackBar.open(result.message, 'Close', { duration: 3000 })
|
||||
}
|
||||
if (!result.actionResults || result.actionResults.length == 0) {
|
||||
return
|
||||
}
|
||||
let layer = result.actionResults[0].taggedLayers.find(
|
||||
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)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,25 +6,24 @@ import { FullInfo } from '../info-data.service'
|
|||
import { Downloader } from '../../openapi'
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-downloader',
|
||||
templateUrl: './downloader.component.html',
|
||||
styleUrls: ['./downloader.component.css']
|
||||
selector: 'gisaf-downloader',
|
||||
templateUrl: './downloader.component.html',
|
||||
})
|
||||
export class DownloaderComponent implements OnInit {
|
||||
@Input() source: FullInfo
|
||||
@Input() downloader: Downloader
|
||||
@Input() source: FullInfo
|
||||
@Input() downloader: Downloader
|
||||
|
||||
constructor(
|
||||
private snackBar: MatSnackBar,
|
||||
) {}
|
||||
constructor(
|
||||
private snackBar: MatSnackBar,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
execute() {
|
||||
window.open('/api/download/plugin/'
|
||||
+ '/' + this.downloader.name
|
||||
+ '/' + this.source.modelInfo.store
|
||||
+ '/' + this.source.featureInfo.id)
|
||||
}
|
||||
}
|
||||
execute() {
|
||||
window.open('/api/download/plugin/'
|
||||
+ '/' + this.downloader.name
|
||||
+ '/' + this.source.modelInfo.store
|
||||
+ '/' + this.source.featureInfo.id)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue