Skip to content

Commit

Permalink
Merge pull request #7 from conterra/dev_exclusive
Browse files Browse the repository at this point in the history
Dev exclusive
  • Loading branch information
sholtkamp authored Feb 2, 2024
2 parents aa0bb9f + f00e8d5 commit 05f59e2
Show file tree
Hide file tree
Showing 21 changed files with 253 additions and 186 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
/.vscode/settings.json
/.externalToolBuilders/
/package-lock.json
/gulpfile.overrides.js
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# add path patterns to ignore style files
**/external-libs/**
**/styles/dijit/**
**/styles/dijit/**
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
✅ Tested for map.apps 4.15.1 / Linie 4
✅ Tested for map.apps 4.16.0 / Linie 4

#### Release Notes
- autogenerated SNAPSHOT-Release
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ gulp.task("lint",
gulp.task("preview",
gulp.series(
"build",
"lint",
// "lint",
gulp.parallel(
"watch",
"browser-sync"
Expand Down
40 changes: 25 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@
"version": "0.0.1",
"license": "CC0-1.0",
"scripts": {
"check-licenses": "node ./src/support/js/check-licenses.js"
"check-licenses": "tsx ./src/support/js/check-licenses.ts",
"check-types": "tsc --noEmit",
"watch-types": "tsc -w --noEmit"
},
"devDependencies": {
"@conterra/ct-mapapps-typings": "4.15.1",
"@conterra/mapapps-mocha-runner": "^1.1.1",
"@types/arcgis-js-api": "4.26.0",
"chai": "^4.3.7",
"ct-mapapps-browser-sync": "0.0.30",
"ct-mapapps-gulp-js": "0.9.4",
"eslint-config-ct-prodeng": "1.3.0-next-2",
"license-checker": "^25.0.1",
"mocha": "^10.2.0",
"puppeteer": "^19.11.1",
"vue-template-compiler": "2.7.8",
"stylelint-config-ct-prodeng": "1.0.4",
"stylelint-config-recommended": "5.0.0",
"stylelint": "^13.13.1"
"@conterra/ct-mapapps-typings": "~4.16.0",
"@conterra/mapapps-mocha-runner": "1.1.1",
"@types/arcgis-js-api": "4.28.0",
"@types/chai": "4.3.10",
"@types/license-checker": "^25.0.6",
"@types/mocha": "10.0.4",
"chai": "4.3.10",
"ct-mapapps-browser-sync": "0.0.34",
"ct-mapapps-gulp-js": "0.10.2",
"eslint-config-ct-prodeng": "1.4.0",
"license-checker": "25.0.1",
"mocha": "10.2.0",
"puppeteer": "21.5.2",
"stylelint": "15.11.0",
"stylelint-config-ct-prodeng": "2.0.0",
"stylelint-config-recommended": "13.0.0",
"stylelint-config-recommended-less": "2.0.0",
"ts-node": "^10.9.1",
"tsx": "^4.6.0",
"typescript": "5.2.2",
"vue": "2.7.15",
"vue-template-compiler": "2.7.15"
}
}
57 changes: 24 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@
<version>${ct.jsrt-test.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>de.conterra.mapapps</groupId>
<artifactId>mapapps-maven-plugin</artifactId>
<version>${mapapps.version}</version>
</plugin>
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
Expand Down Expand Up @@ -138,10 +142,9 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
<version>1.14.2</version>
<configuration>
<nodeVersion>v18.13.0</nodeVersion>
<npmVersion>8.19.3</npmVersion>
<nodeVersion>v20.9.0</nodeVersion>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -219,22 +222,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.11.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<version>3.5.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>unpack-themes-src</id>
Expand Down Expand Up @@ -403,6 +407,12 @@
<plugin>
<groupId>de.conterra.mapapps</groupId>
<artifactId>mapapps-maven-plugin</artifactId>
<configuration>
<!-- only build zip files -->
<skipDeploy>true</skipDeploy>
<sourceDirectory>${js.build.outputPath}/apps</sourceDirectory>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
<executions>
<execution>
<!-- used to create .zip files containing the apps during the build -->
Expand All @@ -411,32 +421,7 @@
<goal>deployApps</goal>
</goals>
</execution>
<execution>
<id>build-app-template</id>
<phase>prepare-package</phase>
<goals>
<goal>deployAppTemplate</goal>
</goals>
<configuration>
<templateFile>${project.build.directory}/${project.artifactId}-sample-app.zip</templateFile>
<templateResources>
<templateResource>
<directory>${js.build.outputPath}/apps/sample</directory>
<includes>
<include>**/*</include>
</includes>
</templateResource>
</templateResources>
</configuration>
</execution>
</executions>
<configuration>
<!-- only build zip files -->
<skipDeploy>true</skipDeploy>
<createApp>false</createApp>
<sourceDirectory>${js.build.outputPath}/apps</sourceDirectory>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -490,11 +475,12 @@
<root.build.outputPath>${project.build.directory}/webapp</root.build.outputPath>
<js.build.outputPath>${root.build.outputPath}/js</js.build.outputPath>

<mapapps.version>4.15.1</mapapps.version>
<mapapps.version>4.16.0</mapapps.version>
<vuetify.version>1.5.28</vuetify.version>
<!-- JS lib versions -->
<apprt.version>${mapapps.version}</apprt.version>
<!-- java lib versions -->
<ct.jsregistry.version>1.5.10</ct.jsregistry.version>
<ct.jsregistry.version>1.5.14</ct.jsregistry.version>
<ct.jsrt-test.version>2.0.2</ct.jsrt-test.version>

