Skip to content

Commit caf304e

Browse files
ref #1124 done
1 parent ab78930 commit caf304e

File tree

8 files changed

+168
-15
lines changed

8 files changed

+168
-15
lines changed

DisplayObjects/mobile/assets/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version_c8o": "2.1.8-beta4",
2+
"version_c8o": "2.1.8-beta5",
33
"deleted_element": "Deleted element",
44
"copy_link_no_auth": "Copy link without authentication",
55
"to_the_app": "to the app",

DisplayObjects/mobile/assets/i18n/es.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version_c8o": "2.1.8-beta4",
2+
"version_c8o": "2.1.8-beta5",
33
"deleted_element": "Elemento eliminado",
44
"copy_link_no_auth": "Copiar enlace sin autenticación",
55
"to_the_app": "a la aplicación",

DisplayObjects/mobile/assets/i18n/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version_c8o": "2.1.8-beta4",
2+
"version_c8o": "2.1.8-beta5",
33
"deleted_element": "Élément supprimé",
44
"copy_link_no_auth": "Copier le lien sans authentification",
55
"to_the_app": "à l'application",

DisplayObjects/mobile/assets/i18n/it.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version_c8o": "2.1.8-beta4",
2+
"version_c8o": "2.1.8-beta5",
33
"deleted_element": "Elemento eliminato",
44
"copy_link_no_auth": "Copia il link senza autenticazione",
55
"to_the_app": "all'app",

_c8oProject/sequences/APIV2_CleanThumbnailsWallpapersB64.yaml

