Skip to content

Commit

Permalink
Merge pull request #184 from swisstopo/develop
Browse files Browse the repository at this point in the history
INT Release
  • Loading branch information
TIL-EBP authored Jun 27, 2024
2 parents 020ec31 + 9a414cf commit 59345ed
Show file tree
Hide file tree
Showing 46 changed files with 918 additions and 880 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Configure the following variables:
Install node modules:

```bash
npm run install
npm install
```

#### 4. Generate Database Types
Expand Down
1 change: 0 additions & 1 deletion apps/client-asset-sg/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ asset-sg-menu-bar {

@media screen and (min-width: 1194px) {
:host {
max-width: 1920px;
margin: 0 auto;
grid-template-areas: "app-bar app-bar" "menu-bar router-outlet";
grid-template-rows: $app-bar-height calc(100vh - $app-bar-height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AppState } from '../../state/app-state';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MenuBarComponent {
@HostBinding('attr.role') role = 'navigation';
private _router = inject(Router);
public _translateService = inject(TranslateService);
private _store = inject(Store<AppState>);
Expand Down Expand Up @@ -53,11 +54,6 @@ export class MenuBarComponent {
}

public openAssetDrawer() {
this._store.dispatch(appSharedStateActions.triggerSearch());
}

@HostBinding('role')
get hostRole(): string {
return 'navigation';
this._store.dispatch(appSharedStateActions.toggleSearchFilter());
}
}
9 changes: 7 additions & 2 deletions apps/client-asset-sg/src/app/i18n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const deAppTranslations = {
userManagement: 'Benutzer Verwaltung',
},
map: {
zoomIn: 'Hineinoomen',
zoomIn: 'Hineinzoomen',
zoomOut: 'Herauszoomen',
zoomToOrigin: 'Zur Ursprungsposition zoomen',
drawingModeOn: 'Der Zeichenmodus ist ausgeschaltet. Klicken Sie, um den Zeichenmodus einzuschalten',
Expand All @@ -50,7 +50,6 @@ export const deAppTranslations = {
originalTitle: 'Originaltitel',
kind: 'Art',
topic: 'Thema',
language: 'Sprache',
format: 'Format',
createdDate: 'Erstellungsdatum',
lastProcessedDate: 'Letztes Update',
Expand All @@ -74,12 +73,18 @@ export const deAppTranslations = {
Polygon: 'Polygon',
None: 'Keine',
},
language: 'Sprache',
languageItem: {
None: 'keine',
},
resetSearch: 'Suche zurücksetzen',
file: 'Datei',
openFileInNewTab: '{{fileName}} in neuem Tab öffnen',
downloadFile: '{{fileName}} herunterladen',
assetsUnderMouseCursor: '{{ assetsCount }} Assets unter dem Mauszeiger gefunden. Bitte wählen Sie eines aus:',
removePolygon: 'Polygon aufheben',
hideTable: 'Tabelle verbergen',
showTable: 'Tabelle anzeigen',
},
contactRoles: {
author: 'Autor',
Expand Down
7 changes: 6 additions & 1 deletion apps/client-asset-sg/src/app/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const enAppTranslations: AppTranslations = {
originalTitle: 'Original title',
kind: 'Kind',
topic: 'Topic',
language: 'Language',
format: 'Format',
createdDate: 'Date created',
lastProcessedDate: 'Last update',
Expand All @@ -75,12 +74,18 @@ export const enAppTranslations: AppTranslations = {
Polygon: 'Polygon',
None: 'None',
},
language: 'Language',
languageItem: {
None: 'none',
},
resetSearch: 'Reset search',
file: 'File',
openFileInNewTab: 'Open {{fileName}} in new tab',
downloadFile: 'Download {{fileName}}',
assetsUnderMouseCursor: '{{ assetsCount }} assets found under the mouse cursor. Please select one:',
removePolygon: 'Remove polygon',
hideTable: 'Hide table',
showTable: 'Show table',
},
contactRoles: {
author: 'Author',
Expand Down
7 changes: 6 additions & 1 deletion apps/client-asset-sg/src/app/i18n/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const frAppTranslations: AppTranslations = {
originalTitle: 'Titre original',
kind: 'Type',
topic: 'Thème',
language: 'Langue',
format: 'Format',
createdDate: 'Date de création',
lastProcessedDate: 'Dernière mise à jour',
Expand All @@ -75,13 +74,19 @@ export const frAppTranslations: AppTranslations = {
Polygon: 'Polygone',
None: 'Aucune',
},
language: 'Langue',
languageItem: {
None: 'aucune',
},
resetSearch: 'Réinitialiser la recherche',
file: 'Fichier',
openFileInNewTab: 'Ouvrir {{fileName}} dans un nouvel onglet',
downloadFile: 'Télécharger {{fileName}}',
assetsUnderMouseCursor:
'{{ assetsCount }} ssets trouvés sous le curseur de la souris. Veuillez en sélectionner un :',
removePolygon: 'Annuler le polygone',
hideTable: 'fr Tabelle verbergen',
showTable: 'fr Tabelle anzeigen',
},
contactRoles: {
author: 'Auteur',
Expand Down
7 changes: 6 additions & 1 deletion apps/client-asset-sg/src/app/i18n/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const itAppTranslations: AppTranslations = {
originalTitle: 'IT Originaltitel',
kind: 'IT Art',
topic: 'IT Thema',
language: 'IT Sprache',
format: 'IT Format',
createdDate: 'IT Erstellungsdatum',
lastProcessedDate: 'IT Letztes Update',
Expand All @@ -75,12 +74,18 @@ export const itAppTranslations: AppTranslations = {
Polygon: 'IT Polygon',
None: 'IT Keine',
},
language: 'IT Sprache',
languageItem: {
None: 'IT keine',
},
resetSearch: 'IT Suche zurücksetzen',
file: 'IT Datei',
openFileInNewTab: 'IT {{fileName}} in neuem Tab öffnen',
downloadFile: 'IT {{fileName}} herunterladen',
assetsUnderMouseCursor: 'IT {{ assetsCount }} Assets unter dem Mauszeiger gefunden. Bitte wählen Sie eines aus:',
removePolygon: 'IT Polygon aufheben',
hideTable: 'IT Tabelle verbergen',
showTable: 'IT Tabelle anzeigen',
},
contactRoles: {
author: 'IT Autor',
Expand Down
7 changes: 6 additions & 1 deletion apps/client-asset-sg/src/app/i18n/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const rmAppTranslations: AppTranslations = {
originalTitle: 'RM Originaltitel',
kind: 'RM Art',
topic: 'RM Thema',
language: 'RM Sprache',
format: 'RM Format',
createdDate: 'RM Erstellungsdatum',
lastProcessedDate: 'RM Letztes Update',
Expand All @@ -75,12 +74,18 @@ export const rmAppTranslations: AppTranslations = {
Polygon: 'RM Polygon',
None: 'RM Keine',
},
language: 'RM Sprache',
languageItem: {
None: 'RM keine',
},
resetSearch: 'RM Suche zurücksetzen',
file: 'RM Datei',
openFileInNewTab: 'RM {{fileName}} in neuem Tab öffnen',
downloadFile: 'RM {{fileName}} herunterladen',
assetsUnderMouseCursor: 'RM {{ assetsCount }} Assets unter dem Mauszeiger gefunden. Bitte wählen Sie eines aus:',
removePolygon: 'RM Polygon aufheben',
hideTable: 'RM Tabelle verbergen',
showTable: 'RM Tabelle anzeigen',
},
contactRoles: {
author: 'RM Autor',
Expand Down
1 change: 0 additions & 1 deletion apps/server-asset-sg/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default {
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/server-asset-sg',
coverageReporters: ['json', 'text', 'cobertura', 'lcov'],

// Allow only a single worker so the tests don't run in parallel.
// Many of the tests are integration tests, meaning they access actual databases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ describe(AssetSearchService, () => {
expect(hit.sgsId).toEqual(asset.sgsId);
expect(hit.createDate).toEqual(asset.createDate);
expect(hit.assetKindItemCode).toEqual(asset.assetKindItemCode);
expect(hit.languageItemCodes).toEqual(asset.assetLanguages.map((it) => it.languageItemCode));
expect(hit.usageCode).toEqual(makeUsageCode(asset.publicUse.isAvailable, asset.internalUse.isAvailable));
expect(hit.authorIds).toEqual([]);
expect(hit.contactNames).toEqual([]);
expect(hit.manCatLabelItemCodes).toEqual([]);

const languageItemCodes =
asset.assetLanguages.length === 0 ? ['None'] : asset.assetLanguages.map((it) => it.languageItemCode);
expect(hit.languageItemCodes).toEqual(languageItemCodes);
};

describe('register', () => {
Expand Down Expand Up @@ -355,10 +358,17 @@ describe(AssetSearchService, () => {
},
]);
expect(stats.languageItemCodes).toEqual(
asset.assetLanguages.map((it) => ({
value: it.languageItemCode,
count: 1,
}))
asset.assetLanguages.length === 0
? [
{
count: 1,
value: 'None',
},
]
: asset.assetLanguages.map((it) => ({
value: it.languageItemCode,
count: 1,
}))
);
expect(stats.usageCodes).toEqual([
{
Expand Down Expand Up @@ -539,6 +549,13 @@ describe(AssetSearchService, () => {
const expectedLanguageItemCodes = makeBucket(expectedAssets, (asset) =>
asset.assetLanguages.map((it) => it.languageItemCode)
);
const assetsWithoutLanguage = expectedAssets.filter((it) => it.assetLanguages.length === 0);
if (assetsWithoutLanguage.length !== 0) {
expectedLanguageItemCodes.push({
key: 'None',
count: assetsWithoutLanguage.length,
});
}
expect(aggs.buckets.languageItemCodes.sort(compareBuckets)).toEqual(
expectedLanguageItemCodes.sort(compareBuckets)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,16 @@ export class AssetSearchService {
throw new Error(`unknown geomText prefix: ${prefix}`);
}
});
const languageItemCodes =
asset.assetLanguages.length === 0 ? ['None'] : asset.assetLanguages.map((it) => it.languageItemCode);
return {
assetId: asset.assetId,
titlePublic: asset.titlePublic,
titleOriginal: asset.titleOriginal,
sgsId: asset.sgsId,
createDate: asset.createDate,
assetKindItemCode: asset.assetKindItemCode,
languageItemCodes: asset.assetLanguages.map((it) => it.languageItemCode),
languageItemCodes,
usageCode: makeUsageCode(asset.publicUse.isAvailable, asset.internalUse.isAvailable),
authorIds: asset.assetContacts.filter((it) => it.role === 'author').map((it) => it.contactId),
contactNames: contacts.map((it) => it.name),
Expand Down Expand Up @@ -655,8 +657,8 @@ const mapQueryToElasticDsl = (query: AssetSearchQuery): QueryDslQueryContainer =
if (query.languageItemCodes != null) {
filters.push(makeArrayFilter('languageItemCodes', query.languageItemCodes));
}
if (query.geomCodes != null) {
filters.push(makeArrayFilter('geometryCodes', query.geomCodes));
if (query.geometryCodes != null) {
filters.push(makeArrayFilter('geometryCodes', query.geometryCodes));
}

return {
Expand Down
35 changes: 31 additions & 4 deletions libs/asset-viewer/src/lib/asset-viewer.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CdkMonitorFocus } from '@angular/cdk/a11y';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
Expand All @@ -8,36 +9,49 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import {
MatCell,
MatCellDef,
MatColumnDef,
MatHeaderCell,
MatHeaderCellDef,
MatHeaderRow,
MatHeaderRowDef,
MatRow,
MatRowDef,
MatTable,
} from '@angular/material/table';
import { MatDateFnsModule } from '@angular/material-date-fns-adapter';
import { RouterModule } from '@angular/router';
import {
AnchorComponent,
AnimateNumberComponent,
ButtonComponent,
DatePipe,
DatepickerToggleIconComponent,
DatePipe,
DragHandleComponent,
DrawerComponent,
DrawerPanelComponent,
IsEditorPipe,
SmartTranslatePipe,
ValueItemDescriptionPipe,
ValueItemNamePipe,
ZoomControlsComponent,
} from '@asset-sg/client-shared';
import { SvgIconComponent } from '@ngneat/svg-icon';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { TranslateModule } from '@ngx-translate/core';
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
import { ForModule } from '@rx-angular/template/for';
import { LetModule } from '@rx-angular/template/let';
import { PushModule } from '@rx-angular/template/push';
import { de } from 'date-fns/locale/de';

import { AssetPickerComponent } from './components/asset-picker';
import { AssetSearchDetailComponent } from './components/asset-search-detail';
import { AssetSearchFilterListComponent } from './components/asset-search-filter-list/asset-search-filter-list.component';
import { AssetSearchRefineComponent } from './components/asset-search-refine';
import { AssetSearchResultsComponent } from './components/asset-search-results';
import { AssetSearchResultComponent } from './components/asset-search-results/asset-search-result/asset-search-result.component';
import { AssetViewerPageComponent } from './components/asset-viewer-page';
import { MapComponent } from './components/map';
import { AssetSearchEffects } from './state/asset-search/asset-search.effects';
Expand All @@ -49,9 +63,9 @@ import { assetSearchReducer } from './state/asset-search/asset-search.reducer';
MapComponent,
AssetSearchDetailComponent,
AssetSearchRefineComponent,
AssetSearchFilterListComponent,
AssetSearchResultsComponent,
AssetPickerComponent,
AssetSearchResultComponent,
],
imports: [
CommonModule,
Expand Down Expand Up @@ -93,8 +107,21 @@ import { assetSearchReducer } from './state/asset-search/asset-search.reducer';
DrawerComponent,
DrawerPanelComponent,
DatepickerToggleIconComponent,
MatTable,
MatColumnDef,
MatHeaderCell,
MatCell,
MatCellDef,
MatHeaderCellDef,
MatHeaderRow,
MatRow,
MatHeaderRowDef,
MatRowDef,
SmartTranslatePipe,
CdkMonitorFocus,
],
providers: [
TranslatePipe,
{ provide: MAT_DATE_LOCALE, useValue: de },
{
provide: MAT_DATE_FORMATS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
<li *rxFor="let asset of assets">
<a
asset-sg-reset
[routerLink]="[]"
[queryParams]="{ assetId: asset.assetId }"
queryParamsHandling="merge"
(click)="selectAndClose(asset.assetId)"
(mouseover)="onAssetMouseOver(asset.assetId)"
(mouseout)="onAssetMouseOut()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,24 @@
<span class="filename"> {{ assetFile.fileName }} ({{ assetFile.fileSize }}) </span>
<button
asset-sg-icon-button
*ngIf="!isActiveFileDownload(assetFile, false); else downloadSpinner"
[title]="'search.openFileInNewTab' | translate : { fileName: assetFile.fileName }"
(click)="downloadFile(assetFile, false)"
>
<svg-icon key="ext-link"></svg-icon>
</button>
<button
asset-sg-icon-button
*ngIf="!isActiveFileDownload(assetFile); else downloadSpinner"
[title]="'search.downloadFile' | translate : { fileName: assetFile.fileName }"
(click)="downloadFile(assetFile)"
>
<svg-icon key="download"></svg-icon>
</button>

<ng-template #downloadSpinner>
<mat-progress-spinner mode="indeterminate" [diameter]="24" />
</ng-template>
</li>
</ul>
</td>
Expand Down
Loading

0 comments on commit 59345ed

Please sign in to comment.