diff --git a/.eslintrc.json b/.eslintrc.json index 7932fc6..f6eeb38 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -57,9 +57,13 @@ "testing-library/no-await-sync-query": "error", "testing-library/prefer-screen-queries": "off", "testing-library/no-debugging-utils": "off", - "testing-library/no-dom-import": "off" + "testing-library/no-dom-import": "off", + "no-relative-import-paths/no-relative-import-paths": [ + "error", + { "allowSameFolder": true, "rootDir": "src", "prefix": "$" } + ] }, - "plugins": ["@typescript-eslint", "react-hooks", "unused-imports"], + "plugins": ["@typescript-eslint", "react-hooks", "no-relative-import-paths", "unused-imports"], "env": {}, "parserOptions": { "project": "./tsconfig.json" diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..be9f93b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.preferences.importModuleSpecifier": "non-relative" +} diff --git a/i18n/en.pot b/i18n/en.pot index 381c725..545af00 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -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-04-19T12:52:35.588Z\n" -"PO-Revision-Date: 2024-04-19T12:52:35.589Z\n" +"POT-Creation-Date: 2024-05-15T07:48:56.601Z\n" +"PO-Revision-Date: 2024-05-15T07:48:56.602Z\n" msgid "ID" msgstr "" @@ -89,6 +89,12 @@ msgstr "" msgid "New Data Quality Report" msgstr "" +msgid "Add" +msgstr "" + +msgid "List" +msgstr "" + msgid "Name" msgstr "" @@ -235,6 +241,12 @@ msgstr "" msgid "Yes, {{actionButton}}" msgstr "" +msgid "Hello {{name}}" +msgstr "" + +msgid "Detail page" +msgstr "" + msgid "Progress" msgstr "" diff --git a/i18n/es.po b/i18n/es.po index 993baa4..c4a35f1 100644 --- a/i18n/es.po +++ b/i18n/es.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-04-19T12:52:35.588Z\n" +"POT-Creation-Date: 2024-05-15T07:48:56.601Z\n" "PO-Revision-Date: 2018-10-25T09:02:35.143Z\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -89,6 +89,12 @@ msgstr "" msgid "New Data Quality Report" msgstr "" +msgid "Add" +msgstr "Añadir" + +msgid "List" +msgstr "Listar" + msgid "Name" msgstr "" @@ -235,17 +241,14 @@ msgstr "" msgid "Yes, {{actionButton}}" msgstr "" +msgid "Hello {{name}}" +msgstr "Hola {{name}}" + +msgid "Detail page" +msgstr "" + msgid "Progress" msgstr "" msgid "Last Modification" msgstr "" - -#~ msgid "Add" -#~ msgstr "Añadir" - -#~ msgid "List" -#~ msgstr "Listar" - -#~ msgid "Hello {{name}}" -#~ msgstr "Hola {{name}}" diff --git a/package.json b/package.json index 3d543e6..8389ffa 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "dependencies": { "$": "link:./src", "@dhis2/app-runtime": "2.8.0", - "@dhis2/d2-i18n": "1.1.3", "@dhis2/d2-i18n-extract": "1.0.8", "@dhis2/d2-i18n-generate": "1.2.0", + "@dhis2/d2-i18n": "1.1.3", "@dhis2/ui": "6.12.0", "@eyeseetea/d2-api": "1.14.0", "@eyeseetea/d2-logger": "1.0.0", @@ -25,15 +25,16 @@ "@material-ui/lab": "4.0.0-alpha.60", "@material-ui/styles": "4.11.5", "classnames": "2.5.1", - "d2": "31.10.2", "d2-manifest": "1.0.0", + "d2": "31.10.2", + "eslint-plugin-no-relative-import-paths": "^1.5.3", "font-awesome": "4.7.0", "lodash": "4.17.21", - "purify-ts": "2.0.3", "purify-ts-extra-codec": "0.6.0", - "react": "^18.2.0", + "purify-ts": "2.0.3", "react-dom": "^18.2.0", "react-router-dom": "5.2.0", + "react": "^18.2.0", "real-cancellable-promise": "^1.1.2", "styled-components": "5.3.5", "styled-jsx": "3.4.5", diff --git a/src/data/api-futures.ts b/src/data/api-futures.ts index 577870c..502ffe7 100644 --- a/src/data/api-futures.ts +++ b/src/data/api-futures.ts @@ -1,5 +1,5 @@ -import { Future } from "../domain/entities/generic/Future"; -import { CancelableResponse } from "../types/d2-api"; +import { Future } from "$/domain/entities/generic/Future"; +import { CancelableResponse } from "$/types/d2-api"; export type FutureData = Future; diff --git a/src/data/common/D2CategoryOption.ts b/src/data/common/D2CategoryOption.ts index d67f1e6..6f3cb26 100644 --- a/src/data/common/D2CategoryOption.ts +++ b/src/data/common/D2CategoryOption.ts @@ -1,8 +1,8 @@ -import { D2Api } from "../../types/d2-api"; -import { FutureData, apiToFuture } from "../api-futures"; -import { Id } from "../../domain/entities/Ref"; -import _ from "../../domain/entities/generic/Collection"; -import { CategoryOption } from "../../domain/entities/CategoryOption"; +import { D2Api } from "$/types/d2-api"; +import { FutureData, apiToFuture } from "$/data/api-futures"; +import { Id } from "$/domain/entities/Ref"; +import _ from "$/domain/entities/generic/Collection"; +import { CategoryOption } from "$/domain/entities/CategoryOption"; import { Maybe } from "$/utils/ts-utils"; export class D2CategoryOption { diff --git a/src/data/common/D2Country.ts b/src/data/common/D2Country.ts index f87b36f..4004f80 100644 --- a/src/data/common/D2Country.ts +++ b/src/data/common/D2Country.ts @@ -1,5 +1,5 @@ import { D2Api } from "$/types/d2-api"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { Id } from "$/domain/entities/Ref"; import _ from "$/domain/entities/generic/Collection"; import { Country } from "$/domain/entities/Country"; diff --git a/src/data/common/D2DataElement.ts b/src/data/common/D2DataElement.ts index 6b5ce1f..aca5eb3 100644 --- a/src/data/common/D2DataElement.ts +++ b/src/data/common/D2DataElement.ts @@ -1,8 +1,8 @@ -import { D2Api } from "../../types/d2-api"; -import { FutureData, apiToFuture } from "../api-futures"; -import { Id } from "../../domain/entities/Ref"; -import _ from "../../domain/entities/generic/Collection"; -import { DataElement } from "../../domain/entities/DataElement"; +import { D2Api } from "$/types/d2-api"; +import { FutureData, apiToFuture } from "$/data/api-futures"; +import { Id } from "$/domain/entities/Ref"; +import _ from "$/domain/entities/generic/Collection"; +import { DataElement } from "$/domain/entities/DataElement"; export class D2DataElement { constructor(private api: D2Api) {} diff --git a/src/data/common/D2User.ts b/src/data/common/D2User.ts index baf455c..7714d6d 100644 --- a/src/data/common/D2User.ts +++ b/src/data/common/D2User.ts @@ -2,7 +2,7 @@ import { UserGroup } from "$/domain/entities/UserGroup"; import { Future } from "$/domain/entities/generic/Future"; import { User } from "$/domain/entities/User"; import { D2Api, MetadataPick } from "$/types/d2-api"; -import { apiToFuture, FutureData } from "../api-futures"; +import { apiToFuture, FutureData } from "$/data/api-futures"; import _ from "$/domain/entities/generic/Collection"; export class D2User { diff --git a/src/data/common/SpreadSheet.ts b/src/data/common/SpreadSheet.ts index 048a540..5723ec2 100644 --- a/src/data/common/SpreadSheet.ts +++ b/src/data/common/SpreadSheet.ts @@ -1,5 +1,5 @@ import * as XLSX from "xlsx"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; import { Future } from "$/domain/entities/generic/Future"; export interface Workbook { diff --git a/src/data/repositories/AnalysisSectionD2Repository.ts b/src/data/repositories/AnalysisSectionD2Repository.ts index adec690..884888d 100644 --- a/src/data/repositories/AnalysisSectionD2Repository.ts +++ b/src/data/repositories/AnalysisSectionD2Repository.ts @@ -2,7 +2,7 @@ import { MetadataItem } from "$/domain/entities/MetadataItem"; import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; import { Future } from "$/domain/entities/generic/Future"; import { AnalysisSectionRepository } from "$/domain/repositories/AnalysisSectionRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class AnalysisSectionD2Repository implements AnalysisSectionRepository { constructor(private metadata: MetadataItem) {} diff --git a/src/data/repositories/AnalysisSectionTestRepository.ts b/src/data/repositories/AnalysisSectionTestRepository.ts index ba8b063..13c6965 100644 --- a/src/data/repositories/AnalysisSectionTestRepository.ts +++ b/src/data/repositories/AnalysisSectionTestRepository.ts @@ -1,7 +1,7 @@ import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; import { Future } from "$/domain/entities/generic/Future"; import { AnalysisSectionRepository } from "$/domain/repositories/AnalysisSectionRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class AnalysisSectionTestRepository implements AnalysisSectionRepository { get(): FutureData { diff --git a/src/data/repositories/CountryD2Repository.ts b/src/data/repositories/CountryD2Repository.ts index 38470db..c2d2c9b 100644 --- a/src/data/repositories/CountryD2Repository.ts +++ b/src/data/repositories/CountryD2Repository.ts @@ -1,10 +1,10 @@ -import { D2Api } from "../../types/d2-api"; -import { FutureData } from "../api-futures"; -import { Id } from "../../domain/entities/Ref"; -import _ from "../../domain/entities/generic/Collection"; -import { Country } from "../../domain/entities/Country"; -import { CountryOptions, CountryRepository } from "../../domain/repositories/CountryRepository"; -import { D2OrgUnit } from "../common/D2Country"; +import { D2Api } from "$/types/d2-api"; +import { FutureData } from "$/data/api-futures"; +import { Id } from "$/domain/entities/Ref"; +import _ from "$/domain/entities/generic/Collection"; +import { Country } from "$/domain/entities/Country"; +import { CountryOptions, CountryRepository } from "$/domain/repositories/CountryRepository"; +import { D2OrgUnit } from "$/data/common/D2Country"; export class CountryD2Repository implements CountryRepository { d2Country: D2OrgUnit; diff --git a/src/data/repositories/CountryTestRepository.ts b/src/data/repositories/CountryTestRepository.ts index 269e6f6..41b3947 100644 --- a/src/data/repositories/CountryTestRepository.ts +++ b/src/data/repositories/CountryTestRepository.ts @@ -1,7 +1,7 @@ -import { FutureData } from "../api-futures"; -import _ from "../../domain/entities/generic/Collection"; -import { Country } from "../../domain/entities/Country"; -import { CountryRepository } from "../../domain/repositories/CountryRepository"; +import { FutureData } from "$/data/api-futures"; +import _ from "$/domain/entities/generic/Collection"; +import { Country } from "$/domain/entities/Country"; +import { CountryRepository } from "$/domain/repositories/CountryRepository"; import { Future } from "$/domain/entities/generic/Future"; export class CountryTestRepository implements CountryRepository { diff --git a/src/data/repositories/DataValueD2Repository.ts b/src/data/repositories/DataValueD2Repository.ts index cb53795..36c117d 100644 --- a/src/data/repositories/DataValueD2Repository.ts +++ b/src/data/repositories/DataValueD2Repository.ts @@ -4,7 +4,7 @@ import { DataValueRepository, GetDataValueOptions, } from "$/domain/repositories/DataValueRepository"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { DataValueSetsDataValue } from "@eyeseetea/d2-api/api"; export class DataValueD2Repository implements DataValueRepository { diff --git a/src/data/repositories/DataValueTestRepository.ts b/src/data/repositories/DataValueTestRepository.ts index 687fd4d..98f09df 100644 --- a/src/data/repositories/DataValueTestRepository.ts +++ b/src/data/repositories/DataValueTestRepository.ts @@ -1,6 +1,6 @@ import { DataValue } from "$/domain/entities/DataValue"; import { DataValueRepository } from "$/domain/repositories/DataValueRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; import { Future } from "$/domain/entities/generic/Future"; export class DataValueTestRepository implements DataValueRepository { diff --git a/src/data/repositories/IssueD2Repository.ts b/src/data/repositories/IssueD2Repository.ts index 9243eb7..5e26116 100644 --- a/src/data/repositories/IssueD2Repository.ts +++ b/src/data/repositories/IssueD2Repository.ts @@ -1,7 +1,7 @@ import { D2Api, D2TrackerEvent, DataValue } from "$/types/d2-api"; import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { GetIssuesOptions, IssueRepository } from "$/domain/repositories/IssueRepository"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { RowsPaginated } from "$/domain/entities/Pagination"; import { Future } from "$/domain/entities/generic/Future"; import { logger } from "$/utils/logger"; @@ -20,8 +20,8 @@ import { HashMap } from "$/domain/entities/generic/HashMap"; import { Maybe } from "$/utils/ts-utils"; import { IssueAction } from "$/domain/entities/IssueAction"; import { IssueStatus } from "$/domain/entities/IssueStatus"; -import { getDefaultModules } from "../common/D2Module"; -import { getProgramStageIndexById } from "../common/utils"; +import { getDefaultModules } from "$/data/common/D2Module"; +import { getProgramStageIndexById } from "$/data/common/utils"; export class IssueD2Repository implements IssueRepository { d2DataElement: D2DataElement; diff --git a/src/data/repositories/IssueSpreadSheetRepository.ts b/src/data/repositories/IssueSpreadSheetRepository.ts index 01cf7f9..f3219bc 100644 --- a/src/data/repositories/IssueSpreadSheetRepository.ts +++ b/src/data/repositories/IssueSpreadSheetRepository.ts @@ -5,8 +5,8 @@ import { QualityAnalysisIssueAttrs, } from "$/domain/entities/QualityAnalysisIssue"; import { IssueExportRepository } from "$/domain/repositories/IssueExportRepository"; -import { FutureData } from "../api-futures"; -import { Workbook, WorkbookSheet, exportToSpreadsheet } from "../common/SpreadSheet"; +import { FutureData } from "$/data/api-futures"; +import { Workbook, WorkbookSheet, exportToSpreadsheet } from "$/data/common/SpreadSheet"; import i18n from "$/utils/i18n"; import { MetadataItem } from "$/domain/entities/MetadataItem"; diff --git a/src/data/repositories/IssueSpreadSheetTestRepository.ts b/src/data/repositories/IssueSpreadSheetTestRepository.ts index 4c6f38d..b47e4a7 100644 --- a/src/data/repositories/IssueSpreadSheetTestRepository.ts +++ b/src/data/repositories/IssueSpreadSheetTestRepository.ts @@ -1,7 +1,7 @@ import _ from "lodash"; import { IssueExportRepository } from "$/domain/repositories/IssueExportRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; import { Future } from "$/domain/entities/generic/Future"; export class IssueSpreadSheetTestRepository implements IssueExportRepository { diff --git a/src/data/repositories/IssueTestRepository.ts b/src/data/repositories/IssueTestRepository.ts index 2ff969e..50dba56 100644 --- a/src/data/repositories/IssueTestRepository.ts +++ b/src/data/repositories/IssueTestRepository.ts @@ -1,7 +1,7 @@ import { RowsPaginated } from "$/domain/entities/Pagination"; import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { IssueRepository } from "$/domain/repositories/IssueRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class IssueTestRepository implements IssueRepository { getById(): FutureData { diff --git a/src/data/repositories/MetadataD2Repository.ts b/src/data/repositories/MetadataD2Repository.ts index 1a8f4bb..1625ab2 100644 --- a/src/data/repositories/MetadataD2Repository.ts +++ b/src/data/repositories/MetadataD2Repository.ts @@ -1,11 +1,11 @@ import _ from "lodash"; -import { D2Api, MetadataPick } from "../../types/d2-api"; -import { FutureData, apiToFuture } from "../api-futures"; -import { MetadataRepository } from "../../domain/repositories/MetadataRepository"; -import { MetadataItem } from "../../domain/entities/MetadataItem"; -import rec from "../../domain/entities/generic/Rec"; -import { Future } from "../../domain/entities/generic/Future"; +import { D2Api, MetadataPick } from "$/types/d2-api"; +import { FutureData, apiToFuture } from "$/data/api-futures"; +import { MetadataRepository } from "$/domain/repositories/MetadataRepository"; +import { MetadataItem } from "$/domain/entities/MetadataItem"; +import rec from "$/domain/entities/generic/Rec"; +import { Future } from "$/domain/entities/generic/Future"; const metadataCodes = { organisationUnits: { global: "WHO-HQ" }, diff --git a/src/data/repositories/MetadataTestRepository.ts b/src/data/repositories/MetadataTestRepository.ts index 967ac09..2084e09 100644 --- a/src/data/repositories/MetadataTestRepository.ts +++ b/src/data/repositories/MetadataTestRepository.ts @@ -1,6 +1,6 @@ -import { FutureData } from "../api-futures"; -import { MetadataRepository } from "../../domain/repositories/MetadataRepository"; -import { MetadataItem } from "../../domain/entities/MetadataItem"; +import { FutureData } from "$/data/api-futures"; +import { MetadataRepository } from "$/domain/repositories/MetadataRepository"; +import { MetadataItem } from "$/domain/entities/MetadataItem"; export class MetadataTestRepository implements MetadataRepository { get(): FutureData { diff --git a/src/data/repositories/ModuleD2Repository.ts b/src/data/repositories/ModuleD2Repository.ts index bf5a0d3..4bd636e 100644 --- a/src/data/repositories/ModuleD2Repository.ts +++ b/src/data/repositories/ModuleD2Repository.ts @@ -5,7 +5,7 @@ import { Module } from "$/domain/entities/Module"; import { ModuleRepository } from "$/domain/repositories/ModuleRepository"; import { FutureData, apiToFuture } from "$/data/api-futures"; import { Future } from "$/domain/entities/generic/Future"; -import { getDefaultModules } from "../common/D2Module"; +import { getDefaultModules } from "$/data/common/D2Module"; import { DataElement } from "$/domain/entities/DataElement"; import _ from "$/domain/entities/generic/Collection"; import { Maybe } from "$/utils/ts-utils"; diff --git a/src/data/repositories/ModuleTestRepository.ts b/src/data/repositories/ModuleTestRepository.ts index c1f3e20..9e24415 100644 --- a/src/data/repositories/ModuleTestRepository.ts +++ b/src/data/repositories/ModuleTestRepository.ts @@ -1,7 +1,7 @@ import { Module } from "$/domain/entities/Module"; import { Future } from "$/domain/entities/generic/Future"; import { ModuleRepository } from "$/domain/repositories/ModuleRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class ModuleTestRepository implements ModuleRepository { getByIds(): FutureData { diff --git a/src/data/repositories/OutlierD2Repository.ts b/src/data/repositories/OutlierD2Repository.ts index 8433dac..25c9c90 100644 --- a/src/data/repositories/OutlierD2Repository.ts +++ b/src/data/repositories/OutlierD2Repository.ts @@ -1,6 +1,6 @@ import { D2Api } from "$/types/d2-api"; import { OutlierOptions, OutlierRepository } from "$/domain/repositories/OutlierRepository"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { Id, Period } from "$/domain/entities/Ref"; import { Outlier } from "$/domain/entities/Outlier"; import { Maybe } from "$/utils/ts-utils"; diff --git a/src/data/repositories/OutlierTestRepository.ts b/src/data/repositories/OutlierTestRepository.ts index 2c8becb..7f9d471 100644 --- a/src/data/repositories/OutlierTestRepository.ts +++ b/src/data/repositories/OutlierTestRepository.ts @@ -1,6 +1,6 @@ import { Outlier } from "$/domain/entities/Outlier"; import { OutlierRepository } from "$/domain/repositories/OutlierRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class OutlierTestRepository implements OutlierRepository { export(): FutureData { diff --git a/src/data/repositories/QualityAnalysisD2Repository.ts b/src/data/repositories/QualityAnalysisD2Repository.ts index f07465d..1b2bcc9 100644 --- a/src/data/repositories/QualityAnalysisD2Repository.ts +++ b/src/data/repositories/QualityAnalysisD2Repository.ts @@ -4,38 +4,38 @@ import { D2TrackerEvent, D2Api, D2TrackerTrackedEntity, -} from "../../types/d2-api"; +} from "$/types/d2-api"; import { QualityAnalysisOptions, QualityAnalysisPaginated, QualityAnalysisRepository, -} from "../../domain/repositories/QualityAnalysisRepository"; -import { FutureData, apiToFuture } from "../api-futures"; -import { QualityAnalysis } from "../../domain/entities/QualityAnalysis"; -import { Id } from "../../domain/entities/Ref"; -import _ from "../../domain/entities/generic/Collection"; -import { HashMap } from "../../domain/entities/generic/HashMap"; -import { Maybe } from "../../utils/ts-utils"; -import { QualityAnalysisIssue } from "../../domain/entities/QualityAnalysisIssue"; -import { Future } from "../../domain/entities/generic/Future"; -import { MetadataItem, ProgramStage } from "../../domain/entities/MetadataItem"; +} from "$/domain/repositories/QualityAnalysisRepository"; +import { FutureData, apiToFuture } from "$/data/api-futures"; +import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; +import { Id } from "$/domain/entities/Ref"; +import _ from "$/domain/entities/generic/Collection"; +import { HashMap } from "$/domain/entities/generic/HashMap"; +import { Maybe } from "$/utils/ts-utils"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; +import { Future } from "$/domain/entities/generic/Future"; +import { MetadataItem, ProgramStage } from "$/domain/entities/MetadataItem"; import { QualityAnalysisStatus, qualityAnalysisStatus, -} from "../../domain/entities/QualityAnalysisStatus"; +} from "$/domain/entities/QualityAnalysisStatus"; import { Module } from "$/domain/entities/Module"; import { QualityAnalysisSection, SECTION_PENDING_STATE, -} from "../../domain/entities/QualityAnalysisSection"; -import { D2User } from "../common/D2User"; -import { D2CategoryOption } from "../common/D2CategoryOption"; -import { D2DataElement } from "../common/D2DataElement"; -import { D2OrgUnit } from "../common/D2Country"; -import { getUid } from "../../utils/uid"; +} from "$/domain/entities/QualityAnalysisSection"; +import { D2User } from "$/data/common/D2User"; +import { D2CategoryOption } from "$/data/common/D2CategoryOption"; +import { D2DataElement } from "$/data/common/D2DataElement"; +import { D2OrgUnit } from "$/data/common/D2Country"; +import { getUid } from "$/utils/uid"; import { DATA_QUALITY_NAMESPACE } from "$/domain/entities/Settings"; -import { getDefaultModules } from "../common/D2Module"; -import { getProgramStageIndexById } from "../common/utils"; +import { getDefaultModules } from "$/data/common/D2Module"; +import { getProgramStageIndexById } from "$/data/common/utils"; export class QualityAnalysisD2Repository implements QualityAnalysisRepository { d2DataElement: D2DataElement; diff --git a/src/data/repositories/QualityAnalysisTestRepository.ts b/src/data/repositories/QualityAnalysisTestRepository.ts index c7213ec..cffdc58 100644 --- a/src/data/repositories/QualityAnalysisTestRepository.ts +++ b/src/data/repositories/QualityAnalysisTestRepository.ts @@ -1,10 +1,10 @@ import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; -import { Future } from "../../domain/entities/generic/Future"; +import { Future } from "$/domain/entities/generic/Future"; import { QualityAnalysisPaginated, QualityAnalysisRepository, -} from "../../domain/repositories/QualityAnalysisRepository"; -import { FutureData } from "../api-futures"; +} from "$/domain/repositories/QualityAnalysisRepository"; +import { FutureData } from "$/data/api-futures"; export class QualityAnalysisTestRepository implements QualityAnalysisRepository { getById(): FutureData { diff --git a/src/data/repositories/SequentialD2Repository.ts b/src/data/repositories/SequentialD2Repository.ts index 4127ecc..4ea8fa5 100644 --- a/src/data/repositories/SequentialD2Repository.ts +++ b/src/data/repositories/SequentialD2Repository.ts @@ -2,7 +2,7 @@ import { D2Api } from "$/types/d2-api"; import { Sequential } from "$/domain/entities/Sequential"; import { SequentialRepository } from "$/domain/repositories/SequentialRepository"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { MetadataItem } from "$/domain/entities/MetadataItem"; import { DateISOString, Id } from "$/domain/entities/Ref"; diff --git a/src/data/repositories/SequentialTestRepository.ts b/src/data/repositories/SequentialTestRepository.ts index 53b4c96..adbd57d 100644 --- a/src/data/repositories/SequentialTestRepository.ts +++ b/src/data/repositories/SequentialTestRepository.ts @@ -1,6 +1,6 @@ import { Sequential } from "$/domain/entities/Sequential"; import { SequentialRepository } from "$/domain/repositories/SequentialRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class SequentialTestRepository implements SequentialRepository { get(): FutureData { diff --git a/src/data/repositories/SettingsTestRepository.ts b/src/data/repositories/SettingsTestRepository.ts index 67e08d6..f44bce6 100644 --- a/src/data/repositories/SettingsTestRepository.ts +++ b/src/data/repositories/SettingsTestRepository.ts @@ -1,6 +1,6 @@ -import { Settings } from "../../domain/entities/Settings"; -import { SettingsRepository } from "../../domain/repositories/SettingsRepository"; -import { FutureData } from "../api-futures"; +import { Settings } from "$/domain/entities/Settings"; +import { SettingsRepository } from "$/domain/repositories/SettingsRepository"; +import { FutureData } from "$/data/api-futures"; export class SettingsTestRepository implements SettingsRepository { get(): FutureData { diff --git a/src/data/repositories/ValidationRuleAnalysisD2Repository.ts b/src/data/repositories/ValidationRuleAnalysisD2Repository.ts index d68237c..dd8e5a8 100644 --- a/src/data/repositories/ValidationRuleAnalysisD2Repository.ts +++ b/src/data/repositories/ValidationRuleAnalysisD2Repository.ts @@ -1,7 +1,7 @@ import { ValidationRuleAnalysis } from "$/domain/entities/ValidationRuleAnalysis"; import { D2Api } from "$/types/d2-api"; import { Id } from "$/domain/entities/Ref"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; import { ValidationRuleAnalysisRepository, ValidationRuleOptions, diff --git a/src/data/repositories/ValidationRuleAnalysisTestRepository.ts b/src/data/repositories/ValidationRuleAnalysisTestRepository.ts index 01ca2a3..4bc1df2 100644 --- a/src/data/repositories/ValidationRuleAnalysisTestRepository.ts +++ b/src/data/repositories/ValidationRuleAnalysisTestRepository.ts @@ -1,7 +1,7 @@ import { ValidationRuleAnalysis } from "$/domain/entities/ValidationRuleAnalysis"; import { Future } from "$/domain/entities/generic/Future"; import { ValidationRuleAnalysisRepository } from "$/domain/repositories/ValidationRuleAnalysisRepository"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class ValidationRuleAnalysisTestRepository implements ValidationRuleAnalysisRepository { get(): FutureData { diff --git a/src/data/repositories/ValidationRuleGroupD2Repository.ts b/src/data/repositories/ValidationRuleGroupD2Repository.ts index d029991..025ac1a 100644 --- a/src/data/repositories/ValidationRuleGroupD2Repository.ts +++ b/src/data/repositories/ValidationRuleGroupD2Repository.ts @@ -3,7 +3,7 @@ import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; import { Future } from "$/domain/entities/generic/Future"; import { ValidationRuleGroupRepository } from "$/domain/repositories/ValidationRuleGroupRepository"; import { D2Api } from "$/types/d2-api"; -import { FutureData, apiToFuture } from "../api-futures"; +import { FutureData, apiToFuture } from "$/data/api-futures"; export class ValidationRuleD2Repository implements ValidationRuleGroupRepository { constructor(private api: D2Api) {} diff --git a/src/data/repositories/ValidationRuleGroupTestRepository.ts b/src/data/repositories/ValidationRuleGroupTestRepository.ts index 78dc17e..7609493 100644 --- a/src/data/repositories/ValidationRuleGroupTestRepository.ts +++ b/src/data/repositories/ValidationRuleGroupTestRepository.ts @@ -1,7 +1,7 @@ import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; import { ValidationRuleGroupRepository } from "$/domain/repositories/ValidationRuleGroupRepository"; import { Future } from "$/domain/entities/generic/Future"; -import { FutureData } from "../api-futures"; +import { FutureData } from "$/data/api-futures"; export class ValidationRuleTestRepository implements ValidationRuleGroupRepository { getById(): FutureData { diff --git a/src/domain/entities/MidwiferyPersonnel.ts b/src/domain/entities/MidwiferyPersonnel.ts index c66d4dc..8f8259f 100644 --- a/src/domain/entities/MidwiferyPersonnel.ts +++ b/src/domain/entities/MidwiferyPersonnel.ts @@ -1,6 +1,6 @@ import { Maybe } from "$/utils/ts-utils"; import { NamedRef } from "@eyeseetea/d2-logger/domain/entities/Base"; -import { convertToNumberOrZero } from "../usecases/common/utils"; +import { convertToNumberOrZero } from "$/domain/usecases/common/utils"; import { DataElement } from "./DataElement"; import { DataValue } from "./DataValue"; import { Struct } from "./generic/Struct"; diff --git a/src/domain/entities/QualityAnalysisIssue.ts b/src/domain/entities/QualityAnalysisIssue.ts index 390d4db..43b13ee 100644 --- a/src/domain/entities/QualityAnalysisIssue.ts +++ b/src/domain/entities/QualityAnalysisIssue.ts @@ -1,4 +1,4 @@ -import { Maybe } from "../../utils/ts-utils"; +import { Maybe } from "$/utils/ts-utils"; import { Country } from "./Country"; import { Struct } from "./generic/Struct"; import { IssueAction } from "./IssueAction"; diff --git a/src/domain/entities/__tests__/QualityAnalysis.spec.ts b/src/domain/entities/__tests__/QualityAnalysis.spec.ts index b79381f..55d4a79 100644 --- a/src/domain/entities/__tests__/QualityAnalysis.spec.ts +++ b/src/domain/entities/__tests__/QualityAnalysis.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import { QualityAnalysis, QualityAnalysisAttrs } from "../QualityAnalysis"; +import { QualityAnalysis, QualityAnalysisAttrs } from "$/domain/entities/QualityAnalysis"; function createQualityAnalysis(data: Partial) { return QualityAnalysis.build({ diff --git a/src/domain/entities/__tests__/User.spec.ts b/src/domain/entities/__tests__/User.spec.ts index d781ff9..afc9f41 100644 --- a/src/domain/entities/__tests__/User.spec.ts +++ b/src/domain/entities/__tests__/User.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import { createAdminUser, createNonAdminUser, createUserWithGroups } from "./userFixtures"; -import { UserGroup } from "../UserGroup"; +import { UserGroup } from "$/domain/entities/UserGroup"; describe("User", () => { it("should be admin if has a role with authority ALL", () => { diff --git a/src/domain/entities/__tests__/userFixtures.ts b/src/domain/entities/__tests__/userFixtures.ts index aae60dc..0f7992e 100644 --- a/src/domain/entities/__tests__/userFixtures.ts +++ b/src/domain/entities/__tests__/userFixtures.ts @@ -1,5 +1,5 @@ -import { User, UserRole } from "../User"; -import { UserGroup } from "../UserGroup"; +import { User, UserRole } from "$/domain/entities/User"; +import { UserGroup } from "$/domain/entities/UserGroup"; export function createAdminUser(): User { const adminRoles = [{ id: "Hg7n0MwzUQn", name: "Super user", authorities: ["ALL"] }]; diff --git a/src/domain/entities/generic/Errors.ts b/src/domain/entities/generic/Errors.ts index 0745b46..2119dc7 100644 --- a/src/domain/entities/generic/Errors.ts +++ b/src/domain/entities/generic/Errors.ts @@ -1,4 +1,4 @@ -import i18n from "../../../utils/i18n"; +import i18n from "$/utils/i18n"; export type ValidationErrorKey = "field_cannot_be_blank"; diff --git a/src/domain/entities/generic/__tests/Collection.spec.ts b/src/domain/entities/generic/__tests/Collection.spec.ts index a56976c..1b19d62 100644 --- a/src/domain/entities/generic/__tests/Collection.spec.ts +++ b/src/domain/entities/generic/__tests/Collection.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "vitest"; -import _, { Collection } from "../Collection"; +import _, { Collection } from "$/domain/entities/generic/Collection"; import { expectTypeOf } from "expect-type"; describe("Collection", () => { diff --git a/src/domain/entities/generic/__tests/Future.spec.ts b/src/domain/entities/generic/__tests/Future.spec.ts index b29a654..4edf0ff 100644 --- a/src/domain/entities/generic/__tests/Future.spec.ts +++ b/src/domain/entities/generic/__tests/Future.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test, it, vi, expectTypeOf } from "vitest"; -import { Future } from "../Future"; +import { Future } from "$/domain/entities/generic/Future"; describe("Basic builders", () => { test("Future.success", async () => { diff --git a/src/domain/entities/generic/__tests/HashMap.spec.ts b/src/domain/entities/generic/__tests/HashMap.spec.ts index 54db069..a666d0c 100644 --- a/src/domain/entities/generic/__tests/HashMap.spec.ts +++ b/src/domain/entities/generic/__tests/HashMap.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "vitest"; -import { HashMap } from "../HashMap"; +import { HashMap } from "$/domain/entities/generic/HashMap"; const mapAbc123 = HashMap.fromPairs([ ["a", 1], diff --git a/src/domain/entities/generic/__tests/Rec.spec.ts b/src/domain/entities/generic/__tests/Rec.spec.ts index b288462..7f406a9 100644 --- a/src/domain/entities/generic/__tests/Rec.spec.ts +++ b/src/domain/entities/generic/__tests/Rec.spec.ts @@ -1,4 +1,4 @@ -import { Rec } from "../Rec"; +import { Rec } from "$/domain/entities/generic/Rec"; import { expectTypeOf } from "expect-type"; const rec1 = Rec.from({ x: 1, s: "hello", n: null }); diff --git a/src/domain/entities/generic/__tests/Struct.spec.ts b/src/domain/entities/generic/__tests/Struct.spec.ts index c8e3310..1da70df 100644 --- a/src/domain/entities/generic/__tests/Struct.spec.ts +++ b/src/domain/entities/generic/__tests/Struct.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from "vitest"; -import { Struct } from "../Struct"; +import { Struct } from "$/domain/entities/generic/Struct"; class Person extends Struct<{ name: string; age: number }>() { description() { diff --git a/src/domain/repositories/AnalysisSectionRepository.ts b/src/domain/repositories/AnalysisSectionRepository.ts index c6a8561..9b7f3b1 100644 --- a/src/domain/repositories/AnalysisSectionRepository.ts +++ b/src/domain/repositories/AnalysisSectionRepository.ts @@ -1,5 +1,5 @@ import { FutureData } from "$/data/api-futures"; -import { QualityAnalysisSection } from "../entities/QualityAnalysisSection"; +import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; export interface AnalysisSectionRepository { get(): FutureData; diff --git a/src/domain/repositories/CountryRepository.ts b/src/domain/repositories/CountryRepository.ts index 5057699..6221e55 100644 --- a/src/domain/repositories/CountryRepository.ts +++ b/src/domain/repositories/CountryRepository.ts @@ -1,7 +1,7 @@ import { Maybe } from "$/utils/ts-utils"; -import { FutureData } from "../../data/api-futures"; -import { Country } from "../entities/Country"; -import { Id } from "../entities/Ref"; +import { FutureData } from "$/data/api-futures"; +import { Country } from "$/domain/entities/Country"; +import { Id } from "$/domain/entities/Ref"; export interface CountryRepository { getBy(options: CountryOptions): FutureData; diff --git a/src/domain/repositories/IssueExportRepository.ts b/src/domain/repositories/IssueExportRepository.ts index bbe2ffd..705f55f 100644 --- a/src/domain/repositories/IssueExportRepository.ts +++ b/src/domain/repositories/IssueExportRepository.ts @@ -1,5 +1,5 @@ import { FutureData } from "$/data/api-futures"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; export interface IssueExportRepository { export(issues: QualityAnalysisIssue[]): FutureData; diff --git a/src/domain/repositories/IssueRepository.ts b/src/domain/repositories/IssueRepository.ts index 2089108..64fca0b 100644 --- a/src/domain/repositories/IssueRepository.ts +++ b/src/domain/repositories/IssueRepository.ts @@ -1,8 +1,8 @@ import { RowsPaginated } from "$/domain/entities/Pagination"; import { Id, Period } from "$/domain/entities/Ref"; import { Maybe } from "$/utils/ts-utils"; -import { FutureData } from "../../data/api-futures"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; +import { FutureData } from "$/data/api-futures"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { Pagination } from "$/domain/entities/Pagination"; export interface IssueRepository { diff --git a/src/domain/repositories/MetadataRepository.ts b/src/domain/repositories/MetadataRepository.ts index a64c42d..5e9ce6c 100644 --- a/src/domain/repositories/MetadataRepository.ts +++ b/src/domain/repositories/MetadataRepository.ts @@ -1,5 +1,5 @@ -import { MetadataItem } from "../entities/MetadataItem"; -import { FutureData } from "../../data/api-futures"; +import { MetadataItem } from "$/domain/entities/MetadataItem"; +import { FutureData } from "$/data/api-futures"; export interface MetadataRepository { get(): FutureData; diff --git a/src/domain/repositories/OutlierRepository.ts b/src/domain/repositories/OutlierRepository.ts index 57a9273..a3a5666 100644 --- a/src/domain/repositories/OutlierRepository.ts +++ b/src/domain/repositories/OutlierRepository.ts @@ -1,7 +1,7 @@ import { Outlier } from "$/domain/entities/Outlier"; import { Id } from "$/domain/entities/Ref"; import { Maybe } from "$/utils/ts-utils"; -import { FutureData } from "../../data/api-futures"; +import { FutureData } from "$/data/api-futures"; export interface OutlierRepository { export(options: OutlierOptions): FutureData; diff --git a/src/domain/repositories/QualityAnalysisRepository.ts b/src/domain/repositories/QualityAnalysisRepository.ts index ae856f0..73e8424 100644 --- a/src/domain/repositories/QualityAnalysisRepository.ts +++ b/src/domain/repositories/QualityAnalysisRepository.ts @@ -1,6 +1,6 @@ -import { FutureData } from "../../data/api-futures"; -import { Maybe } from "../../utils/ts-utils"; -import { QualityAnalysis } from "../entities/QualityAnalysis"; +import { FutureData } from "$/data/api-futures"; +import { Maybe } from "$/utils/ts-utils"; +import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { Id } from "$/domain/entities/Ref"; export interface QualityAnalysisRepository { diff --git a/src/domain/repositories/SettingsRepository.ts b/src/domain/repositories/SettingsRepository.ts index 7cffc9a..fd62acd 100644 --- a/src/domain/repositories/SettingsRepository.ts +++ b/src/domain/repositories/SettingsRepository.ts @@ -1,5 +1,5 @@ -import { FutureData } from "../../data/api-futures"; -import { Settings } from "../entities/Settings"; +import { FutureData } from "$/data/api-futures"; +import { Settings } from "$/domain/entities/Settings"; export interface SettingsRepository { get(): FutureData; diff --git a/src/domain/repositories/UserRepository.ts b/src/domain/repositories/UserRepository.ts index 2b365b8..41eb9c7 100644 --- a/src/domain/repositories/UserRepository.ts +++ b/src/domain/repositories/UserRepository.ts @@ -1,5 +1,5 @@ -import { FutureData } from "../../data/api-futures"; -import { User } from "../entities/User"; +import { FutureData } from "$/data/api-futures"; +import { User } from "$/domain/entities/User"; export interface UserRepository { getCurrent(): FutureData; diff --git a/src/domain/repositories/ValidationRuleAnalysisRepository.ts b/src/domain/repositories/ValidationRuleAnalysisRepository.ts index 0f41690..eb4de74 100644 --- a/src/domain/repositories/ValidationRuleAnalysisRepository.ts +++ b/src/domain/repositories/ValidationRuleAnalysisRepository.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { DateISOString, Id } from "../entities/Ref"; -import { ValidationRuleAnalysis } from "../entities/ValidationRuleAnalysis"; +import { DateISOString, Id } from "$/domain/entities/Ref"; +import { ValidationRuleAnalysis } from "$/domain/entities/ValidationRuleAnalysis"; export interface ValidationRuleAnalysisRepository { get(options: ValidationRuleOptions): FutureData; diff --git a/src/domain/repositories/ValidationRuleGroupRepository.ts b/src/domain/repositories/ValidationRuleGroupRepository.ts index 8743cc5..7de1d10 100644 --- a/src/domain/repositories/ValidationRuleGroupRepository.ts +++ b/src/domain/repositories/ValidationRuleGroupRepository.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { Id } from "../entities/Ref"; -import { ValidationRuleGroup } from "../entities/ValidationRuleGroup"; +import { Id } from "$/domain/entities/Ref"; +import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; export interface ValidationRuleGroupRepository { get(): FutureData; diff --git a/src/domain/usecases/CreateQualityAnalysisUseCase.ts b/src/domain/usecases/CreateQualityAnalysisUseCase.ts index 2591624..23e9220 100644 --- a/src/domain/usecases/CreateQualityAnalysisUseCase.ts +++ b/src/domain/usecases/CreateQualityAnalysisUseCase.ts @@ -1,15 +1,15 @@ import { Id } from "$/domain/entities/Ref"; import { getUid } from "$/utils/uid"; -import { FutureData } from "../../data/api-futures"; -import { QualityAnalysis } from "../entities/QualityAnalysis"; -import { QualityAnalysisSection } from "../entities/QualityAnalysisSection"; -import { getErrors } from "../entities/generic/Errors"; -import { Future } from "../entities/generic/Future"; -import { AnalysisSectionRepository } from "../repositories/AnalysisSectionRepository"; -import { QualityAnalysisRepository } from "../repositories/QualityAnalysisRepository"; -import { SequentialRepository } from "../repositories/SequentialRepository"; -import { SettingsRepository } from "../repositories/SettingsRepository"; -import { UserRepository } from "../repositories/UserRepository"; +import { FutureData } from "$/data/api-futures"; +import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; +import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; +import { getErrors } from "$/domain/entities/generic/Errors"; +import { Future } from "$/domain/entities/generic/Future"; +import { AnalysisSectionRepository } from "$/domain/repositories/AnalysisSectionRepository"; +import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysisRepository"; +import { SequentialRepository } from "$/domain/repositories/SequentialRepository"; +import { SettingsRepository } from "$/domain/repositories/SettingsRepository"; +import { UserRepository } from "$/domain/repositories/UserRepository"; export class CreateQualityAnalysisUseCase { constructor( diff --git a/src/domain/usecases/ExportIssuesUseCase.ts b/src/domain/usecases/ExportIssuesUseCase.ts index d33ef61..a511dd8 100644 --- a/src/domain/usecases/ExportIssuesUseCase.ts +++ b/src/domain/usecases/ExportIssuesUseCase.ts @@ -1,8 +1,8 @@ import { FutureData } from "$/data/api-futures"; import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { Id } from "$/domain/entities/Ref"; -import { IssueExportRepository } from "../repositories/IssueExportRepository"; -import { GetIssuesOptions, IssueRepository } from "../repositories/IssueRepository"; +import { IssueExportRepository } from "$/domain/repositories/IssueExportRepository"; +import { GetIssuesOptions, IssueRepository } from "$/domain/repositories/IssueRepository"; import { UCIssue } from "./common/UCIssue"; export class ExportIssuesUseCase { diff --git a/src/domain/usecases/GetAllIssuesUseCase.ts b/src/domain/usecases/GetAllIssuesUseCase.ts index 09c1c0b..461871b 100644 --- a/src/domain/usecases/GetAllIssuesUseCase.ts +++ b/src/domain/usecases/GetAllIssuesUseCase.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { RowsPaginated } from "../entities/Pagination"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; +import { RowsPaginated } from "$/domain/entities/Pagination"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { GetIssuesOptions, IssueRepository } from "$/domain/repositories/IssueRepository"; export class GetAllIssuesUseCase { diff --git a/src/domain/usecases/GetAnalysisByIdUseCase.ts b/src/domain/usecases/GetAnalysisByIdUseCase.ts index 39d5f32..27c2717 100644 --- a/src/domain/usecases/GetAnalysisByIdUseCase.ts +++ b/src/domain/usecases/GetAnalysisByIdUseCase.ts @@ -1,7 +1,7 @@ import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { Id } from "@eyeseetea/d2-api"; -import { FutureData } from "../../data/api-futures"; -import { QualityAnalysisRepository } from "../repositories/QualityAnalysisRepository"; +import { FutureData } from "$/data/api-futures"; +import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysisRepository"; export class GetAnalysisByIdUseCase { constructor(private qualityAnalysisRepository: QualityAnalysisRepository) {} diff --git a/src/domain/usecases/GetCountriesByIdsUseCase.ts b/src/domain/usecases/GetCountriesByIdsUseCase.ts index 4ba5d9e..9575ef8 100644 --- a/src/domain/usecases/GetCountriesByIdsUseCase.ts +++ b/src/domain/usecases/GetCountriesByIdsUseCase.ts @@ -2,7 +2,7 @@ import { FutureData } from "$/data/api-futures"; import { Country } from "$/domain/entities/Country"; import { Id } from "$/domain/entities/Ref"; import { Future } from "$/domain/entities/generic/Future"; -import { CountryRepository } from "../repositories/CountryRepository"; +import { CountryRepository } from "$/domain/repositories/CountryRepository"; export class GetCountriesByIdsUseCase { constructor(private countryRepository: CountryRepository) {} diff --git a/src/domain/usecases/GetCurrentUserUseCase.ts b/src/domain/usecases/GetCurrentUserUseCase.ts index 0db65b7..e20f22d 100644 --- a/src/domain/usecases/GetCurrentUserUseCase.ts +++ b/src/domain/usecases/GetCurrentUserUseCase.ts @@ -1,6 +1,6 @@ -import { FutureData } from "../../data/api-futures"; -import { User } from "../entities/User"; -import { UserRepository } from "../repositories/UserRepository"; +import { FutureData } from "$/data/api-futures"; +import { User } from "$/domain/entities/User"; +import { UserRepository } from "$/domain/repositories/UserRepository"; export class GetCurrentUserUseCase { constructor(private usersRepository: UserRepository) {} diff --git a/src/domain/usecases/GetMissingDisaggregatesUseCase.ts b/src/domain/usecases/GetMissingDisaggregatesUseCase.ts index fcbf9e5..b1ae626 100644 --- a/src/domain/usecases/GetMissingDisaggregatesUseCase.ts +++ b/src/domain/usecases/GetMissingDisaggregatesUseCase.ts @@ -17,7 +17,7 @@ import { UCIssue } from "./common/UCIssue"; import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { MissingDisaggregates } from "$/domain/entities/MissingDisaggregates"; import { getCurrentSection } from "./common/utils"; -import { SettingsRepository } from "../repositories/SettingsRepository"; +import { SettingsRepository } from "$/domain/repositories/SettingsRepository"; import { SectionDisaggregation, SectionSetting, Settings } from "$/domain/entities/Settings"; import { MissingComboValue } from "$/domain/entities/MissingComboValue"; diff --git a/src/domain/usecases/GetModulesUseCase.ts b/src/domain/usecases/GetModulesUseCase.ts index f85f639..b5cc294 100644 --- a/src/domain/usecases/GetModulesUseCase.ts +++ b/src/domain/usecases/GetModulesUseCase.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { Module } from "../entities/Module"; -import { ModuleRepository } from "../repositories/ModuleRepository"; +import { Module } from "$/domain/entities/Module"; +import { ModuleRepository } from "$/domain/repositories/ModuleRepository"; export class GetModulesUseCase { constructor(private moduleRepository: ModuleRepository) {} diff --git a/src/domain/usecases/GetOutlierIssuesUseCase.ts b/src/domain/usecases/GetOutlierIssuesUseCase.ts index e285799..dc2b182 100644 --- a/src/domain/usecases/GetOutlierIssuesUseCase.ts +++ b/src/domain/usecases/GetOutlierIssuesUseCase.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { RowsPaginated } from "../entities/Pagination"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; +import { RowsPaginated } from "$/domain/entities/Pagination"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; import { GetIssuesOptions, IssueRepository } from "$/domain/repositories/IssueRepository"; export class GetOutlierIssuesUseCase { diff --git a/src/domain/usecases/GetQualityAnalisysUseCase.ts b/src/domain/usecases/GetQualityAnalisysUseCase.ts index d4c05a7..ac5a0c3 100644 --- a/src/domain/usecases/GetQualityAnalisysUseCase.ts +++ b/src/domain/usecases/GetQualityAnalisysUseCase.ts @@ -1,9 +1,9 @@ -import { FutureData } from "../../data/api-futures"; +import { FutureData } from "$/data/api-futures"; import { QualityAnalysisOptions, QualityAnalysisPaginated, QualityAnalysisRepository, -} from "../repositories/QualityAnalysisRepository"; +} from "$/domain/repositories/QualityAnalysisRepository"; export class GetQualityAnalysisUseCase { constructor(private qualityAnalysisRepository: QualityAnalysisRepository) {} diff --git a/src/domain/usecases/GetSettingsUseCase.ts b/src/domain/usecases/GetSettingsUseCase.ts index 4e2a14e..01ed565 100644 --- a/src/domain/usecases/GetSettingsUseCase.ts +++ b/src/domain/usecases/GetSettingsUseCase.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { Settings } from "../entities/Settings"; -import { SettingsRepository } from "../repositories/SettingsRepository"; +import { Settings } from "$/domain/entities/Settings"; +import { SettingsRepository } from "$/domain/repositories/SettingsRepository"; export class GetSettingsUseCase { constructor(private settingsRepository: SettingsRepository) {} diff --git a/src/domain/usecases/GetValidationRuleGroupUseCase.ts b/src/domain/usecases/GetValidationRuleGroupUseCase.ts index 44ccdbe..1f4439d 100644 --- a/src/domain/usecases/GetValidationRuleGroupUseCase.ts +++ b/src/domain/usecases/GetValidationRuleGroupUseCase.ts @@ -1,6 +1,6 @@ import { FutureData } from "$/data/api-futures"; -import { ValidationRuleGroup } from "../entities/ValidationRuleGroup"; -import { ValidationRuleGroupRepository } from "../repositories/ValidationRuleGroupRepository"; +import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; +import { ValidationRuleGroupRepository } from "$/domain/repositories/ValidationRuleGroupRepository"; export class GetValidationRuleGroupUseCase { constructor(private validationRuleGroupRepository: ValidationRuleGroupRepository) {} diff --git a/src/domain/usecases/RunOutlierUseCase.ts b/src/domain/usecases/RunOutlierUseCase.ts index 5c6abf0..12b9180 100644 --- a/src/domain/usecases/RunOutlierUseCase.ts +++ b/src/domain/usecases/RunOutlierUseCase.ts @@ -11,7 +11,7 @@ import { ModuleRepository } from "$/domain/repositories/ModuleRepository"; import { DataElement } from "$/domain/entities/DataElement"; import { UCIssue } from "./common/UCIssue"; import { UCAnalysis } from "./common/UCAnalysis"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; export class RunOutlierUseCase { private issueUseCase: UCIssue; diff --git a/src/domain/usecases/RunValidationsUseCase.ts b/src/domain/usecases/RunValidationsUseCase.ts index 5d9dea0..7b8cd5c 100644 --- a/src/domain/usecases/RunValidationsUseCase.ts +++ b/src/domain/usecases/RunValidationsUseCase.ts @@ -7,13 +7,13 @@ import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysis import _ from "$/domain/entities/generic/Collection"; import { UCIssue } from "./common/UCIssue"; import { UCAnalysis } from "./common/UCAnalysis"; -import { ValidationRuleAnalysisRepository } from "../repositories/ValidationRuleAnalysisRepository"; -import { ValidationRuleAnalysis } from "../entities/ValidationRuleAnalysis"; -import { QualityAnalysisIssue } from "../entities/QualityAnalysisIssue"; -import { ValidationRuleGroupRepository } from "../repositories/ValidationRuleGroupRepository"; -import { ValidationRuleGroup } from "../entities/ValidationRuleGroup"; -import { MetadataItem } from "../entities/MetadataItem"; -import { CountryRepository } from "../repositories/CountryRepository"; +import { ValidationRuleAnalysisRepository } from "$/domain/repositories/ValidationRuleAnalysisRepository"; +import { ValidationRuleAnalysis } from "$/domain/entities/ValidationRuleAnalysis"; +import { QualityAnalysisIssue } from "$/domain/entities/QualityAnalysisIssue"; +import { ValidationRuleGroupRepository } from "$/domain/repositories/ValidationRuleGroupRepository"; +import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; +import { MetadataItem } from "$/domain/entities/MetadataItem"; +import { CountryRepository } from "$/domain/repositories/CountryRepository"; export class RunValidationsUseCase { private issueUseCase: UCIssue; diff --git a/src/domain/usecases/SaveConfigAnalysisUseCase.ts b/src/domain/usecases/SaveConfigAnalysisUseCase.ts index 2230e03..a5ddb2e 100644 --- a/src/domain/usecases/SaveConfigAnalysisUseCase.ts +++ b/src/domain/usecases/SaveConfigAnalysisUseCase.ts @@ -1,7 +1,7 @@ import { Id } from "$/domain/entities/Ref"; -import { FutureData } from "../../data/api-futures"; -import { QualityAnalysis } from "../entities/QualityAnalysis"; -import { QualityAnalysisRepository } from "../repositories/QualityAnalysisRepository"; +import { FutureData } from "$/data/api-futures"; +import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; +import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysisRepository"; export class SaveConfigAnalysisUseCase { constructor(private qualityAnalysisRepository: QualityAnalysisRepository) {} diff --git a/src/domain/usecases/SaveIssueUseCase.ts b/src/domain/usecases/SaveIssueUseCase.ts index dea59e9..22eabb0 100644 --- a/src/domain/usecases/SaveIssueUseCase.ts +++ b/src/domain/usecases/SaveIssueUseCase.ts @@ -12,7 +12,7 @@ import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysis import { UserRepository } from "$/domain/repositories/UserRepository"; import _ from "$/domain/entities/generic/Collection"; import { Maybe } from "$/utils/ts-utils"; -import { IssueRepository } from "../repositories/IssueRepository"; +import { IssueRepository } from "$/domain/repositories/IssueRepository"; export class SaveIssueUseCase { constructor( diff --git a/src/domain/usecases/UpdateStatusAnalysisUseCase.ts b/src/domain/usecases/UpdateStatusAnalysisUseCase.ts index d63936d..45b7d5d 100644 --- a/src/domain/usecases/UpdateStatusAnalysisUseCase.ts +++ b/src/domain/usecases/UpdateStatusAnalysisUseCase.ts @@ -2,7 +2,7 @@ import { FutureData } from "$/data/api-futures"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { QualityAnalysisStatus } from "$/domain/entities/QualityAnalysisStatus"; import { Id } from "$/domain/entities/Ref"; -import { QualityAnalysisRepository } from "../repositories/QualityAnalysisRepository"; +import { QualityAnalysisRepository } from "$/domain/repositories/QualityAnalysisRepository"; export class UpdateStatusAnalysisUseCase { constructor(private qualityAnalysisRepository: QualityAnalysisRepository) {} diff --git a/src/domain/usecases/__tests__/GetCurrentUserUseCase.spec.ts b/src/domain/usecases/__tests__/GetCurrentUserUseCase.spec.ts index 405adea..91d9885 100644 --- a/src/domain/usecases/__tests__/GetCurrentUserUseCase.spec.ts +++ b/src/domain/usecases/__tests__/GetCurrentUserUseCase.spec.ts @@ -1,4 +1,4 @@ -import { getTestCompositionRoot } from "../../../CompositionRoot"; +import { getTestCompositionRoot } from "$/CompositionRoot"; describe("GetCurrentUserUseCase", () => { it("returns user", async () => { diff --git a/src/scripts/example.ts b/src/scripts/example.ts index 5d65e29..2d092db 100644 --- a/src/scripts/example.ts +++ b/src/scripts/example.ts @@ -1,6 +1,6 @@ import { command, run, string, option } from "cmd-ts"; import path from "path"; -import { D2Api } from "../types/d2-api"; +import { D2Api } from "$/types/d2-api"; function main() { const cmd = command({ diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts index c625f83..ded81e9 100644 --- a/src/utils/i18n.ts +++ b/src/utils/i18n.ts @@ -1,5 +1,5 @@ // @ts-ignore -import i18n from "../locales"; +import i18n from "$/locales"; function t(s: Str, namespace?: GetNamespace): string { return i18n.t(s, namespace); diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 452ab2d..64b20f1 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,5 +1,5 @@ import { TrackerProgramLogger, initLogger } from "@eyeseetea/d2-logger"; -import { Id } from "../domain/entities/Ref"; +import { Id } from "$/domain/entities/Ref"; export let logger: TrackerProgramLogger; diff --git a/src/utils/tests.tsx b/src/utils/tests.tsx index b04d4a6..6c0def7 100644 --- a/src/utils/tests.tsx +++ b/src/utils/tests.tsx @@ -1,9 +1,9 @@ import { render, RenderResult } from "@testing-library/react"; import { SnackbarProvider } from "@eyeseetea/d2-ui-components"; import { ReactNode } from "react"; -import { AppContext, AppContextState } from "../webapp/contexts/app-context"; -import { getTestCompositionRoot } from "../CompositionRoot"; -import { createAdminUser } from "../domain/entities/__tests__/userFixtures"; +import { AppContext, AppContextState } from "$/webapp/contexts/app-context"; +import { getTestCompositionRoot } from "$/CompositionRoot"; +import { createAdminUser } from "$/domain/entities/__tests__/userFixtures"; import { MetadataItem } from "$/domain/entities/MetadataItem"; import { D2Api } from "$/types/d2-api"; diff --git a/src/webapp/components/analysis-filter/AnalysisFilter.tsx b/src/webapp/components/analysis-filter/AnalysisFilter.tsx index f6f4f58..3cb0ac1 100644 --- a/src/webapp/components/analysis-filter/AnalysisFilter.tsx +++ b/src/webapp/components/analysis-filter/AnalysisFilter.tsx @@ -6,7 +6,7 @@ import _, { Collection } from "$/domain/entities/generic/Collection"; import { Module } from "$/domain/entities/Module"; import { qualityAnalysisStatus } from "$/domain/entities/QualityAnalysisStatus"; import { Maybe } from "$/utils/ts-utils"; -import { MenuButton } from "../menu-button/MenuButton"; +import { MenuButton } from "$/webapp/components/menu-button/MenuButton"; import { Id } from "$/domain/entities/Ref"; const currentYear = new Date().getFullYear(); diff --git a/src/webapp/components/card-grid/CardGrid.tsx b/src/webapp/components/card-grid/CardGrid.tsx new file mode 100644 index 0000000..9ddd3d7 --- /dev/null +++ b/src/webapp/components/card-grid/CardGrid.tsx @@ -0,0 +1,50 @@ +import React from "react"; +import styled from "styled-components"; +import { PageHeader } from "$/webapp/components/page-header/PageHeader"; +import { MenuCard, MenuCardProps } from "./MenuCard"; + +export const CardGrid: React.FC = React.memo(({ title, cards, onBackClick }) => { + return ( + + {!!title && } + + + {cards.map(({ key, title, children }) => ( +
+ {!!title && {title}} + + {children.map(props => ( + + ))} +
+ ))} +
+
+ ); +}); + +export interface CardGridProps { + cards: Card[]; + title?: string; + onBackClick?: () => void; +} + +export interface Card { + title?: string; + key: string; + children: MenuCardProps[]; +} + +const Container = styled.div` + margin-left: 30px; + display: flex; + flex-direction: column; +`; + +const Title = styled.h1` + font-size: 24px; + font-weight: 300; + color: rgba(0, 0, 0, 0.87); + padding: 15px 0px 15px; + margin: 0; +`; diff --git a/src/webapp/components/card-grid/MenuCard.tsx b/src/webapp/components/card-grid/MenuCard.tsx new file mode 100644 index 0000000..61680cc --- /dev/null +++ b/src/webapp/components/card-grid/MenuCard.tsx @@ -0,0 +1,76 @@ +import { + Card as MUICard, + CardActions as MUICardActions, + CardContent as MUICardContent, + CardHeader as MUICardHeader, + IconButton, + Tooltip, +} from "@material-ui/core"; +import AddIcon from "@material-ui/icons/Add"; +import ViewListIcon from "@material-ui/icons/ViewList"; +import React from "react"; +import styled from "styled-components"; +import i18n from "$/utils/i18n"; + +export const MenuCard: React.FC = React.memo( + ({ name, description, addAction, listAction = () => {} }) => { + return ( + +
+ + {description} + + + {addAction && ( + + + + + + )} + + {listAction && ( + + + + + + )} + + + ); + } +); + +export interface MenuCardProps { + name: string; + description?: string; + addAction?: () => void; + listAction?: () => void; +} + +const Card = styled(MUICard)` + padding: 0; + margin: 0.5rem; + float: left; + width: 230px; +`; + +const Content = styled(MUICardContent)` + height: 120px; + padding: 0.5rem 1rem; + font-size: 14px; +`; + +const Actions = styled(MUICardActions)` + margin-left: auto; +`; + +const Header = styled(MUICardHeader)` + padding: 1rem; + height: auto; + border-bottom: 1px solid #ddd; + cursor: pointer; + font-size: 15px; + font-weight: 500; +`; diff --git a/src/webapp/components/configuration-form/ConfigurationForm.tsx b/src/webapp/components/configuration-form/ConfigurationForm.tsx index b63f061..d100e2c 100644 --- a/src/webapp/components/configuration-form/ConfigurationForm.tsx +++ b/src/webapp/components/configuration-form/ConfigurationForm.tsx @@ -6,7 +6,7 @@ import i18n from "$/utils/i18n"; import { useAppContext } from "$/webapp/contexts/app-context"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { Maybe } from "$/utils/ts-utils"; -import { periods } from "../analysis-filter/AnalysisFilter"; +import { periods } from "$/webapp/components/analysis-filter/AnalysisFilter"; import { Id } from "$/domain/entities/Ref"; import _ from "$/domain/entities/generic/Collection"; import { Country } from "$/domain/entities/Country"; diff --git a/src/webapp/components/issues/IssueFilters.tsx b/src/webapp/components/issues/IssueFilters.tsx index 135284c..9619126 100644 --- a/src/webapp/components/issues/IssueFilters.tsx +++ b/src/webapp/components/issues/IssueFilters.tsx @@ -2,16 +2,16 @@ import React from "react"; import { Id, Period } from "$/domain/entities/Ref"; import { GetIssuesOptions } from "$/domain/repositories/IssueRepository"; -import { SelectMultiCheckboxes } from "../selectmulti-checkboxes/SelectMultiCheckboxes"; -import { periods } from "../analysis-filter/AnalysisFilter"; +import { SelectMultiCheckboxes } from "$/webapp/components/selectmulti-checkboxes/SelectMultiCheckboxes"; +import { periods } from "$/webapp/components/analysis-filter/AnalysisFilter"; import { Maybe } from "$/utils/ts-utils"; import i18n from "$/utils/i18n"; import { useAppContext } from "$/webapp/contexts/app-context"; import { Dropdown, SearchBox, useSnackbar } from "@eyeseetea/d2-ui-components"; import styled from "styled-components"; import { Button, Dialog, DialogActions, TextField } from "@material-ui/core"; -import { CountrySelector } from "../country-selector/CountrySelector"; -import { getIdFromCountriesPaths } from "../configuration-form/ConfigurationForm"; +import { CountrySelector } from "$/webapp/components/country-selector/CountrySelector"; +import { getIdFromCountriesPaths } from "$/webapp/components/configuration-form/ConfigurationForm"; import { Country } from "$/domain/entities/Country"; const followUpItems = [ diff --git a/src/webapp/components/issues/SelectorInline.tsx b/src/webapp/components/issues/SelectorInline.tsx index 6a2f7e7..600b4e1 100644 --- a/src/webapp/components/issues/SelectorInline.tsx +++ b/src/webapp/components/issues/SelectorInline.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Button, Menu } from "@material-ui/core"; import { MenuItem } from "material-ui"; -import { ButtonTag } from "../tag/ButtonTag"; +import { ButtonTag } from "$/webapp/components/tag/ButtonTag"; import { mapIssueStatusAndActionToColor } from "$/webapp/utils/issues"; export const SelectorInline: React.FC = React.memo(props => { diff --git a/src/webapp/contexts/app-context.ts b/src/webapp/contexts/app-context.ts index 53a9910..8d4886e 100644 --- a/src/webapp/contexts/app-context.ts +++ b/src/webapp/contexts/app-context.ts @@ -1,6 +1,6 @@ import React, { useContext } from "react"; -import { CompositionRoot } from "../../CompositionRoot"; -import { User } from "../../domain/entities/User"; +import { CompositionRoot } from "$/CompositionRoot"; +import { User } from "$/domain/entities/User"; import { MetadataItem } from "$/domain/entities/MetadataItem"; import { D2Api } from "$/types/d2-api"; import { ValidationRuleGroup } from "$/domain/entities/ValidationRuleGroup"; diff --git a/src/webapp/hooks/useAnalysis.ts b/src/webapp/hooks/useAnalysis.ts index 100b654..e53403b 100644 --- a/src/webapp/hooks/useAnalysis.ts +++ b/src/webapp/hooks/useAnalysis.ts @@ -1,7 +1,7 @@ import React from "react"; import { Id } from "$/domain/entities/Ref"; -import { useAppContext } from "../contexts/app-context"; +import { useAppContext } from "$/webapp/contexts/app-context"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { Maybe } from "$/utils/ts-utils"; diff --git a/src/webapp/hooks/useModule.ts b/src/webapp/hooks/useModule.ts index 70b9fcb..199eac4 100644 --- a/src/webapp/hooks/useModule.ts +++ b/src/webapp/hooks/useModule.ts @@ -1,5 +1,5 @@ import React from "react"; -import { useAppContext } from "../contexts/app-context"; +import { useAppContext } from "$/webapp/contexts/app-context"; import { useSnackbar } from "@eyeseetea/d2-ui-components"; import { Module } from "$/domain/entities/Module"; diff --git a/src/webapp/pages/analysis/steps/1-outliers/OutliersStep.tsx b/src/webapp/pages/analysis/steps/1-outliers/OutliersStep.tsx index 74b5c86..ad72a07 100644 --- a/src/webapp/pages/analysis/steps/1-outliers/OutliersStep.tsx +++ b/src/webapp/pages/analysis/steps/1-outliers/OutliersStep.tsx @@ -3,8 +3,8 @@ import { Dropdown } from "@eyeseetea/d2-ui-components"; import i18n from "$/utils/i18n"; import { algorithmList, thresholdList, useAnalysisOutlier } from "./useOutliers"; import { Maybe } from "$/utils/ts-utils"; -import { StepAnalysis } from "../StepAnalysis"; -import { PageStepProps } from "../../AnalysisPage"; +import { StepAnalysis } from "$/webapp/pages/analysis/steps/StepAnalysis"; +import { PageStepProps } from "$/webapp/pages/analysis/AnalysisPage"; import { UserFeedbackContainer } from "$/webapp/components/user-feedback-container/UserFeedbackContainer"; const defaultOutlierParams = { algorithm: "Z_SCORE", threshold: "3" }; diff --git a/src/webapp/pages/analysis/steps/2-disaggregates/DisaggregatesStep.tsx b/src/webapp/pages/analysis/steps/2-disaggregates/DisaggregatesStep.tsx index e3891b5..f8f5a05 100644 --- a/src/webapp/pages/analysis/steps/2-disaggregates/DisaggregatesStep.tsx +++ b/src/webapp/pages/analysis/steps/2-disaggregates/DisaggregatesStep.tsx @@ -3,8 +3,8 @@ import i18n from "$/utils/i18n"; import styled from "styled-components"; import { useDisaggregatesStep } from "./useDisaggregatesStep"; import { SelectMultiCheckboxes } from "$/webapp/components/selectmulti-checkboxes/SelectMultiCheckboxes"; -import { StepAnalysis } from "../StepAnalysis"; -import { PageStepProps } from "../../AnalysisPage"; +import { StepAnalysis } from "$/webapp/pages/analysis/steps/StepAnalysis"; +import { PageStepProps } from "$/webapp/pages/analysis/AnalysisPage"; import { UserFeedbackContainer } from "$/webapp/components/user-feedback-container/UserFeedbackContainer"; export const DisaggregatesStep: React.FC = React.memo(props => { diff --git a/src/webapp/pages/analysis/steps/2-disaggregates/useDisaggregatesStep.tsx b/src/webapp/pages/analysis/steps/2-disaggregates/useDisaggregatesStep.tsx index 92a1bf6..3f52360 100644 --- a/src/webapp/pages/analysis/steps/2-disaggregates/useDisaggregatesStep.tsx +++ b/src/webapp/pages/analysis/steps/2-disaggregates/useDisaggregatesStep.tsx @@ -4,7 +4,7 @@ import { useAppContext } from "$/webapp/contexts/app-context"; import { Id } from "$/domain/entities/Ref"; import { Option } from "$/webapp/components/selectmulti-checkboxes/SelectMultiCheckboxes"; import _ from "$/domain/entities/generic/Collection"; -import { UpdateAnalysisState } from "../../AnalysisPage"; +import { UpdateAnalysisState } from "$/webapp/pages/analysis/AnalysisPage"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { Maybe } from "$/utils/ts-utils"; diff --git a/src/webapp/pages/analysis/steps/3-general-practitioners/GeneralPractitionersStep.tsx b/src/webapp/pages/analysis/steps/3-general-practitioners/GeneralPractitionersStep.tsx index e0e0c9c..f0427b7 100644 --- a/src/webapp/pages/analysis/steps/3-general-practitioners/GeneralPractitionersStep.tsx +++ b/src/webapp/pages/analysis/steps/3-general-practitioners/GeneralPractitionersStep.tsx @@ -7,7 +7,7 @@ import { StepAnalysis } from "$/webapp/pages/analysis/steps/StepAnalysis"; import styled from "styled-components"; import { useGeneralPractitionersStep } from "./useGeneralPractitionersStep"; import { SelectMultiCheckboxes } from "$/webapp/components/selectmulti-checkboxes/SelectMultiCheckboxes"; -import { PageStepProps } from "../../AnalysisPage"; +import { PageStepProps } from "$/webapp/pages/analysis/AnalysisPage"; import { EmptyState } from "$/webapp/components/empty-state/EmptyState"; import { Typography } from "@material-ui/core"; import { UserFeedbackContainer } from "$/webapp/components/user-feedback-container/UserFeedbackContainer"; diff --git a/src/webapp/pages/analysis/steps/3-general-practitioners/useGeneralPractitionersStep.tsx b/src/webapp/pages/analysis/steps/3-general-practitioners/useGeneralPractitionersStep.tsx index e38adf2..f17bc2c 100644 --- a/src/webapp/pages/analysis/steps/3-general-practitioners/useGeneralPractitionersStep.tsx +++ b/src/webapp/pages/analysis/steps/3-general-practitioners/useGeneralPractitionersStep.tsx @@ -4,7 +4,7 @@ import { Id } from "$/domain/entities/Ref"; import { useAppContext } from "$/webapp/contexts/app-context"; import { useSnackbar } from "@eyeseetea/d2-ui-components"; import React from "react"; -import { UpdateAnalysisState } from "../../AnalysisPage"; +import { UpdateAnalysisState } from "$/webapp/pages/analysis/AnalysisPage"; import { Maybe } from "$/utils/ts-utils"; const doubleCountsList = [ diff --git a/src/webapp/pages/analysis/steps/4-nursingMidwifery/NursingMidwiferyStep.tsx b/src/webapp/pages/analysis/steps/4-nursingMidwifery/NursingMidwiferyStep.tsx index d4acabc..817614b 100644 --- a/src/webapp/pages/analysis/steps/4-nursingMidwifery/NursingMidwiferyStep.tsx +++ b/src/webapp/pages/analysis/steps/4-nursingMidwifery/NursingMidwiferyStep.tsx @@ -3,8 +3,8 @@ import i18n from "$/utils/i18n"; import { useNursingMidwiferyStep } from "./useNursingMidwiferyStep"; import { SelectMultiCheckboxes } from "$/webapp/components/selectmulti-checkboxes/SelectMultiCheckboxes"; -import { StepAnalysis } from "../StepAnalysis"; -import { PageStepProps } from "../../AnalysisPage"; +import { StepAnalysis } from "$/webapp/pages/analysis/steps/StepAnalysis"; +import { PageStepProps } from "$/webapp/pages/analysis/AnalysisPage"; import { UserFeedbackContainer } from "$/webapp/components/user-feedback-container/UserFeedbackContainer"; diff --git a/src/webapp/pages/analysis/steps/4-nursingMidwifery/useNursingMidwiferyStep.tsx b/src/webapp/pages/analysis/steps/4-nursingMidwifery/useNursingMidwiferyStep.tsx index d6ec73c..8854882 100644 --- a/src/webapp/pages/analysis/steps/4-nursingMidwifery/useNursingMidwiferyStep.tsx +++ b/src/webapp/pages/analysis/steps/4-nursingMidwifery/useNursingMidwiferyStep.tsx @@ -3,7 +3,7 @@ import { Id } from "$/domain/entities/Ref"; import { useAppContext } from "$/webapp/contexts/app-context"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; -import { UpdateAnalysisState } from "../../AnalysisPage"; +import { UpdateAnalysisState } from "$/webapp/pages/analysis/AnalysisPage"; import { Maybe } from "$/utils/ts-utils"; export function useNursingMidwiferyStep(props: UseNursingMidwiferyStepProps) { diff --git a/src/webapp/pages/analysis/steps/5-validation/ValidationStep.tsx b/src/webapp/pages/analysis/steps/5-validation/ValidationStep.tsx index b64c072..1d10c6c 100644 --- a/src/webapp/pages/analysis/steps/5-validation/ValidationStep.tsx +++ b/src/webapp/pages/analysis/steps/5-validation/ValidationStep.tsx @@ -3,8 +3,8 @@ import i18n from "$/utils/i18n"; import { Dropdown } from "@eyeseetea/d2-ui-components"; import styled from "styled-components"; import { useValidationStep } from "./useValidationStep"; -import { PageStepProps } from "../../AnalysisPage"; -import { StepAnalysis } from "../StepAnalysis"; +import { PageStepProps } from "$/webapp/pages/analysis/AnalysisPage"; +import { StepAnalysis } from "$/webapp/pages/analysis/steps/StepAnalysis"; import { UserFeedbackContainer } from "$/webapp/components/user-feedback-container/UserFeedbackContainer"; export const ValidationStep: React.FC = React.memo(props => { diff --git a/src/webapp/pages/analysis/steps/5-validation/useValidationStep.tsx b/src/webapp/pages/analysis/steps/5-validation/useValidationStep.tsx index 846f709..7f3fd8f 100644 --- a/src/webapp/pages/analysis/steps/5-validation/useValidationStep.tsx +++ b/src/webapp/pages/analysis/steps/5-validation/useValidationStep.tsx @@ -2,7 +2,7 @@ import React from "react"; import { useAppContext } from "$/webapp/contexts/app-context"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { QualityAnalysisSection } from "$/domain/entities/QualityAnalysisSection"; -import { UpdateAnalysisState } from "../../AnalysisPage"; +import { UpdateAnalysisState } from "$/webapp/pages/analysis/AnalysisPage"; import { Maybe } from "$/utils/ts-utils"; export function useValidationStep(props: UseValidationStepProps) { diff --git a/src/webapp/pages/analysis/steps/ConfigurationStep.tsx b/src/webapp/pages/analysis/steps/ConfigurationStep.tsx index d23341d..268de89 100644 --- a/src/webapp/pages/analysis/steps/ConfigurationStep.tsx +++ b/src/webapp/pages/analysis/steps/ConfigurationStep.tsx @@ -6,7 +6,7 @@ import styled from "styled-components"; import { ConfigurationForm } from "$/webapp/components/configuration-form/ConfigurationForm"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { useAnalysisMethods } from "$/webapp/hooks/useQualityAnalysisTable"; -import { UpdateAnalysisState } from "../AnalysisPage"; +import { UpdateAnalysisState } from "$/webapp/pages/analysis/AnalysisPage"; export type ConfigurationStepProps = { analysis: QualityAnalysis; diff --git a/src/webapp/pages/app/App.tsx b/src/webapp/pages/app/App.tsx index 5b27e86..03b8c7a 100644 --- a/src/webapp/pages/app/App.tsx +++ b/src/webapp/pages/app/App.tsx @@ -6,11 +6,11 @@ import { MuiThemeProvider } from "@material-ui/core/styles"; import OldMuiThemeProvider from "material-ui/styles/MuiThemeProvider"; import { LoadingProvider } from "@eyeseetea/d2-ui-components"; import React, { useEffect, useState } from "react"; -import { appConfig } from "../../../app-config"; -import { CompositionRoot } from "../../../CompositionRoot"; -import Share from "../../components/share/Share"; -import { AppContext, AppContextState } from "../../contexts/app-context"; -import { Router } from "../Router"; +import { appConfig } from "$/app-config"; +import { CompositionRoot } from "$/CompositionRoot"; +import Share from "$/webapp/components/share/Share"; +import { AppContext, AppContextState } from "$/webapp/contexts/app-context"; +import { Router } from "$/webapp/pages/Router"; import "./App.css"; import muiThemeLegacy from "./themes/dhis2-legacy.theme"; import { muiTheme } from "./themes/dhis2.theme"; diff --git a/src/webapp/pages/app/Dhis2App.tsx b/src/webapp/pages/app/Dhis2App.tsx index 3b0224d..b8a6b2d 100644 --- a/src/webapp/pages/app/Dhis2App.tsx +++ b/src/webapp/pages/app/Dhis2App.tsx @@ -1,11 +1,11 @@ import React from "react"; import i18n from "@dhis2/d2-i18n"; import { Provider } from "@dhis2/app-runtime"; -import { D2Api } from "../../../types/d2-api"; -import { setupLogger } from "../../../utils/logger"; +import { D2Api } from "$/types/d2-api"; +import { setupLogger } from "$/utils/logger"; import App from "./App"; -import { CompositionRoot, getWebappCompositionRoot } from "../../../CompositionRoot"; -import { MetadataD2Repository } from "../../../data/repositories/MetadataD2Repository"; +import { CompositionRoot, getWebappCompositionRoot } from "$/CompositionRoot"; +import { MetadataD2Repository } from "$/data/repositories/MetadataD2Repository"; import { MetadataItem } from "$/domain/entities/MetadataItem"; export function Dhis2App(_props: {}) { diff --git a/src/webapp/pages/app/__tests__/App.spec.tsx b/src/webapp/pages/app/__tests__/App.spec.tsx index d2b0ea9..ce909fa 100644 --- a/src/webapp/pages/app/__tests__/App.spec.tsx +++ b/src/webapp/pages/app/__tests__/App.spec.tsx @@ -1,7 +1,7 @@ import { render } from "@testing-library/react"; -import App from "../App"; -import { getTestContext } from "../../../../utils/tests"; +import App from "$/webapp/pages/app/App"; +import { getTestContext } from "$/utils/tests"; import { Provider } from "@dhis2/app-runtime"; import { MetadataItem } from "$/domain/entities/MetadataItem"; import { getD2APiFromInstance } from "$/utils/d2-api"; diff --git a/src/webapp/pages/example/ExamplePage.tsx b/src/webapp/pages/example/ExamplePage.tsx new file mode 100644 index 0000000..c444f3b --- /dev/null +++ b/src/webapp/pages/example/ExamplePage.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { useHistory } from "react-router-dom"; +import styled from "styled-components"; +import i18n from "$/utils/i18n"; +import { PageHeader } from "$/webapp/components/page-header/PageHeader"; + +export const ExamplePage: React.FC = React.memo(props => { + const { name } = props; + const title = i18n.t("Hello {{name}}", { name }); + const history = useHistory(); + + const goBack = React.useCallback(() => { + history.goBack(); + }, [history]); + + return ( + + + {title} + + ); +}); + +const Title = styled.h2` + color: blue; +`; + +interface ExamplePageProps { + name: string; +} diff --git a/src/webapp/pages/landing/LandingPage.tsx b/src/webapp/pages/landing/LandingPage.tsx new file mode 100644 index 0000000..935274b --- /dev/null +++ b/src/webapp/pages/landing/LandingPage.tsx @@ -0,0 +1,39 @@ +import { Typography } from "@material-ui/core"; +import React from "react"; +import { useHistory } from "react-router-dom"; +import { Card, CardGrid } from "$/webapp/components/card-grid/CardGrid"; +import { useAppContext } from "$/webapp/contexts/app-context"; + +export const LandingPage: React.FC = React.memo(() => { + const history = useHistory(); + const { currentUser } = useAppContext(); + + const cards: Card[] = [ + { + title: "Section", + key: "main", + children: [ + { + name: "John", + description: "Entry point 1", + listAction: () => history.push("/for/John"), + }, + { + name: "Mary", + description: "Entry point 2", + listAction: () => history.push("/for/Mary"), + }, + ], + }, + ]; + + return ( + <> + + Current user: {currentUser.name} [{currentUser.id}] + + + + + ); +}); diff --git a/src/webapp/utils/analysis.tsx b/src/webapp/utils/analysis.tsx index 0589371..7125901 100644 --- a/src/webapp/utils/analysis.tsx +++ b/src/webapp/utils/analysis.tsx @@ -1,11 +1,11 @@ import i18n from "$/utils/i18n"; -import { ProgressStatus } from "../components/progress-status/ProgressStatus"; +import { ProgressStatus } from "$/webapp/components/progress-status/ProgressStatus"; import { QualityAnalysis } from "$/domain/entities/QualityAnalysis"; import { TableColumn } from "@eyeseetea/d2-ui-components"; import { Tooltip } from "@material-ui/core"; import styled from "styled-components"; -import { Tag } from "../components/tag/Tag"; +import { Tag } from "$/webapp/components/tag/Tag"; function mapAnalysisStatusToColor(sectionStatus: string) { switch (sectionStatus) { diff --git a/yarn.lock b/yarn.lock index 3001dc3..06d7a92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6360,6 +6360,11 @@ eslint-plugin-jsx-a11y@^6.5.1: object.fromentries "^2.0.6" semver "^6.3.0" +eslint-plugin-no-relative-import-paths@^1.5.3: + version "1.5.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-no-relative-import-paths/-/eslint-plugin-no-relative-import-paths-1.5.4.tgz#dd83666b13d43dd22156e4cc660f73700843791a" + integrity sha512-2smViH7R3682NR6dwgYr8Vm7emqNP1gEjBku6DbvUy3Ef/2Fz+mhwsFjZGSixzWzazMCj4MAgIWTsHELCCDJKA== + eslint-plugin-react-hooks@^4.3.0: version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"