Skip to content

Commit

Permalink
fix: DHIS2-10765 use form names
Browse files Browse the repository at this point in the history
  • Loading branch information
JoakimSM committed Mar 25, 2021
1 parent ae5303c commit 8578891
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const mainConfig: Array<MainColumnConfig> = [{

const getMetaDataConfig = (attributes: Array<DataElement>): Array<MetadataColumnConfig> =>
attributes
.map(({ id, displayInReports, type, formName, optionSet }) => ({
.map(({ id, displayInReports, type, name, optionSet }) => ({
id,
visible: displayInReports,
type,
header: formName,
header: name,
options: optionSet && optionSet.options.map(({ text, value }) => ({ text, value })),
multiValueFilter: !!optionSet,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class DataElementFactory {
NAME: 'NAME',
DESCRIPTION: 'DESCRIPTION',
SHORT_NAME: 'SHORT_NAME',
FORM_NAME: 'FORM_NAME',
};

static errorMessages = {
Expand Down Expand Up @@ -165,7 +166,11 @@ class DataElementFactory {
cachedTrackedEntityAttribute.translations,
DataElementFactory.translationPropertyNames.SHORT_NAME) ||
cachedTrackedEntityAttribute.displayShortName;
dataElement.formName = dataElement.name;
dataElement.formName =
this._getAttributeTranslation(
cachedTrackedEntityAttribute.translations,
DataElementFactory.translationPropertyNames.FORM_NAME) ||
cachedTrackedEntityAttribute.displayFormName;
dataElement.description =
this._getAttributeTranslation(
cachedTrackedEntityAttribute.translations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DataElementFactory {
NAME: 'NAME',
DESCRIPTION: 'DESCRIPTION',
SHORT_NAME: 'SHORT_NAME',
FORM_NAME: 'FORM_NAME',
};

static errorMessages = {
Expand Down Expand Up @@ -99,8 +100,8 @@ class DataElementFactory {
cachedAttribute.displayShortName;
o.formName =
this._getAttributeTranslation(
cachedAttribute.translations, DataElementFactory.translationPropertyNames.NAME) ||
cachedAttribute.displayName;
cachedAttribute.translations, DataElementFactory.translationPropertyNames.FORM_NAME) ||
cachedAttribute.displayFormName;
o.description =
this._getAttributeTranslation(
cachedAttribute.translations, DataElementFactory.translationPropertyNames.DESCRIPTION) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const storeTrackedEntityAttributes = (ids: Array<string>) => {
const query = {
resource: 'trackedEntityAttributes',
params: {
fields: 'id,displayName,displayShortName,description,valueType,optionSetValue,unique,orgunitScope,' +
fields: 'id,displayName,displayShortName,displayFormName,description,valueType,optionSetValue,unique,orgunitScope,' +
'pattern,translations[property,locale,value],optionSet[id]',
filter: `id:in:[${ids.join(',')}]`,
pageSize: ids.length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type CachedTrackedEntityAttribute = {
id: string,
displayName: string,
displayShortName: string,
displayFormName: string,
description: string,
translations: Array<CachedAttributeTranslation>,
valueType: string,
Expand Down

0 comments on commit 8578891

Please sign in to comment.