Skip to content

Commit

Permalink
Merge branch 'master' into feat/offline-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Apr 23, 2021
2 parents c135a34 + f652946 commit 3389362
Show file tree
Hide file tree
Showing 14 changed files with 279 additions and 306 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [31.14.11](https://github.com/dhis2/dashboard-app/compare/v31.14.10...v31.14.11) (2021-04-20)


### Bug Fixes

* remove material-ui as direct dependency and update to latest ui design DHIS2-10143 ([#1704](https://github.com/dhis2/dashboard-app/issues/1704)) ([4f4cc50](https://github.com/dhis2/dashboard-app/commit/4f4cc50b209fed3e3a93194357540535b0ffc242))

## [31.14.10](https://github.com/dhis2/dashboard-app/compare/v31.14.9...v31.14.10) (2021-03-30)


Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { chartSel } from '../../selectors/dashboardItem'
import {
dashboardTitleSel,
dashboardChipSel,
newDashboardLinkSel,
newButtonSel,
} from '../../selectors/viewDashboard'

beforeEach(() => {
Expand All @@ -26,7 +26,7 @@ Then('the {string} dashboard displays in view mode', title => {
})

Given('I choose to create new dashboard', () => {
cy.get(newDashboardLinkSel, EXTENDED_TIMEOUT).click()
cy.get(newButtonSel, EXTENDED_TIMEOUT).click()
})

When('I choose to edit dashboard', () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/ui/error_scenarios/no_dashboards.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { EXTENDED_TIMEOUT } from '../../../support/utils'
import { newDashboardLinkSel } from '../../../selectors/viewDashboard'
import { newButtonSel } from '../../../selectors/viewDashboard'

// Scenario: There are no dashboards
Given('I open an app with no dashboards', () => {
Expand All @@ -10,5 +10,5 @@ Given('I open an app with no dashboards', () => {

Then('a message displays informing that there are no dashboards', () => {
cy.contains('No dashboards found', EXTENDED_TIMEOUT).should('be.visible')
cy.get(newDashboardLinkSel).should('be.visible')
cy.get(newButtonSel).should('be.visible')
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { EXTENDED_TIMEOUT } from '../../../support/utils'
import { chartSel } from '../../../selectors/dashboardItem'
import { dashboardTitleSel } from '../../../selectors/viewDashboard'
import {
dashboardTitleSel,
newButtonSel,
} from '../../../selectors/viewDashboard'
import { dimensionsModalSel } from '../../../selectors/dashboardFilter'

const TEST_DASHBOARD_TITLE = 'TEST_DASHBOARD_TITLE'
Expand All @@ -18,7 +21,7 @@ When('dashboard title is changed', () => {

Then('the small screen view is shown', () => {
//controlbar - no search dashboard field
cy.get('[data-test="link-new-dashboard"]').should('not.be.visible')
cy.get(newButtonSel).should('not.be.visible')

//titlebar - only the More button and the title
cy.get('button').contains('Edit').should('not.be.visible')
Expand All @@ -36,7 +39,7 @@ When('I restore the wide screen', () => {
})

Then('the wide screen view is shown', () => {
cy.get('[data-test="link-new-dashboard"]').should('be.visible')
cy.get(newButtonSel).should('be.visible')

cy.get('button').contains('Edit').should('be.visible')
cy.get('button').contains('Share').should('be.visible')
Expand Down
2 changes: 1 addition & 1 deletion cypress/selectors/viewDashboard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Dashboards bar
export const dashboardChipSel = '[data-test="dashboard-chip"]'
export const newDashboardLinkSel = '[data-test="link-new-dashboard"]'
export const newButtonSel = '[data-test="new-button"]'
export const chipStarSel = '[data-test="dhis2-uicore-chip-icon"]'
export const dashboardSearchInputSel =
'input:visible[placeholder="Search for a dashboard"]'
Expand Down
6 changes: 3 additions & 3 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: 2021-04-21T12:59:59.325Z\n"
"PO-Revision-Date: 2021-04-21T12:59:59.325Z\n"
"POT-Creation-Date: 2021-04-23T09:46:24.658Z\n"
"PO-Revision-Date: 2021-04-23T09:46:24.658Z\n"

msgid "Untitled dashboard"
msgstr ""
Expand Down Expand Up @@ -267,7 +267,7 @@ msgstr ""
msgid "Create a new dashboard"
msgstr ""

msgid "New"
msgid "Create a new dashboard"
msgstr ""

msgid "Search for a dashboard"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"private": true,
"license": "BSD-3-Clause",
"dependencies": {
"@dhis2/analytics": "^17.0.0",
"@dhis2/analytics": "^17.0.2",
"@dhis2/app-runtime": "^2.8.0",
"@dhis2/app-runtime-adapter-d2": "^1.0.2",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-ui-core": "^7.1.8",
"@dhis2/d2-ui-interpretations": "^7.1.8",
"@dhis2/d2-ui-mentions-wrapper": "^7.1.8",
"@dhis2/d2-ui-mentions-wrapper": "^7.2.0",
"@dhis2/d2-ui-rich-text": "^7.1.8",
"@dhis2/d2-ui-sharing-dialog": "^7.1.8",
"@dhis2/d2-ui-translation-dialog": "^7.1.8",
Expand Down
38 changes: 23 additions & 15 deletions src/pages/view/DashboardsBar/Content.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import React, { useState } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import cx from 'classnames'
import { Link, withRouter } from 'react-router-dom'
import { Redirect, withRouter } from 'react-router-dom'
import { Button, Tooltip, colors, IconAdd24 } from '@dhis2/ui'

import Chip from './Chip'
Expand All @@ -25,13 +25,19 @@ const Content = ({
onChipClicked,
onSearchClicked,
}) => {
const [redirectUrl, setRedirectUrl] = useState(null)

const onSelectDashboard = () => {
const id = getFilteredDashboards(dashboards, filterText)[0]?.id
if (id) {
history.push(id)
}
}

const enterNewMode = () => {
setRedirectUrl('/new')
}

const getChips = () =>
getFilteredDashboards(dashboards, filterText).map(dashboard => (
<Chip
Expand All @@ -55,26 +61,28 @@ const Content = ({
)

const getControlsLarge = () => (
<div className={classes.controlsLarge}>
<Link
className={classes.newLink}
to={'/new'}
data-test="link-new-dashboard"
>
<Tooltip content={i18n.t('Create a new dashboard')}>
<Button small icon={<IconAdd24 color={colors.grey600} />}>
{i18n.t('New')}
</Button>
</Tooltip>
</Link>
<span className={classes.controlsLarge}>
<Tooltip content={i18n.t('Create a new dashboard')}>
<Button
className={classes.newButton}
small
icon={<IconAdd24 color={colors.grey600} />}
onClick={enterNewMode}
dataTest="new-button"
/>
</Tooltip>
<Filter
onKeypressEnter={onSelectDashboard}
onSearchClicked={onSearchClicked}
expanded={expanded}
/>
</div>
</span>
)

if (redirectUrl) {
return <Redirect to={redirectUrl} />
}

return (
<div
className={cx(
Expand Down
4 changes: 2 additions & 2 deletions src/pages/view/DashboardsBar/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const FilterUnconnected = ({
}

return (
<div
<span
className={cx(
classes.container,
expanded ? classes.expanded : classes.collapsed
Expand Down Expand Up @@ -109,7 +109,7 @@ export const FilterUnconnected = ({
</div>
)}
</div>
</div>
</span>
)
}

Expand Down
Loading

0 comments on commit 3389362

Please sign in to comment.