Lines changed: 86 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ comment: |
3636
var useIndex = ["_design/mangoIndexes2", "cleanup_thumbnail_wallpaper_b64"];
3737
var bookmark = null;
3838
var running = true;
39+
var creatorDisplayCache = {};
3940
while (running) {
4041
context.getRootContext().lastAccessTime = new Date().getTime();
4142
var query = {
@@ -82,17 +83,91 @@ comment: |
8283
if (!docEntry || !docEntry._id) {
8384
continue;
8485
}
85-
context.addTextNode(docsNode, "_id", docEntry._id);
86-
if (!shouldExecute) {
87-
continue;
86+
var docNode = context.addTextNode(docsNode, "document", "");
87+
context.addTextNode(docNode, "_id", docEntry._id);
88+
if (shouldExecute) {
89+
log.warn("Fetching full document " + docEntry._id + " for cleanup processing.");
8890
}
89-
log.warn("Fetching full document " + docEntry._id + " for cleanup processing.");
9091
var fullDoc = null;
9192
try {
9293
fullDoc = toJSON(fsclient.getDocument("c8oforms_fs", docEntry._id, new HashMap()));
9394
}
9495
catch (e) {
95-
log.error("Failed to fetch document " + docEntry._id + " while preparing cleanup: " + e);
96+
log.error("Failed to fetch document " + docEntry._id + " while preparing cleanup metadata: " + e);
97+
context.addTextNode(docNode, "metadataFetchStatus", "error");
98+
context.addTextNode(errorsNode, "_id", docEntry._id);
99+
continue;
100+
}
101+
if (fullDoc) {
102+
if (hasOwn(fullDoc, "creator") && fullDoc.creator !== undefined && fullDoc.creator !== null) {
103+
var creatorValue = ("" + fullDoc.creator).trim();
104+
if (creatorValue.length > 0) {
105+
context.addTextNode(docNode, "creator", creatorValue);
106+
var cacheKey = creatorValue;
107+
var cachedDisplay = hasOwn(creatorDisplayCache, cacheKey) ? creatorDisplayCache[cacheKey] : undefined;
108+
if (cachedDisplay === undefined) {
109+
var creatorDocId = creatorValue.indexOf("C8Oreserved_") === 0 ? creatorValue : "C8Oreserved_" + creatorValue;
110+
try {
111+
var creatorDoc = toJSON(fsclient.getDocument("c8oforms_fs", creatorDocId, new HashMap()));
112+
if (creatorDoc && hasOwn(creatorDoc, "displayName") && creatorDoc.displayName !== null && creatorDoc.displayName !== undefined) {
113+
cachedDisplay = "" + creatorDoc.displayName;
114+
}
115+
else {
116+
cachedDisplay = "";
117+
}
118+
}
119+
catch (err) {
120+
log.warn("Failed to fetch creator profile " + creatorDocId + " while preparing metadata for " + docEntry._id + ": " + err);
121+
cachedDisplay = "";
122+
}
123+
creatorDisplayCache[cacheKey] = cachedDisplay;
124+
}
125+
var displayNameValue = cachedDisplay !== undefined && cachedDisplay !== null ? "" + cachedDisplay : "";
126+
context.addTextNode(docNode, "creatorDisplayName", displayNameValue);
127+
}
128+
}
129+
if (hasOwn(fullDoc, "name") && fullDoc.name !== undefined && fullDoc.name !== null) {
130+
context.addTextNode(docNode, "name", "" + fullDoc.name);
131+
}
132+
if (hasOwn(fullDoc, "lastMofification") && fullDoc.lastMofification !== undefined && fullDoc.lastMofification !== null) {
133+
var rawLastModification = fullDoc.lastMofification;
134+
var lastModificationMillis = null;
135+
if (typeof rawLastModification === "number") {
136+
lastModificationMillis = rawLastModification;
137+
}
138+
else if (typeof rawLastModification === "string") {
139+
var trimmed = rawLastModification.trim();
140+
if (trimmed.length > 0) {
141+
var parsedMillis = parseInt(trimmed, 10);
142+
if (!isNaN(parsedMillis)) {
143+
lastModificationMillis = parsedMillis;
144+
}
145+
else {
146+
var parsedDate = Date.parse(trimmed);
147+
if (!isNaN(parsedDate)) {
148+
lastModificationMillis = parsedDate;
149+
}
150+
}
151+
}
152+
}
153+
else {
154+
var coerced = +rawLastModification;
155+
if (!isNaN(coerced)) {
156+
lastModificationMillis = coerced;
157+
}
158+
}
159+
if (lastModificationMillis !== null) {
160+
var lastModificationDate = new Date(lastModificationMillis);
161+
if (!isNaN(lastModificationDate.getTime())) {
162+
context.addTextNode(docNode, "lastMofificationDate", "" + lastModificationDate);
163+
}
164+
}
165+
}
166+
}
167+
if (!shouldExecute) {
168+
continue;
169+
}
170+
if (!fullDoc) {
96171
context.addTextNode(errorsNode, "_id", docEntry._id);
97172
continue;
98173
}
@@ -206,4 +281,9 @@ comment: |
206281
value: false
207282
↓chunkSize [variables.RequestableVariable-202406070003]:
208283
comment: Number of documents fetched per CouchDB page while iterating.
209-
value: 1000
284+
value: 1000
285+
↓Test_Case_exec [core.TestCase]:
286+
↓execute [variables.TestCaseVariable-1760444342789]:
287+
value: true
288+
↓chunkSize [variables.TestCaseVariable-1760444342791]:
289+
value: 1000

_c8oProject/sequences/APIV2_RebuildC8oGrp.yaml

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ comment: |
157157
var useIndex = ["_design/mangoIndexes2", "forms_c8ogrp_audit"];
158158
var bookmark = null;
159159
var running = true;
160+
var creatorDisplayCache = {};
160161
log.warn("Starting c8oGrp audit in " + (shouldExecute ? "apply" : "dry-run") + " mode with batch size " + limit + ".");
161162
while (running) {
162163
context.getRootContext().lastAccessTime = new Date().getTime();
@@ -188,7 +189,9 @@ comment: |
188189
"c8oGrp",
189190
"shared",
190191
"collabs",
191-
"creator"
192+
"creator",
193+
"name",
194+
"lastMofification"
192195
]
193196
};
194197
if (bookmark !== null) {
@@ -235,9 +238,74 @@ comment: |
235238
if (docNode === null) {
236239
docNode = context.addTextNode(docsNode, "document", "");
237240
context.addTextNode(docNode, "id", docEntry._id);
241+
if (docEntry.creator !== undefined && docEntry.creator !== null) {
242+
var rawCreator = ("" + docEntry.creator).trim();
243+
if (rawCreator.length > 0) {
244+
context.addTextNode(docNode, "creator", rawCreator);
245+
var cacheKey = rawCreator;
246+
var cachedDisplay = hasOwn(creatorDisplayCache, cacheKey) ? creatorDisplayCache[cacheKey] : undefined;
247+
if (cachedDisplay === undefined) {
248+
var creatorDocId = rawCreator.indexOf("C8Oreserved_") === 0 ? rawCreator : "C8Oreserved_" + rawCreator;
249+
try {
250+
var creatorDoc = toJSON(fsclient.getDocument("c8oforms_fs", creatorDocId, new HashMap()));
251+
if (creatorDoc && hasOwn(creatorDoc, "displayName") && creatorDoc.displayName !== null && creatorDoc.displayName !== undefined) {
252+
cachedDisplay = "" + creatorDoc.displayName;
253+
}
254+
else {
255+
cachedDisplay = "";
256+
}
257+
}
258+
catch (err) {
259+
log.warn("Failed to fetch creator profile " + creatorDocId + " while preparing metadata for " + docEntry._id + ": " + err);
260+
cachedDisplay = "";
261+
}
262+
creatorDisplayCache[cacheKey] = cachedDisplay;
263+
}
264+
var displayNameValue = cachedDisplay !== undefined && cachedDisplay !== null ? "" + cachedDisplay : "";
265+
context.addTextNode(docNode, "creatorDisplayName", displayNameValue);
266+
}
267+
}
268+
if (hasOwn(docEntry, "name") && docEntry.name !== undefined && docEntry.name !== null) {
269+
context.addTextNode(docNode, "name", "" + docEntry.name);
270+
}
271+
if (hasOwn(docEntry, "lastMofification") && docEntry.lastMofification !== undefined && docEntry.lastMofification !== null) {
272+
var rawLastModification = docEntry.lastMofification;
273+
var lastModificationMillis = null;
274+
if (typeof rawLastModification === "number") {
275+
lastModificationMillis = rawLastModification;
276+
}
277+
else if (typeof rawLastModification === "string") {
278+
var trimmed = rawLastModification.trim();
279+
if (trimmed.length > 0) {
280+
var parsedMillis = parseInt(trimmed, 10);
281+
if (!isNaN(parsedMillis)) {
282+
lastModificationMillis = parsedMillis;
283+
}
284+
else {
285+
var parsedDate = Date.parse(trimmed);
286+
if (!isNaN(parsedDate)) {
287+
lastModificationMillis = parsedDate;
288+
}
289+
}
290+
}
291+
}
292+
else {
293+
var coerced = +rawLastModification;
294+
if (!isNaN(coerced)) {
295+
lastModificationMillis = coerced;
296+
}
297+
}
298+
if (lastModificationMillis !== null) {
299+
var lastModificationDate = new Date(lastModificationMillis);
300+
if (!isNaN(lastModificationDate.getTime())) {
301+
context.addTextNode(docNode, "lastMofificationDate", "" + lastModificationDate);
302+
}
303+
}
304+
}
238305
context.addTextNode(docNode, "current", JSON.stringify(currentKeys));
239306
context.addTextNode(docNode, "expected", JSON.stringify(expectedKeys));
240307
}
308+
return docNode;
241309
};
242310
if (mismatch) {
243311
ensureDocNode();
@@ -363,7 +431,12 @@ comment: |
363431
log.warn("c8oGrp audit summary: scanned=" + totalScanned + ", mismatched=" + totalMismatched + ", updated=" + totalUpdated + ", errors=" + totalErrors + ".");'
364432
↓execute [variables.RequestableVariable-202406070022]:
365433
comment: Set to true to rebuild c8oGrp based on computed expectations.
366-
value: true
434+
value: false
367435
↓chunkSize [variables.RequestableVariable-202406070023]:
368436
comment: Number of documents fetched per Mango page during the audit.
369-
value: 100
437+
value: 100
438+
↓Test_Case_execute [core.TestCase]:
439+
↓execute [variables.TestCaseVariable-1760521991270]:
440+
value: true
441+
↓chunkSize [variables.TestCaseVariable-1760521991272]:
442+
value: 100

c8oProject.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
contextTimeout: ${C8Oforms.context.timeout=60}
55
corsOrigin: =Origin
66
httpSessionTimeout: ${C8Oforms.http_session.timeout=60}
7-
version: 2.1.8-beta4
7+
version: 2.1.8-beta5
88
↓c8oforms_fs [connectors.FullSyncConnector]: 🗏 connectors/c8oforms_fs.yaml
99
↓c8oforms_response_fs [connectors.FullSyncConnector]: 🗏 connectors/c8oforms_response_fs.yaml
1010
↓AddUser [sequences.GenericSequence]: 🗏 sequences/AddUser.yaml

ngswForPWA/ngsw-config-sub-pwa.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"appData": {
55
"name": "Convertigo Forms Builder",
66
"description": "A simple and intuitive \"no code\" tool to create your personalized apps in a few clicks!",
7-
"version": "2.1.8-beta4"
7+
"version": "2.1.8-beta5"
88
},
99
"assetGroups": [
1010
{

0 commit comments

Comments
 (0)