Skip to content

Commit

Permalink
Merge pull request #660 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
adrianq authored Oct 6, 2020
2 parents 3228af9 + 6a87161 commit 5de4f3d
Show file tree
Hide file tree
Showing 34 changed files with 418 additions and 219 deletions.
9 changes: 6 additions & 3 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2020-09-18T10:25:12.901Z\n"
"PO-Revision-Date: 2020-09-18T10:25:12.901Z\n"
"POT-Creation-Date: 2020-10-06T10:10:16.836Z\n"
"PO-Revision-Date: 2020-10-06T10:10:16.836Z\n"

msgid "Field {{field}} cannot be blank"
msgstr ""
Expand Down Expand Up @@ -35,7 +35,7 @@ msgstr ""
msgid "Error {{status}}"
msgstr ""

msgid "Network error {{error}}, check if server is up and CORS is enabled"
msgid "Network error, check if server is up and CORS is enabled"
msgstr ""

msgid "Unknown error"
Expand Down Expand Up @@ -514,6 +514,9 @@ msgstr ""
msgid "Include user information and sharing settings"
msgstr ""

msgid "Remove organisation unit references"
msgstr ""

msgid "Use default dependencies"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2020-09-17T07:32:35.965Z\n"
"POT-Creation-Date: 2020-10-06T10:10:16.836Z\n"
"PO-Revision-Date: 2020-07-10T06:53:30.625Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -35,7 +35,7 @@ msgstr ""
msgid "Error {{status}}"
msgstr ""

msgid "Network error {{error}}, check if server is up and CORS is enabled"
msgid "Network error, check if server is up and CORS is enabled"
msgstr ""

msgid "Unknown error"
Expand Down Expand Up @@ -515,6 +515,9 @@ msgstr ""
msgid "Include user information and sharing settings"
msgstr ""

msgid "Remove organisation unit references"
msgstr ""

msgid "Use default dependencies"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions i18n/fr.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2020-09-17T07:32:35.965Z\n"
"POT-Creation-Date: 2020-10-06T10:10:16.836Z\n"
"PO-Revision-Date: 2020-07-10T06:53:30.625Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -35,7 +35,7 @@ msgstr ""
msgid "Error {{status}}"
msgstr ""

msgid "Network error {{error}}, check if server is up and CORS is enabled"
msgid "Network error, check if server is up and CORS is enabled"
msgstr ""

msgid "Unknown error"
Expand Down Expand Up @@ -515,6 +515,9 @@ msgstr ""
msgid "Include user information and sharing settings"
msgstr ""

msgid "Remove organisation unit references"
msgstr ""

msgid "Use default dependencies"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions i18n/pt.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2020-09-17T07:32:35.965Z\n"
"POT-Creation-Date: 2020-10-06T10:10:16.836Z\n"
"PO-Revision-Date: 2020-07-10T06:53:30.625Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -35,7 +35,7 @@ msgstr ""
msgid "Error {{status}}"
msgstr ""

msgid "Network error {{error}}, check if server is up and CORS is enabled"
msgid "Network error, check if server is up and CORS is enabled"
msgstr ""

msgid "Unknown error"
Expand Down Expand Up @@ -515,6 +515,9 @@ msgstr ""
msgid "Include user information and sharing settings"
msgstr ""

msgid "Remove organisation unit references"
msgstr ""

msgid "Use default dependencies"
msgstr ""

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "metadata-synchronization",
"description": "Advanced metadata & data synchronization utility",
"version": "2.2.1",
"version": "2.3.0",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"homepage": ".",
Expand All @@ -24,12 +24,11 @@
"@material-ui/styles": "4.10.0",
"@octokit/rest": "18.0.0",
"axios": "0.19.2",
"axios-retry": "3.1.8",
"btoa": "1.2.1",
"cronstrue": "1.95.0",
"cryptr": "4.0.2",
"d2": "31.8.1",
"d2-api": "1.1.0",
"d2-api": "1.2.0",
"d2-manifest": "1.0.0",
"d2-ui-components": "2.1.0",
"file-saver": "2.0.2",
Expand Down
60 changes: 41 additions & 19 deletions src/data/aggregated/AggregatedD2ApiRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import { cleanOrgUnitPaths } from "../../domain/synchronization/utils";
import { DataImportParams } from "../../types/d2";
import { D2Api, DataValueSetsPostResponse } from "../../types/d2-api";
import { promiseMap } from "../../utils/common";
import { getD2APiFromInstance } from "../../utils/d2-utils";

export class AggregatedD2ApiRepository implements AggregatedRepository {
private api: D2Api;

constructor(private instance: Instance) {
this.api = new D2Api({ baseUrl: instance.url, auth: instance.auth });
this.api = getD2APiFromInstance(instance);
}

public async getAggregated(
Expand Down Expand Up @@ -182,24 +183,45 @@ export class AggregatedD2ApiRepository implements AggregatedRepository {
data: object,
additionalParams: DataImportParams | undefined
): Promise<SynchronizationResult> {
const { status, description, importCount, conflicts } = await this.api
.post<DataValueSetsPostResponse>(
"/dataValueSets",
{
idScheme: "UID",
dataElementIdScheme: "UID",
orgUnitIdScheme: "UID",
eventIdScheme: "UID",
preheatCache: false,
skipExistingCheck: false,
format: "json",
async: false,
dryRun: false,
...additionalParams,
},
data
)
.getData();
try {
const response = await this.api
.post<DataValueSetsPostResponse>(
"/dataValueSets",
{
idScheme: "UID",
dataElementIdScheme: "UID",
orgUnitIdScheme: "UID",
eventIdScheme: "UID",
preheatCache: false,
skipExistingCheck: false,
format: "json",
async: false,
dryRun: false,
...additionalParams,
},
data
)
.getData();

return this.cleanAggregatedImportResponse(response);
} catch (error) {
if (error?.response?.data) {
return this.cleanAggregatedImportResponse(error.response.data);
}

return {
status: "NETWORK ERROR",
instance: this.instance.toPublicObject(),
date: new Date(),
type: "aggregated",
};
}
}

private cleanAggregatedImportResponse(
importResult: DataValueSetsPostResponse
): SynchronizationResult {
const { status, description, importCount, conflicts } = importResult;

const errors =
conflicts?.map(({ object, value }) => ({
Expand Down
Loading

0 comments on commit 5de4f3d

Please sign in to comment.