Skip to content

Commit

Permalink
Merge pull request #1011 from geonetwork/converter-support-multilingu…
Browse files Browse the repository at this point in the history
…al-translations-per-field

Metadata Editor / support multilingual values in certain fields
  • Loading branch information
jahow authored Oct 9, 2024
2 parents 4180640 + e42e934 commit 822d2a4
Show file tree
Hide file tree
Showing 62 changed files with 8,114 additions and 970 deletions.
146 changes: 3 additions & 143 deletions apps/datahub/README.md
Original file line number Diff line number Diff line change
@@ -1,147 +1,7 @@
# Datahub

UI of the web application `datahub`.
The Datahub is an application to provide a default, pure and simple UI for metadata and dataset search.

`datahub` is an application to provide a default, pure and simple UI for metadata and dataset search.
More information here: https://geonetwork.github.io/geonetwork-ui/main/docs/apps/datahub.html

Inspire by Opendata catalogs (CKAN, Opendatasoft), the Hub will host geo and non-geo dataset. It will provide dataviz tool and focuses the experience on the dataset instead of on the metadata.

## How to run it

The Datahub application is available as a docker image or as a ZIP archive.

### With docker

The docker image is `geonetwork/geonetwork-ui-datahub`.

To run it on the 8080 port with a custom GN4 API url and proxy path, use:

```bash
$ docker run -p 8080:80 \
-e GN4_API_URL=https://gn4.custom/geonetwork/srv/api \
-e PROXY_PATH=/proxy?url= \
geonetwork/geonetwork-ui-datahub
```

Notice how the `GN4_API_URL` and `PROXY_PATH` variables are used to override any values present in the app configuration file.
**This override will happen everytime the docker container is started.**

The application will be available on http://localhost:8080/datahub/.

#### Specifying a custom configuration file

If the `GN4_API_URL` and `PROXY_PATH` environment variables are not enough and you want to specify a full configuration file,
you can do so like this:

```bash
# this assumes a file named `default.toml` is located in the /home/user/custom-conf directory:
$ docker run -p 8080:80 \
-v /home/user/custom-conf:/conf \
geonetwork/geonetwork-ui-datahub
```

If a file named `default.toml` is found in the `/conf` folder _of the app container_ at startup, it will be used by the application.

You can specify a different directory to look for the `default.toml` file using the `CONFIG_DIRECTORY_OVERRIDE` env variable, like so:

```bash
# this assumes a file named `default.toml` is located in the /home/user/custom-conf directory:
$ docker run -p 8080:80 \
-v /home/user/custom-conf:/some/random/path \
-e CONFIG_DIRECTORY_OVERRIDE=/some/random/path \
geonetwork/geonetwork-ui-datahub
```

This can be useful when dealing with existing volumes having their own directory structure.

#### Adding custom assets to the docker container

Any file found in the `/assets` folder _of the app container_ at startup will be copied along with the other assets already present. Existing assets with conflicting names will be
replaced. Directory structure in the `/assets` folder will be preserved.

For each image file present in the copied assets, a [preload link](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload) will be created in the `index.html` file of the application. This will help reducing the
time to first significant draw for new visitors, especially for header backgrounds and the like.

You can specify a different directory to look for the custom assets using the `ASSETS_DIRECTORY_OVERRIDE` env variable, like so:

```bash
# custom assets are located in the /home/user/my-assets directory:
$ docker run -p 8080:80 \
-v /home/user/my-assets:/some/random/path \
-e ASSETS_DIRECTORY_OVERRIDE=/some/random/path \
geonetwork/geonetwork-ui-datahub
```

#### Adding custom scripts when deploying Datahub

You can deploy custom executable sh scripts when deploying a container by setting the environment variable `CUSTOM_SCRIPTS_DIRECTORY` pointing to a mounted volume.

It can be used to deploy custom header by example.

```bash
$ docker run -p 8080:80 \
-v /home/user/my-scripts:/some/random/path \
-e CUSTOM_SCRIPTS_DIRECTORY=/some/random/path \
geonetwork/geonetwork-ui-datahub
```

### From the ZIP archive

Each release of GeoNetwork-UI comes with ZIP archives of all applications: https://github.com/geonetwork/geonetwork-ui/releases

Download the Datahub archive and simply serve its contents using an HTTP server like Apache or NGINX.

## Configuration

