Skip to content

Commit af32420

Browse files
authored
feat: improve push command (updates coming from suggestions) (#185)
1 parent 4b9f46d commit af32420

20 files changed

+11157
-5060
lines changed

schema.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
"removeOtherKeys": {
9191
"description": "Remove keys which are not present in the import (within imported namespaces).",
9292
"type": "boolean"
93+
},
94+
"errorOnUnresolvedConflict": {
95+
"$ref": "#/$defs/errorOnUnresolvedConflict"
96+
},
97+
"overrideMode": {
98+
"$ref": "#/$defs/overrideMode"
9399
}
94100
}
95101
},
@@ -251,6 +257,16 @@
251257
"type": "string",
252258
"enum": ["OVERRIDE", "KEEP", "NO_FORCE"]
253259
},
260+
"overrideMode": {
261+
"description": "Specifies what is considered non-overridable translation: \n - RECOMMENDED - protected reviewed translations are considered as non-overridable\n - ALL - translations that user has permissions for",
262+
"type": "string",
263+
"enum": ["ALL", "RECOMMENDED"]
264+
},
265+
"errorOnUnresolvedConflict": {
266+
"description": "Fail the whole import if there are unresolved conflicts in import: \n - yes - fail if any unresolved conflict is present\n no - don't fail and just print unresolved conflicts\n auto - fails when when forceMode=KEEP, otherwise doesn't fail",
267+
"type": "string",
268+
"enum": ["yes", "no", "auto"]
269+
},
254270
"path": {
255271
"description": "File glob specifying which files to include.",
256272
"type": "string"

scripts/tolgee.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tolgee.authentication.registrationsAllowed=false
33
tolgee.authentication.initialUsername=admin
44
tolgee.authentication.initialPassword=admin
55

6-
tolgee.rateLimits.enabled=false
6+
tolgee.rate-limits.enabled=false
77

88
tolgee.internal.showVersion=true
99
tolgee.internal.controllerEnabled=true

src/client/errorFromLoadable.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { getUnresolvedConflictsMessage } from '../utils/printFailedKeys.js';
12
import { LoadableData } from './TolgeeClient.js';
23

34
export const addErrorDetails = (loadable: LoadableData, showBeError = true) => {
5+
let additionalInfo = '';
46
const items: string[] = [];
57
items.push(`status: ${loadable.response.status}`);
68
if (showBeError && loadable.error?.code) {
@@ -9,7 +11,18 @@ export const addErrorDetails = (loadable: LoadableData, showBeError = true) => {
911
if (loadable.response.status === 403 && loadable.error?.params?.[0]) {
1012
items.push(`missing scope: ${loadable.error.params[0]}`);
1113
}
12-
return `[${items.join(', ')}]`;
14+
15+
if (
16+
loadable.error?.code === 'conflict_is_not_resolved' &&
17+
typeof loadable.error.params?.[0] === 'object'
18+
) {
19+
additionalInfo += getUnresolvedConflictsMessage(
20+
loadable.error.params as any,
21+
true
22+
);
23+
}
24+
25+
return `[${items.join(', ')}]${additionalInfo ? '\n' + additionalInfo : ''}`;
1326
};
1427

1528
export const errorFromLoadable = (loadable: LoadableData) => {

0 commit comments

Comments
 (0)