Skip to content

Commit

Permalink
feat: migration
Browse files Browse the repository at this point in the history
Improved the migration page
  • Loading branch information
nnkogift committed Oct 1, 2024
1 parent 37b288f commit 93b9caf
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
22 changes: 20 additions & 2 deletions packages/app/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: 2024-10-01T09:23:10.631Z\n"
"PO-Revision-Date: 2024-10-01T09:23:10.631Z\n"
"POT-Creation-Date: 2024-10-01T11:27:30.817Z\n"
"PO-Revision-Date: 2024-10-01T11:27:30.817Z\n"

msgid "Scorecard deleted successfully"
msgstr "Scorecard deleted successfully"
Expand Down Expand Up @@ -474,6 +474,24 @@ msgid_plural "Migrate {{count}} scorecard(s)"
msgstr[0] "Migrate {{count}} scorecard(s)"
msgstr[1] "Migrate {{count}} scorecard(s)"

msgid "Migrate scorecards from v1"
msgstr "Migrate scorecards from v1"

msgid "Status"
msgstr "Status"

msgid "Success"
msgstr "Success"

msgid "Migrated"
msgstr "Migrated"

msgid "Failed"
msgstr "Failed"

msgid "Back"
msgstr "Back"

msgid "Scorecards to migrate"
msgstr "Scorecards to migrate"

Expand Down
4 changes: 2 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"@dhis2/app-service-datastore": "^1.0.0-alpha.2",
"@dhis2/multi-calendar-dates": "^1.2.4",
"@dhis2/ui": "^9.11.0",
"@hisptz/dhis2-analytics": "^2.0.30",
"@hisptz/dhis2-ui": "^2.0.23",
"@hisptz/dhis2-analytics": "^2.0.32",
"@hisptz/dhis2-ui": "^2.0.25",
"@hisptz/dhis2-utils": "^2.0.5",
"@hookform/resolvers": "^3.9.0",
"@iapps/function-analytics": "^1.0.0-beta.23",
Expand Down
6 changes: 6 additions & 0 deletions packages/app/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@
"Migrating scorecard(s)... ({{progress}}/{{count}})_plural": "Migrating scorecard(s)... ({{progress}}/{{count}})",
"Migrate {{count}} scorecard(s)": "Migrate {{count}} scorecard(s)",
"Migrate {{count}} scorecard(s)_plural": "Migrate {{count}} scorecard(s)",
"Migrate scorecards from v1": "Migrate scorecards from v1",
"Status": "Status",
"Success": "Success",
"Migrated": "Migrated",
"Failed": "Failed",
"Back": "Back",
"Scorecards to migrate": "Scorecards to migrate",
"Select the scorecards configuration that you would like to migrate": "Select the scorecards configuration that you would like to migrate",
"Getting your scorecard configuration...": "Getting your scorecard configuration...",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useOldScorecards } from "../hooks/data";
import { FullPageError } from "@scorecard/shared";
import { CircularLoader, Tag } from "@dhis2/ui";
import { SimpleDataTable, SimpleDataTableColumn } from "@hisptz/dhis2-ui";
import { SimpleDataTable, SimpleDataTableColumn, SimpleDataTableRow } from "@hisptz/dhis2-ui";
import i18n from "@dhis2/d2-i18n";
import { useEffect, useMemo, useState } from "react";
import { fromPairs, get, uniq } from "lodash";
Expand Down Expand Up @@ -37,7 +37,9 @@ export function OldScorecardList() {
};

const onAdd = (values: string[]) => {
setSelectedConfig((prevState) => uniq([...prevState, ...values]));
setSelectedConfig((prevState) => {
return uniq([...prevState, ...values]).filter((value) => !["EXISTS", "SUCCESS"].includes(get(progress, value)));
});
};

