Skip to content

Commit

Permalink
add geoadmin-demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Dec 6, 2024
1 parent e285a15 commit 9273fac
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
# OpenAPI generated specs
**/spec.yaml
/.nx

.angular
36 changes: 36 additions & 0 deletions apps/geoadmin-demo/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "geoadmin",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "geoadmin-root",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/geoadmin-demo/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'geoadmin-demo',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/apps/geoadmin-demo',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
}
101 changes: 101 additions & 0 deletions apps/geoadmin-demo/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "geoadmin-demo",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "geonetwork-ui",
"sourceRoot": "apps/geoadmin-demo/src",
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/geoadmin-demo",
"index": "apps/geoadmin-demo/src/index.html",
"main": "apps/geoadmin-demo/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/geoadmin-demo/tsconfig.app.json",
"assets": [
"apps/geoadmin-demo/src/favicon.ico",
"apps/geoadmin-demo/src/assets"
],
"styles": ["apps/geoadmin-demo/src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "geoadmin-demo:build:production"
},
"development": {
"browserTarget": "geoadmin-demo:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "geoadmin-demo:build"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/geoadmin-demo/**/*.ts",
"apps/geoadmin-demo/**/*.html"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/geoadmin-demo/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "geoadmin-demo:build"
}
}
}
}
Empty file.
Binary file added apps/geoadmin-demo/src/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions apps/geoadmin-demo/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Geoadmin + Geocat integration demo</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script src="https://cdn.jsdelivr.net/gh/camptocamp/geocat-geonetwork-ui@wc-dist-geocat-gpf/gn-wc.js"></script>
</head>
<body>
<iframe
id="geoadmin-root"
src="https://map.geo.admin.ch/#embed?bgLayer=ch.swisstopo.pixelkarte-grau"
></iframe>
<gn-search-input
api-url="https://www.geocat.ch/geonetwork/srv/api"
primary-color="#0f4395"
secondary-color="#8bc832"
></gn-search-input>
<gn-results-list
api-url="https://www.geocat.ch/geonetwork/srv/api"
layout="ROW"
primary-color="#0f4395"
secondary-color="#8bc832"
></gn-results-list>

<script>
GNUI.recordsRepository
.search({
filters: {
any: 'wasser',
linkProtocol: '/OGC:WMT?S.*/',
},
offset: 0,
limit: 10,
sort: ['desc', '_score'],
fields: ['resourceTitleObject', 'link'],
})
.subscribe(console.log)
</script>
</body>
</html>
1 change: 1 addition & 0 deletions apps/geoadmin-demo/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// bla
34 changes: 34 additions & 0 deletions apps/geoadmin-demo/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* You can add global styles to this file, and also import other style files */
html,
body {
height: 100%;
}
body {
margin: 0;
position: relative;
}

#geoadmin-root {
width: 100%;
height: calc(100% - 4px);
border: 0;
}

gn-search-input {
position: absolute;
left: 20px;
top: 55px;
width: 40%;
background: white;
}

gn-results-list {
position: absolute;
left: 20px;
top: 125px;
bottom: 20px;
width: 40%;
padding: 8px;
background: white;
overflow: auto;
}
8 changes: 8 additions & 0 deletions apps/geoadmin-demo/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
}
import 'jest-preset-angular/setup-jest'
10 changes: 10 additions & 0 deletions apps/geoadmin-demo/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": []
},
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"],
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
}
7 changes: 7 additions & 0 deletions apps/geoadmin-demo/tsconfig.editor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"types": ["jest", "node"]
}
}
32 changes: 32 additions & 0 deletions apps/geoadmin-demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
},
{
"path": "./tsconfig.editor.json"
}
],
"extends": "../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
16 changes: 16 additions & 0 deletions apps/geoadmin-demo/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

0 comments on commit 9273fac

Please sign in to comment.