Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
eafab6dc
by Tony Chemit at 2023-11-21T10:30:11+01:00
-
f71ab184
by Tony Chemit at 2023-11-21T11:12:44+01:00
-
78740869
by Tony Chemit at 2023-11-21T11:18:05+01:00
-
52092051
by Tony Chemit at 2023-11-21T11:18:37+01:00
-
0c44c3a8
by Tony Chemit at 2023-11-21T11:30:41+01:00
-
8416c255
by Tony Chemit at 2023-11-21T11:52:18+01:00
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:
| ... | ... | @@ -117,6 +117,12 @@ description = observe.config.defaultBackupDirectory.description |
| 117 | 117 | key = instance.backup.directory
|
| 118 | 118 | type = file
|
| 119 | 119 | defaultValue = ${instance.data.directory}/backup
|
| 120 | + |
|
| 121 | +[option backupsDirectory]
|
|
| 122 | +description = observe.config.backupsDirectory.description
|
|
| 123 | +key = instance.backups.directory
|
|
| 124 | +type = file
|
|
| 125 | +defaultValue = ${instance.data.directory}/backup
|
|
| 120 | 126 | final = true
|
| 121 | 127 | transient = true
|
| 122 | 128 | |
| ... | ... | @@ -313,8 +319,6 @@ description = observe.config.importDirectory.description |
| 313 | 319 | key = instance.import.directory
|
| 314 | 320 | type = file
|
| 315 | 321 | defaultValue = ${instance.data.directory}/backup
|
| 316 | -final = true
|
|
| 317 | -transient = true
|
|
| 318 | 322 | |
| 319 | 323 | [option logDirectory]
|
| 320 | 324 | description = observe.config.defaultLogDbDirectory.description
|
| ... | ... | @@ -13,6 +13,7 @@ observe.config.avdthDirectory.description |
| 13 | 13 | observe.config.backup.atClose
|
| 14 | 14 | observe.config.backup.delay
|
| 15 | 15 | observe.config.backup.use
|
| 16 | +observe.config.backupsDirectory.description
|
|
| 16 | 17 | observe.config.backupsFile.description
|
| 17 | 18 | observe.config.checkServerVersion.description
|
| 18 | 19 | observe.config.client.backupFiles.timeout.description
|
| ... | ... | @@ -676,6 +676,9 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig |
| 676 | 676 | return new File(getBackupDirectory(), String.format(BACKUP_DB_PATTERN, getBuildVersion().toString().replaceAll("\\.", "_"), new Date()));
|
| 677 | 677 | }
|
| 678 | 678 | |
| 679 | + public File newAutomaticBackupDataFile() {
|
|
| 680 | + return new File(getBackupsDirectory(), String.format(BACKUP_DB_PATTERN, getBuildVersion().toString().replaceAll("\\.", "_"), new Date()));
|
|
| 681 | + }
|
|
| 679 | 682 | public File getFeedBackDirectoryFile() {
|
| 680 | 683 | if (feedBackDirectoryFile == null) {
|
| 681 | 684 | Date now = new Date();
|
| ... | ... | @@ -696,7 +699,12 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig |
| 696 | 699 | |
| 697 | 700 | @Override
|
| 698 | 701 | public Map<Path, Integer> getTemporaryDirectoriesAndTimeout() {
|
| 699 | - return Map.of(getTemporaryDirectory().toPath(), getTemporaryFilesTimeout(), getLogDirectory().toPath(), getLogFilesTimeout(), getFeedBackDirectoryFile().toPath(), getFeedbackFilesTimeout(), getBackupDirectory().toPath(), getBackupFilesTimeout());
|
|
| 702 | + return Map.of(getTemporaryDirectory().toPath(), getTemporaryFilesTimeout(), getLogDirectory().toPath(), getLogFilesTimeout(), getFeedBackDirectoryFile().toPath(), getFeedbackFilesTimeout(), getBackupsDirectory().toPath(), getBackupFilesTimeout());
|
|
| 703 | + }
|
|
| 704 | + |
|
| 705 | + public void updateBackupDirectory(File backupFile) {
|
|
| 706 | + setBackupDirectory(backupFile.getParentFile());
|
|
| 707 | + saveForUser();
|
|
| 700 | 708 | }
|
| 701 | 709 | |
| 702 | 710 | public void saveForUser() {
|
| ... | ... | @@ -72,7 +72,7 @@ public abstract class LocalDatabaseBackupTaskSupport implements Runnable { |
| 72 | 72 | }
|
| 73 | 73 | |
| 74 | 74 | protected File doBackup() {
|
| 75 | - File file = config.newBackupDataFile();
|
|
| 75 | + File file = config.newAutomaticBackupDataFile();
|
|
| 76 | 76 | String startMessage = t("observe.ui.datasource.backup.start", new Date());
|
| 77 | 77 | |
| 78 | 78 | ClientUIContextApplicationComponent.value().setUiStatus(startMessage);
|
| ... | ... | @@ -91,6 +91,8 @@ public class Start extends SaveLocalUIActionSupport { |
| 91 | 91 | CreateDatabaseRequest request = CreateDatabaseRequest.builder(false, source.getVersion()).addGeneratedSchema().addVersionTable().addStandaloneTables().addAllData().build();
|
| 92 | 92 | SqlScript dump = dumpService.produceCreateSqlScript(request);
|
| 93 | 93 | dump.copyAndCompress(backupFile.toPath());
|
| 94 | + |
|
| 95 | + stepModel.getClientConfig().updateBackupDirectory(backupFile);
|
|
| 94 | 96 | }
|
| 95 | 97 | |
| 96 | 98 | if (stepModel.containsStepForSave(AdminStep.SYNCHRONIZE)) {
|
| ... | ... | @@ -110,6 +110,12 @@ public class StorageBackupUILauncher extends StorageUILauncher { |
| 110 | 110 | StorageUIModel storageModel = ui.getModel();
|
| 111 | 111 | File backupFile = storageModel.getBackupFile();
|
| 112 | 112 | Objects.requireNonNull(backupFile, "file where to backup can not be null");
|
| 113 | + createBackup(storageModel, backupFile);
|
|
| 114 | + |
|
| 115 | + storageModel.getClientConfig().updateBackupDirectory(backupFile);
|
|
| 116 | + }
|
|
| 117 | + |
|
| 118 | + private void createBackup(StorageUIModel storageModel, File backupFile) {
|
|
| 113 | 119 | ObserveDataSourcesManager dataSourcesManager = storageModel.getDataSourcesManager();
|
| 114 | 120 | ObserveSwingDataSource incomingSource = dataSourcesManager.getMainDataSource();
|
| 115 | 121 | SelectionTreeModel dataModel = storageModel.getSelectDataModel();
|
| ... | ... | @@ -410,7 +410,7 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie |
| 410 | 410 | */
|
| 411 | 411 | protected void initFromConfig(ClientConfig config) {
|
| 412 | 412 | setBackupFile(config.newBackupDataFile());
|
| 413 | - setDumpFile(config.getBackupDirectory());
|
|
| 413 | + setDumpFile(config.getImportDirectory());
|
|
| 414 | 414 | setDoBackup(false);
|
| 415 | 415 | ObserveDataSourcesManager dataSourcesManager = getDataSourcesManager();
|
| 416 | 416 | setLocalConfig(dataSourcesManager.newH2DataSourceConfiguration(I18n.n("observe.ui.datasource.storage.label.local")));
|
| ... | ... | @@ -25,11 +25,15 @@ package fr.ird.observe.client.datasource.editor.ps.data.logbook; |
| 25 | 25 | import fr.ird.observe.client.datasource.editor.api.content.EditableContentUI;
|
| 26 | 26 | import fr.ird.observe.client.util.UIHelper;
|
| 27 | 27 | import fr.ird.observe.client.util.table.EditableListProperty;
|
| 28 | +import fr.ird.observe.dto.data.ps.logbook.ActivityStubDto;
|
|
| 29 | +import fr.ird.observe.dto.data.ps.logbook.WellActivityDto;
|
|
| 28 | 30 | import fr.ird.observe.dto.data.ps.logbook.WellActivitySpeciesDto;
|
| 29 | 31 | import fr.ird.observe.dto.data.ps.logbook.WellDto;
|
| 32 | +import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
|
|
| 30 | 33 | |
| 31 | 34 | import javax.swing.JTable;
|
| 32 | 35 | import java.util.Collection;
|
| 36 | +import java.util.LinkedList;
|
|
| 33 | 37 | import java.util.List;
|
| 34 | 38 | |
| 35 | 39 | public class WellActivityUITableModel extends GeneratedWellActivityUITableModel {
|
| ... | ... | @@ -83,4 +87,20 @@ public class WellActivityUITableModel extends GeneratedWellActivityUITableModel |
| 83 | 87 | super.startEditTableEditBeanOnInlineModels();
|
| 84 | 88 | wellActivitySpeciesTableModel.validate();
|
| 85 | 89 | }
|
| 90 | + |
|
| 91 | + @Override
|
|
| 92 | + protected void onSelectedRowChanged(WellActivityUI ui, int editingRow, WellActivityDto tableEditBean, WellActivityDto previousRowBean, boolean notPersisted, boolean newRow) {
|
|
| 93 | + super.onSelectedRowChanged(ui, editingRow, tableEditBean, previousRowBean, notPersisted, newRow);
|
|
| 94 | + if (ui.getModel().getStates().isReadingMode()) {
|
|
| 95 | + return;
|
|
| 96 | + }
|
|
| 97 | + // Only offers activities not used
|
|
| 98 | + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2717
|
|
| 99 | + FilterableComboBox<ActivityStubDto> editor = ui.getActivity();
|
|
| 100 | + List<ActivityStubDto> columnValues = getColumnValues(0);
|
|
| 101 | + columnValues.remove(tableEditBean.getActivity());
|
|
| 102 | + List<ActivityStubDto> values = new LinkedList<>(ui.getModel().getStates().getActivity());
|
|
| 103 | + values.removeAll(columnValues);
|
|
| 104 | + editor.setData(values);
|
|
| 105 | + }
|
|
| 86 | 106 | } |
| ... | ... | @@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Avdth directory |
| 14 | 14 | observe.config.backup.atClose=Perform a backup of local source when closing application
|
| 15 | 15 | observe.config.backup.delay=Delay in minutes between local data source backup
|
| 16 | 16 | observe.config.backup.use=To activate auto backup of local source
|
| 17 | +observe.config.backupsDirectory.description=Default directory where are stored automatic backups of data sources
|
|
| 17 | 18 | observe.config.backupsFile.description=File to store backups information
|
| 18 | 19 | observe.config.category.application=Validation
|
| 19 | 20 | observe.config.category.application.description=Validation options
|
| ... | ... | @@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Avdth directory \#TODO |
| 14 | 14 | observe.config.backup.atClose=Realizar una copia de seguridad de la base de datos local al cerrar la aplicación
|
| 15 | 15 | observe.config.backup.delay=Minutos entre cada copia de seguridad de la base de datos local
|
| 16 | 16 | observe.config.backup.use=Para activar la copia de seguridad automática
|
| 17 | +observe.config.backupsDirectory.description=Carpeta por defecto para copia de seguridad de automatico bases locales \#TODO
|
|
| 17 | 18 | observe.config.backupsFile.description=Archivo de información de la copia de seguridad
|
| 18 | 19 | observe.config.category.application=Contrôles et validation \#TODO
|
| 19 | 20 | observe.config.category.application.description=Options de contrôles et validation \#TODO
|
| ... | ... | @@ -14,6 +14,7 @@ observe.config.avdthDirectory.description=Répertoire où chercher les bases AVD |
| 14 | 14 | observe.config.backup.atClose=Effectuer une sauvegarde de la base locale à la fermeture de l'application
|
| 15 | 15 | observe.config.backup.delay=Temps en minutes entre chaque sauvegarde de la base locale
|
| 16 | 16 | observe.config.backup.use=Pour activer la sauvegarde automatique
|
| 17 | +observe.config.backupsDirectory.description=Répertoire où conserver les sauvegardes automatiques
|
|
| 17 | 18 | observe.config.backupsFile.description=Fichier des informations des sauvegardes
|
| 18 | 19 | observe.config.category.application=Contrôles et validation
|
| 19 | 20 | observe.config.category.application.description=Options de contrôles et validation
|