Skip to content

Commit

Permalink
Merge branch 'main' into datahub-ign-2905
Browse files Browse the repository at this point in the history
  • Loading branch information
cdebarros committed Sep 3, 2024
2 parents 13c159a + d000fb8 commit 5f42c31
Show file tree
Hide file tree
Showing 470 changed files with 71,739 additions and 62,439 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"plugins": ["@nx", "no-only-tests"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand Down Expand Up @@ -73,6 +73,12 @@
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.cy.ts"],
"rules": {
"no-only-tests/no-only-tests": "error"
}
}
]
}
6 changes: 2 additions & 4 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.checks.outputs.ref }} # use the PR head ref if applicable; otherwise keep default behaviour
persist-credentials: false
Expand All @@ -57,9 +57,7 @@ jobs:
cache: 'npm'

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
uses: nrwl/nx-set-shas@v3

- name: Install dependencies
run: npm ci
Expand Down
55 changes: 32 additions & 23 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
Expand All @@ -38,9 +38,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
Expand Down Expand Up @@ -79,7 +77,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
Expand All @@ -89,9 +87,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx affected -t build --parallel=3

Expand All @@ -102,7 +98,7 @@ jobs:

steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
Expand Down Expand Up @@ -142,38 +138,51 @@ jobs:
comment_tag: build-options
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cypress-run:
name: End-to-end tests
e2e-run:
name: E2E tests / ${{ matrix.app }} / GN v${{ matrix.gn_version }}
runs-on: ubuntu-latest
outputs:
screenshotsUrl: ${{ steps.upload-screenshots.outputs.artifact-url }}
strategy:
fail-fast: false
matrix:
gn_version: [4.2.2, 4.2.8, 4.4.0]
app: [datahub, metadata-editor]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3

- name: Create pipeline docker image
run: cd tools && docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest
working-directory: tools
run: docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest

- name: Build the backend
run: sudo docker-compose -f support-services/docker-compose.yml up -d init
- name: Start up backend support services
env:
GEONETWORK_VERSION: ${{ matrix.gn_version }}
working-directory: support-services
run: docker compose up --quiet-pull init

- name: Install dependencies
run: |
npm ci
- run: npm ci

- name: Run tests
run: npx nx run-many --target=e2e
- name: Run e2e tests for ${{ matrix.app }}
env:
APP: ${{ matrix.app }}
run: npx nx e2e "$APP-e2e"

- uses: actions/upload-artifact@v4
if: always()
id: upload-screenshots
with:
name: cypress-screenshots
name: cypress-screenshots-app-${{ matrix.app }}-gn-${{ matrix.gn_version }}
path: |
apps/datahub-e2e/cypress/screenshots/**/*
apps/metadata-editor-e2e/cypress/screenshots/**/*
Expand All @@ -193,7 +202,7 @@ jobs:

steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webcomponents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.checks.outputs.ref }}
persist-credentials: false
Expand Down
6 changes: 6 additions & 0 deletions apps/datafeeder/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { PublicationLockGuard } from './router/publication-lock.guard'
import { PublicationStatusGuard } from './router/publication-status.guard'
import { UploadProgressGuard } from './router/upload-progress.guard'
import { UploadStatusGuard } from './router/upload-status.guard'
import { DatasetValidationCsvPageComponent } from './presentation/pages/dataset-validation-csv-page/dataset-validation-csv-page'

const routes: Routes = [
{ path: '', component: UploadDataPageComponent },
Expand All @@ -24,6 +25,11 @@ const routes: Routes = [
component: DatasetValidationPageComponent,
canActivate: [UploadStatusGuard, PublicationLockGuard],
},
{
path: ':id/validation-csv',
component: DatasetValidationCsvPageComponent,
canActivate: [UploadStatusGuard, PublicationLockGuard],
},
{
path: ':id/step/:stepId',
component: FormsPageComponent,
Expand Down
2 changes: 2 additions & 0 deletions apps/datafeeder/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { DATAFEEDER_STATE_KEY, reducer } from './store/datafeeder.reducer'
import { FeatureAuthModule } from '@geonetwork-ui/feature/auth'
import { MatIconModule } from '@angular/material/icon'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { DatasetValidationCsvPageComponent } from './presentation/pages/dataset-validation-csv-page/dataset-validation-csv-page'

export function apiConfigurationFactory() {
return new Configuration({
Expand All @@ -54,6 +55,7 @@ export function apiConfigurationFactory() {
UploadDataRulesComponent,
AnalysisProgressPageComponent,
DatasetValidationPageComponent,
DatasetValidationCsvPageComponent,
DataImportValidationMapPanelComponent,
UploadDataErrorDialogComponent,
UploadDataBackgroundComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ import { Component, Input } from '@angular/core'
})
export class UploadDataRulesComponent {
@Input() maxFileSizeMb: number
@Input() acceptedFileFormats = ['SHP', 'GeoJSON', 'GeoPackage', 'Spatialite']
@Input() acceptedFileFormats = [
'SHP',
'GeoJSON',
'GeoPackage',
'Spatialite',
'CSV',
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ export class UploadDataComponent {
haveRights = false
uploading = false
// Edge use uncommon 'application/x-zip-compressed' mime type
acceptedMimeType = ['.zip', 'application/zip', 'application/x-zip-compressed']
acceptedMimeType = [
'.zip',
'application/zip',
'application/x-zip-compressed',
'text/csv',
'application/csv',
]

@Input() maxFileSizeMb: number
@Output() errors$ = new EventEmitter<UploadDataError>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { NO_ERRORS_SCHEMA } from '@angular/core'
import {
ComponentFixture,
discardPeriodicTasks,
fakeAsync,
flush,
flushMicrotasks,
TestBed,
tick,
} from '@angular/core/testing'
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { ActivatedRoute, Router } from '@angular/router'
import {
AnalysisStatusEnumApiModel,
Expand All @@ -25,7 +17,7 @@ const jobMock: UploadJobStatusApiModel = {
jobId: JOB_ID,
status: AnalysisStatusEnumApiModel.Done,
progress: 1,
datasets: [{}],
datasets: [{ format: 'SHAPEFILE' }],
}
const jobMockNoDS: UploadJobStatusApiModel = {
jobId: JOB_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { EMPTY, firstValueFrom, Observable, timer } from 'rxjs'
import { DatafeederFacade } from '../../../store/datafeeder.facade'
import { expand, switchMap } from 'rxjs/operators'
import { UploadProgressGuard } from '../../../router/upload-progress.guard'

const { Pending, Analyzing, Done } = AnalysisStatusEnumApiModel

Expand Down Expand Up @@ -51,9 +52,16 @@ export class AnalysisProgressPageComponent implements OnInit {

onJobFinish(job: UploadJobStatusApiModel) {
const done = job.status === Done && job.datasets?.length > 0
this.router.navigate([done ? 'validation' : '/'], {
relativeTo: this.activatedRoute,
queryParams: done ? {} : { error: 'analysis' },
})
this.router.navigate(
[
done
? UploadProgressGuard.getRedirectPage(job.datasets[0].format)
: '/',
],
{
relativeTo: this.activatedRoute,
queryParams: done ? {} : { error: 'analysis' },
}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
display: flex;
flex: 1;
}
Loading

0 comments on commit 5f42c31

Please sign in to comment.