Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snyk] Upgrade @rgrove/parse-xml from 4.0.1 to 4.1.0 #16

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run-name: 📦 Generate artifacts for ${{ github.event_name == 'issue_comment' &
on:
push:
branches:
- main
- geocat
release:
types: [published]
issue_comment:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
main-branch-name: 'geocat'

- name: Install dependencies
run: npm ci
Expand Down Expand Up @@ -95,22 +95,26 @@ jobs:

- name: Tag all docker images on main also as latest
if: github.event_name == 'push' # only happens when pushing on the main branch
run: docker image ls --format 'docker tag {{.Repository}}:{{.Tag}} {{.Repository}}:latest' --filter=reference='geonetwork/*' | bash -
run: docker image ls --format 'docker tag {{.Repository}}:{{.Tag}} {{.Repository}}:latest' --filter=reference='camptocamp/*' | bash -

- name: Login to DockerHub
- name: Login to Github Packages
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push all docker images
# list all docker images, keep only the ones in the geonetwork org, and call docker push for each of them
run: |
docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='geonetwork/*' | \
docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='camptocamp/*' | \
xargs -I '{}' docker tag '{}' ghcr.io/'{}'
docker image ls --format '{{.Repository}}:{{.Tag}}' |grep ghcr.io | \
xargs -r -L1 docker push $1

build-npm-package:
if: github.event_name != 'issue_comment'
# if: github.event_name != 'issue_comment'
if: false # disabled for geocat
name: Build and publish NPM package
runs-on: ubuntu-latest

Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ env:
on:
push:
branches:
- main
- geocat
pull_request:
types: [opened, synchronize, ready_for_review]

# Only allow concurrent checks on the main branch to keep history
# on QA checks
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
cancel-in-progress: ${{ github.ref_name != 'geocat' }}

jobs:
format-lint-test:
Expand All @@ -40,16 +40,16 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
main-branch-name: 'geocat'
- run: npm ci
- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
- run: npx nx affected -t test --parallel=3 --configuration=ci --ci --codeCoverage --coverageReporters=lcov

- name: Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true
# - name: Coveralls
# uses: coverallsapp/github-action@v2
# with:
# allow-empty: true

# - name: Archive Code Coverage Results (on main)
# if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
main-branch-name: 'geocat'
- run: npm ci
- run: npx nx affected -t build --parallel=3

Expand All @@ -115,6 +115,8 @@ jobs:

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

- name: Install dependencies
run: npm ci
Expand Down Expand Up @@ -145,6 +147,7 @@ jobs:
cypress-run:
name: End-to-end tests
runs-on: ubuntu-latest
if: false # skip for geocat
outputs:
screenshotsUrl: ${{ steps.upload-screenshots.outputs.artifact-url }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
on:
push:
branches:
- main
- geocat
issue_comment:
types:
- edited
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
name: Deploy Storybook to GitHub Pages
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{needs.checks.outputs.ref || 'main'}}
BRANCH_NAME: ${{needs.checks.outputs.ref || 'geocat'}}

steps:
- name: Dump GitHub event
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 @@ -21,7 +21,7 @@ run-name: 🐺 Run Snyk on ${{ github.event_name == 'pull_request' && 'PR' || '

on:
push:
branches: ['main']
branches: ['geocat']
pull_request:
types: [opened, synchronize, ready_for_review]

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/webcomponents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment'
on:
push:
branches:
- main
tags:
- 'v*.*.*'
- geocat
release:
types: [published]

Expand Down Expand Up @@ -56,10 +54,10 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

- name: Publish web component to ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} branch
- name: Publish web component to ${{ env.PUBLISH_BRANCH }} branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./wc-dist
publish_branch: ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }}
publish_branch: ${{ env.PUBLISH_BRANCH }}
1 change: 1 addition & 0 deletions apps/datahub/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
gnUiSearchRouterContainer="mainSearch"
class="selection:bg-primary-lightest selection:text-primary-darker"
>
<datahub-geocat-header></datahub-geocat-header>
<router-outlet></router-outlet>
</div>
7 changes: 7 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ import { RecordOtherlinksComponent } from './record/record-otherlinks/record-oth
import { RecordDownloadsComponent } from './record/record-downloads/record-downloads.component'
import { RecordApisComponent } from './record/record-apis/record-apis.component'
import { MatTabsModule } from '@angular/material/tabs'
import { ORGANIZATIONS_STRATEGY } from '@geonetwork-ui/api/repository/gn4'
import { GeocatHeaderComponent } from './home/geocat-header/geocat-header.component'

export const metaReducers: MetaReducer[] = !environment.production ? [] : []
// https://github.com/nrwl/nx/issues/191
Expand All @@ -104,6 +106,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
RecordOtherlinksComponent,
RecordDownloadsComponent,
RecordApisComponent,
GeocatHeaderComponent,
],
imports: [
BrowserModule,
Expand Down Expand Up @@ -201,6 +204,10 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
provide: ORGANIZATION_URL_TOKEN,
useValue: `${ROUTER_ROUTE_SEARCH}?${ROUTE_PARAMS.PUBLISHER}=\${name}`,
},
{
provide: ORGANIZATIONS_STRATEGY,
useValue: 'groups',
},
],
bootstrap: [AppComponent],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="px-5">
<div
class="mx-auto flex items-center justify-center sm:justify-end gap-2 py-1 text-sm"
>
<a class="block hover:underline mr-4" [href]="docLink" target="_blank">{{
'datahub.header.documentation' | translate
}}</a>
<a class="block hover:underline" [href]="gnLink" target="_blank">{{
'datahub.header.admin' | translate
}}</a>
<gn-ui-language-switcher
*ngIf="showLanguageSwitcher"
class="language-switcher"
></gn-ui-language-switcher>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { GeocatHeaderComponent } from './geocat-header.component'
import { TranslateModule } from '@ngx-translate/core'

