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: add edit sequence route #550

Merged
merged 31 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5f69e98
feat: add use sequence by id hook
Jul 6, 2023
c2ee916
chore: add edit sequence page base
Jul 18, 2023
ef405a7
chore: add sequence edit form base
Jul 18, 2023
af295be
chore: add sequence edit route
Jul 18, 2023
ef22859
chore: add sequence edit form container export
Jul 18, 2023
492fe47
chore: update edit sequence form container
Jul 18, 2023
22023bc
chore(translations): update translations
Jul 19, 2023
73d116b
chore: add selected values to existing queueables
Jul 19, 2023
d886a42
chore: collapse sequence order field to single component
Jul 19, 2023
ff41bf0
style: fix formatting
Jul 19, 2023
ea27c28
chore: fix linting errors
Jul 19, 2023
6357c1a
chore: rename selectedValues
Jul 20, 2023
0855bb0
chore: remove placeholder tests
Jul 20, 2023
859a564
chore: simplify construction of options
Jul 25, 2023
716d6b2
fix: remove lifting of pristine state
Jul 26, 2023
4e7019c
chore: add update queue hook
Jul 26, 2023
f9f7fc8
fix: remove unnecessary test
Jul 26, 2023
ea3f7ca
chore: remove top back to overview button
Jul 27, 2023
bc9798e
test: add sequence edit test
Jul 27, 2023
dc442ad
test: add update queue test
Jul 27, 2023
063cb05
test: add integration tests for edit route
Aug 1, 2023
4f73882
chore: align sequence edit title with job edit title
Aug 2, 2023
88275a1
chore: add delete sequence button
Aug 2, 2023
e05c981
test: add delete sequence modal test
Aug 2, 2023
633f285
test: add delete sequence button test
Aug 2, 2023
3618816
test: add sequence edit form container test
Aug 2, 2023
d2fae00
chore: add translations
Aug 3, 2023
b878dcd
fix: add missing history import
Aug 3, 2023
d852cec
fix: use correct endpoint for delete
Aug 3, 2023
d1ecf3b
refactor: simplify creation of initialValues
Aug 3, 2023
9a1c5c2
fix: use correct endpoint for update
Aug 8, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
{
"name": "one",
"type": "Sequence",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "RWcaltWoKuN",
"name": "1",
"type": "DATA_INTEGRITY",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
},
{
"id": "p2HCjnAmSNE",
"name": "2",
"type": "MONITORING",
"status": "SCHEDULED"
}
]
},
{
"name": "3",
"type": "DISABLE_INACTIVE_USERS",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "xkxSSOLKc7X",
"name": "3",
"type": "DISABLE_INACTIVE_USERS",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
}
]
},
{
"name": "4",
"type": "MATERIALIZED_SQL_VIEW_UPDATE",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "RRKO5XbxBz4",
"name": "4",
"type": "MATERIALIZED_SQL_VIEW_UPDATE",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
}
]
}
]
27 changes: 27 additions & 0 deletions cypress/fixtures/edit-sequence/sequence.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"name": "one",
"type": "Sequence",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "RWcaltWoKuN",
"name": "1",
"type": "DATA_INTEGRITY",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
},
{
"id": "p2HCjnAmSNE",
"name": "2",
"type": "MONITORING",
"status": "SCHEDULED"
}
]
}
]
40 changes: 40 additions & 0 deletions cypress/fixtures/edit-sequence/two-unqueued-jobs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"name": "3",
"type": "DISABLE_INACTIVE_USERS",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "xkxSSOLKc7X",
"name": "3",
"type": "DISABLE_INACTIVE_USERS",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
}
]
},
{
"name": "4",
"type": "MATERIALIZED_SQL_VIEW_UPDATE",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "RRKO5XbxBz4",
"name": "4",
"type": "MATERIALIZED_SQL_VIEW_UPDATE",
"cronExpression": "0 0 3 ? * MON",
"nextExecutionTime": "2023-08-07T03:00:00.000",
"status": "SCHEDULED"
}
]
}
]
234 changes: 117 additions & 117 deletions cypress/fixtures/network/41/static_resources.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions cypress/fixtures/network/41/summary.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"count": 994,
"totalResponseSize": 1015719,
"duplicates": 884,
"count": 951,
"totalResponseSize": 1022634,
"duplicates": 840,
"nonDeterministicResponses": 91,
"apiVersion": "41",
"fixtureFiles": [
Expand All @@ -16,6 +16,7 @@
"users_should_be_able_to_view_jobs.json",
"users_should_be_able_to_edit_jobs_that_take_parameters.json",
"users_should_be_able_to_edit_jobs_without_parameters.json",
"users_should_be_able_to_edit_a_sequence.json",
"jobs_can_be_filtered.json",
"system_job_visibility_can_be_toggled.json",
"user_jobs_can_be_enabled_and_disabled.json",
Expand Down
28 changes: 14 additions & 14 deletions cypress/fixtures/network/41/user_job_actions.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"sec-fetch-mode": "cors"
},
"statusCode": 200,
"responseBody": "[{\"name\":\"User account expiry alert\",\"type\":\"ACCOUNT_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"fUWM1At1TUx\",\"name\":\"User account expiry alert\",\"type\":\"ACCOUNT_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"File resource clean up\",\"type\":\"FILE_RESOURCE_CLEANUP\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"pd6O228pqr0\",\"name\":\"File resource clean up\",\"type\":\"FILE_RESOURCE_CLEANUP\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Data statistics\",\"type\":\"DATA_STATISTICS\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"BFa3jDsbtdO\",\"name\":\"Data statistics\",\"type\":\"DATA_STATISTICS\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Remove expired or used reserved values\",\"type\":\"REMOVE_USED_OR_EXPIRED_RESERVED_VALUES\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"uwWCT2BMmlq\",\"name\":\"Remove expired or used reserved values\",\"type\":\"REMOVE_USED_OR_EXPIRED_RESERVED_VALUES\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Dataset notification\",\"type\":\"DATA_SET_NOTIFICATION\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"YvAwAmrqAtN\",\"name\":\"Dataset notification\",\"type\":\"DATA_SET_NOTIFICATION\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Remove lock exceptions older than 6 months\",\"type\":\"LOCK_EXCEPTION_CLEANUP\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":true,\"sequence\":[{\"id\":\"OQ9KeLgqy20\",\"name\":\"Remove lock exceptions older than 6 months\",\"type\":\"LOCK_EXCEPTION_CLEANUP\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Credentials expiry alert\",\"type\":\"CREDENTIALS_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"sHMedQF7VYa\",\"name\":\"Credentials expiry alert\",\"type\":\"CREDENTIALS_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-06-20T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"System version update check notification\",\"type\":\"SYSTEM_VERSION_UPDATE_CHECK\",\"cronExpression\":\"44 8 3 ? * *\",\"nextExecutionTime\":\"2023-06-20T03:08:44.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"vt21671bgno\",\"name\":\"System version update check notification\",\"type\":\"SYSTEM_VERSION_UPDATE_CHECK\",\"cronExpression\":\"44 8 3 ? * *\",\"nextExecutionTime\":\"2023-06-20T03:08:44.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Validation result notification\",\"type\":\"VALIDATION_RESULTS_NOTIFICATION\",\"cronExpression\":\"0 0 7 * * ?\",\"nextExecutionTime\":\"2023-06-20T07:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"Js3vHn2AVuG\",\"name\":\"Validation result notification\",\"type\":\"VALIDATION_RESULTS_NOTIFICATION\",\"cronExpression\":\"0 0 7 * * ?\",\"nextExecutionTime\":\"2023-06-20T07:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"2\",\"type\":\"RESOURCE_TABLE\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":true,\"sequence\":[{\"id\":\"vFpCA8dV8cT\",\"name\":\"2\",\"type\":\"RESOURCE_TABLE\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"1\",\"type\":\"PROGRAM_NOTIFICATIONS\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":true,\"sequence\":[{\"id\":\"TMddx5FxNgF\",\"name\":\"1\",\"type\":\"PROGRAM_NOTIFICATIONS\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Queue\",\"type\":\"Sequence\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":true,\"sequence\":[{\"id\":\"baeT2xCyDlW\",\"name\":\"123\",\"type\":\"LOCK_EXCEPTION_CLEANUP\",\"cronExpression\":\"0 0 3 ? * MON\",\"nextExecutionTime\":\"2023-06-26T03:00:00.000\",\"status\":\"SCHEDULED\"},{\"id\":\"Nx6d0HgSi5l\",\"name\":\"asdf\",\"type\":\"EVENT_PROGRAMS_DATA_SYNC\",\"status\":\"SCHEDULED\"}]}]",
"responseSize": 4859,
"responseBody": "[{\"name\":\"User account expiry alert\",\"type\":\"ACCOUNT_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"fUWM1At1TUx\",\"name\":\"User account expiry alert\",\"type\":\"ACCOUNT_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"File resource clean up\",\"type\":\"FILE_RESOURCE_CLEANUP\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"pd6O228pqr0\",\"name\":\"File resource clean up\",\"type\":\"FILE_RESOURCE_CLEANUP\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Data statistics\",\"type\":\"DATA_STATISTICS\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"BFa3jDsbtdO\",\"name\":\"Data statistics\",\"type\":\"DATA_STATISTICS\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Remove expired or used reserved values\",\"type\":\"REMOVE_USED_OR_EXPIRED_RESERVED_VALUES\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"uwWCT2BMmlq\",\"name\":\"Remove expired or used reserved values\",\"type\":\"REMOVE_USED_OR_EXPIRED_RESERVED_VALUES\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Dataset notification\",\"type\":\"DATA_SET_NOTIFICATION\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"YvAwAmrqAtN\",\"name\":\"Dataset notification\",\"type\":\"DATA_SET_NOTIFICATION\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Remove lock exceptions older than 6 months\",\"type\":\"LOCK_EXCEPTION_CLEANUP\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":true,\"sequence\":[{\"id\":\"OQ9KeLgqy20\",\"name\":\"Remove lock exceptions older than 6 months\",\"type\":\"LOCK_EXCEPTION_CLEANUP\",\"cronExpression\":\"0 0 2 ? * *\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Credentials expiry alert\",\"type\":\"CREDENTIALS_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"sHMedQF7VYa\",\"name\":\"Credentials expiry alert\",\"type\":\"CREDENTIALS_EXPIRY_ALERT\",\"cronExpression\":\"0 0 2 * * ?\",\"nextExecutionTime\":\"2023-08-02T02:00:00.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"System version update check notification\",\"type\":\"SYSTEM_VERSION_UPDATE_CHECK\",\"cronExpression\":\"44 8 3 ? * *\",\"nextExecutionTime\":\"2023-08-02T03:08:44.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"vt21671bgno\",\"name\":\"System version update check notification\",\"type\":\"SYSTEM_VERSION_UPDATE_CHECK\",\"cronExpression\":\"44 8 3 ? * *\",\"nextExecutionTime\":\"2023-08-02T03:08:44.000\",\"status\":\"SCHEDULED\"}]},{\"name\":\"Validation result notification\",\"type\":\"VALIDATION_RESULTS_NOTIFICATION\",\"cronExpression\":\"0 0 7 * * ?\",\"nextExecutionTime\":\"2023-08-02T07:00:00.000\",\"status\":\"SCHEDULED\",\"enabled\":true,\"configurable\":false,\"sequence\":[{\"id\":\"Js3vHn2AVuG\",\"name\":\"Validation result notification\",\"type\":\"VALIDATION_RESULTS_NOTIFICATION\",\"cronExpression\":\"0 0 7 * * ?\",\"nextExecutionTime\":\"2023-08-02T07:00:00.000\",\"status\":\"SCHEDULED\"}]}]",
"responseSize": 3724,
"responseHeaders": {
"server": "nginx/1.23.0",
"content-type": "application/json;charset=UTF-8",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"path": "/api/41/systemSettings/helpPageLink",
"featureName": "Users should be able to edit a sequence",
"static": false,
"count": 1,
"nonDeterministic": false,
"method": "GET",
"requestBody": "",
"requestHeaders": {
"host": "debug.dhis2.org",
"connection": "keep-alive",
"accept": "application/json",
"origin": "http://localhost:3000",
"sec-fetch-site": "cross-site",
"sec-fetch-mode": "cors"
},
"statusCode": 200,
"responseBody": "{\"helpPageLink\":\"https://dhis2.github.io/dhis2-docs/master/en/user/html/dhis2_user_manual_en.html\"}",
"responseSize": 99,
"responseHeaders": {
"server": "nginx/1.23.0",
"content-type": "application/json;charset=UTF-8",
"transfer-encoding": "chunked",
"connection": "keep-alive",
"access-control-allow-credentials": "true",
"access-control-allow-origin": "http://localhost:3000",
"vary": "Origin",
"access-control-expose-headers": "ETag, Location",
"cache-control": "no-cache, private",
"x-content-type-options": "nosniff",
"x-xss-protection": "1; mode=block"
}
}
]
Loading