Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
November 2023
- 1 participants
- 43 discussions
[Git][ultreiaio/ird-observe][develop] 3 commits: fix how to make line (on ll we have no text, and for ps we have points always...
by Tony CHEMIT (@tchemit) 21 Nov '23
by Tony CHEMIT (@tchemit) 21 Nov '23
21 Nov '23
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
cf138579 by Tony Chemit at 2023-11-21T13:15:38+01:00
fix how to make line (on ll we have no text, and for ps we have points always with text (but text can also be null))
- - - - -
998e6449 by Tony Chemit at 2023-11-21T13:17:02+01:00
adapt ps logbook lines (use the same layer to display day and night points (but night ones have no text)
- - - - -
f5d24778 by Tony Chemit at 2023-11-21T13:43:49+01:00
Merge branch 'feature/issue-2756' into develop
La distinction jour/nuit sur la carte est peu pertinente pour les données logbook
- See #2756
- - - - -
8 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/map/TripMapContentBuilderSupport.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripMapContentBuilder.java
- client/datasource/editor/ps/src/main/i18n/getters/java.getter
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java
- client/datasource/editor/ps/src/main/resources/map/ps-style.xml
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
Changes:
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/map/TripMapContentBuilderSupport.java
=====================================
@@ -331,12 +331,17 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
return DATE_FORMAT.format(date);
}
+ protected void addLine(DefaultFeatureCollection linesFeatures, String lineName, Coordinate[] coordinates) {
+ LineString line = getGeometryFactory().createLineString(coordinates);
+ lineBuilder.add(line);
+ lineBuilder.add(lineName);
+ linesFeatures.add(lineBuilder.buildFeature(null));
+ }
+
protected void addLine(DefaultFeatureCollection linesFeatures, String lineName, Coordinate[] coordinates, Date date) {
LineString line = getGeometryFactory().createLineString(coordinates);
lineBuilder.add(line);
- if (date != null) {
- lineBuilder.add(formatDate(date));
- }
+ lineBuilder.add(date == null ? null : formatDate(date));
lineBuilder.add(lineName);
linesFeatures.add(lineBuilder.buildFeature(null));
}
=====================================
client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripMapContentBuilder.java
=====================================
@@ -159,7 +159,7 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
if (!lines.isEmpty()) {
lineTypes.add(lineType);
for (Coordinate[] tripLine : lines) {
- addLine(linesFeatures, lineType, tripLine, null);
+ addLine(linesFeatures, lineType, tripLine);
}
}
}
=====================================
client/datasource/editor/ps/src/main/i18n/getters/java.getter
=====================================
@@ -45,8 +45,7 @@ observe.ui.action.copyFloatingObjectPartToRight.tip
observe.ui.choice.cancel
observe.ui.choice.dcp.default
observe.ui.choice.save
-observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays
-observe.ui.datasource.editor.content.map.legend.logbook.tripDay
+observe.ui.datasource.editor.content.map.legend.logbook.tripSegment
observe.ui.datasource.editor.content.map.legend.obs.tripBetweenTwoDays
observe.ui.datasource.editor.content.map.legend.obs.tripDay
observe.ui.datasource.editor.content.map.logbook.points.not.valid
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java
=====================================
@@ -109,15 +109,19 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) {
if (tripMapConfig.isAddObservations()) {
addLines0(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isObs()).collect(Collectors.toList()),
- "observation",
+ "observationDay",
+ "observationNight",
+ true,
t("observe.ui.datasource.editor.content.map.legend.obs.tripDay"),
t("observe.ui.datasource.editor.content.map.legend.obs.tripBetweenTwoDays"));
}
if (tripMapConfig.isAddLogbook()) {
addLines0(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isLogbook()).collect(Collectors.toList()),
- "logbook",
- t("observe.ui.datasource.editor.content.map.legend.logbook.tripDay"),
- t("observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays"));
+ "logbookSegment",
+ "logbookSegment",
+ false,
+ t("observe.ui.datasource.editor.content.map.legend.logbook.tripSegment"),
+ null);
}
}
@@ -128,14 +132,12 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
}
}
- protected void addTripBetweenTwoDay(DefaultFeatureCollection linesFeatures, String label, TripMapPoint previousPoint, TripMapPoint point) {
+ protected void addTripBetweenTwoDay(DefaultFeatureCollection linesFeatures, String label, TripMapPoint previousPoint, TripMapPoint point, boolean addTime) {
Coordinate[] coordinates = create(previousPoint, point);
- addLine(linesFeatures, label, coordinates, previousPoint.getTime());
+ addLine(linesFeatures, label, coordinates, addTime ? previousPoint.getTime() : null);
}
- protected void addLines0(List<TripMapPoint> tripMapPoints, String prefix, String pointDayLabel, String pointNightLabel) {
- String pointDay = prefix + "Day";
- String pointNight = prefix + "Night";
+ protected void addLines0(List<TripMapPoint> tripMapPoints, String pointDay, String pointNight, boolean addDate, String pointDayLabel, String pointNightLabel) {
if (tripMapPoints.size() == 2 && tripMapPoints.stream().allMatch(t -> t.getType().isTrip())) {
// Got only trip points, nothing to display then
return;
@@ -152,7 +154,7 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
if (previousPoint != null && !DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) {
// changing day
addTripDay(linesFeatures, pointDay, coordinatesByDay, previousPoint);
- addTripBetweenTwoDay(linesFeatures, pointNight, previousPoint, point);
+ addTripBetweenTwoDay(linesFeatures, pointNight, previousPoint, point, addDate);
coordinatesByDay.clear();
}
coordinatesByDay.add(coordinate);
@@ -167,6 +169,9 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
mapContent.addLayer(layerLines);
}
addLineLegend(styleLines, pointDay, pointDayLabel);
- addLineLegend(styleLines, pointNight, pointNightLabel);
+ if (pointNightLabel != null) {
+ addLineLegend(styleLines, pointNight, pointNightLabel);
+ }
}
-}
+
+}
\ No newline at end of file
=====================================
client/datasource/editor/ps/src/main/resources/map/ps-style.xml
=====================================
@@ -84,13 +84,14 @@
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
- <ogc:Literal>logbookDay</ogc:Literal>
+ <ogc:Literal>logbookSegment</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">${mapPsStyleLogbookLineColor}</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
+ <CssParameter name="stroke-dasharray">6 4</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
@@ -113,23 +114,6 @@
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
- <FeatureTypeStyle>
- <Rule>
- <ogc:Filter>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>type</ogc:PropertyName>
- <ogc:Literal>logbookNight</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Filter>
- <LineSymbolizer>
- <Stroke>
- <CssParameter name="stroke">${mapPsStyleLogbookLineColor}</CssParameter>
- <CssParameter name="stroke-width">2</CssParameter>
- <CssParameter name="stroke-dasharray">6 4</CssParameter>
- </Stroke>
- </LineSymbolizer>
- </Rule>
- </FeatureTypeStyle>
</UserStyle>
</NamedLayer>
=====================================
client/runner/src/main/i18n/translations/client-runner_en_GB.properties
=====================================
@@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Legend
observe.ui.datasource.editor.content.map.legend.logbook.hauling=Logbook - Hauling
observe.ui.datasource.editor.content.map.legend.logbook.setting=Logbook - Setting
observe.ui.datasource.editor.content.map.legend.logbook.trip=Logbook - Route
-observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Night trip
-observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Logbook - Day trip
+observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Logbook - Segment
observe.ui.datasource.editor.content.map.legend.not.valid.count=( %d points are not displayed )
observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Hauling
observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Setting
=====================================
client/runner/src/main/i18n/translations/client-runner_es_ES.properties
=====================================
@@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Legend \#TODO
observe.ui.datasource.editor.content.map.legend.logbook.hauling=Logbook - Arrastre
observe.ui.datasource.editor.content.map.legend.logbook.setting=Logbook - Calada
observe.ui.datasource.editor.content.map.legend.logbook.trip=Logbook - Trayecto
-observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Logbook - Trayecto del noche
-observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Logbook - Trayecto del día
+observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Logbook - Trayecto
observe.ui.datasource.editor.content.map.legend.not.valid.count=( %d points are not displayed )
observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Arrastre
observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Calada
=====================================
client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
=====================================
@@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Légende
observe.ui.datasource.editor.content.map.legend.logbook.hauling=Livre de bord - Virage
observe.ui.datasource.editor.content.map.legend.logbook.setting=Livre de bord - Filage
observe.ui.datasource.editor.content.map.legend.logbook.trip=Livre de bord - Trajet
-observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Livre de bord - Trajet de nuit
-observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Livre de bord - Trajet de jour
+observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Livre de bord - Trajet
observe.ui.datasource.editor.content.map.legend.not.valid.count=( dont %d points non affichés )
observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Virage
observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Filage
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8416c2555343dfcd9429d2c0…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8416c2555343dfcd9429d2c0…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 6 commits: Sur le plan de cuves, empêcher la saisie multiple d'une même activité sur une...
by Tony CHEMIT (@tchemit) 21 Nov '23
by Tony CHEMIT (@tchemit) 21 Nov '23
21 Nov '23
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
eafab6dc by Tony Chemit at 2023-11-21T10:30:11+01:00
Sur le plan de cuves, empêcher la saisie multiple d'une même activité sur une même cuve - Closes #2717
- - - - -
f71ab184 by Tony Chemit at 2023-11-21T11:12:44+01:00
importDirectory must not be final and transient to be persisted...
- - - - -
78740869 by Tony Chemit at 2023-11-21T11:18:05+01:00
add backupsDirectory (only used for automatic backups)
- - - - -
52092051 by Tony Chemit at 2023-11-21T11:18:37+01:00
fix dumpFile initial value in initFromConfig method
- - - - -
0c44c3a8 by Tony Chemit at 2023-11-21T11:30:41+01:00
persist backupDirectory when performing a backup
- - - - -
8416c255 by Tony Chemit at 2023-11-21T11:52:18+01:00
Merge branch 'feature/issue-2804' into develop
Les assistants d'ouverture ou sauvergade de sql.gz ne retrouvent jamais le dernier répertoire utilisé
- Closes #2804
- - - - -
11 changed files:
- client/configuration/src/main/config/Client.ini
- client/configuration/src/main/i18n/getters/config.getter
- client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- client/core/src/main/java/fr/ird/observe/client/datasource/h2/backup/LocalDatabaseBackupTaskSupport.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/save/actions/Start.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/wizard/StorageBackupUILauncher.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/wizard/StorageUIModel.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellActivityUITableModel.java
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
Changes:
=====================================
client/configuration/src/main/config/Client.ini
=====================================
@@ -117,6 +117,12 @@ description = observe.config.defaultBackupDirectory.description
key = instance.backup.directory
type = file
defaultValue = ${instance.data.directory}/backup
+
+[option backupsDirectory]
+description = observe.config.backupsDirectory.description
+key = instance.backups.directory
+type = file
+defaultValue = ${instance.data.directory}/backup
final = true
transient = true
@@ -313,8 +319,6 @@ description = observe.config.importDirectory.description
key = instance.import.directory
type = file
defaultValue = ${instance.data.directory}/backup
-final = true
-transient = true
[option logDirectory]
description = observe.config.defaultLogDbDirectory.description
=====================================
client/configuration/src/main/i18n/getters/config.getter
=====================================
@@ -13,6 +13,7 @@ observe.config.avdthDirectory.description
observe.config.backup.atClose
observe.config.backup.delay
observe.config.backup.use
+observe.config.backupsDirectory.description
observe.config.backupsFile.description
observe.config.checkServerVersion.description
observe.config.client.backupFiles.timeout.description
=====================================
client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
=====================================
@@ -676,6 +676,9 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig
return new File(getBackupDirectory(), String.format(BACKUP_DB_PATTERN, getBuildVersion().toString().replaceAll("\\.", "_"), new Date()));
}
+ public File newAutomaticBackupDataFile() {
+ return new File(getBackupsDirectory(), String.format(BACKUP_DB_PATTERN, getBuildVersion().toString().replaceAll("\\.", "_"), new Date()));
+ }
public File getFeedBackDirectoryFile() {
if (feedBackDirectoryFile == null) {
Date now = new Date();
@@ -696,7 +699,12 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig
@Override
public Map<Path, Integer> getTemporaryDirectoriesAndTimeout() {
- return Map.of(getTemporaryDirectory().toPath(), getTemporaryFilesTimeout(), getLogDirectory().toPath(), getLogFilesTimeout(), getFeedBackDirectoryFile().toPath(), getFeedbackFilesTimeout(), getBackupDirectory().toPath(), getBackupFilesTimeout());
+ return Map.of(getTemporaryDirectory().toPath(), getTemporaryFilesTimeout(), getLogDirectory().toPath(), getLogFilesTimeout(), getFeedBackDirectoryFile().toPath(), getFeedbackFilesTimeout(), getBackupsDirectory().toPath(), getBackupFilesTimeout());
+ }
+
+ public void updateBackupDirectory(File backupFile) {
+ setBackupDirectory(backupFile.getParentFile());
+ saveForUser();
}
public void saveForUser() {
=====================================
client/core/src/main/java/fr/ird/observe/client/datasource/h2/backup/LocalDatabaseBackupTaskSupport.java
=====================================
@@ -72,7 +72,7 @@ public abstract class LocalDatabaseBackupTaskSupport implements Runnable {
}
protected File doBackup() {
- File file = config.newBackupDataFile();
+ File file = config.newAutomaticBackupDataFile();
String startMessage = t("observe.ui.datasource.backup.start", new Date());
ClientUIContextApplicationComponent.value().setUiStatus(startMessage);
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/save/actions/Start.java
=====================================
@@ -91,6 +91,8 @@ public class Start extends SaveLocalUIActionSupport {
CreateDatabaseRequest request = CreateDatabaseRequest.builder(false, source.getVersion()).addGeneratedSchema().addVersionTable().addStandaloneTables().addAllData().build();
SqlScript dump = dumpService.produceCreateSqlScript(request);
dump.copyAndCompress(backupFile.toPath());
+
+ stepModel.getClientConfig().updateBackupDirectory(backupFile);
}
if (stepModel.containsStepForSave(AdminStep.SYNCHRONIZE)) {
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/wizard/StorageBackupUILauncher.java
=====================================
@@ -110,6 +110,12 @@ public class StorageBackupUILauncher extends StorageUILauncher {
StorageUIModel storageModel = ui.getModel();
File backupFile = storageModel.getBackupFile();
Objects.requireNonNull(backupFile, "file where to backup can not be null");
+ createBackup(storageModel, backupFile);
+
+ storageModel.getClientConfig().updateBackupDirectory(backupFile);
+ }
+
+ private void createBackup(StorageUIModel storageModel, File backupFile) {
ObserveDataSourcesManager dataSourcesManager = storageModel.getDataSourcesManager();
ObserveSwingDataSource incomingSource = dataSourcesManager.getMainDataSource();
SelectionTreeModel dataModel = storageModel.getSelectDataModel();
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/wizard/StorageUIModel.java
=====================================
@@ -410,7 +410,7 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie
*/
protected void initFromConfig(ClientConfig config) {
setBackupFile(config.newBackupDataFile());
- setDumpFile(config.getBackupDirectory());
+ setDumpFile(config.getImportDirectory());
setDoBackup(false);
ObserveDataSourcesManager dataSourcesManager = getDataSourcesManager();
setLocalConfig(dataSourcesManager.newH2DataSourceConfiguration(I18n.n("observe.ui.datasource.storage.label.local")));
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellActivityUITableModel.java
=====================================
@@ -25,11 +25,15 @@ package fr.ird.observe.client.datasource.editor.ps.data.logbook;
import fr.ird.observe.client.datasource.editor.api.content.EditableContentUI;
import fr.ird.observe.client.util.UIHelper;
import fr.ird.observe.client.util.table.EditableListProperty;
+import fr.ird.observe.dto.data.ps.logbook.ActivityStubDto;
+import fr.ird.observe.dto.data.ps.logbook.WellActivityDto;
import fr.ird.observe.dto.data.ps.logbook.WellActivitySpeciesDto;
import fr.ird.observe.dto.data.ps.logbook.WellDto;
+import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
import javax.swing.JTable;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
public class WellActivityUITableModel extends GeneratedWellActivityUITableModel {
@@ -83,4 +87,20 @@ public class WellActivityUITableModel extends GeneratedWellActivityUITableModel
super.startEditTableEditBeanOnInlineModels();
wellActivitySpeciesTableModel.validate();
}
+
+ @Override
+ protected void onSelectedRowChanged(WellActivityUI ui, int editingRow, WellActivityDto tableEditBean, WellActivityDto previousRowBean, boolean notPersisted, boolean newRow) {
+ super.onSelectedRowChanged(ui, editingRow, tableEditBean, previousRowBean, notPersisted, newRow);
+ if (ui.getModel().getStates().isReadingMode()) {
+ return;
+ }
+ // Only offers activities not used
+ // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2717
+ FilterableComboBox<ActivityStubDto> editor = ui.getActivity();
+ List<ActivityStubDto> columnValues = getColumnValues(0);
+ columnValues.remove(tableEditBean.getActivity());
+ List<ActivityStubDto> values = new LinkedList<>(ui.getModel().getStates().getActivity());
+ values.removeAll(columnValues);
+ editor.setData(values);
+ }
}
=====================================
client/runner/src/main/i18n/translations/client-runner_en_GB.properties
=====================================
@@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Avdth directory
observe.config.backup.atClose=Perform a backup of local source when closing application
observe.config.backup.delay=Delay in minutes between local data source backup
observe.config.backup.use=To activate auto backup of local source
+observe.config.backupsDirectory.description=Default directory where are stored automatic backups of data sources
observe.config.backupsFile.description=File to store backups information
observe.config.category.application=Validation
observe.config.category.application.description=Validation options
=====================================
client/runner/src/main/i18n/translations/client-runner_es_ES.properties
=====================================
@@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Avdth directory \#TODO
observe.config.backup.atClose=Realizar una copia de seguridad de la base de datos local al cerrar la aplicación
observe.config.backup.delay=Minutos entre cada copia de seguridad de la base de datos local
observe.config.backup.use=Para activar la copia de seguridad automática
+observe.config.backupsDirectory.description=Carpeta por defecto para copia de seguridad de automatico bases locales \#TODO
observe.config.backupsFile.description=Archivo de información de la copia de seguridad
observe.config.category.application=Contrôles et validation \#TODO
observe.config.category.application.description=Options de contrôles et validation \#TODO
=====================================
client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
=====================================
@@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Répertoire où chercher les bases AVD
observe.config.backup.atClose=Effectuer une sauvegarde de la base locale à la fermeture de l'application
observe.config.backup.delay=Temps en minutes entre chaque sauvegarde de la base locale
observe.config.backup.use=Pour activer la sauvegarde automatique
+observe.config.backupsDirectory.description=Répertoire où conserver les sauvegardes automatiques
observe.config.backupsFile.description=Fichier des informations des sauvegardes
observe.config.category.application=Contrôles et validation
observe.config.category.application.description=Options de contrôles et validation
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/3e9dac1427773a2977f7afeb…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/3e9dac1427773a2977f7afeb…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 4 commits: Move to version 9.3.0
by Tony CHEMIT (@tchemit) 17 Nov '23
by Tony CHEMIT (@tchemit) 17 Nov '23
17 Nov '23
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
7e3962e1 by Tony Chemit at 2023-11-15T12:00:25+01:00
Move to version 9.3.0
- - - - -
38a62dbb by Tony Chemit at 2023-11-17T12:14:33+01:00
Ajout de la fonctionnalité d'export html dans l'interface graphique
- - - - -
939468ef by Tony Chemit at 2023-11-17T12:15:13+01:00
Ajout des templates pour générer l'export html
- - - - -
3e9dac14 by Tony Chemit at 2023-11-17T12:17:49+01:00
Merge branch 'feature/issue_2755' into develop
Sur les tableaux de synthèse, ajouter un export HTML - Closes #2755
- - - - -
30 changed files:
- client/configuration/pom.xml
- client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- client/core/pom.xml
- client/core/src/main/resources/observe-ui.properties
- client/datasource/actions/pom.xml
- client/datasource/actions/src/main/i18n/getters/java.getter
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_en_GB.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_es_ES.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_fr_FR.ftl
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/ObserveKeyStrokesActions.java
- + client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/HtmlExportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUI.jaxx
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToClipboard.java
- + client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToHtml.java
- + client/datasource/actions/src/main/resources/icons/action-export-clipboard.png
- client/datasource/actions/src/main/resources/icons/action-export-csv.png
- + client/datasource/actions/src/main/resources/icons/action-export-html.png
- client/datasource/editor/api-test/pom.xml
- client/datasource/editor/api/pom.xml
- client/datasource/editor/common/pom.xml
- client/datasource/editor/ll/pom.xml
- client/datasource/editor/pom.xml
- client/datasource/editor/ps/pom.xml
- client/datasource/editor/spi/pom.xml
- client/datasource/pom.xml
- client/pom.xml
- client/runner/pom.xml
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/90eab29a122283e6bb3dc160…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/90eab29a122283e6bb3dc160…
You're receiving this email because of your account on gitlab.com.
1
0
17 Nov '23
Tony CHEMIT deleted branch feature/issue_2755 at ultreiaio / ird-observe
--
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][feature/issue_2755] 2 commits: Ajout de la fonctionnalité d'export html dans l'interface graphique
by Tony CHEMIT (@tchemit) 17 Nov '23
by Tony CHEMIT (@tchemit) 17 Nov '23
17 Nov '23
Tony CHEMIT pushed to branch feature/issue_2755 at ultreiaio / ird-observe
Commits:
38a62dbb by Tony Chemit at 2023-11-17T12:14:33+01:00
Ajout de la fonctionnalité d'export html dans l'interface graphique
- - - - -
939468ef by Tony Chemit at 2023-11-17T12:15:13+01:00
Ajout des templates pour générer l'export html
- - - - -
20 changed files:
- client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- client/core/src/main/resources/observe-ui.properties
- client/datasource/actions/pom.xml
- client/datasource/actions/src/main/i18n/getters/java.getter
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_en_GB.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_es_ES.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_fr_FR.ftl
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/ObserveKeyStrokesActions.java
- + client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/HtmlExportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUI.jaxx
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToClipboard.java
- + client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToHtml.java
- + client/datasource/actions/src/main/resources/icons/action-export-clipboard.png
- client/datasource/actions/src/main/resources/icons/action-export-csv.png
- + client/datasource/actions/src/main/resources/icons/action-export-html.png
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
Changes:
=====================================
client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
=====================================
@@ -466,7 +466,7 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig
}
@Override
- protected Supplier<Gson> getGsonSupplier() {
+ public Supplier<Gson> getGsonSupplier() {
return gsonSupplier == null ? gsonSupplier = new DtoGsonSupplier(true) : gsonSupplier;
}
=====================================
client/core/src/main/resources/observe-ui.properties
=====================================
@@ -239,6 +239,8 @@ icon.action.wizard-refresh=action-wizard-refresh-16.png
icon.action.wizard-config=action-wizard-config-16.png
icon.action.wizard-message=action-wizard-message-16.png
icon.action.export-csv=action-export-csv.png
+icon.action.export-html=action-export-html.png
+icon.action.export-clipboard=action-export-clipboard.png
# couleurs au format (r,g,b)
icon.Table.removeIcon=action-delete.png
color.Table.lastRowColor=255,255,0
=====================================
client/datasource/actions/pom.xml
=====================================
@@ -112,6 +112,10 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
<dependency>
<groupId>io.ultreia.java4all</groupId>
<artifactId>application-template</artifactId>
=====================================
client/datasource/actions/src/main/i18n/getters/java.getter
=====================================
@@ -84,6 +84,9 @@ observe.ui.datasource.editor.actions.report.exportToClipboard
observe.ui.datasource.editor.actions.report.exportToCsv
observe.ui.datasource.editor.actions.report.exportToCsv.done
observe.ui.datasource.editor.actions.report.exportToCsv.tip
+observe.ui.datasource.editor.actions.report.exportToHtml
+observe.ui.datasource.editor.actions.report.exportToHtml.done
+observe.ui.datasource.editor.actions.report.exportToHtml.tip
observe.ui.datasource.editor.actions.report.no.report.found
observe.ui.datasource.editor.actions.report.report.count.found
observe.ui.datasource.editor.actions.report.title
=====================================
client/datasource/actions/src/main/i18n/templates/reportHtmlExport_en_GB.ftl
=====================================
@@ -0,0 +1,240 @@
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.actions.report.HtmlExportModel" -->
+<!DOCTYPE html>
+<!--
+ #%L
+ ObServe Client :: DataSource :: Actions
+ %%
+ Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<html lang="en">
+<head>
+ <link href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" rel="stylesheet"/>
+ <title>Report ${.data_model.selectedReport.name}</title>
+ <script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
+ <style>
+ .config-panel {
+ padding: 10px;
+ margin: 10px 0;
+ background: #fcfcfc;
+ border: 1px solid #e9e9e9;
+ display: inline-block;
+ }
+
+ .config-panel label {
+ margin-right: 10px;
+ }
+
+ td.gridjs-td {
+ background-color: transparent;
+ }
+
+ tr:nth-child(even) {
+ background-color: #dddddd;
+ }
+
+ tr:hover td {
+ background-color: rgba(0, 0, 0, 0.1);
+ }
+
+ tr td:hover {
+ color: #fff;
+ }
+
+ th:hover {
+ background-color: #999;
+ color: #fff;
+ }
+ </style>
+ <script type="application/javascript">
+
+ function searchValue() {
+ return searchOption.checked;
+ }
+
+ function resizableValue() {
+ return resizableOption.checked;
+ }
+
+ function sortValue() {
+ return sortOption.checked;
+ }
+
+ function paginationValue() {
+ return paginationOption.checked ? {limit: paginationSizeOption.value} : false;
+ }
+
+ function toggleSearch(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle search to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleResizable(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle resizable to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleSort(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle sort to: " + newValue);
+ updateGrid(config);
+ }
+
+ function togglePagination(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle pagination to: " + newValue);
+ if (newValue) {
+ paginationSizeOption["disabled"] = null;
+ } else {
+ paginationSizeOption.disabled = true;
+ }
+ updateGrid(config);
+ }
+
+ function changePaginationSize(config, source) {
+ let newValue = source.value;
+ // console.info("Change pagination size to: " + newValue);
+ updateGrid(config);
+ }
+
+ function updateGrid(config) {
+ let newConfig = {
+ language: config.language,
+ data: config.data,
+ columns: config.columns,
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue()
+ };
+ gridContainerParent.innerHTML = "<div id=\"wrapper\"></div>";
+ // console.info(newConfig);
+ setTimeout(() => {
+ grid = new gridjs.Grid(newConfig).render(document.getElementById("wrapper"));
+ }, 50);
+ }
+ </script>
+</head>
+<body>
+<h1>Report ${.data_model.selectedReport.name}</h1>
+<h2>Configuration</h2>
+<h3>Selected data:</h3>
+<ul>
+ <li>
+ <#assign selectDataModel = .data_model.selectDataModel.selectionDataModel />
+ <#assign selectDataCount = selectDataModel.getSelectedCount() />
+
+ <#if selectDataCount == 1> 1 trip <#else> ${selectDataCount} trips</#if>.
+ <ul>
+ <#list selectDataModel.getSelectedLabels() as key, value>
+ <li>
+ ${key}
+ <ul>
+ <#list value as trip>
+ <li>${trip}</li>
+ </#list>
+ </ul>
+ </li>
+ </#list>
+ </ul>
+ </li>
+</ul>
+<h3>Selected report:</h3>
+
+<#assign selectedReport = .data_model.selectedReport />
+<p><b>${selectedReport.name}</b></p>
+<ul>
+ <#list selectedReport.getVariables() as variable>
+ <li>
+ Variable ${variable.name} : ${variable.selectedValue}.
+ </li>
+ </#list>
+</ul>
+<h2>Result</h2>
+
+<div class="config-panel">
+ <label><input id="search" type="checkbox" checked/> Search</label>|
+ <label><input id="resizable" type="checkbox" checked/> Resizable columns</label>|
+ <label><input id="sort" type="checkbox" checked/> Sort</label>|
+ <label><input id="pagination" type="checkbox"/> Pagination</label>|
+ <label>Page size <input id="paginationSize" type="number" disabled value="20"/></label>
+</div>
+<div id="wrapperParent">
+ <div id="wrapper"></div>
+</div>
+<script type="application/javascript">
+ const json = ${.data_model.json};
+
+ const gridContainerParent = document.getElementById("wrapperParent");
+ const searchOption = document.getElementById("search");
+ const resizableOption = document.getElementById("resizable");
+ const paginationOption = document.getElementById("pagination");
+ const paginationSizeOption = document.getElementById("paginationSize");
+ const sortOption = document.getElementById("sort");
+
+ let grid = new gridjs.Grid({
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue(),
+ <#--language: {-->
+ <#-- 'search': {-->
+ <#-- 'placeholder': '🔍 Recherche...'-->
+ <#-- },-->
+ <#-- sort: {-->
+ <#-- sortAsc: 'Tri ascendant',-->
+ <#-- sortDesc: 'Tri descendant',-->
+ <#-- },-->
+ <#-- pagination: {-->
+ <#-- previous: 'Précédent',-->
+ <#-- next: 'Suivant',-->
+ <#-- navigate: (page, pages) => `Page ${r"${page}"} sur ${r"${pages}"}`,-->
+ <#-- page: (page) => `Page ${r"${page}"}`,-->
+ <#-- showing: 'Affichage des lignes de',-->
+ <#-- of: 'sur',-->
+ <#-- to: 'à',-->
+ <#-- results: 'lignes.',-->
+ <#-- },-->
+ <#-- loading: 'Chargement...'-->
+ <#--},-->
+ columns: !!json.columnNames ? json.columnNames : [],
+ data: json.data.data
+ });
+ updateGrid(grid.config);
+
+ searchOption.addEventListener("change", function () {
+ toggleSearch(grid.config, this);
+ });
+ resizableOption.addEventListener("change", function () {
+ toggleResizable(grid.config, this);
+ });
+ sortOption.addEventListener("change", function () {
+ toggleSort(grid.config, this);
+ });
+ paginationOption.addEventListener("change", function () {
+ togglePagination(grid.config, this);
+ });
+
+ paginationSizeOption.addEventListener("change", function () {
+ changePaginationSize(grid.config, this);
+ });
+</script>
+</body>
+</html>
=====================================
client/datasource/actions/src/main/i18n/templates/reportHtmlExport_es_ES.ftl
=====================================
@@ -0,0 +1,240 @@
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.actions.report.HtmlExportModel" -->
+<!DOCTYPE html>
+<!--
+ #%L
+ ObServe Client :: DataSource :: Actions
+ %%
+ Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<#--TODO-->
+<html lang="en">
+<head>
+ <link href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" rel="stylesheet"/>
+ <title>Report ${.data_model.selectedReport.name}</title>
+ <script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
+ <style>
+ .config-panel {
+ padding: 10px;
+ margin: 10px 0;
+ background: #fcfcfc;
+ border: 1px solid #e9e9e9;
+ display: inline-block;
+ }
+
+ .config-panel label {
+ margin-right: 10px;
+ }
+
+ td.gridjs-td {
+ background-color: transparent;
+ }
+
+ tr:nth-child(even) {
+ background-color: #dddddd;
+ }
+
+ tr:hover td {
+ background-color: rgba(0, 0, 0, 0.1);
+ }
+
+ tr td:hover {
+ color: #fff;
+ }
+
+ th:hover {
+ background-color: #999;
+ color: #fff;
+ }
+ </style>
+ <script type="application/javascript">
+
+ function searchValue() {
+ return searchOption.checked;
+ }
+
+ function resizableValue() {
+ return resizableOption.checked;
+ }
+
+ function sortValue() {
+ return sortOption.checked;
+ }
+
+ function paginationValue() {
+ return paginationOption.checked ? {limit: paginationSizeOption.value} : false;
+ }
+
+ function toggleSearch(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle search to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleResizable(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle resizable to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleSort(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle sort to: " + newValue);
+ updateGrid(config);
+ }
+
+ function togglePagination(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle pagination to: " + newValue);
+ if (newValue) {
+ paginationSizeOption["disabled"] = null;
+ } else {
+ paginationSizeOption.disabled = true;
+ }
+ updateGrid(config);
+ }
+
+ function changePaginationSize(config, source) {
+ let newValue = source.value;
+ // console.info("Change pagination size to: " + newValue);
+ updateGrid(config);
+ }
+
+ function updateGrid(config) {
+ let newConfig = {
+ language: config.language,
+ data: config.data,
+ columns: config.columns,
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue()
+ };
+ gridContainerParent.innerHTML = "<div id=\"wrapper\"></div>";
+ // console.info(newConfig);
+ setTimeout(() => {
+ grid = new gridjs.Grid(newConfig).render(document.getElementById("wrapper"));
+ }, 50);
+ }
+ </script>
+</head>
+<body>
+<h1>Report ${.data_model.selectedReport.name}</h1>
+<h2>Configuration</h2>
+<h3>Selected data:</h3>
+<ul>
+ <li>
+ <#assign selectDataModel = .data_model.selectDataModel.selectionDataModel />
+ <#assign selectDataCount = selectDataModel.getSelectedCount() />
+
+ <#if selectDataCount == 1> 1 trip <#else> ${selectDataCount} trips</#if>.
+ <ul>
+ <#list selectDataModel.getSelectedLabels() as key, value>
+ <li>
+ ${key}
+ <ul>
+ <#list value as trip>
+ <li>${trip}</li>
+ </#list>
+ </ul>
+ </li>
+ </#list>
+ </ul>
+ </li>
+</ul>
+<h3>Selected report:</h3>
+
+<#assign selectedReport = .data_model.selectedReport />
+<p><b>${selectedReport.name}</b></p>
+<ul>
+ <#list selectedReport.getVariables() as variable>
+ <li>
+ Variable ${variable.name} : ${variable.selectedValue}.
+ </li>
+ </#list>
+</ul>
+<h2>Result</h2>
+
+<div class="config-panel">
+ <label><input id="search" type="checkbox" checked/> Search</label>|
+ <label><input id="resizable" type="checkbox" checked/> Resizable columns</label>|
+ <label><input id="sort" type="checkbox" checked/> Sort</label>|
+ <label><input id="pagination" type="checkbox"/> Pagination</label>|
+ <label>Page size <input id="paginationSize" type="number" disabled value="20"/></label>
+</div>
+<div id="wrapperParent">
+ <div id="wrapper"></div>
+</div>
+<script type="application/javascript">
+ const json = ${.data_model.json};
+
+ const gridContainerParent = document.getElementById("wrapperParent");
+ const searchOption = document.getElementById("search");
+ const resizableOption = document.getElementById("resizable");
+ const paginationOption = document.getElementById("pagination");
+ const paginationSizeOption = document.getElementById("paginationSize");
+ const sortOption = document.getElementById("sort");
+
+ let grid = new gridjs.Grid({
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue(),
+ <#--language: {-->
+ <#-- 'search': {-->
+ <#-- 'placeholder': '🔍 Recherche...'-->
+ <#-- },-->
+ <#-- sort: {-->
+ <#-- sortAsc: 'Tri ascendant',-->
+ <#-- sortDesc: 'Tri descendant',-->
+ <#-- },-->
+ <#-- pagination: {-->
+ <#-- previous: 'Précédent',-->
+ <#-- next: 'Suivant',-->
+ <#-- navigate: (page, pages) => `Page ${r"${page}"} sur ${r"${pages}"}`,-->
+ <#-- page: (page) => `Page ${r"${page}"}`,-->
+ <#-- showing: 'Affichage des lignes de',-->
+ <#-- of: 'sur',-->
+ <#-- to: 'à',-->
+ <#-- results: 'lignes.',-->
+ <#-- },-->
+ <#-- loading: 'Chargement...'-->
+ <#--},-->
+ columns: !!json.columnNames ? json.columnNames : [],
+ data: json.data.data
+ });
+ updateGrid(grid.config);
+
+ searchOption.addEventListener("change", function () {
+ toggleSearch(grid.config, this);
+ });
+ resizableOption.addEventListener("change", function () {
+ toggleResizable(grid.config, this);
+ });
+ sortOption.addEventListener("change", function () {
+ toggleSort(grid.config, this);
+ });
+ paginationOption.addEventListener("change", function () {
+ togglePagination(grid.config, this);
+ });
+
+ paginationSizeOption.addEventListener("change", function () {
+ changePaginationSize(grid.config, this);
+ });
+</script>
+</body>
+</html>
=====================================
client/datasource/actions/src/main/i18n/templates/reportHtmlExport_fr_FR.ftl
=====================================
@@ -0,0 +1,240 @@
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.actions.report.HtmlExportModel" -->
+<!DOCTYPE html>
+<!--
+ #%L
+ ObServe Client :: DataSource :: Actions
+ %%
+ Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<html lang="fr">
+<head>
+ <link href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" rel="stylesheet"/>
+ <title>Rapport ${.data_model.selectedReport.name}</title>
+ <script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
+ <style>
+ .config-panel {
+ padding: 10px;
+ margin: 10px 0;
+ background: #fcfcfc;
+ border: 1px solid #e9e9e9;
+ display: inline-block;
+ }
+
+ .config-panel label {
+ margin-right: 10px;
+ }
+
+ td.gridjs-td {
+ background-color: transparent;
+ }
+
+ tr:nth-child(even) {
+ background-color: #dddddd;
+ }
+
+ tr:hover td {
+ background-color: rgba(0, 0, 0, 0.1);
+ }
+
+ tr td:hover {
+ color: #fff;
+ }
+
+ th:hover {
+ background-color: #999;
+ color: #fff;
+ }
+ </style>
+ <script type="application/javascript">
+
+ function searchValue() {
+ return searchOption.checked;
+ }
+
+ function resizableValue() {
+ return resizableOption.checked;
+ }
+
+ function sortValue() {
+ return sortOption.checked;
+ }
+
+ function paginationValue() {
+ return paginationOption.checked ? {limit: paginationSizeOption.value} : false;
+ }
+
+ function toggleSearch(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle search to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleResizable(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle resizable to: " + newValue);
+ updateGrid(config);
+ }
+
+ function toggleSort(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle sort to: " + newValue);
+ updateGrid(config);
+ }
+
+ function togglePagination(config, source) {
+ let newValue = source.checked;
+ // console.info("Toggle pagination to: " + newValue);
+ if (newValue) {
+ paginationSizeOption["disabled"] = null;
+ } else {
+ paginationSizeOption.disabled = true;
+ }
+ updateGrid(config);
+ }
+
+ function changePaginationSize(config, source) {
+ let newValue = source.value;
+ // console.info("Change pagination size to: " + newValue);
+ updateGrid(config);
+ }
+
+ function updateGrid(config) {
+ let newConfig = {
+ language: config.language,
+ data: config.data,
+ columns: config.columns,
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue()
+ };
+ gridContainerParent.innerHTML = "<div id=\"wrapper\"></div>";
+ // console.info(newConfig);
+ setTimeout(() => {
+ grid = new gridjs.Grid(newConfig).render(document.getElementById("wrapper"));
+ }, 50);
+ }
+ </script>
+</head>
+<body>
+<h1>Rapport ${.data_model.selectedReport.name}</h1>
+<h2>Configuration</h2>
+<h3>Données sélectionnées :</h3>
+<ul>
+ <li>
+ <#assign selectDataModel = .data_model.selectDataModel.selectionDataModel />
+ <#assign selectDataCount = selectDataModel.getSelectedCount() />
+
+ <#if selectDataCount == 1> 1 marée <#else> ${selectDataCount} marées</#if>.
+ <ul>
+ <#list selectDataModel.getSelectedLabels() as key, value>
+ <li>
+ ${key}
+ <ul>
+ <#list value as trip>
+ <li>${trip}</li>
+ </#list>
+ </ul>
+ </li>
+ </#list>
+ </ul>
+ </li>
+</ul>
+<h3>Rapport sélectionné :</h3>
+
+<#assign selectedReport = .data_model.selectedReport />
+<p><b>${selectedReport.name}</b></p>
+<ul>
+ <#list selectedReport.getVariables() as variable>
+ <li>
+ Variable ${variable.name} : ${variable.selectedValue}.
+ </li>
+ </#list>
+</ul>
+<h2>Résultat</h2>
+
+<div class="config-panel">
+ <label><input id="search" type="checkbox" checked/> Recherche</label>|
+ <label><input id="resizable" type="checkbox" checked/> Colonnes redimensionnables</label>|
+ <label><input id="sort" type="checkbox" checked/> Tri des colonnes</label>|
+ <label><input id="pagination" type="checkbox"/> Pagination</label>|
+ <label>Nombre de lignes par page <input id="paginationSize" type="number" disabled value="20"/></label>
+</div>
+<div id="wrapperParent">
+ <div id="wrapper"></div>
+</div>
+<script type="application/javascript">
+ const json = ${.data_model.json};
+
+ const gridContainerParent = document.getElementById("wrapperParent");
+ const searchOption = document.getElementById("search");
+ const resizableOption = document.getElementById("resizable");
+ const paginationOption = document.getElementById("pagination");
+ const paginationSizeOption = document.getElementById("paginationSize");
+ const sortOption = document.getElementById("sort");
+
+ let grid = new gridjs.Grid({
+ search: searchValue(),
+ resizable: resizableValue(),
+ sort: sortValue(),
+ pagination: paginationValue(),
+ language: {
+ 'search': {
+ 'placeholder': '🔍 Recherche...'
+ },
+ sort: {
+ sortAsc: 'Tri ascendant',
+ sortDesc: 'Tri descendant',
+ },
+ pagination: {
+ previous: 'Précédent',
+ next: 'Suivant',
+ navigate: (page, pages) => `Page ${r"${page}"} sur ${r"${pages}"}`,
+ page: (page) => `Page ${r"${page}"}`,
+ showing: 'Affichage des lignes de',
+ of: 'sur',
+ to: 'à',
+ results: 'lignes.',
+ },
+ loading: 'Chargement...'
+ },
+ columns: !!json.columnNames ? json.columnNames : [],
+ data: json.data.data
+ });
+ updateGrid(grid.config);
+
+ searchOption.addEventListener("change", function () {
+ toggleSearch(grid.config, this);
+ });
+ resizableOption.addEventListener("change", function () {
+ toggleResizable(grid.config, this);
+ });
+ sortOption.addEventListener("change", function () {
+ toggleSort(grid.config, this);
+ });
+ paginationOption.addEventListener("change", function () {
+ togglePagination(grid.config, this);
+ });
+
+ paginationSizeOption.addEventListener("change", function () {
+ changePaginationSize(grid.config, this);
+ });
+</script>
+</body>
+</html>
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/ObserveKeyStrokesActions.java
=====================================
@@ -42,6 +42,7 @@ public class ObserveKeyStrokesActions extends ObserveKeyStrokesEditorApi {
public static final KeyStroke KEY_STROKE_EXPORT_POPUP = KeyStroke.getKeyStroke("pressed F10");
public static final KeyStroke KEY_STROKE_EXPORT_CLIPBOARD = KeyStroke.getKeyStroke("pressed F2");
public static final KeyStroke KEY_STROKE_EXPORT_CSV = KeyStroke.getKeyStroke("pressed F3");
+ public static final KeyStroke KEY_STROKE_EXPORT_HTML = KeyStroke.getKeyStroke("pressed F4");
public static final KeyStroke KEY_STROKE_EXIT = KeyStroke.getKeyStroke("alt pressed F");
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/HtmlExportModel.java
=====================================
@@ -0,0 +1,108 @@
+package fr.ird.observe.client.datasource.actions.report;
+
+/*-
+ * #%L
+ * ObServe Client :: DataSource :: Actions
+ * %%
+ * Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.gson.Gson;
+import fr.ird.observe.client.datasource.actions.config.SelectDataModel;
+import fr.ird.observe.report.Report;
+import io.ultreia.java4all.application.template.spi.GenerateTemplate;
+import io.ultreia.java4all.util.matrix.DataMatrix;
+
+import java.util.List;
+
+/**
+ * The model used to generate data file in html export.
+ *
+ * Created at 15/11/2023.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.3.0
+ */
+@GenerateTemplate(template = "reportHtmlExport.ftl")
+public class HtmlExportModel {
+ /**
+ * Selected report.
+ */
+ private final transient Report selectedReport;
+ /**
+ * Selected data model.
+ */
+ private final transient SelectDataModel selectDataModel;
+
+ private final List<String> columnNames;
+ private final List<String> rowNames;
+ private final DataMatrix data;
+ private final boolean withColumnHeader;
+ private final boolean withRowHeader;
+ private final transient String json;
+
+ public HtmlExportModel(Gson gson,
+ Report selectedReport,
+ SelectDataModel selectDataModel,
+ List<String> columnNames,
+ List<String> rowNames,
+ DataMatrix data,
+ boolean withColumnHeader,
+ boolean withRowHeader) {
+ this.selectedReport = selectedReport;
+ this.selectDataModel = selectDataModel;
+ this.columnNames = columnNames;
+ this.rowNames = rowNames;
+ this.data = data;
+ this.withColumnHeader = withColumnHeader;
+ this.withRowHeader = withRowHeader;
+ this.json = gson.toJson(this);
+ }
+
+ public String getJson() {
+ return json;
+ }
+
+ public Report getSelectedReport() {
+ return selectedReport;
+ }
+
+ public SelectDataModel getSelectDataModel() {
+ return selectDataModel;
+ }
+
+ public List<String> getColumnNames() {
+ return columnNames;
+ }
+
+ public List<String> getRowNames() {
+ return rowNames;
+ }
+
+ public DataMatrix getData() {
+ return data;
+ }
+
+ public boolean isWithColumnHeader() {
+ return withColumnHeader;
+ }
+
+ public boolean isWithRowHeader() {
+ return withRowHeader;
+ }
+}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
=====================================
@@ -60,6 +60,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -397,6 +398,10 @@ public class ReportModel extends AdminActionModel {
return new File(getClientConfig().getExportDirectory(), String.format("export-%1$s--%2$tF--%2$tk-%2$tM-%2$tS.csv", Objects.requireNonNull(getSelectedReport()).getId().replaceAll("\\.", "_"), new Date()));
}
+ public Path newExportHtmlDirectory() {
+ return getClientConfig().getExportDirectory().toPath().resolve( String.format("export-%1$s--%2$tF--%2$tk-%2$tM-%2$tS", Objects.requireNonNull(getSelectedReport()).getId().replaceAll("\\.", "_"), new Date()));
+ }
+
void onReportsChanged(ReportUI ui, List<ReportDefinition> newValue) {
log.debug(String.format("New reports : %s", newValue));
newValue.sort(Comparator.comparing(ReportDefinition::getName));
@@ -596,6 +601,11 @@ public class ReportModel extends AdminActionModel {
}
}
+ public HtmlExportModel toJsonModel() {
+
+ return new HtmlExportModel(getClientConfig().getGsonSupplier().get(), getSelectedReport(), selectDataModel, getResultModel().getColumnNames(), getResultModel().getRowNames(), getResultModel().getData(), getResultModel().isWithColumnHeader(), getResultModel().isWithRowHeader());
+ }
+
private Map<String, FilterableComboBox<?>> initVariableComponents(ReportUI ui, Report report) {
Map<String, FilterableComboBox<?>> result = new TreeMap<>();
JPanel variablesPanel = ui.getReportVariableSelectorPanel();
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUI.jaxx
=====================================
@@ -80,6 +80,7 @@ public void destroy() {
<JPopupMenu id='exportPopup'>
<JMenuItem id='exportToClipboard' styleClass="enabledIfReportSelected"/>
<JMenuItem id='exportToCsv' styleClass="enabledIfReportSelected"/>
+ <JMenuItem id='exportToHtml' styleClass="enabledIfReportSelected"/>
</JPopupMenu>
<JToolBar id='titleRightToolBar'>
<JToggleButton id='toggleExport'/>
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
=====================================
@@ -236,6 +236,26 @@ public class ResultTableModel extends AbstractTableModel {
return data == null ? null : data.getValue(columnIndex, rowIndex);
}
+ public List<String> getColumnNames() {
+ return columnNames;
+ }
+
+ public List<String> getRowNames() {
+ return rowNames;
+ }
+
+ public DataMatrix getData() {
+ return data;
+ }
+
+ public boolean isWithColumnHeader() {
+ return withColumnHeader;
+ }
+
+ public boolean isWithRowHeader() {
+ return withRowHeader;
+ }
+
public String getClipboardContent(boolean copyRowHeaders, boolean copyColumnHeaders) {
return getDataContent(copyRowHeaders, copyColumnHeaders, true, '\t');
}
@@ -264,5 +284,4 @@ public class ResultTableModel extends AbstractTableModel {
result += data.getClipboardContent(copyRowHeaders || !withRowHeader, true, escapeCell, separator);
return result;
}
-
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToClipboard.java
=====================================
@@ -43,7 +43,7 @@ public class ExportToClipboard extends AdminTabUIActionSupport<ReportUI> {
public ExportToClipboard() {
super(t("observe.ui.datasource.editor.actions.report.exportToClipboard"),
t("observe.ui.datasource.editor.actions.synchro.copy.tip"),
- "report-copy",
+ "export-clipboard",
ObserveKeyStrokesActions.KEY_STROKE_EXPORT_CLIPBOARD);
setCheckMenuItemIsArmed(false);
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToHtml.java
=====================================
@@ -0,0 +1,95 @@
+package fr.ird.observe.client.datasource.actions.report.actions;
+
+/*-
+ * #%L
+ * ObServe Client :: DataSource :: Actions
+ * %%
+ * Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ird.observe.client.datasource.actions.ObserveKeyStrokesActions;
+import fr.ird.observe.client.datasource.actions.actions.AdminTabUIActionSupport;
+import fr.ird.observe.client.datasource.actions.report.HtmlExportModel;
+import fr.ird.observe.client.datasource.actions.report.HtmlExportModelTemplate;
+import fr.ird.observe.client.datasource.actions.report.ReportModel;
+import fr.ird.observe.client.datasource.actions.report.ReportUI;
+import fr.ird.observe.client.util.UIHelper;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import static io.ultreia.java4all.i18n.I18n.t;
+
+/**
+ * Created at 15/11/2023.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.3.0
+ */
+public class ExportToHtml extends AdminTabUIActionSupport<ReportUI> {
+
+ private static final Logger log = LogManager.getLogger(ExportToClipboard.class);
+
+ public ExportToHtml() {
+ super(t("observe.ui.datasource.editor.actions.report.exportToHtml"),
+ t("observe.ui.datasource.editor.actions.report.exportToHtml.tip"),
+ "export-html",
+ ObserveKeyStrokesActions.KEY_STROKE_EXPORT_HTML);
+ setCheckMenuItemIsArmed(false);
+ }
+
+ @Override
+ protected void doActionPerformed(ActionEvent e, ReportUI ui) {
+ try {
+ run();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+
+ private void run() throws IOException {
+ ReportModel stepModel = ui.getStepModel();
+
+ String reportId = stepModel.getSelectedReport().getId();
+ // generate result directory
+ Path exportDirectory = stepModel.newExportHtmlDirectory();
+ Files.createDirectories(exportDirectory);
+
+ // generate data file
+ Path dataFile = exportDirectory.resolve("data.json");
+ log.info("Generate data file for report ({}) at {}", reportId, dataFile);
+ HtmlExportModel dataModel = stepModel.toJsonModel();
+ String dataContent = dataModel.getJson();
+ Files.writeString(dataFile, dataContent);
+
+ // generate html file
+ Path htmlFile = exportDirectory.resolve("report.html");
+ log.info("Generate html file for report ({}) at {}", reportId, htmlFile);
+ String fileContent = HtmlExportModelTemplate.generate(dataModel);
+ Files.writeString(htmlFile, fileContent);
+
+ // open html file
+ UIHelper.openLink(htmlFile.toUri());
+ setUiStatus(t("observe.ui.datasource.editor.actions.report.exportToHtml.done", exportDirectory));
+ }
+}
=====================================
client/datasource/actions/src/main/resources/icons/action-export-clipboard.png
=====================================
Binary files /dev/null and b/client/datasource/actions/src/main/resources/icons/action-export-clipboard.png differ
=====================================
client/datasource/actions/src/main/resources/icons/action-export-csv.png
=====================================
Binary files a/client/datasource/actions/src/main/resources/icons/action-export-csv.png and b/client/datasource/actions/src/main/resources/icons/action-export-csv.png differ
=====================================
client/datasource/actions/src/main/resources/icons/action-export-html.png
=====================================
Binary files /dev/null and b/client/datasource/actions/src/main/resources/icons/action-export-html.png differ
=====================================
client/runner/src/main/i18n/translations/client-runner_en_GB.properties
=====================================
@@ -573,6 +573,9 @@ observe.ui.datasource.editor.actions.report.exportToClipboard=Clipboard
observe.ui.datasource.editor.actions.report.exportToCsv=CSV
observe.ui.datasource.editor.actions.report.exportToCsv.done=Csv export done at %s
observe.ui.datasource.editor.actions.report.exportToCsv.tip=Export to csv
+observe.ui.datasource.editor.actions.report.exportToHtml=Html
+observe.ui.datasource.editor.actions.report.exportToHtml.done=Html export done at %s
+observe.ui.datasource.editor.actions.report.exportToHtml.tip=Export to html
observe.ui.datasource.editor.actions.report.no.report.found=No report found.
observe.ui.datasource.editor.actions.report.report.count.found=Found %s reports.
observe.ui.datasource.editor.actions.report.report.description=Description of selected report
=====================================
client/runner/src/main/i18n/translations/client-runner_es_ES.properties
=====================================
@@ -573,6 +573,9 @@ observe.ui.datasource.editor.actions.report.exportToClipboard=Clipboard
observe.ui.datasource.editor.actions.report.exportToCsv=CSV
observe.ui.datasource.editor.actions.report.exportToCsv.done=Csv export done at %s
observe.ui.datasource.editor.actions.report.exportToCsv.tip=Export to csv
+observe.ui.datasource.editor.actions.report.exportToHtml=Html
+observe.ui.datasource.editor.actions.report.exportToHtml.done=Html export done at %s \#TODO
+observe.ui.datasource.editor.actions.report.exportToHtml.tip=Export to html \#TODO
observe.ui.datasource.editor.actions.report.no.report.found=No report found. \#TODO
observe.ui.datasource.editor.actions.report.report.count.found=Found %s reports. \#TODO
observe.ui.datasource.editor.actions.report.report.description=Descripción del informe seleccionado
=====================================
client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
=====================================
@@ -573,6 +573,9 @@ observe.ui.datasource.editor.actions.report.exportToClipboard=Presse papier
observe.ui.datasource.editor.actions.report.exportToCsv=Csv
observe.ui.datasource.editor.actions.report.exportToCsv.done=Export csv sauvegardé dans le fichier %s
observe.ui.datasource.editor.actions.report.exportToCsv.tip=Exporter au format Csv
+observe.ui.datasource.editor.actions.report.exportToHtml=Html
+observe.ui.datasource.editor.actions.report.exportToHtml.done=Export html sauvegardé dans le répertoire %s
+observe.ui.datasource.editor.actions.report.exportToHtml.tip=Exporter au format Html
observe.ui.datasource.editor.actions.report.no.report.found=Aucun rapport trouvé.
observe.ui.datasource.editor.actions.report.report.count.found=%s rapports détectés.
observe.ui.datasource.editor.actions.report.report.description=Description du rapport sélectionné
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/455386042bf6ae7140dabc8a…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/455386042bf6ae7140dabc8a…
You're receiving this email because of your account on gitlab.com.
1
0
16 Nov '23
Tony CHEMIT pushed to branch feature/issue_2755 at ultreiaio / ird-observe
Commits:
45538604 by Tony Chemit at 2023-11-16T18:49:02+01:00
stash
- - - - -
7 changed files:
- client/datasource/actions/src/main/resources/report/html/default/report.html → client/datasource/actions/src/main/i18n/templates/reportHtmlExport_en_GB.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_es_ES.ftl
- + client/datasource/actions/src/main/i18n/templates/reportHtmlExport_fr_FR.ftl
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultJsonModel.java → client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/HtmlExportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToHtml.java
Changes:
=====================================
client/datasource/actions/src/main/resources/report/html/default/report.html → client/datasource/actions/src/main/i18n/templates/reportHtmlExport_en_GB.ftl
=====================================
@@ -74,7 +74,7 @@
}
new gridjs.Grid(config).render(container);
}
- var json = ${json};
+ var json = ${data};
</script>
</head>
<body>
=====================================
client/datasource/actions/src/main/i18n/templates/reportHtmlExport_es_ES.ftl
=====================================
@@ -0,0 +1,21 @@
+<#--
+ #%L
+ ObServe Client :: DataSource :: Actions
+ %%
+ Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+-->
=====================================
client/datasource/actions/src/main/i18n/templates/reportHtmlExport_fr_FR.ftl
=====================================
@@ -0,0 +1,263 @@
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.actions.report.HtmlExportModel" -->
+<!DOCTYPE html>
+<!--
+ #%L
+ ObServe Client :: DataSource :: Actions
+ %%
+ Copyright (C) 2008 - 2023 IRD, Ultreia.io
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<html lang="en">
+<head>
+ <link href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" rel="stylesheet"/>
+ <title>Report...</title>
+ <script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
+ <style>
+ .config-panel {
+ padding: 10px;
+ margin: 10px 0;
+ background: #fcfcfc;
+ border: 1px solid #e9e9e9;
+ display: inline-block;
+ }
+
+ .config-panel label {
+ margin-right: 10px;
+ }
+
+ td.gridjs-td {
+ background-color: transparent;
+ }
+
+ tr:nth-child(even) {
+ background-color: #dddddd;
+ }
+ </style>
+ <script type="application/javascript">
+ const config = {
+ language: {
+ 'search': {
+ 'placeholder': '🔍 Recherche...'
+ }
+ }
+ };
+ const json = ${.data_model.json};
+ </script>
+</head>
+<body>
+<h1>Rapport ${.data_model.selectedReport.name}</h1>
+<h2>Configuration</h2>
+<h3>Données sélectionnées :</h3>
+<ul>
+ <li>
+ <#assign selectDataModel = .data_model.selectDataModel.selectionDataModel />
+ <#assign selectDataCount = selectDataModel.getSelectedCount() />
+
+ <#if selectDataCount == 1> 1 marée <#else> ${selectDataCount} marées</#if>.
+ <ul>
+ <#list selectDataModel.getSelectedLabels() as key, value>
+ <li>
+ ${key}
+ <ul>
+ <#list value as trip>
+ <li>${trip}</li>
+ </#list>
+ </ul>
+ </li>
+ </#list>
+ </ul>
+ </li>
+</ul>
+<h3>Rapport sélectionné :</h3>
+
+<#assign selectedReport = .data_model.selectedReport />
+<p><b>${selectedReport.name}</b></p>
+<#list selectedReport.getVariables() as variable>
+ <li>
+ Variable ${variable.name} : ${variable.selectedValue}.
+ </li>
+</#list>
+<h2>Résultat</h2>
+
+<div class="config-panel">
+ <label><input id="search" type="checkbox" class="action" checked/> Search</label>
+ <label><input id="resizable" type="checkbox" class="action" checked/> Colonnes redimensionnables</label>
+ <label><input id="sort" type="checkbox" class="action" checked/> Sorting</label>
+ <label><input id="pagination" type="checkbox" class="action"/> Pagination</label>
+ <label>Page size<input id="paginationSize" type="number" disabled value="20"/></label>
+</div>
+<div id="wrapperParent">
+ <div id="wrapper"></div>
+</div>
+<script type="application/javascript">
+ const gridContainerParent = document.getElementById("wrapperParent");
+ const searchOption = document.getElementById("search");
+ const resizableOption = document.getElementById("resizable");
+ const paginationOption = document.getElementById("pagination");
+ const paginationSizeOption = document.getElementById("paginationSize");
+ const sortOption = document.getElementById("sort");
+
+ // FIXME Use options value from the very beginning :)
+
+ let grid = new gridjs.Grid({
+ search: true, resizable: true, sort: true,
+ language: config.language, data: []
+ });
+
+ function initGrid(json, container) {
+ let config = {data: json.data.data};
+ if (!!json.columnNames) {
+ config.columns = json.columnNames;
+ } else {
+ config.columns = null;
+ }
+ grid.updateConfig(config).render(container);
+ }
+
+ initGrid(json, document.getElementById("wrapper"));
+
+ function toggle(source) {
+ let newValue = source.checked;
+ let option = source.id;
+ switch (option) {
+ case "search":
+ toggleSearch(newValue);
+ break;
+ case "resizable":
+ toggleResizable(newValue);
+ break;
+ case "pagination":
+ togglePagination(newValue);
+ break;
+ case "paginationSize":
+ changePaginationSize(newValue);
+ break;
+ case "sort":
+ toggleSort(newValue);
+ break;
+ }
+ }
+
+ function toggleSearch(newValue) {
+ console.info("Toggle search to: " + newValue);
+ let newConfig = {
+ language: config.language,
+ data: grid.config.data,
+ columns: grid.config.columns,
+ resizable: resizableOption.checked,
+ pagination: paginationOption.checked ? {limit: paginationSizeOption.value} : false,
+ sort: sortOption.checked
+ };
+ if (newValue) {
+ newConfig.search = true;
+ }
+ updateGrid(newConfig);
+ }
+
+ function toggleResizable(newValue) {
+ console.info("Toggle resizable to: " + newValue);
+ let newConfig = {
+ language: config.language,
+ data: grid.config.data,
+ columns: grid.config.columns,
+ search: searchOption.checked,
+ pagination: paginationOption.checked ? {limit: paginationSizeOption.value} : false,
+ sort: sortOption.checked
+ };
+ if (newValue) {
+ newConfig.resizable = true;
+ }
+ updateGrid(newConfig);
+ }
+
+ function toggleSort(newValue) {
+ console.info("Toggle sort to: " + newValue);
+ let newConfig = {
+ language: config.language,
+ data: grid.config.data,
+ columns: grid.config.columns,
+ search: searchOption.checked,
+ pagination: paginationOption.checked ? {limit: paginationSizeOption.value} : false,
+ resizable: resizableOption.checked
+ };
+ if (newValue) {
+ newConfig.sort = true;
+ }
+ updateGrid(newConfig);
+ }
+
+ function togglePagination(newValue) {
+ console.info("Toggle pagination to: " + newValue);
+ let newConfig = {
+ language: config.language,
+ data: grid.config.data,
+ columns: grid.config.columns,
+ search: searchOption.checked,
+ resizable: resizableOption.checked,
+ sort: sortOption.checked,
+ };
+ if (newValue) {
+ newConfig.pagination = {
+ limit: paginationSizeOption.value
+ };
+ paginationSizeOption["disabled"] = null;
+ } else {
+
+ paginationSizeOption.disabled = true;
+ }
+
+
+ updateGrid(newConfig);
+ }
+
+ function changePaginationSize(newValue) {
+ console.info("Change pagination size to: " + newValue);
+ let newConfig = {
+ language: config.language,
+ data: grid.config.data,
+ columns: grid.config.columns,
+ search: searchOption.checked,
+ resizable: resizableOption.checked,
+ sort: sortOption.checked,
+ pagination: {
+ limit: paginationSizeOption.value
+ }
+ };
+ updateGrid(newConfig);
+ }
+
+ function updateGrid(newConfig) {
+ gridContainerParent.innerHTML = "<div id=\"wrapper\"></div>";
+ console.info(newConfig);
+ setTimeout(() => {
+ grid = new gridjs.Grid(newConfig).render(document.getElementById("wrapper"));
+ }, 200);
+ }
+
+ let actions = document.getElementsByClassName("action");
+ for (const action of document.getElementsByClassName("action")) {
+ action.addEventListener("click", function (event) {
+ toggle(this);
+ });
+ }
+ paginationSizeOption.addEventListener("change", function (event) {
+ toggle(this);
+ });
+</script>
+</body>
+</html>
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultJsonModel.java → client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/HtmlExportModel.java
=====================================
@@ -22,6 +22,10 @@ package fr.ird.observe.client.datasource.actions.report;
* #L%
*/
+import com.google.gson.Gson;
+import fr.ird.observe.client.datasource.actions.config.SelectDataModel;
+import fr.ird.observe.report.Report;
+import io.ultreia.java4all.application.template.spi.GenerateTemplate;
import io.ultreia.java4all.util.matrix.DataMatrix;
import java.util.List;
@@ -34,24 +38,52 @@ import java.util.List;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 9.3.0
*/
-public class ResultJsonModel {
+@GenerateTemplate(template = "reportHtmlExport.ftl")
+public class HtmlExportModel {
+ /**
+ * Selected report.
+ */
+ private final transient Report selectedReport;
+ /**
+ * Selected data model.
+ */
+ private final transient SelectDataModel selectDataModel;
private final List<String> columnNames;
private final List<String> rowNames;
private final DataMatrix data;
private final boolean withColumnHeader;
private final boolean withRowHeader;
+ private final transient String json;
- public ResultJsonModel(List<String> columnNames,
+ public HtmlExportModel(Gson gson,
+ Report selectedReport,
+ SelectDataModel selectDataModel,
+ List<String> columnNames,
List<String> rowNames,
DataMatrix data,
boolean withColumnHeader,
boolean withRowHeader) {
+ this.selectedReport = selectedReport;
+ this.selectDataModel = selectDataModel;
this.columnNames = columnNames;
this.rowNames = rowNames;
this.data = data;
this.withColumnHeader = withColumnHeader;
this.withRowHeader = withRowHeader;
+ this.json = gson.toJson(this);
+ }
+
+ public String getJson() {
+ return json;
+ }
+
+ public Report getSelectedReport() {
+ return selectedReport;
+ }
+
+ public SelectDataModel getSelectDataModel() {
+ return selectDataModel;
}
public List<String> getColumnNames() {
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
=====================================
@@ -601,6 +601,11 @@ public class ReportModel extends AdminActionModel {
}
}
+ public HtmlExportModel toJsonModel() {
+
+ return new HtmlExportModel(getClientConfig().getGsonSupplier().get(), getSelectedReport(), selectDataModel, getResultModel().getColumnNames(), getResultModel().getRowNames(), getResultModel().getData(), getResultModel().isWithColumnHeader(), getResultModel().isWithRowHeader());
+ }
+
private Map<String, FilterableComboBox<?>> initVariableComponents(ReportUI ui, Report report) {
Map<String, FilterableComboBox<?>> result = new TreeMap<>();
JPanel variablesPanel = ui.getReportVariableSelectorPanel();
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java
=====================================
@@ -236,6 +236,26 @@ public class ResultTableModel extends AbstractTableModel {
return data == null ? null : data.getValue(columnIndex, rowIndex);
}
+ public List<String> getColumnNames() {
+ return columnNames;
+ }
+
+ public List<String> getRowNames() {
+ return rowNames;
+ }
+
+ public DataMatrix getData() {
+ return data;
+ }
+
+ public boolean isWithColumnHeader() {
+ return withColumnHeader;
+ }
+
+ public boolean isWithRowHeader() {
+ return withRowHeader;
+ }
+
public String getClipboardContent(boolean copyRowHeaders, boolean copyColumnHeaders) {
return getDataContent(copyRowHeaders, copyColumnHeaders, true, '\t');
}
@@ -264,8 +284,4 @@ public class ResultTableModel extends AbstractTableModel {
result += data.getClipboardContent(copyRowHeaders || !withRowHeader, true, escapeCell, separator);
return result;
}
-
- public ResultJsonModel toJsonModel() {
- return new ResultJsonModel(columnNames, rowNames, data, withColumnHeader, withRowHeader);
- }
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/actions/ExportToHtml.java
=====================================
@@ -22,13 +22,12 @@ package fr.ird.observe.client.datasource.actions.report.actions;
* #L%
*/
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
import fr.ird.observe.client.datasource.actions.ObserveKeyStrokesActions;
import fr.ird.observe.client.datasource.actions.actions.AdminTabUIActionSupport;
+import fr.ird.observe.client.datasource.actions.report.HtmlExportModel;
+import fr.ird.observe.client.datasource.actions.report.HtmlExportModelTemplate;
import fr.ird.observe.client.datasource.actions.report.ReportModel;
import fr.ird.observe.client.datasource.actions.report.ReportUI;
-import fr.ird.observe.client.datasource.actions.report.ResultJsonModel;
import fr.ird.observe.client.util.UIHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -79,20 +78,14 @@ public class ExportToHtml extends AdminTabUIActionSupport<ReportUI> {
// generate data file
Path dataFile = exportDirectory.resolve("data.json");
log.info("Generate data file for report ({}) at {}", reportId, dataFile);
- ResultJsonModel dataModel = stepModel.getResultModel().toJsonModel();
- String dataContent = getClientConfig().getGsonSupplier().get().toJson(dataModel);
+ HtmlExportModel dataModel = stepModel.toJsonModel();
+ String dataContent = dataModel.getJson();
Files.writeString(dataFile, dataContent);
-// // generate javascript file
-// Path jsFile = exportDirectory.resolve("report.js");
-// log.info("Generate js file for report ({}) at {}", reportId, jsFile);
-// String jsContent = Resources.asCharSource(Resources.getResource("report/html/default/report.js"), Charsets.UTF_8).read();
-// Files.writeString(jsFile, jsContent);
-
// generate html file
Path htmlFile = exportDirectory.resolve("report.html");
log.info("Generate html file for report ({}) at {}", reportId, htmlFile);
- String fileContent = Resources.asCharSource(Resources.getResource("report/html/default/report.html"), Charsets.UTF_8).read().replace("${json}", dataContent);
+ String fileContent = HtmlExportModelTemplate.generate(dataModel);
Files.writeString(htmlFile, fileContent);
// open html file
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/455386042bf6ae7140dabc8a2…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/455386042bf6ae7140dabc8a2…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe] Pushed new branch feature/issue_2755
by Tony CHEMIT (@tchemit) 15 Nov '23
by Tony CHEMIT (@tchemit) 15 Nov '23
15 Nov '23
Tony CHEMIT pushed new branch feature/issue_2755 at ultreiaio / ird-observe
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/tree/feature/issue_2755
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][pages] Site checkin for project ObServe (version 9.2.1)
by Tony CHEMIT (@tchemit) 14 Nov '23
by Tony CHEMIT (@tchemit) 14 Nov '23
14 Nov '23
Tony CHEMIT pushed to branch pages at ultreiaio / ird-observe
Commits:
4417bcf0 by Tony Chemit at 2023-11-14T17:48:18+01:00
Site checkin for project ObServe (version 9.2.1)
- - - - -
8 changed files:
- − 9.2.1-SNAPSHOT/CHANGELOG.html
- − 9.2.1-SNAPSHOT/avdth/index.html
- − 9.2.1-SNAPSHOT/changelog.html
- − 9.2.1-SNAPSHOT/ci-management.html
- − 9.2.1-SNAPSHOT/client/changelog.html
- − 9.2.1-SNAPSHOT/client/ci-management.html
- − 9.2.1-SNAPSHOT/client/client-configuration/changelog.html
- − 9.2.1-SNAPSHOT/client/client-configuration/ci-management.html
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/4417bcf0b5fd87aa1d4e25ac3…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/4417bcf0b5fd87aa1d4e25ac3…
You're receiving this email because of your account on gitlab.com.
1
0
14 Nov '23
Tony CHEMIT deleted branch release/9.2.1 at ultreiaio / ird-observe
--
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 5 commits: [jgitflow-maven-plugin]updating poms for branch'release/9.2.1' with non-snapshot versions[skip ci]
by Tony CHEMIT (@tchemit) 14 Nov '23
by Tony CHEMIT (@tchemit) 14 Nov '23
14 Nov '23
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
26e27715 by Tony Chemit at 2023-11-14T16:52:35+01:00
[jgitflow-maven-plugin]updating poms for branch'release/9.2.1' with non-snapshot versions[skip ci]
- - - - -
92131097 by Tony Chemit at 2023-11-14T17:11:52+01:00
[jgitflow-maven-plugin]merging 'release/9.2.1' into 'master'
- - - - -
ce079ce4 by Tony Chemit at 2023-11-14T17:11:57+01:00
[jgitflow-maven-plugin]updating develop poms to master versions to avoid merge conflicts[skip ci]
- - - - -
550888fb by Tony Chemit at 2023-11-14T17:11:58+01:00
[jgitflow-maven-plugin]merging 'master' into 'develop'
- - - - -
90eab29a by Tony Chemit at 2023-11-14T17:11:59+01:00
[jgitflow-maven-plugin]Updating develop poms back to pre merge state[skip ci]
- - - - -
0 changed files:
Changes:
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/cd4f3685afb7205bc80732a1…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/cd4f3685afb7205bc80732a1…
You're receiving this email because of your account on gitlab.com.
1
0