Skip to content

Commit

Permalink
Merge pull request #201 from swisstopo/feature/asset-197-maintenance-…
Browse files Browse the repository at this point in the history
…warnings-aufraeumen

Feature 197: Maintenance Frontend Warnings/Flags aufräumen
  • Loading branch information
daniel-va authored Jul 8, 2024
2 parents 7354081 + e526e7d commit 22e5282
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 74 deletions.
11 changes: 6 additions & 5 deletions apps/client-asset-sg/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
"inlineStyleLanguage": "scss",
"assets": ["apps/client-asset-sg/src/favicon.ico", "apps/client-asset-sg/src/assets"],
"styles": ["apps/client-asset-sg/src/styles.scss"],
"scripts": []
"scripts": [],
"allowedCommonJsDependencies": ["tsafe", "validator", "xml-utils", "pbf", "rbush", "earcut"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "1.2mb",
"maximumError": "1.3mb"
"maximumWarning": "1.4mb",
"maximumError": "1.6mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumWarning": "4kb",
"maximumError": "6kb"
}
],
"outputHashing": "all",
Expand Down
2 changes: 1 addition & 1 deletion apps/server-asset-sg/src/utils/file/put-file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { unknownToError, unknownToUnknownError } from '@asset-sg/core';
import { PutObjectCommand } from '@aws-sdk/client-s3';
import { pipe } from 'fp-ts/lib/function';
import { pipe } from 'fp-ts/function';
import * as TE from 'fp-ts/TaskEither';

