Skip to content

Commit

Permalink
Merge branch 'master' into DHIS2-15940/add-cache-strategy-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp authored Dec 14, 2023
2 parents f6e9e97 + 2984bb5 commit 25305c2
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 68 deletions.
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
## [32.24.4](https://github.com/dhis2/maintenance-app/compare/v32.24.3...v32.24.4) (2023-12-13)


### Bug Fixes

* fix crash when instance url contains api ([#2745](https://github.com/dhis2/maintenance-app/issues/2745)) ([4114327](https://github.com/dhis2/maintenance-app/commit/41143270de65f2c19f157593a443e0e6b50b2b51))

## [32.24.3](https://github.com/dhis2/maintenance-app/compare/v32.24.2...v32.24.3) (2023-11-26)


### Bug Fixes

* **translations:** sync translations from transifex (master) ([3968236](https://github.com/dhis2/maintenance-app/commit/3968236bb43288bcf355cffbca06e64027d340d1))

## [32.24.2](https://github.com/dhis2/maintenance-app/compare/v32.24.1...v32.24.2) (2023-11-19)


### Bug Fixes

* **translations:** sync translations from transifex (master) ([1d45d64](https://github.com/dhis2/maintenance-app/commit/1d45d64f5d5cbeb4215ea03e7c9b508681b99c30))

## [32.24.1](https://github.com/dhis2/maintenance-app/compare/v32.24.0...v32.24.1) (2023-11-05)


### Bug Fixes

* **translations:** sync translations from transifex (master) ([56728e2](https://github.com/dhis2/maintenance-app/commit/56728e2a373080a5f42636995eb340852377897b))

# [32.24.0](https://github.com/dhis2/maintenance-app/compare/v32.23.38...v32.24.0) (2023-11-03)


### Features

* force Overlay for geojson and arcgis ([#2722](https://github.com/dhis2/maintenance-app/issues/2722)) ([87ae5e0](https://github.com/dhis2/maintenance-app/commit/87ae5e0f74c6726d33e9cd270c54797763e00d82))

## [32.23.38](https://github.com/dhis2/maintenance-app/compare/v32.23.37...v32.23.38) (2023-11-02)


### Bug Fixes

* **predictor:** fix hide when default catcombo ([37f79e3](https://github.com/dhis2/maintenance-app/commit/37f79e3ccc1cf8fa25ca5fa4b96adcac2e2c04e5))
* typo ([0f61601](https://github.com/dhis2/maintenance-app/commit/0f616015c315ee36d41e3281109c8c4765ed3fa4))
* **predictor:** update default unselected categoryoptioncombo selection ([b8d6cd2](https://github.com/dhis2/maintenance-app/commit/b8d6cd2fc521bb32c698bafcf48f77e4339b8ef6))

## [32.23.37](https://github.com/dhis2/maintenance-app/compare/v32.23.36...v32.23.37) (2023-10-22)


### Bug Fixes

* **translations:** sync translations from transifex (master) ([1570a65](https://github.com/dhis2/maintenance-app/commit/1570a6557eff3d4412524e24a8b15865607d6d7c))

## [32.23.36](https://github.com/dhis2/maintenance-app/compare/v32.23.35...v32.23.36) (2023-10-03)


Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maintenance-app",
"version": "32.23.36",
"version": "32.24.4",
"description": "DHIS2 Maintenance app",
"repository": {
"type": "git",
Expand Down Expand Up @@ -81,7 +81,7 @@
"@dhis2/d2-ui-header-bar": "^1.1.4",
"@dhis2/d2-ui-sharing-dialog": "^1.0.12",
"ckeditor": "4.6.1",
"d2": "30.2.2",
"d2": "^30.2.3",
"d2-ui": "29.0.34",
"lodash": "^4.17.11",
"material-design-icons-iconfont": "^4.0.5",
Expand Down
7 changes: 7 additions & 0 deletions src/config/field-overrides/externalMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export default new Map([
return <DropDown {...props} value={'BASEMAP'} disabled />;
}

if (
props.model.mapService === 'GEOJSON_URL' ||
props.model.mapService === 'ARCGIS_FEATURE'
) {
return <DropDown {...props} value={'OVERLAY'} disabled />;
}

return <DropDown {...props} />;
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import DropDown from '../../../forms/form-fields/drop-down.js';
import { red500, grey400 } from 'material-ui/styles/colors';
import { LinearProgress } from 'material-ui';

const DEFAULT = 'default';

const DropDownLoader = ({ msg }) => (
<p
style={{
Expand All @@ -25,6 +23,8 @@ class DataElementCategoryOptionCombo extends Component {
options: [],
loading: false,
loadErrorText: '',
defaultCategoryOptionComboId: null,
hasOnlyDefaultCatCombo: false,
};
getTranslation = this.context.d2.i18n.getTranslation.bind(
this.context.d2.i18n
Expand All @@ -37,7 +37,13 @@ class DataElementCategoryOptionCombo extends Component {
prevOutputId = null;

onChange = ({ target }) => {
const value = target.value ? { id: target.value } : null;
const selectedId = target.value;
let value = selectedId ? { id: selectedId } : null;

if(selectedId === this.state.defaultCategoryOptionComboId) {
value = null
}

this.props.onChange({ target: { value } });
};

Expand Down Expand Up @@ -79,27 +85,39 @@ class DataElementCategoryOptionCombo extends Component {
this.setState({ loading: true, loadErrorText: '' });

try {
const response = await this.context.d2.models.dataElements.get(
const catComboResponse = this.context.d2.models.dataElements.get(
this.props.model.output.id,
{ fields: ['categoryCombo[categoryOptionCombos[id,name]]'] }
{ fields: ['categoryCombo[isDefault,categoryOptionCombos[id,name]]']}
);
// need to get the default categoryCombo - to be able to show the correct label in the dropdown
const defaultCatComboResponse = this.context.d2.models.categoryCombos.list({
fields: ['id', 'name', 'isDefault', 'categoryOptionCombos[id,name]'],
filter: `isDefault:eq:true`
})
const [response, defaultCatCombo] = await Promise.all([catComboResponse, defaultCatComboResponse])

const defaultCategoryOptionCombo = defaultCatCombo.toArray()[0].categoryOptionCombos.toArray()[0]
const categoryOptionCombos =
response.categoryCombo.categoryOptionCombos;
const hasOnlyDefault =

const hasOnlyDefaultCatCombo = defaultCategoryOptionCombo &&
categoryOptionCombos.length === 1 &&
categoryOptionCombos[0].name === DEFAULT;
const options = hasOnlyDefault
? []
: categoryOptionCombos.map(o => ({
text: o.name,
value: o.id,
}));

this.setState({ options, loading: false });
categoryOptionCombos[0].id === defaultCategoryOptionCombo.id;

let options = [{ text: this.getTranslation('predict_according_to_input_category_option_combo'), value: defaultCategoryOptionCombo.id }];

options = options.concat(categoryOptionCombos.map(
o => ({
text: o.name,
value: o.id,
})
));

this.setState({ options, loading: false, defaultCategoryOptionComboId: defaultCategoryOptionCombo.id, hasOnlyDefaultCatCombo });
} catch (error) {
console.error(error);
const msg = this.getTranslation('output_combo_error');
this.setState({ loading: false, loadErrorText: msg });
this.setState({ loading: false, loadErrorText: msg, hasOnlyDefaultCatCombo: false });
}
}

Expand All @@ -124,12 +142,19 @@ class DataElementCategoryOptionCombo extends Component {
return null;
}

if(this.state.hasOnlyDefaultCatCombo) {
return null;
}

const value = this.props.value && this.props.value.id || this.state.defaultCategoryOptionComboId

return (
<DropDown
labelText={this.getTranslation('output_combo')}
onChange={this.onChange}
value={this.props.value && this.props.value.id}
value={value}
options={this.state.options}
isRequired
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/i18n_module_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2330,3 +2330,4 @@ owner_at_end_organisation_unit=Owner at end organisation unit
registration_organisation_unit=Registration organisation unit
organisation_unit_field=Organisation unit field
prevent_adding_new_events_to_stage=Prevent adding new events to stage
predict_according_to_input_category_option_combo=Predict according to input category option combo
7 changes: 4 additions & 3 deletions src/i18n/i18n_module_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ int=Entero
view_1=Vista 1
view_2=Vista 2
zero_is_significant=Alamacenar valores cero
form_name=Nombre del formulario
form_name=Nombre de formulario
compulsory=Obligatorio
data_dimension=Dimensi\u00f3n de datos
include_subhierarchy_in_analytics=Incluir la sub-jerarqu\u00eda en anal\u00edticas
Expand Down Expand Up @@ -1536,7 +1536,7 @@ characters_without_params=Characters without params
scheduled_date = scheduled date
send_message=Enviar mensaje
message_is_sent=Mensaje enviado
recipients=Recipients
recipients=Destinatarios
message_type=Message type
both=Both
direct_sms=Direct SMS
Expand Down Expand Up @@ -1593,7 +1593,7 @@ auto_save_registration_forms=Auto save registration form
show_advanced_options=Mostrar opciones avanzadas
hide_advanced_options=Ocultar opciones avanzadas
program_validation_rule_management=Administraci\u00f3n de reglas validaci\u00f3n de programas
confidential=Confidential
confidential=Confidencial
program_indicator_management_form=Program indicator management form
auto_save_prorgam_entry_form_forms=Auto-save program entry forms
filter_by_program=Filter by program
Expand Down Expand Up @@ -2327,3 +2327,4 @@ owner_at_end_organisation_unit=Owner at end organisation unit
registration_organisation_unit=Registration organisation unit
organisation_unit_field=Organisation unit field
prevent_adding_new_events_to_stage=Prevent adding new events to stage
predict_according_to_input_category_option_combo=Predict according to input category option combo
Loading

0 comments on commit 25305c2

Please sign in to comment.