@adminforth/i18n 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +2 -2
- package/custom/BulkActionButton.vue +4 -2
- package/custom/LanguageUnderLogin.vue +1 -1
- package/custom/TranslationJobViewComponent.vue +9 -6
- package/dist/custom/BulkActionButton.vue +4 -2
- package/dist/custom/LanguageUnderLogin.vue +1 -1
- package/dist/custom/TranslationJobViewComponent.vue +9 -6
- package/dist/index.js +4 -4
- package/index.ts +4 -4
- package/package.json +2 -2
package/build.log
CHANGED
|
@@ -20,5 +20,5 @@ custom/package.json
|
|
|
20
20
|
custom/pnpm-lock.yaml
|
|
21
21
|
custom/tsconfig.json
|
|
22
22
|
|
|
23
|
-
sent 45,
|
|
24
|
-
total size is 44,
|
|
23
|
+
sent 45,755 bytes received 305 bytes 92,120.00 bytes/sec
|
|
24
|
+
total size is 44,587 speedup is 0.97
|
|
@@ -98,8 +98,10 @@
|
|
|
98
98
|
const allChecked = computed(() => Object.values(checkedLanguages.value).every(Boolean));
|
|
99
99
|
const noneChecked = computed(() => Object.values(checkedLanguages.value).every(value => !value));
|
|
100
100
|
|
|
101
|
+
let unsubscribeFromTranslationProgress: () => void;
|
|
102
|
+
|
|
101
103
|
onMounted(() => {
|
|
102
|
-
websocket.subscribe('/translation_progress', (data) => {
|
|
104
|
+
unsubscribeFromTranslationProgress = websocket.subscribe('/translation_progress', (data) => {
|
|
103
105
|
adminforth.list.refresh();
|
|
104
106
|
});
|
|
105
107
|
for (const lang of props.meta.supportedLanguages) {
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
});
|
|
109
111
|
|
|
110
112
|
onUnmounted( () => {
|
|
111
|
-
|
|
113
|
+
unsubscribeFromTranslationProgress();
|
|
112
114
|
} )
|
|
113
115
|
|
|
114
116
|
function selectAll() {
|
|
@@ -45,7 +45,7 @@ watch(() => selectedLanguage.value, async (newVal) => {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
await setLang({ setLocaleMessage, locale }, props.meta.pluginInstanceId, newVal);
|
|
48
|
-
coreStore.
|
|
48
|
+
coreStore.fetchConfig({ redirectToLoginIfNotLoggedIn: false });
|
|
49
49
|
coreStore.getLoginFormConfig();
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -135,10 +135,12 @@ async function loadPage(targetPage: number) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
let unsubscribeFromTaskUpdates: () => void;
|
|
139
|
+
let unsubscribeFromTaskErrors: () => void;
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
onMounted(async () => {
|
|
142
|
+
// subscribe before the first await, so onUnmounted always has something to unsubscribe
|
|
143
|
+
unsubscribeFromTaskUpdates = websocket.subscribe(`/background-jobs-task-update/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
142
144
|
const indexOnPage = data.taskIndex - currentOffset.value;
|
|
143
145
|
if (indexOnPage >= 0 && indexOnPage < translationTasks.value.length) {
|
|
144
146
|
if (data.state) {
|
|
@@ -149,15 +151,16 @@ onMounted(async () => {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
});
|
|
152
|
-
websocket.subscribe(`/background-jobs-task-error/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
154
|
+
unsubscribeFromTaskErrors = websocket.subscribe(`/background-jobs-task-error/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
153
155
|
console.log('Error received for task', data);
|
|
154
156
|
});
|
|
155
157
|
|
|
158
|
+
await loadPage(0);
|
|
156
159
|
});
|
|
157
160
|
|
|
158
161
|
onUnmounted(() => {
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
unsubscribeFromTaskUpdates();
|
|
163
|
+
unsubscribeFromTaskErrors();
|
|
161
164
|
});
|
|
162
165
|
|
|
163
166
|
|
|
@@ -98,8 +98,10 @@
|
|
|
98
98
|
const allChecked = computed(() => Object.values(checkedLanguages.value).every(Boolean));
|
|
99
99
|
const noneChecked = computed(() => Object.values(checkedLanguages.value).every(value => !value));
|
|
100
100
|
|
|
101
|
+
let unsubscribeFromTranslationProgress: () => void;
|
|
102
|
+
|
|
101
103
|
onMounted(() => {
|
|
102
|
-
websocket.subscribe('/translation_progress', (data) => {
|
|
104
|
+
unsubscribeFromTranslationProgress = websocket.subscribe('/translation_progress', (data) => {
|
|
103
105
|
adminforth.list.refresh();
|
|
104
106
|
});
|
|
105
107
|
for (const lang of props.meta.supportedLanguages) {
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
});
|
|
109
111
|
|
|
110
112
|
onUnmounted( () => {
|
|
111
|
-
|
|
113
|
+
unsubscribeFromTranslationProgress();
|
|
112
114
|
} )
|
|
113
115
|
|
|
114
116
|
function selectAll() {
|
|
@@ -45,7 +45,7 @@ watch(() => selectedLanguage.value, async (newVal) => {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
await setLang({ setLocaleMessage, locale }, props.meta.pluginInstanceId, newVal);
|
|
48
|
-
coreStore.
|
|
48
|
+
coreStore.fetchConfig({ redirectToLoginIfNotLoggedIn: false });
|
|
49
49
|
coreStore.getLoginFormConfig();
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -135,10 +135,12 @@ async function loadPage(targetPage: number) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
let unsubscribeFromTaskUpdates: () => void;
|
|
139
|
+
let unsubscribeFromTaskErrors: () => void;
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
onMounted(async () => {
|
|
142
|
+
// subscribe before the first await, so onUnmounted always has something to unsubscribe
|
|
143
|
+
unsubscribeFromTaskUpdates = websocket.subscribe(`/background-jobs-task-update/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
142
144
|
const indexOnPage = data.taskIndex - currentOffset.value;
|
|
143
145
|
if (indexOnPage >= 0 && indexOnPage < translationTasks.value.length) {
|
|
144
146
|
if (data.state) {
|
|
@@ -149,15 +151,16 @@ onMounted(async () => {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
});
|
|
152
|
-
websocket.subscribe(`/background-jobs-task-error/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
154
|
+
unsubscribeFromTaskErrors = websocket.subscribe(`/background-jobs-task-error/${props.job.id}`, (data: { taskIndex: number, status?: string, state?: Record<string, any> }) => {
|
|
153
155
|
console.log('Error received for task', data);
|
|
154
156
|
});
|
|
155
157
|
|
|
158
|
+
await loadPage(0);
|
|
156
159
|
});
|
|
157
160
|
|
|
158
161
|
onUnmounted(() => {
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
unsubscribeFromTaskUpdates();
|
|
163
|
+
unsubscribeFromTaskErrors();
|
|
161
164
|
});
|
|
162
165
|
|
|
163
166
|
|
package/dist/index.js
CHANGED
|
@@ -280,10 +280,10 @@ export default class I18nPlugin extends I18nBase {
|
|
|
280
280
|
return { ok: true };
|
|
281
281
|
}));
|
|
282
282
|
// also add edit hook beforeSave to update completedFieldName
|
|
283
|
-
resourceConfig.hooks.edit.beforeSave.push((_a) => __awaiter(this, [_a], void 0, function* ({
|
|
284
|
-
const futureRecord = Object.assign(Object.assign({}, oldRecord),
|
|
283
|
+
resourceConfig.hooks.edit.beforeSave.push((_a) => __awaiter(this, [_a], void 0, function* ({ updates, oldRecord }) {
|
|
284
|
+
const futureRecord = Object.assign(Object.assign({}, oldRecord), updates);
|
|
285
285
|
const futureCompletedFieldValue = yield this.computeCompletedFieldValue(futureRecord);
|
|
286
|
-
|
|
286
|
+
updates[this.options.completedFieldName] = futureCompletedFieldValue;
|
|
287
287
|
return { ok: true };
|
|
288
288
|
}));
|
|
289
289
|
// add list hook to support filtering by fully_translated virtual field
|
|
@@ -907,7 +907,7 @@ export default class I18nPlugin extends I18nBase {
|
|
|
907
907
|
result = yield this.adminforth.updateResourceRecord({
|
|
908
908
|
resource,
|
|
909
909
|
recordId,
|
|
910
|
-
|
|
910
|
+
updates: updateRecord,
|
|
911
911
|
oldRecord,
|
|
912
912
|
adminUser
|
|
913
913
|
});
|
package/index.ts
CHANGED
|
@@ -332,12 +332,12 @@ export default class I18nPlugin extends I18nBase<PluginOptions> {
|
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
// also add edit hook beforeSave to update completedFieldName
|
|
335
|
-
resourceConfig.hooks.edit.beforeSave.push(async ({
|
|
336
|
-
const futureRecord = { ...oldRecord, ...
|
|
335
|
+
resourceConfig.hooks.edit.beforeSave.push(async ({ updates, oldRecord }: { updates: any, oldRecord: any }): Promise<{ ok: boolean, error?: string }> => {
|
|
336
|
+
const futureRecord = { ...oldRecord, ...updates };
|
|
337
337
|
|
|
338
338
|
const futureCompletedFieldValue = await this.computeCompletedFieldValue(futureRecord);
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
updates[this.options.completedFieldName] = futureCompletedFieldValue;
|
|
341
341
|
return { ok: true };
|
|
342
342
|
});
|
|
343
343
|
|
|
@@ -1129,7 +1129,7 @@ export default class I18nPlugin extends I18nBase<PluginOptions> {
|
|
|
1129
1129
|
result = await this.adminforth.updateResourceRecord({
|
|
1130
1130
|
resource,
|
|
1131
1131
|
recordId,
|
|
1132
|
-
|
|
1132
|
+
updates: updateRecord,
|
|
1133
1133
|
oldRecord,
|
|
1134
1134
|
adminUser
|
|
1135
1135
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/i18n",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^22.10.7",
|
|
46
|
-
"adminforth": "^
|
|
46
|
+
"adminforth": "^4.7.3",
|
|
47
47
|
"i18n-iso-countries": "^7.13.0",
|
|
48
48
|
"semantic-release": "^24.2.1",
|
|
49
49
|
"semantic-release-slack-bot": "^4.0.2",
|