Skip to content
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
46 changes: 35 additions & 11 deletions packages/app/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: 2020-05-14T06:49:01.865Z\n"
"PO-Revision-Date: 2020-05-14T06:49:01.865Z\n"
"POT-Creation-Date: 2020-06-02T04:24:38.833Z\n"
"PO-Revision-Date: 2020-06-02T04:24:38.833Z\n"

msgid "Rename successful"
msgstr ""
Expand Down Expand Up @@ -64,15 +64,6 @@ msgid ""
"items. Only the first {{maxNumber}} items will be used and saved."
msgstr ""

msgid "Data"
msgstr ""

msgid "Period"
msgstr ""

msgid "Organisation units"
msgstr ""

msgid "Main dimensions"
msgstr ""

Expand Down Expand Up @@ -109,12 +100,33 @@ msgstr ""
msgid "Metadata ID scheme"
msgstr ""

msgid "ID"
msgstr ""

msgid "Code"
msgstr ""

msgid "Name"
msgstr ""

msgid "Download"
msgstr ""

msgid "Plain data source"
msgstr ""

msgid "JSON"
msgstr ""

msgid "XML"
msgstr ""

msgid "Excel"
msgstr ""

msgid "CSV"
msgstr ""

msgid "Advanced"
msgstr ""

Expand All @@ -124,6 +136,9 @@ msgstr ""
msgid "Other formats"
msgstr ""

msgid "JRXML"
msgstr ""

msgid "Raw data SQL"
msgstr ""

Expand Down Expand Up @@ -178,6 +193,12 @@ msgstr ""
msgid "And {{numberOfItems}} others..."
msgstr ""

msgid "Select a period"
msgstr ""

msgid "Select years"
msgstr ""

msgid "Unsaved visualization"
msgstr ""

Expand Down Expand Up @@ -715,6 +736,9 @@ msgstr ""
msgid "User org unit grand children"
msgstr ""

msgid "Data"
msgstr ""

msgid "Axes"
msgstr ""

