Skip to content

Commit

Permalink
chore: remove technical dept (#1082)
Browse files Browse the repository at this point in the history
* refactor: add current user provider

* chore: add required properties to current user provider

* refactor: rewrite section navigation and home components

* refactor: replace all usage of the old current user hook by the new one

* refactor: move new use current user hook to hooks folder

* refactor: remove all usage of api

* chore: remove console.log and prop error

* refactor: remove unused files

* chore: cleanup unused deps

* chore: fix jest test suite

* chore: fix cypress test suite

* chore: update network fixtures and test against 2.40
  • Loading branch information
HendrikThePendric authored Nov 17, 2022
1 parent e049d37 commit ede7365
Show file tree
Hide file tree
Showing 68 changed files with 3,170 additions and 6,245 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_dhis2BaseUrl: http://localhost:8080
CYPRESS_dhis2ApiVersion: 38
CYPRESS_dhis2ApiVersion: 40
CYPRESS_networkMode: stub

release:
Expand Down
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dhis2Password": "district",
"dhis2DataTestPrefix": "",
"networkMode": "live",
"dhis2ApiVersion": "38"
"dhis2ApiVersion": "40"
},
"testFiles": "**/*.feature",
"ignoreTestFiles": ["**/*-wip/*.feature"],
Expand Down

This file was deleted.

488 changes: 0 additions & 488 deletions cypress/fixtures/network/38/static_resources.json

This file was deleted.

20 changes: 5 additions & 15 deletions cypress/fixtures/network/38/summary.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
{
"count": 662,
"totalResponseSize": 780349,
"duplicates": 514,
"nonDeterministicResponses": 55,
"count": 0,
"totalResponseSize": 0,
"duplicates": 0,
"nonDeterministicResponses": 0,
"apiVersion": "38",
"fixtureFiles": [
"static_resources.json",
"show_tiles_with_list_and_add_action_to_all_available_sections.json",
"the_app_has_a_main_navigation.json",
"user_groups_can_be_listed.json",
"the_user_group_list_can_be_searched.json",
"user_roles_can_be_listed.json",
"the_user_role_list_can_be_searched.json",
"users_can_be_listed.json",
"the_user_list_can_be_searched.json"
]
"fixtureFiles": []
}
444 changes: 0 additions & 444 deletions cypress/fixtures/network/38/the_app_has_a_main_navigation.json

This file was deleted.

508 changes: 0 additions & 508 deletions cypress/fixtures/network/38/the_user_group_list_can_be_searched.json

This file was deleted.

760 changes: 0 additions & 760 deletions cypress/fixtures/network/38/the_user_list_can_be_searched.json

This file was deleted.

475 changes: 0 additions & 475 deletions cypress/fixtures/network/38/the_user_role_list_can_be_searched.json

This file was deleted.

444 changes: 0 additions & 444 deletions cypress/fixtures/network/38/user_groups_can_be_listed.json

This file was deleted.

444 changes: 0 additions & 444 deletions cypress/fixtures/network/38/user_roles_can_be_listed.json

This file was deleted.

444 changes: 0 additions & 444 deletions cypress/fixtures/network/38/users_can_be_listed.json

This file was deleted.

Large diffs are not rendered by default.

358 changes: 358 additions & 0 deletions cypress/fixtures/network/40/static_resources.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions cypress/fixtures/network/40/summary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"count": 337,
"totalResponseSize": 213240,
"duplicates": 263,
"nonDeterministicResponses": 24,
"apiVersion": "40",
"fixtureFiles": [
"static_resources.json",
"show_tiles_with_list_and_add_action_to_all_available_sections.json",
"the_app_has_a_main_navigation.json",
"user_groups_can_be_listed.json",
"the_user_group_list_can_be_searched.json",
"user_roles_can_be_listed.json",
"the_user_role_list_can_be_searched.json",
"users_can_be_listed.json",
"the_user_list_can_be_searched.json"
]
}
172 changes: 172 additions & 0 deletions cypress/fixtures/network/40/the_app_has_a_main_navigation.json

Large diffs are not rendered by default.

273 changes: 273 additions & 0 deletions cypress/fixtures/network/40/the_user_group_list_can_be_searched.json

Large diffs are not rendered by default.

439 changes: 439 additions & 0 deletions cypress/fixtures/network/40/the_user_list_can_be_searched.json

Large diffs are not rendered by default.

205 changes: 205 additions & 0 deletions cypress/fixtures/network/40/the_user_role_list_can_be_searched.json

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions cypress/fixtures/network/40/user_groups_can_be_listed.json

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions cypress/fixtures/network/40/user_roles_can_be_listed.json

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions cypress/fixtures/network/40/users_can_be_listed.json

Large diffs are not rendered by default.

57 changes: 24 additions & 33 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: 2022-06-13T10:12:52.361Z\n"
"PO-Revision-Date: 2022-06-13T10:12:52.361Z\n"
"POT-Creation-Date: 2022-11-16T12:36:05.591Z\n"
"PO-Revision-Date: 2022-11-16T12:36:05.591Z\n"

msgid "Yes"
msgstr "Yes"
Expand Down Expand Up @@ -53,6 +53,12 @@ msgstr "Will be added"
msgid "Will be removed"
msgstr "Will be removed"

