Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTM-1160: Allow configuration of template for feature type #957

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@
new GeoServiceLayerSettings()
.attribution(map5Attr.getAttribution())
.hiDpiDisabled(false)
.hiDpiMode(TileLayerHiDpiMode.SUBSTITUTELAYERSHOWNEXTZOOMLEVEL)
.hiDpiMode(

Check warning on line 522 in src/main/java/org/tailormap/api/configuration/dev/PopulateTestData.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/configuration/dev/PopulateTestData.java#L522

Added line #L522 was not covered by tests
TileLayerHiDpiMode.SUBSTITUTELAYERSHOWNEXTZOOMLEVEL)
.hiDpiSubstituteLayer("map5topo_hq"),
"map5topo_gray", map5Attr,
"map5topo_simple", map5Attr,
Expand Down Expand Up @@ -1062,7 +1063,8 @@
root.setChildrenIds(childrenIds);
app.getSettings()
.putLayerSettingsItem("lyr:map5:map5topo", new AppLayerSettings().title("Map5"))
.putLayerSettingsItem("lyr:map5:map5topo_simple", new AppLayerSettings().title("Map5 simple"));
.putLayerSettingsItem(
"lyr:map5:map5topo_simple", new AppLayerSettings().title("Map5 simple"));

Check warning on line 1067 in src/main/java/org/tailormap/api/configuration/dev/PopulateTestData.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/configuration/dev/PopulateTestData.java#L1066-L1067

Added lines #L1066 - L1067 were not covered by tests
app.getContentRoot()
.addBaseLayerNodesItem(
new AppTreeLayerNode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.tailormap.api.persistence.json.AppLayerSettings;
import org.tailormap.api.persistence.json.AppTreeLayerNode;
import org.tailormap.api.persistence.json.AttributeSettings;
import org.tailormap.api.persistence.json.FeatureTypeTemplate;
import org.tailormap.api.persistence.json.GeoServiceLayer;
import org.tailormap.api.persistence.json.TMAttributeDescriptor;
import org.tailormap.api.persistence.json.TMAttributeType;
Expand Down Expand Up @@ -460,6 +461,10 @@
} finally {
featureSource.getDataStore().dispose();
}
FeatureTypeTemplate ftt = tmFeatureType.getSettings().getTemplate();
if (ftt != null) {
featuresResponse.setTemplate(ftt.getTemplate());

Check warning on line 466 in src/main/java/org/tailormap/api/controller/FeaturesController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/controller/FeaturesController.java#L466

Added line #L466 was not covered by tests
}
if (addFields) {
configuredAttributes.values().stream()
.map(
Expand Down
13 changes: 13 additions & 0 deletions src/main/resources/openapi/persistence-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ components:
- attributeSettings
- readOnlyAttributes
properties:
template:
$ref: '#/components/schemas/FeatureTypeTemplate'
attributeOrder:
description: Reordering of the attributes by attribute names. Attributes in the feature
type that are not in this array should still be shown; either after the attribute that
Expand All @@ -266,6 +268,17 @@ components:
additionalProperties:
$ref: '#/components/schemas/AttributeSettings'

FeatureTypeTemplate:
type: object
description: Template/description for a feature. Will replace placeholders by attribute values in the viewer
properties:
template:
type: string
markupLanguage:
type: string
templateLanguage:
type: string

AttributeSettings:
properties:
title:
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/openapi/viewer-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ components:
minLength: 0
items:
$ref: './viewer-schemas.yaml#/components/schemas/ColumnMetadata'
template:
description: Template/description for a feature. Will replace placeholders by attribute values in the viewer
type: string
nullable: true
example:
total: 400
page: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ private static ResultMatcher[] provinciesWFSResultMatchers() {
jsonPath("$.features[0].attributes.fuuid").doesNotExist(),
jsonPath("$.columnMetadata").isArray(),
jsonPath("$.columnMetadata").isNotEmpty(),
jsonPath("$.template").isEmpty(),
jsonPath("$.columnMetadata[?(@.key == 'naam')].alias").value("Naam"),
jsonPath("$.columnMetadata[?(@.key == 'identificatie')].key").isEmpty(),
jsonPath("$.columnMetadata[?(@.key == 'ligtInLandCode')].key").isEmpty(),
Expand Down
Loading