const getStatus = (status?: "SUCCESS" | "EXISTS" | "FAILED") => {
Expand All @@ -54,6 +56,7 @@ export function OldScorecardList() {
};

const rows = useMemo(() => scorecards?.map((config) => {
const selectable = !["EXISTS", "SUCCESS"].includes(get(progress, config.id));

return {
id: config.id,
Expand All @@ -62,9 +65,9 @@ export function OldScorecardList() {
status: getStatus(get(progress, config.id)),
cellsStyle: {
bordered: true,
selectable: get(progress, config.id) === "EXISTS"
disableSelection: !selectable
}
};
} as SimpleDataTableRow;
}) ?? [], [scorecards]);

useEffect(() => {
Expand Down
34 changes: 17 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2933,15 +2933,15 @@
dependencies:
"@hapi/hoek" "^9.0.0"

"@hisptz/dhis2-analytics@^2.0.30":
version "2.0.30"
resolved "https://registry.yarnpkg.com/@hisptz/dhis2-analytics/-/dhis2-analytics-2.0.30.tgz#c72c7bcf0482555b6fe6ef30ac09b0e04907dec0"
integrity sha512-oauHazfBDZI3N5g9GtquQY1rAbbBd8YbGjg18lo9mBDywUkwbCxDxTdzZoWEd9MJSO5vtAAQjlWj3Tojr7r6+A==
"@hisptz/dhis2-analytics@^2.0.32":
version "2.0.32"
resolved "https://registry.yarnpkg.com/@hisptz/dhis2-analytics/-/dhis2-analytics-2.0.32.tgz#011fdf78e499a6f709ecc5dd1d54284688d3d34f"
integrity sha512-uyRhEuGHvU1nU/JIoatLa/imybPooVhQZO3F3GVxd1dLUNoKEoKRD0vmAymzFwVsr5Bgq9qQHgqiS59L9XmKxg==
dependencies:
"@dnd-kit/core" "^6.1.0"
"@dnd-kit/utilities" "^3.2.2"
"@hisptz/dhis2-ui" "2.0.23"
"@hisptz/dhis2-utils" "2.0.7"
"@hisptz/dhis2-ui" "2.0.25"
"@hisptz/dhis2-utils" "2.0.8"
"@react-leaflet/core" "^2.1.0"
"@tanstack/react-table" "^8.19.3"
d3-color "^3.1.0"
Expand All @@ -2963,7 +2963,7 @@
zod "^3.23.8"

"@hisptz/dhis2-analytics@file:../dhis2-utils-v2/packages/analytics":
version "2.0.30"
version "2.0.32"
dependencies:
"@dnd-kit/core" "^6.1.0"
"@dnd-kit/utilities" "^3.2.2"
Expand All @@ -2989,12 +2989,10 @@
screenfull "^6.0.2"
zod "^3.23.8"

"@hisptz/[email protected]", "@hisptz/dhis2-ui@^2.0.23":
version "2.0.23"
resolved "https://registry.yarnpkg.com/@hisptz/dhis2-ui/-/dhis2-ui-2.0.23.tgz#699bbfa03ed9235c220caacb9682645e54d215a2"
integrity sha512-TJgPnEh0uuJzErS59bBmU9ylj5ydOVIL16RtcBMKcWk6uX3B6QCESdLTVKCfuJj6L/0ukRyDFNlVFKrzm2qfOg==
"@hisptz/[email protected]", "@hisptz/dhis2-ui@file:../dhis2-utils-v2/packages/ui":
version "2.0.25"
dependencies:
"@hisptz/dhis2-utils" "2.0.7"
"@hisptz/dhis2-utils" "workspace:*"
classnames "^2.5.1"
dexie "^3.2.3"
jodit-react "^1.3.39"
Expand All @@ -3008,10 +3006,12 @@
styled-components "^6.1.8"
usehooks-ts "^2.9.2"

"@hisptz/dhis2-ui@file:../dhis2-utils-v2/packages/ui":
version "2.0.23"
"@hisptz/dhis2-ui@^2.0.25":
version "2.0.25"
resolved "https://registry.yarnpkg.com/@hisptz/dhis2-ui/-/dhis2-ui-2.0.25.tgz#3c295c949f045cfdd05b4ad712e88b3a11d46240"
integrity sha512-t6G98mJSgGY0XcMulRqqxo6KVibrvXbBSYKyBDVvV2nqD2DBEKLCi/uKotOHq53txYOGgv0aOh8wWZo5SkT8rw==
dependencies:
"@hisptz/dhis2-utils" "workspace:*"
"@hisptz/dhis2-utils" "2.0.8"
classnames "^2.5.1"
dexie "^3.2.3"
jodit-react "^1.3.39"
Expand Down Expand Up @@ -3051,8 +3051,8 @@
dependencies:
luxon "^3.4.4"

"@hisptz/[email protected].7", "@hisptz/dhis2-utils@file:../dhis2-utils-v2/packages/utils":
version "2.0.7"
"@hisptz/[email protected].8", "@hisptz/dhis2-utils@file:../dhis2-utils-v2/packages/utils":
version "2.0.8"
dependencies:
"@dhis2/multi-calendar-dates" "^1.2.4"
luxon "^3.4.4"
Expand Down

0 comments on commit 93b9caf

Please sign in to comment.