From c8cdb866d19de1558cd5fb9d2b1351c7618e6650 Mon Sep 17 00:00:00 2001 From: "@dhis2-bot" Date: Tue, 20 Apr 2021 12:47:07 +0000 Subject: [PATCH 1/4] chore(release): cut 31.14.11 [skip ci] ## [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)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 536552860..191786317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) From f10b2f14cb218b240dfec50ceaba1cfe01e21f1f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 23 Apr 2021 05:43:11 +0000 Subject: [PATCH 2/4] chore(deps): bump @dhis2/analytics from 17.0.0 to 17.0.2 (#1717) Bumps [@dhis2/analytics](https://github.com/dhis2/analytics) from 17.0.0 to 17.0.2. - [Release notes](https://github.com/dhis2/analytics/releases) - [Changelog](https://github.com/dhis2/analytics/blob/master/CHANGELOG.md) - [Commits](https://github.com/dhis2/analytics/compare/v17.0.0...v17.0.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ac564f0cf..88626c4f3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "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", diff --git a/yarn.lock b/yarn.lock index ebf838a3e..0cdd128cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1549,10 +1549,10 @@ react-beautiful-dnd "^10.1.1" resize-observer-polyfill "^1.5.1" -"@dhis2/analytics@^17.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-17.0.0.tgz#ef635ab06a2526f8c61ed7a2996afbbe454bfc3c" - integrity sha512-i76hW5iuwNsWw4F+9qFOymOWkgj6YzqBoKVQ/lZC2mSYrqQWrrRRhKHaFBPKDm/chHo0kTF9Au0IaR3aBAKmbg== +"@dhis2/analytics@^17.0.2": + version "17.0.2" + resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-17.0.2.tgz#5b818247837d50a8496dc5bc490dca0026e174ec" + integrity sha512-ukL6gMP72F6hMkjt/LEKS9faONpZnDYm0YBbTDPv1JfZt3eKrDeArEwfaWnieGE7BB3+RJkME7aNjuZkh/LnUg== dependencies: "@dhis2/d2-ui-favorites-dialog" "^7.1.5" "@dhis2/d2-ui-org-unit-dialog" "^7.1.5" @@ -1764,17 +1764,6 @@ material-ui "^0.20.0" rxjs "^5.5.7" -"@dhis2/d2-ui-core@7.1.6": - version "7.1.6" - resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-7.1.6.tgz#2bc65f86f1cbf0e04ca17accfb164968e5fcb7d4" - integrity sha512-zF5Xnts5NLmGkPJHR3QI4H9KLruHSp3JPAmR2lxNtturSpwEzecnauydo/Og76wcscd4V3ylEmIY2d5Ey2o9OA== - dependencies: - babel-runtime "^6.26.0" - d2 "~31.7" - lodash "^4.17.10" - material-ui "^0.20.0" - rxjs "^5.5.7" - "@dhis2/d2-ui-core@7.1.8", "@dhis2/d2-ui-core@^7.1.8": version "7.1.8" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-7.1.8.tgz#1339f91f4ce2e0a38897dab29de22db725d058a5" From 686d970cd40e0025916515ef3c02892a1bb3d8db Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Fri, 23 Apr 2021 12:14:54 +0200 Subject: [PATCH 3/4] fix: make New button icon-only and set redirect url rather than use Link component (#1714) Remove "New" from the New button to simplify the interface. Align the button and search field with the chips (bottom edge). The button is now a button rather than a Link, and sets a redirectUrl for navigation. --- cypress/integration/common/common.js | 4 +- .../ui/error_scenarios/no_dashboards.js | 4 +- .../responsive_dashboard.js | 9 +- cypress/selectors/viewDashboard.js | 2 +- i18n/en.pot | 8 +- src/pages/view/DashboardsBar/Content.js | 38 +- src/pages/view/DashboardsBar/Filter.js | 4 +- .../__snapshots__/DashboardsBar.spec.js.snap | 469 ++++++++---------- .../__snapshots__/Filter.spec.js.snap | 8 +- .../DashboardsBar/styles/Content.module.css | 7 +- .../DashboardsBar/styles/Filter.module.css | 4 - 11 files changed, 257 insertions(+), 300 deletions(-) diff --git a/cypress/integration/common/common.js b/cypress/integration/common/common.js index 125ef9494..b8b48267b 100644 --- a/cypress/integration/common/common.js +++ b/cypress/integration/common/common.js @@ -5,7 +5,7 @@ import { chartSel } from '../../selectors/dashboardItem' import { dashboardTitleSel, dashboardChipSel, - newDashboardLinkSel, + newButtonSel, } from '../../selectors/viewDashboard' beforeEach(() => { @@ -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', () => { diff --git a/cypress/integration/ui/error_scenarios/no_dashboards.js b/cypress/integration/ui/error_scenarios/no_dashboards.js index 6f8014da5..64f15a139 100644 --- a/cypress/integration/ui/error_scenarios/no_dashboards.js +++ b/cypress/integration/ui/error_scenarios/no_dashboards.js @@ -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', () => { @@ -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') }) diff --git a/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js b/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js index 0bac79e17..e1d3eb07c 100644 --- a/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js +++ b/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js @@ -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' @@ -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') @@ -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') diff --git a/cypress/selectors/viewDashboard.js b/cypress/selectors/viewDashboard.js index 0e1693082..c50700d2e 100644 --- a/cypress/selectors/viewDashboard.js +++ b/cypress/selectors/viewDashboard.js @@ -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"]' diff --git a/i18n/en.pot b/i18n/en.pot index b3e80469f..2550400c4 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -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-16T11:52:58.307Z\n" -"PO-Revision-Date: 2021-04-16T11:52:58.307Z\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 "" @@ -267,10 +267,10 @@ msgid "" "print dialog" msgstr "" -msgid "Create a new dashboard" +msgid "Not available offline" msgstr "" -msgid "New" +msgid "Create a new dashboard" msgstr "" msgid "Search for a dashboard" diff --git a/src/pages/view/DashboardsBar/Content.js b/src/pages/view/DashboardsBar/Content.js index 7ce251d4c..fb725c474 100644 --- a/src/pages/view/DashboardsBar/Content.js +++ b/src/pages/view/DashboardsBar/Content.js @@ -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' @@ -25,6 +25,8 @@ const Content = ({ onChipClicked, onSearchClicked, }) => { + const [redirectUrl, setRedirectUrl] = useState(null) + const onSelectDashboard = () => { const id = getFilteredDashboards(dashboards, filterText)[0]?.id if (id) { @@ -32,6 +34,10 @@ const Content = ({ } } + const enterNewMode = () => { + setRedirectUrl('/new') + } + const getChips = () => getFilteredDashboards(dashboards, filterText).map(dashboard => ( ( -
- - - - - + + +
+ ) + if (redirectUrl) { + return + } + return (
)}
- + ) } diff --git a/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap b/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap index e67d3db55..348a56964 100644 --- a/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap +++ b/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap @@ -18,7 +18,7 @@ exports[`clicking "Show more" maximizes dashboards bar height 1`] = `
- -
+
- -
+ + - - + + + - - + + + - - + + + @@ -933,7 +905,7 @@ exports[`renders a DashboardsBar with selected item 1`] = `
- -
+
- -
+ + - - + + + - - + + + - - + `; exports[`Filter when filterText property is provided renders an input with correct value property 1`] = `
-
- + `; diff --git a/src/pages/view/DashboardsBar/styles/Content.module.css b/src/pages/view/DashboardsBar/styles/Content.module.css index 00360083b..387b5561f 100644 --- a/src/pages/view/DashboardsBar/styles/Content.module.css +++ b/src/pages/view/DashboardsBar/styles/Content.module.css @@ -2,9 +2,7 @@ display: inline; } -.newLink { - display: inline-block; - text-decoration: none; +.newButton { margin-right: var(--spacers-dp8); margin-top: var(--spacers-dp4); } @@ -14,7 +12,8 @@ } .controlsLarge { - display: inline; + position: relative; + top: var(--spacers-dp4); } @media only screen and (max-width: 480px) { diff --git a/src/pages/view/DashboardsBar/styles/Filter.module.css b/src/pages/view/DashboardsBar/styles/Filter.module.css index 11a3966f2..c45ed6154 100644 --- a/src/pages/view/DashboardsBar/styles/Filter.module.css +++ b/src/pages/view/DashboardsBar/styles/Filter.module.css @@ -82,10 +82,6 @@ margin-left: 8px; } -.container { - display: inline; -} - @media only screen and (max-width: 480px) { .input { width: 100%; From f652946a82bf28da74235101b7a08a50c9b3f75a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 23 Apr 2021 10:28:26 +0000 Subject: [PATCH 4/4] chore(deps): bump @dhis2/d2-ui-mentions-wrapper from 7.1.8 to 7.2.0 (#1718) Bumps @dhis2/d2-ui-mentions-wrapper from 7.1.8 to 7.2.0. Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jen Jones Arnesen --- package.json | 2 +- yarn.lock | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 88626c4f3..35e728816 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@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", diff --git a/yarn.lock b/yarn.lock index 0cdd128cb..55c485f06 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1807,7 +1807,7 @@ prop-types "^15.5.10" react-portal "^4.1.5" -"@dhis2/d2-ui-mentions-wrapper@7.1.8", "@dhis2/d2-ui-mentions-wrapper@^7.1.8": +"@dhis2/d2-ui-mentions-wrapper@7.1.8": version "7.1.8" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-mentions-wrapper/-/d2-ui-mentions-wrapper-7.1.8.tgz#000c3f6b4a0ab1cf0eafe9130a54a066f1080ea7" integrity sha512-OsLDwLltXo8ABLnO8jw2M6UTopFTJwzetC86oHMPg/WtukqsN0kJbmskVAVD6cO8yV5/w1TR059RKjWmm78Wbg== @@ -1816,6 +1816,15 @@ lodash "^4.17.10" prop-types "^15.6.2" +"@dhis2/d2-ui-mentions-wrapper@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-mentions-wrapper/-/d2-ui-mentions-wrapper-7.2.0.tgz#41b216cd5a2895a59cf02c42da9a9c244ee2ec61" + integrity sha512-WN21hMLT6x4E+FUL80BH9m7nfU26FplSd3jj3W1qj1QplfYUE1eABxQPxaDfPFAeFOyOaN4QZxKUY/KmirO9WA== + dependencies: + "@material-ui/core" "^3.3.1" + lodash "^4.17.10" + prop-types "^15.6.2" + "@dhis2/d2-ui-org-unit-dialog@^7.1.5": version "7.1.5" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-dialog/-/d2-ui-org-unit-dialog-7.1.5.tgz#aa6b9257a25ff1a238f77a9638323b6cf0ee37d8"