See the [main README section for more info](../../README.md#application-configuration).

## Development

> For the following instructions, make sure you are using Node v16+ and that you ran `npm install` before anything else.
Executing:

```
npx nx serve datahub
```

will run `datahub` as an Angular application available on [localhost:4200](http://localhost:4200/).

### Proxy

The Datahub app can use a reverse proxy for querying WMS and WFS capabilities (thus working around
CORS limitations).

By default it is disabled in order not to hide those issues to the user.

You can specify a custom proxy path using the `proxy_path` setting in the `[global]` section of the app configuration file. The proxy is disabled when
no path is defined.

Please note that during development a proxy is provided by webpack on the `/dev-proxy?` url path. **It is
not used by default in the Datahub app, you will have to set it up yourself.**

## Building without Docker

Before building, remember to edit the configuration file in [`conf/default.toml`](../../conf/default.toml) to fit your deployment. It indicates the `geonetwork4_api_url` and an optional `proxy_path` to use.

You can build the datahub app using the geonetwork-ui build command:

```shell script
npm install
npx nx build datahub
```

The build artifact will be stored in the `dist/apps/datahub` directory, that can be deployed on a common webserver. Use the `--prod` flag for a production build.

The build also includes the app configuration file (`dist/apps/datahub/assets/configuration`). Do not modify the configuration file here, as it is overwritten on each build.

## Building with Docker

You can build a docker image of the Datahub application like so:

```bash
npm install
npx nx run datahub:docker-build
```

This will build a docker image with the tag `geonetwork/geonetwork-ui-datahub`.
See the [GeoNetwork-UI documentation](https://geonetwork.github.io/geonetwork-ui/main/docs/guide/run.html) to learn how to run and deploy the Datahub.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import {
} from '@angular/core'
import {
CatalogRecord,
DatasetRecord,
OnlineResource,
OnlineResourceType,
RecordKind,
RecordStatusValues,
RoleValues,
ServiceRecord,
} from '@geonetwork-ui/common/domain/model/record'

@Component({
Expand Down Expand Up @@ -100,6 +98,9 @@ export class RecordFormComponent implements AfterViewInit {
keywords: hasPrevious ? this.record.keywords : [],
topics: hasPrevious ? this.record.topics : [],
onlineResources: [],
otherLanguages: [],
defaultLanguage: 'en',
overviews: [],
}
if (kind === 'dataset') {
this.record = {
Expand All @@ -108,15 +109,14 @@ export class RecordFormComponent implements AfterViewInit {
status: 'under_development',
updateFrequency: 'unknown',
lineage: '',
overviews: [],
spatialExtents: [],
temporalExtents: [],
} as DatasetRecord
}
} else {
this.record = {
...record,
kind: 'service',
} as ServiceRecord
}
}
this.recordChanged.emit(this.record)
}
Expand Down
4 changes: 2 additions & 2 deletions apps/metadata-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

A UI application containing a dashboard for seeing metadata records, and a powerful form-based editor.

## How to run it
More information here: https://geonetwork.github.io/geonetwork-ui/main/docs/apps/editor.html

> TODO
See the [GeoNetwork-UI documentation](https://geonetwork.github.io/geonetwork-ui/main/docs/guide/run.html) to learn how to run and deploy the Metadata Editor.
11 changes: 7 additions & 4 deletions apps/metadata-editor/src/app/new-record.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ export class NewRecordResolver {
resolve(): Observable<[CatalogRecord, string, boolean]> {
return this.getCurrentUserAsPointOfContact().pipe(
map((contactsForResource) => {
const catalogRecord = {
const catalogRecord: CatalogRecord = {
uniqueIdentifier: this.recordsRepository.generateTemporaryId(),
title: `My new record (${new Date().toISOString()})`,
abstract: '',
ownerOrganization: {},
ownerOrganization: {
name: 'Owner organization',
},
contacts: [],
recordUpdated: new Date(),
updateFrequency: 'unknown',
languages: [],
otherLanguages: [],
defaultLanguage: 'en',
topics: [],
keywords: [],
licenses: [],
Expand All @@ -46,7 +49,7 @@ export class NewRecordResolver {
onlineResources: [],
spatialExtents: [],
temporalExtents: [],
} as CatalogRecord
}

return [catalogRecord, null, false]
})
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function sidebarGuide() {
items: [
{ text: 'Introduction', link: '/guide/introduction' },
{ text: 'Prerequisites', link: '/guide/prerequisites' },
{ text: 'Run', link: '/guide/run' },
{ text: 'Deploy', link: '/guide/deploy' },
{ text: 'Configure', link: '/guide/configure' },
{ text: 'Theming', link: '/guide/theming' },
Expand Down Expand Up @@ -122,8 +123,8 @@ function sidebarApps() {
text: 'Applications',
items: [
{ text: 'Datahub', link: '/apps/datahub' },
{ text: 'Metadata Editor', link: '/apps/editor' },
{ text: 'Datafeeder', link: '/apps/datafeeder' },
{ text: 'Editor', link: '/apps/editor' },
],
},
]
Expand Down
34 changes: 22 additions & 12 deletions docs/apps/datahub.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,38 @@ outline: deep

# Datahub

## Metadata pages
The **Datahub** application offers a very intuitive and easy-to-use search interface to let people explore a GeoNetwork catalogue and the data it contains.

Each metadata has its own detailed page, made of multiple sections, described as followed.
## Features

The following sections are dynamically generated from the [metadata info component](https://github.com/geonetwork/geonetwork-ui/tree/main/libs/ui/elements/src/lib/metadata-info).
- Powerful search experience using full-text search, advanced filters, sorting
- Marking records as favorite to find them more easily later
- Data visualization using maps, tables and charts
- Using protocols such as WFS to offer a list of formats for download, as well as a tool for generating download URLs based on given parameters
- Ability for users to leave feedbacks on catalog record and for administrators to respond
- Powerful theming system allowing custom colors, fonts and background images
- Support both geo- and non-geo datasets

### Abstract
## Run & deploy

The abstract section is based on the metadata attribute `abstract`.
The Metadata Editor application is available as a docker image or as a ZIP archive.

### Keywords
### Using docker

The keywords section is based on the metadata attribute `keywords`.
The docker image is `geonetwork/geonetwork-ui-datahub`.

### Lineage
See the [run guide](../guide/run#with-docker) for more information.

The lineage section is based on the metadata attribute `lineage`.
### Using the ZIP archive

### Usage and constraints
A `datahub-VERSION.zip` archive is available on every GeoNetwork-UI release: https://github.com/geonetwork/geonetwork-ui/releases

The usage and constraints section is based on the metadata attribute `constraints`.
See the [run guide](../guide/run#from-the-zip-archive) for more information.

### User feedbacks
### Deployment

Please refer to the [general deploy guide](../guide/deploy.md) to learn how to deploy GeoNetwork-UI applications.

## User feedbacks

Authenticated users can post feedbacks at the bottom of the record view as well as answer to existing feedbacks. User feedbacks can be moderated through the administration interface of GeoNetwork.
70 changes: 67 additions & 3 deletions docs/apps/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,72 @@
outline: deep
---

# Editor
# Metadata Editor

The **Metadata Editor** application offers a user-friendly interface to create, edit, and publish metadata records.

## Features

- A dashboard showing the records available on the platform as well as searching and sorting
- A metadata edition interface allowing the modification of various parts of a record (title, abstract, keywords, dates...)
- Create, duplicate and delete records
- Import remote records using a URL
- Keep a draft while editing a record, with the ability to rollback to the published version and discard changes

## Run & deploy

> [!IMPORTANT]
> GeoNetwork version 4.2.5 or above is required for the Metadata Editor app to function normally.
The Metadata Editor application is available as a docker image or as a ZIP archive.

### Using docker

The docker image is `geonetwork/geonetwork-ui-metadata-editor`.

See the [run guide](../guide/run#with-docker) for more information.

### Using the ZIP archive

A `metadata-editor-VERSION.zip` archive is available on every GeoNetwork-UI release: https://github.com/geonetwork/geonetwork-ui/releases

See the [run guide](../guide/run#from-the-zip-archive) for more information.

### Deployment

Please refer to the [general deploy guide](../guide/deploy.md) to learn how to deploy GeoNetwork-UI applications.

## Supported metadata schemas

The editor currently support the following schemas:

- ISO 19139
- ISO 19115-3
- DCAT-AP _(support for writing values in a record is limited for now)_

Any record written in one of those schemas can be opened and modified in the edition interface.

When a record is created it uses the preferred schema, currently ISO 19115-3.

## How it works

The Metadata Editor relies on the GeoNetwork CRUD (create/read/update/delete) API for manipulating records. The records XML is read and modified fully in the browser to allow for a reactive experience as well as offering more possibilities for supported schemas.

## Multilingual support

> Still under development
## Concurrent edition

> Still under development
## Configuring the edition interface

> Still under development
<!--
THIS IS NOT ACCURATE ANYMORE
## My organization
Expand All @@ -16,5 +81,4 @@ The page is made of :
- The second link is the count of users for this organization. It leads to a new page in the dashboard. The page is also made of the organization's name and logo, and of a table presenting the users and their details. These users are fetched from the observables `user$` (logged in user), and `allUsers$` (all users of geonetwork) in the `AuthService`. `allUsers$` are then filtered by their organization to be displayed here. The table in this page is also from the component `md-editor-records-list`, which detects if an input `users` (containing the list of filtered users) was received and creates the table accordingly.
It's important to know that a user with an organization must be logged in for this component to work. If not, or in the case where the organization doesn't own any records, a message will be displayed instead of the table, to inform the user.

## Chapter 2
-->
2 changes: 1 addition & 1 deletion docs/guide/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Some additional notes:

This should point to a proxy to avoid CORS errors on some requests (data preview, OGC capabilities etc.). The actual URL will be appended after this path, e.g. : https://my.proxy/?url=http%3A%2F%2Fencoded.url%2Fservice.

This is an optional parameter: leave empty to disable proxy usage.
This is an optional parameter: leave empty to disable proxy usage. See [this section of the run guide](./run#proxy) for more information.

- `languages` (optional)

Expand Down
Loading

0 comments on commit 822d2a4

Please sign in to comment.