<!-- the default app, replaced in the *.html files to switch app names-->
Expand Down Expand Up @@ -557,6 +543,11 @@
<artifactId>ags-js-api4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.esri</groupId>
<artifactId>terraformer-js</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>moment-js</groupId>
<artifactId>moment-js</artifactId>
Expand Down
35 changes: 35 additions & 0 deletions src/main/js/apps/sample/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,41 @@
],
"map": {
"layers": [
{
"type": "GROUP",
"title": "Bäume",
"visible": true,
"visibilityMode": "exclusive",
"layers": [
{
"id": "baum_children",
"url": "https://services.conterra.de/arcgis/rest/services/mapapps/Baumkataster_Zustand/MapServer",
"type": "AGS_DYNAMIC",
"visible": true,
"title": "Bäume mit Children",
"sublayers": [
{
"id": 0,
"visible": true
}
]
},
{
"id": "baum_nochildren",
"url": "https://services.conterra.de/arcgis/rest/services/mapapps/Baumkataster_Zustand/MapServer",
"type": "AGS_DYNAMIC",
"visible": true,
"title": "Bäume ohne Children",
"listMode": "hide-children",
"sublayers": [
{
"id": 0,
"visible": true
}
]
}
]
},
{
"id": "stoerungen",
"type": "AGS_FEATURE",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
/*
* Copyright (C) 2023 con terra GmbH ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///
/// Copyright (C) 2023 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

import { InjectedReference } from "apprt-core/InjectedReference";
import type { ActionDefinition } from "toc/api";
import type { AGSStoreFactory } from "agssearch/api";
import { Messages } from "./nls/bundle";
import { ResultViewerService } from "result-api/api";
import { TocItem } from "toc/model/TocItem";

const ID = "datatable";

export default class DatatableActionDefinitionFactory {
constructor(props) {
private _i18n: Messages;
private _agsStoreFactory: InjectedReference<AGSStoreFactory>;
private dataModel: InjectedReference<any>;
private resultViewerService: InjectedReference<ResultViewerService>;

private supportedIds: Array<string>;

constructor(props: Record<string, any>) {
this.supportedIds = [ID];
}

createDefinitionById(id) {
public createDefinitionById(id: string): ActionDefinition {
if (ID !== id) {
return;
}
const i18n = this._i18n.get();
const agsStoreFactory = this._agsStoreFactory;
const dataModel = this._dataModel;
const resultViewerService = this._resultViewerService;
// eslint-disable-next-line @typescript-eslint/no-this-alias
const that = this;

return {
id: ID,
type: "button",
label: i18n.actionLabel,
icon: "icon-editor-table",

isVisibleForItem(tocItem) {
isVisibleForItem(tocItem: TocItem): boolean {
const ref = tocItem.ref;
const parent = ref && ref.parent;
const capabilities = parent && parent.capabilities;
Expand All @@ -44,29 +59,34 @@ export default class DatatableActionDefinitionFactory {
return true;
} else if (capabilities?.operations?.supportsQuery) {
return true;
} else {
} else if (parent.visibilityMode === "exclusive") {
return ref.sublayers && tocItem.listMode === "hide-children";
}
else {
return false;
}
} else {
return false;
}
},

trigger(tocItem) {
trigger(tocItem: TocItem): void {
const ref = tocItem.ref;
let id = ref.id;
if (ref?.layer?.type === "map-image") {
id = ref.layer.id + "/" + ref.id;
if (ref?.type === "map-image") {
id = `${id}/${ref.sublayers.items[0].id}`;
} else if (ref?.layer?.type === "map-image") {
id = `${ref.layer.id}/${id}`;
}
const storeProps = {
id: "action_store_" + new Date().getTime(),
id: `action_store_${new Date().getTime()}`,
layerId: id
};

agsStoreFactory.createStore(storeProps).then((store) => {
store.load().then(async () => {
// result-ui is used
if (resultViewerService) {
if (that.resultViewerService) {
const idsProvider = async ({ limit }) => {
const result = await store.query({}, {
count: limit
Expand All @@ -76,19 +96,19 @@ export default class DatatableActionDefinitionFactory {
};
};

const dataTableFactory = resultViewerService.dataTableFactory;
const dataTableFactory = that.resultViewerService.dataTableFactory;
const dataTable = await dataTableFactory.createDataTableFromStoreAndQuery({
dataTableTitle: store.title || store.id || i18n.searchResultTitle,
dataSource: store,
idsProvider
});

const dataTableCollection = dataTableFactory.createDataTableCollection([dataTable]);
resultViewerService.open(dataTableCollection);
that.resultViewerService.open(dataTableCollection);
}
// resulcenter is used
else if (dataModel) {
dataModel.setDatasource(store);
else if (that.dataModel) {
that.dataModel.setDatasource(store);
}
// neither resultcenter nor result-ui is available
else {
Expand All @@ -99,4 +119,12 @@ export default class DatatableActionDefinitionFactory {
}
};
}

setDataModel(dataModel: any): void {
this.dataModel = dataModel;
}

setResultViewerService(resultViewerService: any): void {
this.resultViewerService = resultViewerService;
}
}
Loading

0 comments on commit 05f59e2

Please sign in to comment.