msgid "Network error"
msgstr "Network error"

msgid "Could not load current user information."
msgstr "Could not load current user information."

msgid "Filter options"
msgstr "Filter options"

Expand Down Expand Up @@ -435,11 +441,17 @@ msgstr "Apply"
msgid "Clear all"
msgstr "Clear all"

msgid "There was an error loading the current user"
msgstr "There was an error loading the current user"
msgid "Insufficient permissions"
msgstr "Insufficient permissions"

msgid "You do not have access to any section of the DHIS 2 User Management App"
msgstr "You do not have access to any section of the DHIS 2 User Management App"

msgid "User role"
msgstr "User role"

msgid "You do not have authorities to see users, user roles or user groups"
msgstr "You do not have authorities to see users, user roles or user groups"
msgid "User group"
msgstr "User group"

msgid "Analytics dimension restrictions"
msgstr "Analytics dimension restrictions"
Expand Down Expand Up @@ -619,21 +631,6 @@ msgstr "Passwords do not match"
msgid "Please provide a value"
msgstr "Please provide a value"

msgid "Create, modify, view and delete Users"
msgstr "Create, modify, view and delete Users"

msgid "User role"
msgstr "User role"

msgid "Create, modify, view and delete User Roles"
msgstr "Create, modify, view and delete User Roles"

msgid "User group"
msgstr "User group"

msgid "Create, modify, view and delete User Groups"
msgstr "Create, modify, view and delete User Groups"

msgid "New group"
msgstr "New group"

Expand Down Expand Up @@ -778,26 +775,20 @@ msgstr "Actions"
msgid "Member"
msgstr "Member"

msgid "Insufficient permissions"
msgstr "Insufficient permissions"

msgid "You do not have access to any section of the DHIS 2 User Management App"
msgstr "You do not have access to any section of the DHIS 2 User Management App"

msgid "List"
msgstr "List"

msgid "Add"
msgstr "Add"

msgid "Page not found."
msgstr "Page not found."
msgid "Create, modify, view and delete Users"
msgstr "Create, modify, view and delete Users"

msgid "No match for"
msgstr "No match for"
msgid "Create, modify, view and delete User Roles"
msgstr "Create, modify, view and delete User Roles"

msgid "Go back home"
msgstr "Go back home"
msgid "Create, modify, view and delete User Groups"
msgstr "Create, modify, view and delete User Groups"

msgid "Edit user role"
msgstr "Edit user role"
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,15 @@
},
"dependencies": {
"@dhis2/app-runtime": "^3.4.0",
"@dhis2/app-runtime-adapter-d2": "^1.0.2",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/ui": "^8.4.17",
"classnames": "^2.3.1",
"d2": "^31.7.0",
"lodash-es": "^4.17.21",
"memoize-one": "^6.0.0",
"p-debounce": "^4.0.0",
"query-string": "^7.0.1",
"react-redux": "^7.2.5",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"redux": "^4.1.1",
"redux-thunk": "^2.2.0",
"rxjs": "^5.5.6",
"use-debounce": "^7.0.0",
"use-query-params": "^1.2.3"
},
Expand Down
14 changes: 6 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import React from 'react'
import { Router, Route } from 'react-router-dom'
import { QueryParamProvider } from 'use-query-params'
import SectionLoader from './components/SectionLoader.js'
import SectionNavigation from './components/SectionNavigation.js'
import history from './utils/history.js'

/**
* Main Component
* @class
*/
const App = () => (
<>
<Router history={history} hashType={'noslash'}>
<QueryParamProvider ReactRouterRoute={Route}>
<SectionLoader />
</QueryParamProvider>
</Router>
</>
<Router history={history} hashType={'noslash'}>
<QueryParamProvider ReactRouterRoute={Route}>
<SectionNavigation />
</QueryParamProvider>
</Router>
)

export default App
49 changes: 9 additions & 40 deletions src/AppWrapper.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,15 @@
import './locales/index.js'

import { useD2 } from '@dhis2/app-runtime-adapter-d2'
import { CenteredContent, CircularLoader, CssVariables } from '@dhis2/ui'
import { CssVariables } from '@dhis2/ui'
import React from 'react'
import { Provider } from 'react-redux'
import api from './api/index.js'
import App from './App.js'
import store from './store.js'

const AppWrapper = () => {
const { d2 } = useD2({
d2Config: {
schemas: [
'userRole',
'user',
'userGroup',
'userCredentials',
'organisationUnit',
],
},
i18nRoot: './d2i18n',
onInitialized: (d2) => {
api.init(d2)
},
})

if (!d2) {
return (
<CenteredContent>
<CircularLoader />
</CenteredContent>
)
}

return (
<>
<CssVariables spacers colors theme />
<Provider store={store}>
<App />
</Provider>
</>
)
}
import { CurrentUserProvider } from './components/CurrentUserProvider.js'

const AppWrapper = () => (
<CurrentUserProvider>
<CssVariables spacers colors theme />
<App />
</CurrentUserProvider>
)

export default AppWrapper
78 changes: 0 additions & 78 deletions src/actions/index.js

This file was deleted.

Loading

0 comments on commit ede7365

Please sign in to comment.