Skip to content

Commit

Permalink
fix: several backports to [v37] (#1935)
Browse files Browse the repository at this point in the history
* fix: bump analytics and ui to latest (#1927)

* feat: use the new SharingDialog with cascading sharing (#1913)

* fix: reenable cypress tests for offline (#1928)

* fix: readd missing offlinejs file (#1929)

* fix: disable dirty check on exit (DHIS2-11701) (#1930)

Removing the "dirty" check which would display the "Discard changes?" modal when "Exit without saving" was clicked after making changes to the title/description.

* fix: bump cli-app-scripts to solve issues with z-index and Modals (#1931)

Solves issues with ui Modals and z-index.
Various Modals opened under the edit mode toolbar.



Co-authored-by: Jen Jones Arnesen <[email protected]>

* fix: upgrade d2-ui 7.3.3 (#1932)

This upgrade fixes the broken interpretations component

Co-authored-by: Martin <[email protected]>
Co-authored-by: Edoardo Sabadelli <[email protected]>
Co-authored-by: Jan Henrik Øverland <[email protected]>
  • Loading branch information
4 people authored Sep 6, 2021
1 parent 316ffb9 commit 5c5973f
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 199 deletions.
48 changes: 24 additions & 24 deletions cypress/integration/edit/edit_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Feature: Creating, editing and deleting dashboard
And I click Exit without saving
Then the dashboard displays in view mode

@mutating
Scenario: I cancel exit without saving when name changed
Given I open existing dashboard
When I choose to edit dashboard
And dashboard title is added
And I click Exit without saving
And I decide to continue editing
Then the dashboard displays in edit mode
# @mutating
# Scenario: I cancel exit without saving when name changed
# Given I open existing dashboard
# When I choose to edit dashboard
# And dashboard title is added
# And I click Exit without saving
# And I decide to continue editing
# Then the dashboard displays in edit mode

# @mutating
# Scenario: I cancel exit without saving when item added
Expand All @@ -42,17 +42,17 @@ Feature: Creating, editing and deleting dashboard
When I choose to edit dashboard
And dashboard title is added
And I click Exit without saving
And I confirm I want to discard changes
# And I confirm I want to discard changes
Then the dashboard displays in view mode

# @mutating
# Scenario: I star the dashboard
# Given I open existing dashboard
# And the dashboard is not starred
# When I click to star the dashboard
# Then the dashboard is starred
# When I click to unstar the dashboard
# Then the dashboard is not starred
@mutating
Scenario: I star the dashboard
Given I open existing dashboard
And the dashboard is not starred
When I click to star the dashboard
Then the dashboard is starred
When I click to unstar the dashboard
Then the dashboard is not starred


@mutating
Expand Down Expand Up @@ -88,13 +88,13 @@ Feature: Creating, editing and deleting dashboard
# And I click Exit without saving
# Then Norwegian title and description are displayed

@mutating
Scenario: I change sharing settings of a dashboard
Given I open existing dashboard
When I change sharing settings
And I choose to edit dashboard
And dashboard is saved
Then the new sharing settings should be preserved
# @mutating
# Scenario: I change sharing settings of a dashboard
# Given I open existing dashboard
# When I change sharing settings
# And I choose to edit dashboard
# And dashboard is saved
# Then the new sharing settings should be preserved

@mutating
Scenario: I save a starred dashboard
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/edit/filter_restrict.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Feature: Editing Filter Restrictions
And I add Facility Ownership to selected filters
And I click Confirm
And I click Exit without saving
And I confirm I want to discard changes
# And I confirm I want to discard changes
Then the dashboard displays in view mode
When I choose to edit dashboard
And I click on Filter settings
Expand Down
84 changes: 0 additions & 84 deletions cypress/integration/view/dashboard_filter/dashboard_filter.js

This file was deleted.

10 changes: 5 additions & 5 deletions cypress/integration/view/item_context_menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Feature: Item context menu
When I click Open in Data Visualizer app on a chart dashboard item
Then the chart is opened in the Data Visualizer app

# @nonmutating
# Scenario: Open the interpretations panel
# Given I open the "Delivery" dashboard
# When I click Show details and interpretations on a chart dashboard item
# Then the interpretations panel is displayed
@nonmutating
Scenario: Open the interpretations panel
Given I open the "Delivery" dashboard
When I click Show details and interpretations on a chart dashboard item
Then the interpretations panel is displayed

@nonmutating
Scenario: Text item does not have a context menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When(
Then('the interpretations panel is displayed', () => {
getDashboardItem(chartItemUid)
.find(itemDetailsSel)
.contains('Chart details')
.contains('Visualization details')
.scrollIntoView()
.should('be.visible')

Expand Down
70 changes: 70 additions & 0 deletions cypress/integration/view/offline.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Feature: Offline dashboard

Scenario: I cache an uncached dashboard
Given I create two dashboards
When I cache one of the dashboards
Then the cached dashboard has a Last Updated time and chip icon
And the uncached dashboard does not have a Last Updated time and no chip icon

Scenario: I am online with an uncached dashboard when I lose connectivity
Given I open an uncached dashboard
When connectivity is turned off
Then all actions for "uncached" dashboard requiring connectivity are disabled

Scenario: I am online with a cached dashboard when I lose connectivity
Given I open a cached dashboard
Then the cached dashboard options are available
When connectivity is turned off
Then all actions for "cached" dashboard requiring connectivity are disabled

Scenario: I am offline and switch from a cached dashboard to an uncached dashboard
Given I open a cached dashboard
And connectivity is turned off
When I click to open an uncached dashboard when offline
Then the dashboard is not available and offline message is displayed

Scenario: I am offline and switch to a cached dashboard
Given I open an uncached dashboard
And connectivity is turned off
When I click to open a cached dashboard when offline
Then the cached dashboard is loaded and displayed in view mode

Scenario: I am offline and switch to an uncached dashboard and then connectivity is restored
Given I open a cached dashboard
And connectivity is turned off
When I click to open an uncached dashboard when offline
Then the dashboard is not available and offline message is displayed
When connectivity is turned on
Then the uncached dashboard is loaded and displayed in view mode

Scenario: I am in edit mode on an uncached dashboard when I lose connectivity and then I exit without saving and then connectivity is restored
Given I open an uncached dashboard in edit mode
When connectivity is turned off
Then all edit actions requiring connectivity are disabled
When I click Exit without saving
Then the dashboard is not available and offline message is displayed
When connectivity is turned on
Then the uncached dashboard is loaded and displayed in view mode

Scenario: I am in edit mode on a cached dashboard when I lose connectivity and then I exit without saving
Given I open a cached dashboard in edit mode
When connectivity is turned off
Then all edit actions requiring connectivity are disabled
When I click Exit without saving
Then the cached dashboard is loaded and displayed in view mode

# Scenario: The sharing dialog is open when connectivity is lost
# Given I open a cached dashboard
# When I open sharing settings
# And connectivity is turned off
# Then it is not possible to change sharing settings

Scenario: The interpretations panel is open when connectivity is lost
Given I open a cached dashboard
And I open the interpretations panel
When connectivity is turned off
Then it is not possible to interact with interpretations


Scenario: I delete the cached and uncached dashboard
Given I delete the cached and uncached dashboard
29 changes: 15 additions & 14 deletions cypress/integration/view/offline/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CACHED_DASHBOARD_TITLE = 'aa ca' + new Date().toUTCString().slice(-12, -4)

const createDashboard = cacheState => {
const cachedDashboard = cacheState === CACHED
cy.get(newButtonSel).click()
cy.get(newButtonSel, EXTENDED_TIMEOUT).click()
cy.get(titleInputSel, EXTENDED_TIMEOUT).should('be.visible')

const title = cachedDashboard
Expand All @@ -54,9 +54,6 @@ const createDashboard = cacheState => {
closeMenu()
clickEditActionButton('Save changes')
cy.get(dashboardTitleSel, EXTENDED_TIMEOUT).should('be.visible')
if (cachedDashboard) {
cacheDashboard()
}
}

const openDashboard = title => {
Expand All @@ -73,12 +70,6 @@ const enterEditMode = () => {
cy.get(titleInputSel, EXTENDED_TIMEOUT).should('be.visible')
}

const cacheDashboard = () => {
clickViewActionButton('More')
cy.contains(MAKE_AVAILABLE_OFFLINE_TEXT).click()
cy.contains(OFFLINE_DATA_LAST_UPDATED_TEXT).should('be.visible')
}

const checkCorrectMoreOptions = cacheState => {
clickViewActionButton('More')
if (cacheState === CACHED) {
Expand Down Expand Up @@ -127,14 +118,24 @@ const deleteDashboard = dashboardTitle => {

// Scenario: I cache an uncached dashboard

Given('I create a cached and uncached dashboard', () => {
createDashboard(CACHED)
Given('I create two dashboards', () => {
cy.log('create the uncached dashboard')
createDashboard(UNCACHED)
createDashboard(CACHED)
})

Then('the cached dashboard has a Last Updated time and chip icon', () => {
When('I cache one of the dashboards', () => {
openDashboard(CACHED_DASHBOARD_TITLE)
cy.contains(OFFLINE_DATA_LAST_UPDATED_TEXT).should('be.visible')
clickViewActionButton('More')
cy.contains(MAKE_AVAILABLE_OFFLINE_TEXT, EXTENDED_TIMEOUT).click()
cy.contains(OFFLINE_DATA_LAST_UPDATED_TEXT, EXTENDED_TIMEOUT).should(
'be.visible'
)
})

Then('the cached dashboard has a Last Updated time and chip icon', () => {
// openDashboard(CACHED_DASHBOARD_TITLE)
// cy.contains(OFFLINE_DATA_LAST_UPDATED_TEXT).should('be.visible')

// check that the chip has the icon
cy.get(dashboardChipSel)
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
"@dhis2/app-runtime": "^2.11.0",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-ui-core": "^7.3.2",
"@dhis2/d2-ui-interpretations": "^7.3.2",
"@dhis2/d2-ui-mentions-wrapper": "^7.3.2",
"@dhis2/d2-ui-rich-text": "^7.3.2",
"@dhis2/d2-ui-sharing-dialog": "^7.3.2",
"@dhis2/d2-ui-translation-dialog": "^7.3.2",
"@dhis2/d2-ui-core": "^7.3.3",
"@dhis2/d2-ui-interpretations": "^7.3.3",
"@dhis2/d2-ui-mentions-wrapper": "^7.3.3",
"@dhis2/d2-ui-rich-text": "^7.3.3",
"@dhis2/d2-ui-translation-dialog": "^7.3.3",
"@dhis2/data-visualizer-plugin": "^38.0.1",
"@dhis2/ui": "^6.20.0",
"classnames": "^2.3.1",
Expand Down Expand Up @@ -50,8 +49,11 @@
"cy:run-stub": "cypress_dhis2_api_stub_mode=STUB d2-utils-cypress run --tags '@nonmutating' --appStart 'yarn cypress:start' --record",
"cy:capture": "cypress_dhis2_api_stub_mode=CAPTURE yarn d2-utils-cypress run --appStart 'yarn cypress:start'"
},
"resolutions": {
"@dhis2/ui": "6.20.0"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "^7.6.0",
"@dhis2/cli-app-scripts": "^7.6.2",
"@dhis2/cli-style": "^9.1.0",
"@dhis2/cli-utils-cypress": "^7.0.1",
"@dhis2/cypress-commands": "^7.0.1",
Expand Down
12 changes: 7 additions & 5 deletions src/pages/edit/ActionsBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ const EditBar = ({ dashboard, ...props }) => {
}

const onConfirmDiscard = () => {
if (props.isDirty) {
setConfirmDiscardDlgIsOpen(true)
} else {
onDiscardConfirmed()
}
// disabling dirty check in 2.37

// if (props.isDirty) {
// setConfirmDiscardDlgIsOpen(true)
// } else {
onDiscardConfirmed()
// }
}

const onDiscardConfirmed = () => {
Expand Down
Loading

0 comments on commit 5c5973f

Please sign in to comment.