Expand Down
6 changes: 3 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"private": true,
"homepage": ".",
"devDependencies": {
"@dhis2/cli-app-scripts": "^3.2.5",
"@dhis2/cli-app-scripts": "^4.0.7",
"cypress": "^3.6.1",
"eslint-plugin-cypress": "^2.11.1",
"redux-mock-store": "^1.5.4"
},
"dependencies": {
"@dhis2/analytics": "^6.0.2",
"@dhis2/analytics": "^6.0.3",
"@dhis2/app-runtime": "*",
"@dhis2/d2-i18n": "*",
"@dhis2/d2-ui-file-menu": "^7.0.3",
"@dhis2/d2-ui-interpretations": "^6.5.11",
"@dhis2/d2-ui-interpretations": "^7.0.3",
"@dhis2/data-visualizer-plugin": "35.0.1",
"@dhis2/ui-core": "^4.21.1",
"@material-ui/icons": "^3.0.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import configureStore from './configureStore'
import metadataMiddleware from './middleware/metadata'
import App from './components/App'

import './locales'

const AppWrapper = () => {
const engine = useDataEngine()
const store = configureStore([
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class App extends Component {
if (rootOrgUnit && rootOrgUnit.id) {
store.dispatch(
fromActions.fromMetadata.acAddMetadata({
...defaultMetadata,
...defaultMetadata(),
[rootOrgUnit.id]: {
...rootOrgUnit,
path: `/${rootOrgUnit.id}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,32 +305,18 @@ export class DialogManager extends Component {

render() {
const { dialogId, dimensions } = this.props

const nonPredefinedDimensions = filterOutPredefinedDimensions(
Object.keys(this.props.dimensions)
)

let dialogTitle = ''
if (dialogId === DIMENSION_ID_DATA) {
dialogTitle = i18n.t('Data')
} else if (dialogId === DIMENSION_ID_PERIOD) {
dialogTitle = i18n.t('Period')
} else if (dialogId === DIMENSION_ID_ORGUNIT) {
dialogTitle = i18n.t('Organisation units')
} else if (nonPredefinedDimensions.includes(dialogId)) {
dialogTitle = dimensions[dialogId] && dimensions[dialogId].name
}
const dimension = dimensions[dialogId]

return (
<Fragment>
{dialogId in dimensions && (
{dimension && (
<Modal
onClose={this.closeDialog}
data-test="dialog-manager"
position="top"
large
>
<ModalTitle>{dialogTitle}</ModalTitle>
<ModalTitle>{dimension.name}</ModalTitle>
<ModalContent>
{this.renderDialogContent()}
</ModalContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ describe('The DialogManager component', () => {
dialogId: null,
dimensions: {
test: {},
[DIMENSION_ID_ORGUNIT]: {},
[DIMENSION_ID_DATA]: {},
[DIMENSION_ID_PERIOD]: {},
[DIMENSION_ID_ORGUNIT]: { name: 'Organisation units' },
[DIMENSION_ID_DATA]: { name: 'Data' },
[DIMENSION_ID_PERIOD]: { name: 'Period' },
},
dxIds: ['test'],
ouIds: [],
Expand Down
35 changes: 25 additions & 10 deletions packages/app/src/components/DownloadMenu/DownloadMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,16 @@ export const DownloadMenu = ({
<div className={styles.menuSectionTitle}>
{i18n.t('Metadata ID scheme')}
</div>
<DenseMenuItem label="ID" onClick={downloadData(format, 'UID')} />
<DenseMenuItem
label="Code"
label={i18n.t('ID')}
onClick={downloadData(format, 'UID')}
/>
<DenseMenuItem
label={i18n.t('Code')}
onClick={downloadData(format, 'CODE')}
/>
<DenseMenuItem
label="Name"
label={i18n.t('Name')}
onClick={downloadData(format, 'NAME')}
/>
</Menu>
Expand All @@ -176,16 +179,28 @@ export const DownloadMenu = ({
<div className={styles.menuSectionTitle}>
{i18n.t('Plain data source')}
</div>
<DenseMenuItem Icon={ListIcon} label="JSON">
<DenseMenuItem
Icon={ListIcon}
label={i18n.t('JSON')}
>
{plainDataSourceSubLevel('json')}
</DenseMenuItem>
<DenseMenuItem Icon={ListIcon} label="XML">
<DenseMenuItem
Icon={ListIcon}
label={i18n.t('XML')}
>
{plainDataSourceSubLevel('xml')}
</DenseMenuItem>
<DenseMenuItem Icon={ListIcon} label="Excel">
<DenseMenuItem
Icon={ListIcon}
label={i18n.t('Excel')}
>
{plainDataSourceSubLevel('xls')}
</DenseMenuItem>
<DenseMenuItem Icon={ListIcon} label="CSV">
<DenseMenuItem
Icon={ListIcon}
label={i18n.t('CSV')}
>
{plainDataSourceSubLevel('csv')}
</DenseMenuItem>
<DenseMenuItem
Expand All @@ -199,15 +214,15 @@ export const DownloadMenu = ({
{i18n.t('Data value set')}
</div>
<DenseMenuItem
label="JSON"
label={i18n.t('JSON')}
onClick={downloadData(
'json',
null,
'dataValueSet'
)}
/>
<DenseMenuItem
label="XML"
label={i18n.t('XML')}
onClick={downloadData(
'xml',
null,
Expand All @@ -221,7 +236,7 @@ export const DownloadMenu = ({
{i18n.t('Other formats')}
</div>
<DenseMenuItem
label="JRXML"
label={i18n.t('JRXML')}
onClick={downloadData('jrxml')}
/>
<DenseMenuItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'

import { seriesOptions, categoryOptions } from '../../../modules/yearOverYear'

Expand All @@ -14,14 +15,14 @@ const SinglePeriodSelector = ({ options, selected, onChange }) => (
<SingleSelect
onChange={onChange}
selected={selected}
placeholder="Select a period"
placeholder={i18n.t('Select a period')}
dense
>
{options.map(option => (
<SingleSelectOption
key={option.id}
value={option.id}
label={option.name}
label={option.getName()}
/>
))}
</SingleSelect>
Expand All @@ -37,14 +38,14 @@ const MultiPeriodSelector = ({ options, selected, onChange }) => (
<MultiSelect
onChange={onChange}
selected={selected}
placeholder="Select years"
placeholder={i18n.t('Select years')}
dense
>
{options.map(option => (
<MultiSelectOption
key={option.id}
value={option.id}
label={option.name}
label={option.getName()}
/>
))}
</MultiSelect>
Expand All @@ -64,7 +65,9 @@ const YearOverYearSelect = ({ multiple, value, ...props }) => {
value.forEach(value =>
selected.push({
value,
label: seriesOptions.find(({ id }) => id === value).name,
label: seriesOptions
.find(({ id }) => id === value)
.getName(),
})
)
}
Expand All @@ -75,7 +78,9 @@ const YearOverYearSelect = ({ multiple, value, ...props }) => {

if (value) {
selected.value = value
selected.label = categoryOptions.find(({ id }) => id === value).name
selected.label = categoryOptions
.find(({ id }) => id === value)
.getName()
}

return <SinglePeriodSelector selected={selected} {...props} />
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/components/TitleBar/TitleBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
getVisualizationState,
} from '../../modules/visualization'

export const TITLE_UNSAVED = i18n.t('Unsaved visualization')
export const TITLE_DIRTY = i18n.t('Edited')
export const getTitleUnsaved = () => i18n.t('Unsaved visualization')
export const getTitleDirty = () => i18n.t('Edited')

const defaultTitleStyle = {
...styles.cell,
Expand All @@ -33,7 +33,7 @@ const defaultInterpretationStyle = {
const getTitleText = (titleState, visualization) => {
switch (titleState) {
case STATE_UNSAVED:
return TITLE_UNSAVED
return getTitleUnsaved()
case STATE_SAVED:
case STATE_DIRTY:
return visualization.name
Expand All @@ -60,7 +60,7 @@ const getSuffix = titleState => {
...styles.suffix,
...styles.titleDirty,
}}
>{`- ${TITLE_DIRTY}`}</div>
>{`- ${getTitleDirty()}`}</div>
)
default:
return ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import { TitleBar, TITLE_UNSAVED, TITLE_DIRTY } from '../TitleBar'
import { TitleBar, getTitleUnsaved, getTitleDirty } from '../TitleBar'
import {
STATE_EMPTY,
STATE_UNSAVED,
Expand Down Expand Up @@ -35,14 +35,14 @@ describe('TitleBar component', () => {

it('renders "unsaved" state', () => {
props.titleState = STATE_UNSAVED
props.titleText = TITLE_UNSAVED
props.titleText = getTitleUnsaved()
expect(titleBar().find('div')).toHaveLength(2)
expect(
titleBar()
.find('div')
.first()
.text()
).toEqual(TITLE_UNSAVED)
).toEqual(getTitleUnsaved())
})

it('renders "saved" state', () => {
Expand All @@ -66,7 +66,7 @@ describe('TitleBar component', () => {
.find('div')
.first()
.text()
).toEqual(`Yall- ${TITLE_DIRTY}`)
).toEqual(`Yall- ${getTitleDirty()}`)
})

it('renders a <div> containing everything else', () => {
Expand Down
Loading