diff --git a/app/components/imageoverview/image-overview-taskbar.component.ts b/app/components/imageoverview/image-overview-taskbar.component.ts index 1a3e1d6825..661d8e4cec 100644 --- a/app/components/imageoverview/image-overview-taskbar.component.ts +++ b/app/components/imageoverview/image-overview-taskbar.component.ts @@ -38,9 +38,7 @@ export class ImageOverviewTaskbarComponent { private imageOverviewFacade: ImageOverviewFacade, private persistenceHelper: PersistenceHelper, private imageOverviewComponent: ImageOverviewComponent - ) { - this.imageOverviewFacade.initialize(); - } + ) {} public onKeyDown(event: KeyboardEvent) { diff --git a/app/components/imageoverview/searchbar/image-overview-search-constraints.component.ts b/app/components/imageoverview/searchbar/image-overview-search-constraints.component.ts index 3f22f0fad8..87f75521a6 100644 --- a/app/components/imageoverview/searchbar/image-overview-search-constraints.component.ts +++ b/app/components/imageoverview/searchbar/image-overview-search-constraints.component.ts @@ -6,6 +6,7 @@ import {ImageOverviewFacade} from '../view/imageoverview-facade'; import {ProjectConfiguration} from '../../../core/configuration/project-configuration'; import {FieldDefinition} from '../../../core/configuration/model/field-definition'; import {DocumentReadDatastore} from '../../../core/datastore/document-read-datastore'; +import {clone} from '../../../core/util/object-util'; @Component({ @@ -47,7 +48,7 @@ export class ImageOverviewSearchConstraintsComponent extends SearchConstraintsCo protected getCustomConstraints(): { [name: string]: string } { - return this.imageOverviewFacade.getCustomConstraints(); + return clone(this.imageOverviewFacade.getCustomConstraints()); } diff --git a/app/components/imageoverview/view/imageoverview-facade.ts b/app/components/imageoverview/view/imageoverview-facade.ts index 584a63bf55..001b523e23 100644 --- a/app/components/imageoverview/view/imageoverview-facade.ts +++ b/app/components/imageoverview/view/imageoverview-facade.ts @@ -1,4 +1,5 @@ import {Injectable} from '@angular/core'; +import {equal} from 'tsfun'; import {Query, ImageDocument} from 'idai-components-2'; import {ImagesState} from './images-state'; import {ImageDocumentsManager} from './image-documents-manager'; @@ -96,11 +97,13 @@ export class ImageOverviewFacade { public getPageCount() { + return Math.ceil(this.getTotalDocumentCount() / this.getNrImagesPerPage()); } public getCurrentPage() { + return this.currentOffset / this.getNrImagesPerPage() + 1; } @@ -141,6 +144,8 @@ export class ImageOverviewFacade { public setCustomConstraints(customConstraints: { [name: string]: string }) { + if (equal(this.imagesState.getCustomConstraints())(customConstraints)) return; + this.currentOffset = 0; this.imagesState.setCustomConstraints(customConstraints); diff --git a/app/components/matrix/matrix-view.component.ts b/app/components/matrix/matrix-view.component.ts index 9175be857c..9d42205de6 100644 --- a/app/components/matrix/matrix-view.component.ts +++ b/app/components/matrix/matrix-view.component.ts @@ -12,6 +12,7 @@ import {DotBuilder} from './dot-builder'; import {MatrixSelection, MatrixSelectionMode} from './matrix-selection'; import {Edges, EdgesBuilder, GraphRelationsConfiguration} from './edges-builder'; import {TabManager} from '../tab-manager'; +import {ProjectConfiguration} from '../../core/configuration/project-configuration'; import {POSITION_RELATIONS, TIME_RELATIONS} from '../../core/model/relation-constants'; import IS_CONTEMPORARY_WITH = TIME_RELATIONS.IS_CONTEMPORARY_WITH; import IS_EQUIVALENT_TO = POSITION_RELATIONS.IS_EQUIVALENT_TO; @@ -21,7 +22,6 @@ import IS_ABOVE = POSITION_RELATIONS.IS_ABOVE; import IS_BELOW = POSITION_RELATIONS.IS_BELOW; import IS_CUT_BY = POSITION_RELATIONS.IS_CUT_BY; import CUTS = POSITION_RELATIONS.CUTS; -import {ProjectConfiguration} from '../../core/configuration/project-configuration'; @Component({ @@ -159,6 +159,8 @@ export class MatrixViewComponent implements OnInit { private async populateTrenches(): Promise { + if (!this.projectConfiguration.getTypesMap()['Trench']) return; + this.trenches = (await this.datastore.find({ types: ['Trench'] })).documents; if (this.trenches.length === 0) return; diff --git a/app/components/resources/navigation/navigation-service.ts b/app/components/resources/navigation/navigation-service.ts index 6e89c26ce1..5025769a38 100644 --- a/app/components/resources/navigation/navigation-service.ts +++ b/app/components/resources/navigation/navigation-service.ts @@ -1,9 +1,9 @@ import {Injectable} from '@angular/core'; +import {Observable, Observer} from 'rxjs'; import {FieldDocument, Document} from 'idai-components-2'; import {RoutingService} from '../../routing-service'; import {ViewFacade} from '../view/view-facade'; import {ObserverUtil} from '../../../core/util/observer-util'; -import {Observable, Observer} from 'rxjs'; import {TypeUtility} from '../../../core/model/type-utility'; import {ProjectConfiguration} from '../../../core/configuration/project-configuration'; import {RelationDefinition} from '../../../core/configuration/model/relation-definition'; @@ -12,7 +12,8 @@ import {IdaiType} from '../../../core/configuration/model/idai-type'; @Injectable() /** - * This serves to centralize the behaviour of navigation buttons of both the sidebar as well as the full scale list. + * This serves to centralize the behaviour of navigation buttons of both the sidebar as well as the + * full scale list. * * @author Daniel de Oliveira * @author Thomas Kleinke @@ -98,8 +99,11 @@ export class NavigationService { if (!document.resource.id) return false; // do not show as long as it is not saved if (this.viewFacade.getBypassHierarchy()) return false; - return this.projectConfiguration.getTypesMap()['Operation'].children - .map((type: IdaiType) => type.name) - .includes(document.resource.type); + const operationType: IdaiType|undefined = this.projectConfiguration.getTypesMap()['Operation']; + + return operationType !== undefined && operationType.children !== undefined + && operationType.children + .map((type: IdaiType) => type.name) + .includes(document.resource.type); } } diff --git a/app/components/resources/searchbar/resources-search-constraints.component.ts b/app/components/resources/searchbar/resources-search-constraints.component.ts index c918171334..6db21073de 100644 --- a/app/components/resources/searchbar/resources-search-constraints.component.ts +++ b/app/components/resources/searchbar/resources-search-constraints.component.ts @@ -6,6 +6,7 @@ import {ViewFacade} from '../view/view-facade'; import {FieldDefinition} from '../../../core/configuration/model/field-definition'; import {ProjectConfiguration} from '../../../core/configuration/project-configuration'; import {DocumentReadDatastore} from '../../../core/datastore/document-read-datastore'; +import {clone} from '../../../core/util/object-util'; @Component({ @@ -58,7 +59,7 @@ export class ResourcesSearchConstraintsComponent extends SearchConstraintsCompon protected getCustomConstraints(): { [name: string]: string } { - return this.viewFacade.getCustomConstraints(); + return clone(this.viewFacade.getCustomConstraints()); } diff --git a/app/core/settings/settings-service.ts b/app/core/settings/settings-service.ts index 33e559e7a7..396d22d3d0 100644 --- a/app/core/settings/settings-service.ts +++ b/app/core/settings/settings-service.ts @@ -97,8 +97,7 @@ export class SettingsService { if (this.getSelectedProject().startsWith('monte-turcisi')) customProjectName = 'MonTur'; if (this.getSelectedProject().startsWith('al-ula')) customProjectName = 'AlUla'; if (this.getSelectedProject().startsWith('kalapodi')) customProjectName = 'Kalapodi'; - if (this.getSelectedProject().startsWith('sudan-digital')) customProjectName = 'Sudan'; - + if (this.getSelectedProject().startsWith('sudan-heritage')) customProjectName = 'SudanHeritage'; try { return await this.appConfigurator.go( @@ -314,4 +313,4 @@ export class SettingsService { modified: [{ user: username, date: new Date() }] }; } -} \ No newline at end of file +} diff --git a/app/widgets/search-bar.component.ts b/app/widgets/search-bar.component.ts index 9aa8505e40..7f479a7d60 100644 --- a/app/widgets/search-bar.component.ts +++ b/app/widgets/search-bar.component.ts @@ -1,4 +1,4 @@ -import {Component, EventEmitter, Input, Output, ViewChild, ElementRef} from '@angular/core'; +import {Component, EventEmitter, Input, Output, ViewChild, ElementRef, OnChanges} from '@angular/core'; import {sameset} from 'tsfun'; import {TypeUtility} from '../core/model/type-utility'; import {IdaiType} from '../core/configuration/model/idai-type'; @@ -18,7 +18,7 @@ import {IdaiType} from '../core/configuration/model/idai-type'; * @author Thomas Kleinke * @author Jan G. Wieners */ -export class SearchBarComponent { +export class SearchBarComponent implements OnChanges { @Input() filterOptions: Array = []; @Input() showFiltersMenu: boolean = true; @@ -40,6 +40,14 @@ export class SearchBarComponent { constructor(private typeUtility: TypeUtility) {} + ngOnChanges() { + + if ((!this.types || this.types.length === 0) && this.filterOptions.length === 1) { + this.types = [this.filterOptions[0].name]; + } + } + + public isAllTypesOptionVisible = () => this.filterOptions && this.filterOptions.length > 1; diff --git a/config/Config-SudanHeritage.json b/config/Config-SudanHeritage.json new file mode 100644 index 0000000000..cbedca2c9b --- /dev/null +++ b/config/Config-SudanHeritage.json @@ -0,0 +1,67 @@ +{ + "Project:default": { + "hidden": [], + "fields": {} + }, + "Place:default": { + "hidden": [ + "buildingHistory", + "buildingResearchHistory", + "excavationHistory", + "findSituation", + "findspotClassification" + ], + "typeFamily": "Place", + "description": {}, + "createdBy": "", + "creationDate": "", + "color": "#5572A1", + "commons": [ + "dating", + "description" + ], + "valuelists": { + "siteClassification": "Place-siteClassification-SudanHeritage", + "periodSudanHeritage": "period-SudanHeritage" + }, + "fields": { + "placeName": { + "inputType": "input" + }, + "placeNameOriginalLanguage": { + "inputType": "input" + }, + "periodSudanHeritage": { + "inputType": "checkboxes" + }, + "researchHistory": { + "inputType": "text" + }, + "modernIntervention": { + "inputType": "input" + }, + "siteClassification": { + "inputType": "checkboxes" + }, + "stateOfPreservation": { + "inputType": "text" + }, + "conservationMeasures": { + "inputType": "text" + }, + "objectCirculation": { + "inputType": "text" + }, + "staffInCharge": { + "inputType": "text" + }, + "securityMeasures": { + "inputType": "text" + } + } + }, + "Image:default": { + "hidden": [], + "fields": {} + } +} diff --git a/config/Config-WES.json b/config/Config-WES.json index e195d3f0d6..ac16476f35 100644 --- a/config/Config-WES.json +++ b/config/Config-WES.json @@ -37,7 +37,10 @@ }, "Find:default": { "hidden": [], - "fields": {} + "fields": {}, + "valuelists": { + "period": "periods-wes-1" + } }, "Feature:default": { "hidden": [], @@ -135,7 +138,12 @@ "hidden": [], "fields": {} }, - "Pottery:default": { + "Pottery:wes": { + "parent": "Find", + "typeFamily": "Pottery", + "description": {}, + "createdBy": "Max Haibt", + "creationDate": "", "fields": { "vesselpart": { "inputType": "checkboxes" @@ -637,4 +645,4 @@ "classification": "Mollusk-classification-WES" } } -} \ No newline at end of file +} diff --git a/config/Language-SudanHeritage.de.json b/config/Language-SudanHeritage.de.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/config/Language-SudanHeritage.de.json @@ -0,0 +1 @@ +{} diff --git a/config/Language-SudanHeritage.en.json b/config/Language-SudanHeritage.en.json new file mode 100644 index 0000000000..2420628c26 --- /dev/null +++ b/config/Language-SudanHeritage.en.json @@ -0,0 +1,42 @@ +{ + "types": { + "Place": { + "label": "Heritage Site", + "fields": { + "placeName": { + "label": "Place name" + }, + "placeNameOriginalLanguage": { + "label": "Place name in arabic" + }, + "researchHistory": { + "label": "Research history" + }, + "modernIntervention": { + "label": "Modern structures on the site" + }, + "periodSudanHeritage": { + "label": "Periods observable on the site" + }, + "siteClassification": { + "label": "General archaeological classification for the site" + }, + "stateOfPreservation": { + "label": "Description of the state of preservation" + }, + "conservationMeasures": { + "label": "Measures for conservation of the site" + }, + "objectCirculation": { + "label": "Archaeological objects from this site in circulation" + }, + "staffInCharge": { + "label": "Persons in charge of this site" + }, + "securityMeasures": { + "label": "Measures for securing the site" + } + } + } + } +} diff --git a/config/Library/Valuelists.json b/config/Library/Valuelists.json index cc7b6e9281..29c64d18f2 100644 --- a/config/Library/Valuelists.json +++ b/config/Library/Valuelists.json @@ -274,6 +274,28 @@ "Recent": {} } }, + "period-SudanHeritage": { + "creationDate": "14-11-2019", + "createdBy": "Sami Elamin", + "description": { + "de": "", + "en": "" + }, + "values": { + "Paleolithic": {}, + "Mesolithic": {}, + "Neolithic": {}, + "Pre-Kerma": {}, + "Kerma": {}, + "New Egyptian Kingdom": {}, + "Napata": {}, + "Meroe": {}, + "Post-Meroitic": {}, + "Christian": {}, + "Islamic": {}, + "Modern History": {} + } + }, "colors-default-1": { "creationDate": "", "createdBy": "IT-Referat, DAI, 2019", @@ -1340,6 +1362,39 @@ "Siedlung": {} } }, + "Place-siteClassification-SudanHeritage": { + "creationDate": "", + "createdBy": "", + "description": { + "de": "", + "en": "" + }, + "values": { + "settlement": {}, + "cemetery": {}, + "tumuli grave": {}, + "mound grave": {}, + "rock grave": {}, + "box grave": {}, + "other grave": {}, + "Pyramid (Sandstone)": {}, + "Pyramid (Mud Brick)": {}, + "Rock Art": {}, + "Fortress": {}, + "Castle": {}, + "Hafir": {}, + "Quarry": {}, + "Granary": {}, + "Old mining site": {}, + "Workshop": {}, + "Church": {}, + "Monastery": {}, + "Cathedral": {}, + "Mosque": {}, + "Landscape feature": {}, + "Historical building": {} + } + }, "Layer-consistency-default": { "creationDate": "", "createdBy": "", @@ -8813,4 +8868,4 @@ "Spätklassisch": {} } } -} \ No newline at end of file +}