Skip to content

Commit

Permalink
Merge branch 'release/2.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
blavenie committed Sep 18, 2023
2 parents cffe2e6 + 3de0edf commit 3255788
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 149 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ variables:
DOCKER_BUILDKIT: 1
ARTIFACT_ZIP_FILES: ${OUTPUT_DIR}/${CI_PROJECT_NAME}-*.zip
ENV_FILE: variables.env

IONIC_CLI_VERSION: 7.1.1
ANGULAR_CLI_VERSION: 14.2.12
# ---------------------------------------------------------------
# Jobs templates
# ---------------------------------------------------------------
Expand Down Expand Up @@ -63,7 +64,7 @@ build:env:
- mkdir -p target/docker
- cp -rf scripts/docker/build/* target/docker
# Build and push the CI image
- docker build --cache-from ${CI_BUILD_IMAGE} -t ${CI_BUILD_IMAGE} --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg="CACHE_DIR=${BUILD_CACHE_DIR}" --build-arg="IMAGE_REGISTRY=${DOCKER_IMAGE_REGISTRY}" -f target/docker/Dockerfile .
- docker build --cache-from ${CI_BUILD_IMAGE} -t ${CI_BUILD_IMAGE} --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg="CACHE_DIR=${BUILD_CACHE_DIR}" --build-arg="IMAGE_REGISTRY=${DOCKER_IMAGE_REGISTRY}" --build-arg="IONIC_CLI_VERSION=${IONIC_CLI_VERSION}" --build-arg="ANGULAR_CLI_VERSION=${ANGULAR_CLI_VERSION}" -f target/docker/Dockerfile .
- docker push ${CI_BUILD_IMAGE}
except:
- tags
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ wget -qO- https://raw.githubusercontent.com/sumaris-net/sumaris-app/master/insta

## Contribute

See the [developer guide](./doc/build.md)
See our documentation :
- [How-to build](doc/build.md)
- [Environment setup](doc/setup.md)
- [Developer guide](doc/developer_guide.md)
- Full documentation (functional and technical) : https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc

## License

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "net.sumaris.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 20601
versionName "2.6.1"
versionCode 20700
versionName "2.7.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest android:versionCode="20601" android:versionName="2.6.1" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<manifest android:versionCode="20700" android:versionName="2.7.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="net.sumaris.app.MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter>
Expand Down
55 changes: 29 additions & 26 deletions doc/developer_guide.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Developer guide

## Composant Angular
> Look at the up-to-date documentation at: https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/tree/master/architecture/app
- Pour chaque composant Angular (v14):
- Utiliser Ionic framework, et si besoin Angular Material. Utiliser la classe Moment pour les dates.
- Utiliser RxState avec providers: [RxState] dans la déclaration @Component.
- Juste au-dessus de chaque classe composant, déclarer une interface MonComponentState :
* En remplaçant "MonComponent" par le nom du composant.
* Ajouter les attributs dynamiques du composant dans cette interface.
- Dans le constructeur :
* Limiter les paramètres en utilisant injector: Injector pour faciliter l'héritage.
* Définir tous les paramètres avec une visibilité protected.
* Ajouter un paramètre state: RxState<MonComposantState>.
- Pour chaque attribut dynamique du composant :
* Définir l'attribut avec son type simple dans la classe MonComposantState.
* Dans le composant, définir un getter et un setter avec @Input qui utilise state :
## Writing components

- For each Angular component (v14):
- Use the Ionic framework, and if necessary, Angular Material. Use the Moment class for dates.
- Use RxState with providers: [RxState] in the @Component declaration.
- Right above each component class, declare an interface MyComponentState:
* Replace "MyComponent" with the name of the component.
* Add the component's dynamic attributes to this interface.
- Within the constructor:
* Limit the parameters by using injector: Injector to facilitate inheritance.
* Define all parameters with `protected` visibility.
* Add a parameter state: RxState<MyComponentState>.
- For each dynamic attribute of the component:
* Define the attribute with its basic type in the MyComponentState class.
* In the component, define a getter and a setter with @Input that uses state:
```ts
get attribute(): string {
return this.state.get('attribute');
Expand All @@ -23,16 +25,17 @@
this.state.set('attribute', () => value);
}
```
- Pour les modales (si besoin) :
* Utiliser IonicModal.
* Ne pas définir la modale dans le template HTML (inline) mais dans un composant séparé.
* Gérer la modale depuis le composant appelant via ModalController.
- Pour tout code généré (par GPT ou autre) :
- Ne pas générer les imports TypeScript.
- Ajouter une ligne de commentaire, en entête de classe, indiquant que le code est sous licence libre (GPL version 3), sans toutefois écrire la licence en entier.
- For modals (if needed):
* Use IonicModal.
* Do not define the modal in the HTML template (inline) but in a separate component.
* Manage the modal from the calling component via ModalController.
- For any generated code (by GPT or otherwise):
- Do not generate TypeScript imports.
- Add a comment line at the beginning of the class indicating that the code is under a free license (GPL version 3), but do not write out the full license.

- Use the `ngx-translate` library for labels:
- Use the `TranslateModule` imported from `@ngx-translate/core`.
- Add an i18n key prefix "MY_COMPONENT." before each i18n key.
- In the template, translate each label by indicating the i18n key followed by the `translate` pipe.
- Define the translation for each key in a "fr.json" translation file.

- Utiliser la bibliothèque `ngx-translate` pour les libellés :
- Utiliser le module `TranslateModule` importé depuis `@ngx-translate/core`.
- Ajouter un préfixe de clé i18n "MON_COMPOSANT." devant chaque clé i18n.
- Dans le template, traduire chaque libellé en indiquant la clef i18n suivi de la pipe `translate`.
- Définir la traduction de chaque clé dans un fichier de traduction "fr.json".
91 changes: 0 additions & 91 deletions doc/install-IFREMER.md

This file was deleted.

27 changes: 27 additions & 0 deletions doc/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Development Environment Setup

> Look at the up-to-date documentation at: https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/tree/master/architecture/app
## Prerequisites
### Generate an SSH key
On Windows, in a Git Bash terminal:
`ssh-keygen -t ed25519 -C "[email protected]"`

Then, add the public key to GitHub (account settings: https://github.com/settings/keys) and add an SSH key by copying the contents of the file ~/.ssh/id_ed25519.pub.

### Install Node JS
Windows:
- <https://nodejs.org/dist/v16.17.0/node-v16.17.0-x64.msi>
- or <https://nodejs.org/dist/v16.17.0/node-v16.17.0-win-x64.zip>

Linux:
- <https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz>

## Compile and launch
Clone the project from git:
- `git clone https://gitlab.ifremer.fr/sih/sumaris/sumaris-app.git`

Then, in the sumaris-app project, run these commands:
- `npm install`
- `npm run start`
- Once the pod starts, you can connect at <http://localhost:4200> (as [email protected]/admin) by selecting the network node <http://localhost:8080>
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [[ "_$INSTALL_DIR" == "_" ]]; then
fi

latest_version() {
echo "2.6.1" #lastest
echo "2.7.0" #lastest
}

api_release_url() {
Expand Down
2 changes: 1 addition & 1 deletion ngx-sumaris-components
Submodule ngx-sumaris-components updated from 2f63e0 to 4644e5
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sumaris-app",
"description": "SUMARiS app",
"version": "2.6.1",
"version": "2.7.0",
"author": "[email protected]",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
Expand Down
4 changes: 3 additions & 1 deletion scripts/docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# PREPARE STAGE
ARG IMAGE_REGISTRY
ARG DOCKER_IMAGE="node:16-slim"
ARG IONIC_CLI_VERSION="7.1.1"
ARG ANGULAR_CLI_VERSION="14.2.12"
FROM $IMAGE_REGISTRY$DOCKER_IMAGE AS prepare
FROM $DOCKER_IMAGE AS prepare
ARG CACHE_DIR=/tmp/.build-cache
Expand All @@ -20,7 +22,7 @@ WORKDIR $CACHE_DIR
# Caching npm depedencies
COPY --from=prepare $CACHE_DIR/package.json .
# Install global dependencies
RUN npm install -g npm @ionic/cli @angular/cli
RUN npm install -g @ionic/cli@${IONIC_CLI_VERSION} @angular/cli@${ANGULAR_CLI_VERSION}
# Install project dependencies
RUN npm install --unsafe-perm --force

Expand Down
12 changes: 12 additions & 0 deletions src/app/data/data.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ export const DATA_CONFIG_OPTIONS = Object.freeze({
type: 'boolean',
defaultValue: true
},
ADAGIO_OPTIMIZATION: <FormFieldDefinition> {
key: 'sumaris.persistence.adagio.optimization',
label: 'CONFIGURATION.OPTIONS.ADAGIO_OPTIMIZATION',
type: 'boolean',
defaultValue: false
},
ADAGIO_SCHEMA: <FormFieldDefinition> {
key: 'sumaris.persistence.adagio.schema',
label: 'CONFIGURATION.OPTIONS.ADAGIO_SCHEMA',
type: 'string',
defaultValue: ''
},
SAMPLE_HASH_OPTIMIZATION: <FormFieldDefinition> {
key: 'sumaris.persistence.sample.hashOptimization',
label: 'CONFIGURATION.OPTIONS.SAMPLE_HASH_OPTIMIZATION',
Expand Down
14 changes: 7 additions & 7 deletions src/app/referential/pmfm/pmfm.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
joinPropertiesPath,
MatAutocompleteFieldConfig,
Referential,
ReferentialFilter,
ReferentialRef,
referentialToString,
ReferentialUtils
Expand All @@ -35,7 +34,7 @@ import { ISelectReferentialModalOptions, SelectReferentialModal } from '@app/ref
import { IonCheckbox, ModalController } from '@ionic/angular';
import { SimpleReferentialTable } from '@app/referential/table/referential-simple.table';
import { ReferentialRefFilter } from '@app/referential/services/filter/referential-ref.filter';
import { UnitIds, UnitLabel } from '@app/referential/services/model/model.enum';
import { UnitIds } from '@app/referential/services/model/model.enum';

@Component({
selector: 'app-pmfm',
Expand Down Expand Up @@ -193,12 +192,13 @@ export class PmfmPage extends AppEntityEditor<Pmfm> {
}
};

// TODO : See #450 (need to implement `levelIds[]` to get "n to n" relation between Fraction and Matrix)
// Check fraction
this.form.get('fraction')
.setAsyncValidators(async (control: AbstractControl) => {
const value = control.enabled && control.value;
return value && (!this.matrix || value.levelId !== this.matrix.id) ? {entity: true} : null;
});
// this.form.get('fraction')
// .setAsyncValidators(async (control: AbstractControl) => {
// const value = control.enabled && control.value;
// return value && (!this.matrix || value.levelId !== this.matrix.id) ? {entity: true} : null;
// });

// Listen for parameter
this.registerSubscription(
Expand Down
15 changes: 9 additions & 6 deletions src/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
"ACCESS_PROGRAM_IDS": "Data entry > Authorized data programs",
"ACCESS_NOT_SELF_DATA_MIN_ROLE": "Data entry > Min. user profile (min) to access other people data",
"ACCESS_NOT_SELF_DATA_DEPARTMENT_IDS": "Data entry > Department that can access other people data",
"ADAGIO_OPTIMIZATION": "Persistence > Oracle: Optimize queries for SIH-Adagio",
"ADAGIO_SCHEMA": "Persistence > Oracle: SIH-Adagio Schema",
"SAMPLE_UNIQUE_TAG": "Persistence > Sample: Check if TAG_ID is unique",
"SAMPLE_HASH_OPTIMIZATION": "Persistence > Sample: Optimize save (hash)",
"BATCH_HASH_OPTIMIZATION": "Persistence > Batch: Optimize save (hash)",
Expand Down Expand Up @@ -282,12 +284,13 @@
"METHOD_CALCULATED_WEIGHT_LENGTH_SUM_ID": "Referential > Method > Sum of children Weight-Length weights",
"METHOD_UNKNOWN_ID": "Referential > Method > Unknown",
"FRACTION_INDIVIDUAL_ID": "Referential > Fraction > Individual",
"PARAMETER_GROUP_AGE_LABELS": "Strategy > Parameter > Age labels",
"PARAMETER_GROUP_SEX_LABELS": "Strategy > Parameter > Sex labels",
"PARAMETER_GROUP_WEIGHT_LABELS": "Strategy > Parameter > Weight labels",
"PARAMETER_GROUP_LENGTH_LABELS": "Strategy > Parameter > Length labels",
"PARAMETER_GROUP_MATURITY_LABELS": "Strategy > Parameter > Maturity labels",
"FRACTION_GROUP_CALCIFIED_STRUCTURE_IDS": "Strategy > Fraction > Calcified structure ids",
"PARAMETER_GROUP_TAG_ID_LABELS": "Referential > Parameter > Tag-ID (codes)",
"PARAMETER_GROUP_AGE_LABELS": "Referential > Parameter > Age labels (codes)",
"PARAMETER_GROUP_SEX_LABELS": "Referential > Parameter > Sex labels (codes)",
"PARAMETER_GROUP_WEIGHT_LABELS": "Referential > Parameter > Weight labels (codes)",
"PARAMETER_GROUP_LENGTH_LABELS": "Referential > Parameter > Length labels (codes)",
"PARAMETER_GROUP_MATURITY_LABELS": "Referential > Parameter > Maturity labels (codes)",
"FRACTION_GROUP_CALCIFIED_STRUCTURE_IDS": "Referential > Fraction > Calcified structure (ids)",
"UNIT_NONE_ID": "Referential > Unit > None (hide by default)",
"QUALITY_FLAG_NOT_COMPLETED_ID": "Referential > Quality flag > Not completed",
"QUALITY_FLAG_MISSING_ID": "Referential > Quality flag > Missing",
Expand Down
Loading

0 comments on commit 3255788

Please sign in to comment.