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

feat: toolbar UI update (DHIS2-15167) #368

Merged
merged 44 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
41ed4b2
chore: allow styled-jsx in project
HendrikThePendric May 9, 2023
23628e1
chore: move filemenu component to app
HendrikThePendric May 9, 2023
53df138
chore: stump out toolbar ui components
HendrikThePendric May 9, 2023
395abad
chore: implement toolbar styles
HendrikThePendric May 9, 2023
c4f3dfc
fix: adjust height to 32 px
HendrikThePendric May 9, 2023
fa5a507
fix: ensure flexbox children consume full height
HendrikThePendric May 10, 2023
5bcddc2
feat: add InterpretationsAndDetailsToggler
HendrikThePendric May 10, 2023
2313990
feat: add app logo
HendrikThePendric May 10, 2023
57e4021
feat: add update button
HendrikThePendric May 10, 2023
f8baf6a
feat: add HoverMenuBar
HendrikThePendric May 11, 2023
3eb5dcd
chore: temporarily add analytics files needed by file menu
HendrikThePendric May 11, 2023
705c48c
feat: port file-menu to new hoverable menubar
HendrikThePendric May 15, 2023
f6d3273
feat: migrate view-menu
HendrikThePendric May 15, 2023
383ffd6
feat: add disabled state to view menu
HendrikThePendric May 15, 2023
f088f29
feat: migrate download menu wip
HendrikThePendric May 15, 2023
89b2b0c
feat: add menu and menu items WIP
HendrikThePendric May 23, 2023
90c83a5
fix: let dropdown render children directly in popper
HendrikThePendric May 23, 2023
4a64c57
fix: trigger toggleSubMenu when on items without children so it closes
HendrikThePendric May 23, 2023
a6db849
refactor: intergrate menu and context into a single file
HendrikThePendric May 23, 2023
f03909a
feat: let download menu be clickable or hoverable
HendrikThePendric May 23, 2023
3362917
feat: implement download menu that can be hovered or clicked
HendrikThePendric May 23, 2023
f879689
feat: hoverable options menu
HendrikThePendric May 24, 2023
ba4ab04
chore: cleanup files from old toolbar
HendrikThePendric May 24, 2023
c5a1671
chore: remove stray log statement
HendrikThePendric May 24, 2023
3cc61e6
refactor: organise components for move to analytics
HendrikThePendric May 24, 2023
ecbde2d
refactor: stop using namespaced components, switch to variable names
HendrikThePendric May 25, 2023
04ca31f
chore: remove analytics components and prepare the app for their release
HendrikThePendric May 25, 2023
aac6ff7
fix: wrap action call in useCallback
HendrikThePendric May 30, 2023
7f31658
fix: adjust import name
HendrikThePendric Jun 13, 2023
4d85991
chore: upgrade @dhis2/analytics
HendrikThePendric Jun 20, 2023
2a0891a
chore: remove lint rule needed while building analytics components
HendrikThePendric Jun 20, 2023
d61ebc5
chore: update .pot file
HendrikThePendric Jun 21, 2023
27b1128
chore: adjust e2e selectors to updated components
HendrikThePendric Jun 21, 2023
6121414
chore: fix table e2e test
HendrikThePendric Jun 21, 2023
d8c6e22
chore: appease the linter
HendrikThePendric Jun 21, 2023
e76c63d
chore: align remaining e2e failures
HendrikThePendric Jun 21, 2023
82cbe38
fix: remove unused import
HendrikThePendric Jun 21, 2023
5159b5f
fix: push app name 1px down to improve visual alignment
HendrikThePendric Jun 27, 2023
e13421a
chore: upgrade @dhis2/analytics to get latest toolbar UI fixes
HendrikThePendric Jun 27, 2023
11005a1
chore: fix file menu e2e test by closing the menu via a document click
HendrikThePendric Jun 27, 2023
abb52b0
chore: upgrade analytics to have decreased padding
HendrikThePendric Jun 28, 2023
6327444
fix: upgrade @dhis2/ui to get consistent menu section header styles
HendrikThePendric Jul 3, 2023
6b8f5e5
fix: ensure `MenuSectionHeader` is `dense` when in the `HoverMenuBar`
HendrikThePendric Jul 3, 2023
e342a05
Merge branch 'master' into DHIS2-15167-toolbar-update
janhenrikoverland Aug 9, 2023
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
6 changes: 3 additions & 3 deletions cypress/helpers/fileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ITEM_GETLINK = 'file-menu-getlink'
export const ITEM_DELETE = 'file-menu-delete'