import { assetFolder, bucketName, createS3Client, destroyS3Client } from './common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,50 @@ import {
ChangeDetectionStrategy,
Component,
ElementRef,
inject,
OnInit,
QueryList,
ViewChild,
ViewChildren,
ViewContainerRef,
inject,
} from '@angular/core';
import { FormGroupDirective } from '@angular/forms';
import { MatSelectChange } from '@angular/material/select';
import {
LifecycleHooks,
WGStoLV95,
WindowService,
ZoomControlsComponent,
createFeaturesFromStudies,
createFeaturesFromStudy,
decorateFeature,
featureStyles,
isoWGSLat,
isoWGSLng,
LifecycleHooks,
lv95ToWGS,
olCoordsFromLV95Array,
olZoomControls,
toLonLat,
WGStoLV95,
WindowService,
ZoomControlsComponent,
zoomToStudies,
} from '@asset-sg/client-shared';
import { OO, sequenceProps } from '@asset-sg/core';
import {
eqStudies,
eqStudyByStudyId,
Geom,
Point as GeomPoint,
StudyPolygon as GeomPolygon,
GeomWithCoords,
getStudyWithGeomWithCoords,
LV95,
lv95RoundedToMillimeter,
lv95WithoutPrefix,
LV95X,
LV95Y,
Point as GeomPoint,
Studies,
Study,
eqStudies,
eqStudyByStudyId,
getStudyWithGeomWithCoords,
lv95RoundedToMillimeter,
lv95WithoutPrefix,
StudyPolygon as GeomPolygon,
} from '@asset-sg/shared';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { createId } from '@paralleldrive/cuid2';
import { RxState } from '@rx-angular/state';
import { point } from '@turf/helpers';
import midpoint from '@turf/midpoint';
Expand All @@ -63,7 +62,7 @@ import { Coordinate } from 'ol/coordinate';
import { easeOut } from 'ol/easing';
import Feature from 'ol/Feature';
import { Geometry, LineString, Point, Polygon } from 'ol/geom';
import { Select, Translate, defaults } from 'ol/interaction';
import { defaults, Select, Translate } from 'ol/interaction';
import Draw, { DrawEvent } from 'ol/interaction/Draw';
import { SelectEvent } from 'ol/interaction/Select';
import { TranslateEvent } from 'ol/interaction/Translate';
Expand All @@ -74,18 +73,18 @@ import { Vector as VectorSource, XYZ } from 'ol/source';
import Style from 'ol/style/Style';
import View from 'ol/View';
import {
EMPTY,
Observable,
asyncScheduler,
combineLatest,
delay,
distinctUntilChanged,
EMPTY,
expand,
filter,
fromEvent,
fromEventPattern,
map,
merge,
Observable,
share,
startWith,
subscribeOn,
Expand Down Expand Up @@ -622,7 +621,7 @@ export class AssetEditorTabGeometriesComponent implements OnInit {
}
}
if (e.value === 'Polygon') {
const study = { studyId: 'study_area_new_' + createId(), geom: Geom.as.Polygon({ coords: [] }) };
const study = { studyId: 'study_area_new_' + makeId(), geom: Geom.as.Polygon({ coords: [] }) };
const newStudies = [...this._state.get().studies, study];
this._state.set(
flow(updateNewGeometryType('Polygon'), updateMode('create-new-geometry'), (s) => ({
Expand Down Expand Up @@ -651,7 +650,7 @@ export class AssetEditorTabGeometriesComponent implements OnInit {
.subscribe();
}
if (e.value === 'LineString') {
const study = { studyId: 'study_trace_new_' + createId(), geom: Geom.as.LineString({ coords: [] }) };
const study = { studyId: 'study_trace_new_' + makeId(), geom: Geom.as.LineString({ coords: [] }) };
const newStudies = [...this._state.get().studies, study];
this._state.set(
flow(updateNewGeometryType('Linestring'), updateMode('create-new-geometry'), (s) => ({
Expand Down Expand Up @@ -1469,7 +1468,7 @@ const createNewPointStudy = (olMap: Map | undefined): O.Option<Study> =>
O.fromNullable,
O.chain((map) => O.fromNullable(map.getView().getCenter())),
O.map(coordinateToLv95RoundedToMillimeter),
O.map((coord) => ({ studyId: 'study_location_new_' + createId(), geom: Geom.as.Point({ coord }) }))
O.map((coord) => ({ studyId: 'study_location_new_' + makeId(), geom: Geom.as.Point({ coord }) }))
);

const coordinateToLv95RoundedToMillimeter = (c: Coordinate): LV95 =>
Expand All @@ -1494,3 +1493,6 @@ const scrollIntoViewIfNeeded = (element: Element) => {
element.scrollIntoView({ behavior: 'smooth' });
}
};

let nextId = 0;
const makeId = () => nextId++;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NumberInput } from '@angular/cdk/coercion';
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { PushModule } from '@rx-angular/template/push';
import * as bezier from 'bezier-easing';

import {
BehaviorSubject,
animationFrameScheduler,
Expand Down Expand Up @@ -37,9 +37,8 @@ export class AnimateNumberComponent {
scan((acc, v) => [acc[1], v], [0, 0]),
switchMap(([from, to]) =>
duration(225).pipe(
map(easing),
map((t) => Math.round(from + (to - from) * t)),
endWith(to),
endWith(to as number),
distinctUntilChanged()
)
)
Expand All @@ -56,5 +55,3 @@ const duration = (ms: number, scheduler = animationFrameScheduler) =>
map((ems) => ems / ms),
takeWhile((t) => t <= 1, true)
);

const easing = bezier(0.25, 0.8, 0.25, 1);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as RD from '@devexperts/remote-data-ts';
import { createSelector } from '@ngrx/store';
import * as A from 'fp-ts/Array';
import { flow, pipe } from 'fp-ts/function';
import { contramap } from 'fp-ts/lib/Ord';
import { contramap } from 'fp-ts/Ord';
import * as R from 'fp-ts/Record';
import * as S from 'fp-ts/string';

Expand Down
5 changes: 0 additions & 5 deletions libs/core/src/lib/io-ts-types/Codec/Email.ts

This file was deleted.

5 changes: 3 additions & 2 deletions libs/core/src/lib/io-ts-types/Decoder/Email.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { pipe } from 'fp-ts/function';
import * as D from 'io-ts/Decoder';
import isEmail from 'validator/lib/isEmail';

import { NonEmptyString } from './NonEmptyString';

Expand All @@ -10,4 +9,6 @@ export interface EmailBrand {

export type Email = string & EmailBrand;

export const Email = pipe(NonEmptyString, D.refine(isEmail as (s: string) => s is Email, 'Email'));
const emailRegex = /^[^@]+@[^@]+\.[^@]+$/;
const isEmail = (email: string): email is Email => emailRegex.test(email);
export const Email = pipe(NonEmptyString, D.refine(isEmail, 'Email'));
36 changes: 5 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ng": "nx",
"start": "concurrently \"npm run start:server\" \"npm run start:client\"",
"start:server": "npx nx serve server-asset-sg",
"start:client": "npx nx serve client-asset-sg --disableHostCheck=true",
"start:client": "npx nx serve client-asset-sg",
"build": "npx nx run-many -t build -p server-asset-sg client-asset-sg --configuration=production",
"build:server": "npx nx build server-asset-sg --configuration=production",
"build:client": "npx nx build client-asset-sg --configuration=production",
Expand Down Expand Up @@ -50,7 +50,6 @@
"@ngrx/store": "17.0.1",
"@ngx-translate/core": "^14.0.0",
"@nx/angular": "19.2.1",
"@paralleldrive/cuid2": "^2.2.2",
"@prisma/client": "^4.12.0",
"@rx-angular/cdk": "^1.0.0-rc.4",
"@rx-angular/state": "^1.7.0",
Expand All @@ -59,7 +58,6 @@
"@turf/helpers": "^6.5.0",
"@turf/midpoint": "^6.5.0",
"angular-oauth2-oidc": "^17.0.1",
"bezier-easing": "^2.1.0",
"cache-manager": "^5.4.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
Expand All @@ -80,11 +78,10 @@
"rxjs": "7.8.1",
"serialize-error": "^11.0.0",
"solid-js": "^1.6.9",
"tsafe": "^1.4.1",
"tsafe": "^1.7.1",
"tslib": "^2.3.0",
"type-fest": "^3.5.3",
"url-join": "^5.0.0",
"validator": "^13.7.0",
"vite-plugin-solid": "^2.5.0",
"zone.js": "0.14.6"
},
Expand Down

0 comments on commit 22e5282

Please sign in to comment.