Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: backport #262, #263 and #264 to 2.32 #314

Merged
merged 4 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-04-25T12:42:43.299Z\n"
"PO-Revision-Date: 2019-04-25T12:42:43.299Z\n"
"POT-Creation-Date: 2019-11-20T13:26:46.609Z\n"
"PO-Revision-Date: 2019-11-20T13:26:46.609Z\n"

msgid "Maps"
msgstr ""
Expand Down Expand Up @@ -576,6 +576,12 @@ msgstr ""
msgid "Boundaries"
msgstr ""

msgid "Alert"
msgstr ""

msgid "No boundaries found"
msgstr ""

msgid "Access denied"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maps-app",
"version": "32.0.30",
"version": "32.0.31",
"description": "DHIS2 Maps",
"main": "src/app.js",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/components/dimensions/DimensionFilterRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class DimensionFilterRow extends Component {
<div className={classes.container}>
<DimensionSelect
dimension={dimension}
onChange={dimension => this.onChange(dimension.id, items)}
onChange={selectedDimension =>
this.onChange(selectedDimension.id)
}
/>
<DimensionItemsSelect
dimension={dimension}
Expand Down
5 changes: 1 addition & 4 deletions src/components/filter/FilterSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const styles = {
float: 'left',
width: 'calc((100% - 48px) / 8 * 3)',
},
datePicker: {
width: 164,
},
};

export class FilterSelect extends Component {
Expand Down Expand Up @@ -126,7 +123,7 @@ export class FilterSelect extends Component {
label={i18n.t('Date')}
value={value}
onChange={date => onChange(`${operator}:${date}`)}
style={styles.datePicker}
style={styles.textField}
/>
) : null,
];
Expand Down
16 changes: 6 additions & 10 deletions src/components/periods/PeriodSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,10 @@ class PeriodSelect extends Component {
};

state = {
year: getYear(),
year: null,
periods: null,
};

constructor(props) {
super(props);
this.periodIndex = null;
}

componentDidMount() {
this.setPeriods();
}
Expand All @@ -64,11 +59,11 @@ class PeriodSelect extends Component {
if (periodType !== prevProps.periodType) {
this.setPeriods();
} else if (periods && !period) {
onChange(filterFuturePeriods(periods)[0]); // Autoselect most recent period
onChange(filterFuturePeriods(periods)[0] || periods[0]); // Autoselect most recent period
}

// Change period if year is changed (but keep period index)
if (period && year !== prevState.year) {
if (period && prevState.periods && year !== prevState.year) {
const periodIndex = prevState.periods.findIndex(
item => item.id === period.id
);
Expand Down Expand Up @@ -130,15 +125,16 @@ class PeriodSelect extends Component {

setPeriods() {
const { periodType, period, locale } = this.props;
const year = this.state.year || getYear(period && period.startDate);
let periods;

if (periodType) {
periods = createPeriods(locale, periodType, this.state.year);
periods = createPeriods(locale, periodType, year);
} else if (period) {
periods = [period]; // If period is loaded in favorite
}

this.setState({ periods });
this.setState({ periods, year });
}

nextYear = () => {
Expand Down
8 changes: 2 additions & 6 deletions src/loaders/trackedEntityLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,13 @@ const trackedEntityLoader = async config => {
}

if (program) {
url += `&program=${
program.id
}&programStatus=${programStatus}&programStartDate=${startDate}&programEndDate=${endDate}`;
url += `&program=${program.id}&programStatus=${programStatus}&programStartDate=${startDate}&programEndDate=${endDate}`;

if (followUp !== undefined) {
url += `&followUp=${followUp ? 'TRUE' : 'FALSE'}`;
}
} else {
url += `&trackedEntityType=${
trackedEntityType.id
}&lastUpdatedStartDate=${startDate}&lastUpdatedEndDate=${endDate}`;
url += `&trackedEntityType=${trackedEntityType.id}&lastUpdatedStartDate=${startDate}&lastUpdatedEndDate=${endDate}`;
}

// https://docs.dhis2.org/master/en/developer/html/webapi_tracker_api.html#webapi_tei_grid_query_request_syntax
Expand Down
4 changes: 1 addition & 3 deletions src/util/analyticalObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ export const setCurrentAnalyticalObject = async ao => {
// Sets analytical object to open it in another app
export const setAnalyticalObjectAndSwitchApp = async (layer, openAs) => {
const ao = getAnalyticalObjectFromThematicLayer(layer);
const url = `${config.appUrl}/${
APP_URLS[openAs]
}/#/currentAnalyticalObject`;
const url = `${config.appUrl}/${APP_URLS[openAs]}/#/currentAnalyticalObject`;

await setCurrentAnalyticalObject(ao);

Expand Down
4 changes: 1 addition & 3 deletions src/util/dom-to-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,7 @@ function newUtil() {
resolve(placeholder);
} else {
fail(
`cannot fetch resource: ${url}, status: ${
request.status
}`
`cannot fetch resource: ${url}, status: ${request.status}`
);
}

Expand Down