export const saveVisualization = (name) => {
cy.getBySel('menubar').contains('File').click()
cy.getBySel('dhis2-analytics-hovermenubar').contains('File').click()

cy.getBySel(ITEM_SAVE).click()

Expand All @@ -23,7 +23,7 @@ export const saveVisualization = (name) => {
}

export const saveVisualizationAs = (name) => {
cy.getBySel('menubar').contains('File').click()
cy.getBySel('dhis2-analytics-hovermenubar').contains('File').click()

cy.getBySel(ITEM_SAVEAS).click()

Expand All @@ -36,7 +36,7 @@ export const saveVisualizationAs = (name) => {
}

export const deleteVisualization = () => {
cy.getBySel('menubar').contains('File').click()
cy.getBySel('dhis2-analytics-hovermenubar').contains('File').click()

cy.getBySel(ITEM_DELETE).click()

Expand Down
4 changes: 2 additions & 2 deletions cypress/helpers/interpretations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { EXTENDED_TIMEOUT } from '../support/util.js'

export const expectInterpretationsButtonToBeEnabled = () =>
cy
.getBySel('menubar', EXTENDED_TIMEOUT)
.contains('Interpretations')
.getBySel('dhis2-analytics-toolbar', EXTENDED_TIMEOUT)
.contains('Interpretations and details')
.should('be.enabled')

export const expectInterpretationFormToBeVisible = () =>
Expand Down
30 changes: 26 additions & 4 deletions cypress/helpers/menubar.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

export const clickMenubarUpdateButton = () =>
cy.getBySel('menubar', EXTENDED_TIMEOUT).contains('Update').click()
cy
.getBySel('dhis2-analytics-toolbar', EXTENDED_TIMEOUT)
.contains('Update')
.click()

export const clickMenubarViewButton = () =>
cy.getBySel('menubar', EXTENDED_TIMEOUT).contains('View').click()
cy
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('View')
.click()

export const clickMenubarOptionsButton = () =>
cy.getBySel('menubar', EXTENDED_TIMEOUT).contains('Options').click()
cy
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('Options')
.click()

export const openStyleOptionsModal = () => {
clickMenubarOptionsButton()
return cy.getBySel('options-menu-list').contains('Style').click()
}

export const openLegendOptionsModal = () => {
clickMenubarOptionsButton()
return cy.getBySel('options-menu-list').contains('Legend').click()
}

export const clickMenubarInterpretationsButton = () =>
cy.getBySel('menubar', EXTENDED_TIMEOUT).contains('Interpretations').click()
cy
.getBySel('dhis2-analytics-toolbar', EXTENDED_TIMEOUT)
.contains('Interpretations')
.click()
4 changes: 2 additions & 2 deletions cypress/integration/download.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { EXTENDED_TIMEOUT } from '../support/util.js'

const downloadIsEnabled = () =>
cy
.getBySel('menubar', EXTENDED_TIMEOUT)
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('Download')
.should('not.have.attr', 'disabled')

const downloadIsDisabled = () =>
cy
.getBySel('menubar', EXTENDED_TIMEOUT)
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('Download')
.should('have.attr', 'disabled')

Expand Down
10 changes: 6 additions & 4 deletions cypress/integration/fileMenu.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,29 @@ const defaultItemsMap = {
const assertFileMenuItems = (enabledItemsMap = {}) => {
const itemsMap = Object.assign({}, defaultItemsMap, enabledItemsMap)

cy.getBySel('menubar', EXTENDED_TIMEOUT).contains('File').click()
cy.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('File')
.click()

Object.entries(itemsMap).forEach(([itemName, enabled]) => {
enabled
? cy.getBySel(itemName).should('not.have.class', 'disabled')
: cy.getBySel(itemName).should('have.class', 'disabled')
})

cy.getBySel('file-menu-toggle-layer').click()
cy.get('body').click()
cy.getBySel('file-menu-container').should('not.exist')
}

const assertDownloadIsEnabled = () =>
cy
.getBySel('menubar', EXTENDED_TIMEOUT)
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('Download')
.should('not.have.attr', 'disabled')

const assertDownloadIsDisabled = () =>
cy
.getBySel('menubar', EXTENDED_TIMEOUT)
.getBySel('dhis2-analytics-hovermenubar', EXTENDED_TIMEOUT)
.contains('Download')
.should('have.attr', 'disabled')

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/interpretations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('interpretations', { testIsolation: false }, () => {
// Hiding (the interpretations panel is open at the start of the test)
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Hide interpretations and details')
.should('be.visible')
.click()
Expand All @@ -103,7 +103,7 @@ describe('interpretations', { testIsolation: false }, () => {
// Showing
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Show interpretations and details')
.should('be.visible')
.click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/layout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('layout', () => {
// Hiding
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Hide layout')
.should('be.visible')
.click()
Expand All @@ -79,7 +79,7 @@ describe('layout', () => {
// Showing
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Show layout')
.should('be.visible')
.click()
Expand Down
27 changes: 7 additions & 20 deletions cypress/integration/legendSet.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import {
import { openDimension, selectEventWithProgram } from '../helpers/dimensions.js'
import { deleteVisualization, saveVisualization } from '../helpers/fileMenu.js'
import {
clickMenubarOptionsButton,
clickMenubarUpdateButton,
openLegendOptionsModal,
} from '../helpers/menubar.js'
import {
clickOptionsModalUpdateButton,
clickOptionsTab,
expectLegendDisplayStrategyToBeByDataItem,
expectLegendDisplayStrategyToBeFixed,
expectLegendDisplayStyleToBeFill,
Expand Down Expand Up @@ -115,9 +114,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
assertCellsHaveDefaultColors('tr td')
})
it('background color legend is applied (per data item)', () => {
clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

cy.getBySel('options-modal-content')
.contains('Use a legend for table cell colors')
Expand Down Expand Up @@ -147,9 +144,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
assertCellsHaveDefaultColors('tr td:nth-child(1)')
})
it('text color legend is applied (per data item)', () => {
clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

cy.getBySel('options-modal-content').should('contain', 'Legend style')

Expand Down Expand Up @@ -184,9 +179,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
expectLegendKeyToBeHidden()
})
it('legend key displays correctly when enabled', () => {
clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

expectLegendDisplayStrategyToBeByDataItem()

Expand All @@ -203,9 +196,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
expectLegendKeyToMatchLegendSets([TEST_LEGEND_AGE.name])
})
it('text color legend is applied (single legend)', () => {
clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

cy.getBySel('options-modal-content').should('contain', 'Legend style')

Expand Down Expand Up @@ -251,9 +242,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
assertCellsHaveDefaultColors('tr td:nth-child(1)')
})
it('background color legend is applied (single legend)', () => {
clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

cy.getBySel('options-modal-content').should('contain', 'Legend style')

Expand Down Expand Up @@ -303,9 +292,7 @@ describe(['>=39'], 'Options - Legend', { testIsolation: false }, () => {
// unaffected cells (date column) have default background and text color
assertCellsHaveDefaultColors('tr td:nth-child(1)')

clickMenubarOptionsButton()

clickOptionsTab('Legend')
openLegendOptionsModal()

expectLegendDisplayStrategyToBeFixed()

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/mainSidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('main sidebar', () => {
// Hiding
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Hide dimensions sidebar')
.should('be.visible')
.click()
Expand All @@ -20,7 +20,7 @@ describe('main sidebar', () => {
// Showing
clickMenubarViewButton()

cy.getBySel('dhis2-uicore-menuitem')
cy.getBySel('dhis2-uicore-hovermenulistitem')
.contains('Show dimensions sidebar')
.should('be.visible')
.click()
Expand Down
20 changes: 10 additions & 10 deletions cypress/integration/options.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '../helpers/dimensions.js'
import { saveVisualization } from '../helpers/fileMenu.js'
import {
clickMenubarOptionsButton,
openStyleOptionsModal,
clickMenubarUpdateButton,
} from '../helpers/menubar.js'
import {
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('options', () => {
.should('equal', '7px 6px 5px')

// set to comfortable density
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('display-density-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand All @@ -57,7 +57,7 @@ describe('options', () => {
.should('equal', '10px 8px 8px')

// set to compact density
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('display-density-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand All @@ -82,7 +82,7 @@ describe('options', () => {
.should('equal', REGULAR_FONT_SIZE)

// set to small font size
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('font-size-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand All @@ -96,7 +96,7 @@ describe('options', () => {
.should('be.lt', REGULAR_FONT_SIZE)

// set to large font size
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('font-size-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('options', () => {
getTableRows().eq(0).find('td').eq(2).should('contain', '333 333 444')

// set dgs to comma
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('dgs-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand All @@ -147,7 +147,7 @@ describe('options', () => {
getTableRows().eq(0).find('td').eq(2).should('contain', '333,333,444')

// set dgs to none
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('dgs-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand All @@ -158,7 +158,7 @@ describe('options', () => {
getTableRows().eq(0).find('td').eq(2).should('contain', '333333444')

// set dgs to space
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('dgs-select-content')
.findBySel('dhis2-uicore-select-input')
.click()
Expand Down Expand Up @@ -197,7 +197,7 @@ describe(['>=40'], 'ou hierarchy', () => {
.containsExact(NAME_WITHOUT_HIERARCHY)

// enable show hierarchy - hierarchy is shown
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('options-modal-content')
.contains('Display organisation unit hierarchy')
.click()
Expand All @@ -214,7 +214,7 @@ describe(['>=40'], 'ou hierarchy', () => {
getTableRows().eq(0).find('td').eq(0).containsExact(NAME_WITH_HIERARCHY)

// disable show hierarchy - no hierarchy is shown
clickMenubarOptionsButton()
openStyleOptionsModal()
cy.getBySel('options-modal-content')
.contains('Display organisation unit hierarchy')
.click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/table.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import {
selectEventWithProgramDimensions,
} from '../helpers/dimensions.js'
import {
clickMenubarOptionsButton,
clickMenubarUpdateButton,
openStyleOptionsModal,
} from '../helpers/menubar.js'
import { clickOptionsModalUpdateButton } from '../helpers/options.js'
import {
Expand Down Expand Up @@ -215,7 +215,7 @@ const assertDimensions = () => {

const assertSorting = () => {
// remove any DGS to allow numeric value comparison
clickMenubarOptionsButton()
openStyleOptionsModal()

cy.getBySel('dgs-select-content')
.findBySel('dhis2-uicore-select-input')
Expand Down
8 changes: 4 additions & 4 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: 2023-06-07T12:54:13.099Z\n"
"PO-Revision-Date: 2023-06-07T12:54:13.099Z\n"
"POT-Creation-Date: 2023-06-27T14:37:02.617Z\n"
"PO-Revision-Date: 2023-06-27T14:37:02.617Z\n"

msgid "Add to {{axisName}}"
msgstr "Add to {{axisName}}"
Expand Down Expand Up @@ -314,8 +314,8 @@ msgstr "Unsaved visualization"
msgid "Edited"
msgstr "Edited"

msgid "Interpretations"
msgstr "Interpretations"
msgid "Line list"
msgstr "Line list"

msgid "\"{{- deletedObject}}\" successfully deleted."
msgstr "\"{{- deletedObject}}\" successfully deleted."
Expand Down
Loading
Loading