jest.mock('@geonetwork-ui/util/app-config', () => ({
getGlobalConfig: jest.fn(() => ({
LANGUAGES: ['de', 'fr'],
})),
}))

describe('GeocatHeaderComponent', () => {
let component: GeocatHeaderComponent
let fixture: ComponentFixture<GeocatHeaderComponent>

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [GeocatHeaderComponent],
imports: [TranslateModule.forRoot()],
})
fixture = TestBed.createComponent(GeocatHeaderComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy()
})
})
26 changes: 26 additions & 0 deletions apps/datahub/src/app/home/geocat-header/geocat-header.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component } from '@angular/core'
import { TranslateService } from '@ngx-translate/core'
import { LANG_2_TO_3_MAPPER } from '@geonetwork-ui/util/i18n'
import { getGlobalConfig } from '@geonetwork-ui/util/app-config'

@Component({
selector: 'datahub-geocat-header',
templateUrl: './geocat-header.component.html',
})
export class GeocatHeaderComponent {
showLanguageSwitcher = getGlobalConfig().LANGUAGES?.length > 0

constructor(private translate: TranslateService) {}

get docLink() {
return `https://www.geocat.admin.ch/${
this.translate.currentLang || 'en'
}/home.html`
}

get gnLink() {
return `/geonetwork/srv/${
LANG_2_TO_3_MAPPER[this.translate.currentLang] || 'eng'
}/catalog.edit#/board`
}
}
21 changes: 12 additions & 9 deletions apps/datahub/src/app/home/home-header/home-header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
[style.opacity]="expandRatio"
[innerHTML]="'datahub.header.title.html' | translate"
></div>
<gn-ui-fuzzy-search
class="text-[18px] pointer-events-auto"
(itemSelected)="onFuzzySearchSelection($event)"
[autoFocus]="true"
></gn-ui-fuzzy-search>
<div class="flex flex-wrap gap-4">
<gn-ui-fuzzy-search
class="text-[18px] grow pointer-events-auto"
(itemSelected)="onFuzzySearchSelection($event)"
(inputSubmitted)="updateLocationFilter()"
[autoFocus]="true"
></gn-ui-fuzzy-search>
<gn-ui-location-search
class="text-[18px] grow"
(inputSubmitted)="updateTextFilter()"
></gn-ui-location-search>
</div>
<div class="flex h-0 py-5 gap-3" [style.opacity]="-0.6 + expandRatio * 2">
<datahub-header-badge-button
[routerLink]="ROUTE_SEARCH"
Expand Down Expand Up @@ -77,8 +84,4 @@
></datahub-navigation-menu>
</div>
</div>
<gn-ui-language-switcher
*ngIf="showLanguageSwitcher"
class="language-switcher absolute top-2.5 left-2.5 text-[13px]"
></gn-ui-language-switcher>
</header>
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ describe('HeaderComponent', () => {
})
})

describe('language switcher', () => {
// skipped for geocat
describe.skip('language switcher', () => {
describe('given predefined languages', () => {
it('should display language switcher', () => {
const languageSwitcher = fixture.debugElement.queryAll(
Expand Down
22 changes: 21 additions & 1 deletion apps/datahub/src/app/home/home-header/home-header.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
import {
ChangeDetectionStrategy,
Component,
Input,
ViewChild,
} from '@angular/core'
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
import {
ROUTER_ROUTE_SEARCH,
RouterFacade,
} from '@geonetwork-ui/feature/router'
import {
FieldsService,
FuzzySearchComponent,
LocationSearchComponent,
SearchFacade,
SearchService,
} from '@geonetwork-ui/feature/search'
Expand Down Expand Up @@ -40,6 +47,11 @@ marker('datahub.header.popularRecords')
export class HomeHeaderComponent {
@Input() expandRatio: number

// specific geocat: used to trigger the other field when one is triggered
@ViewChild(FuzzySearchComponent)
textSearch: FuzzySearchComponent
@ViewChild(LocationSearchComponent) locationSearch: LocationSearchComponent

backgroundCss =
getThemeConfig().HEADER_BACKGROUND ||
`center /cover url('assets/img/header_bg.webp')`
Expand Down Expand Up @@ -94,4 +106,12 @@ export class HomeHeaderComponent {
this.searchService.setFilters(searchFilters)
}
}

// specific geocat
updateLocationFilter() {
this.locationSearch.trigger()
}
updateTextFilter() {
this.textSearch.trigger()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
? 'decoration-primary'
: 'decoration-transparent hover:decoration-primary transition-colors'
"
class="hidden sm:block sm:py-4 uppercase truncate underline decoration-4 underline-offset-[19px]"
class="hidden sm:block sm:py-4 uppercase truncate font-title text-sm underline decoration-4 underline-offset-[19px]"
[style.color]="foregroundColor"
translate
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ROUTER_ROUTE_NEWS,
ROUTER_ROUTE_ORGANISATIONS,
} from '../../router/constants'
import { getThemeConfig } from '@geonetwork-ui/util/app-config'
// import { getThemeConfig } from '@geonetwork-ui/util/app-config'

marker('datahub.header.news')
marker('datahub.header.datasets')
Expand All @@ -21,7 +21,7 @@ marker('datahub.header.organisations')
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NavigationMenuComponent {
foregroundColor = getThemeConfig().HEADER_FOREGROUND_COLOR || '#ffffff'
foregroundColor = /*getThemeConfig().HEADER_FOREGROUND_COLOR ||*/ '#ffffff'
displayMobileMenu = false
tabLinks = [
{
Expand Down
Loading
Loading