Skip to content

Commit

Permalink
Merge from v2
Browse files Browse the repository at this point in the history
  • Loading branch information
wongpratan committed Aug 26, 2024
2 parents 63cd4d5 + ff98c42 commit df54b63
Show file tree
Hide file tree
Showing 36 changed files with 1,172 additions and 461 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ jobs:
run: pm2 start ./logs.js -- --toFile logs/ABServices.log
working-directory: ./AppBuilder
- name: Wait for AB
uses: ifaxity/wait-on-action@v1
# Skipping the wait step. Cypress has a bit of wait time built in.
if: false
uses: ifaxity/[email protected]
with:
resource: http://localhost:80
timeout: 300000
Expand All @@ -131,4 +133,4 @@ jobs:
with:
name: ABServices.log
path: ./AppBuilder/logs/ABServices.log


1,192 changes: 825 additions & 367 deletions ABDataCollectionCore.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion ABFactoryCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,10 @@ class ABFactory extends EventEmitter {
return this.objectByID("d84cd351-d96c-490f-9afb-2a0b880ca0ec");
}

objectProcessDefinition() {
return this.objectByID("af91fc75-fb73-4d71-af14-e22832eb5915");
}

objectProcessForm() {
return this.objectByID("d36ae4c8-edef-48d8-bd9c-79a0edcaa067");
}
Expand Down Expand Up @@ -825,7 +829,7 @@ class ABFactory extends EventEmitter {
var newStep = new ABStep(params, this);
return newStep;
}
return null;
// return null;
}

//
Expand Down
5 changes: 2 additions & 3 deletions ABHintCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ module.exports = class ABHintCore extends ABMLClass {
}
}
*/
let active = attributes?.settings.hasOwnProperty("active")
? attributes?.settings?.active
: "1";

let active = attributes?.settings?.active ?? "1";

this.id = attributes?.id || "";
this.name = attributes?.name || "New Tutorial";
Expand Down
2 changes: 1 addition & 1 deletion ABMobileAppCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = class ABMobileAppCore extends ABMLClass {
type: this.type || "mobile.application",
name: this.name,
settings: this.settings,
translations: obj.translations
translations: obj.translations,
};
}
};
17 changes: 12 additions & 5 deletions ABModelCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ module.exports = class ABModelCore {
};
return this.request("get", params)
.then((numberOfRows) => {
resolve(numberOfRows);
// resolve(numberOfRows);
return numberOfRows;
})
.catch((err) => {
// TODO: this should be done in platform/ABModel
Expand Down Expand Up @@ -292,7 +293,7 @@ module.exports = class ABModelCore {
var responseHash = {
/* id : [{entry}] */
};
var cond = { where: {} };
var cond = { where: {}, populate: true };
cond.where[PK] = [];

console.log(
Expand Down Expand Up @@ -343,7 +344,13 @@ module.exports = class ABModelCore {
);
}
allKeys.forEach((key) => {
var resolve = responseHash[key].resolve;
let entry = responseHash[key];
let resolve;
if (Array.isArray(entry)) {
resolve = entry[0].resolve;
} else {
resolve = entry.resolve;
}
resolve({ data: [] });
delete responseHash[key];
});
Expand Down Expand Up @@ -435,7 +442,7 @@ module.exports = class ABModelCore {
if (fields.length == 1) {
let data =
myObj[
fields[0].replace(/[^a-z0-9\.]/gi, "") + "__relation"
fields[0].replace(/[^a-z0-9.]/gi, "") + "__relation"
];
if (!data) return resolve([]);

Expand All @@ -458,7 +465,7 @@ module.exports = class ABModelCore {
var returnData = {};
fields.forEach((colName) => {
returnData[colName] =
myObj[colName.replace(/[^a-z0-9\.]/gi, "") + "__relation"];
myObj[colName.replace(/[^a-z0-9.]/gi, "") + "__relation"];
});

resolve(returnData);
Expand Down
59 changes: 57 additions & 2 deletions ABObjectCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ module.exports = class ABObjectCore extends ABMLClass {
* @return {string}
*/
urlRestCount() {
return `/app_builder/model/count/${this.id}`;
return `/app_builder/model/${this.id}/count`;
}

///
Expand Down Expand Up @@ -932,6 +932,11 @@ module.exports = class ABObjectCore extends ABMLClass {
fields.push(field.columnName);
});
}
// Default defining label
else {
const defaultFld = this.fields((f) => f.fieldUseAsLabel())[0];
if (defaultFld) fields.push(defaultFld.columnName);
}

// System requires to include number field values
// because they are used on Formula/Calculate fields on client side
Expand Down Expand Up @@ -1003,5 +1008,55 @@ module.exports = class ABObjectCore extends ABMLClass {

return labelData;
}
};

/**
* @method whereCleanUp()
* Parse through the current where condition and remove any null or
* empty logical blocks.
* @param {obj} curr
* 1) The current where condition in ABQuery Format:
* {
* glue: [AND, OR],
* rules: [ {rule} ]
* }
* or 2) The current {rule} to validate
* {
* key:{string},
* rule:{string},
* vlaue:{mixed}
* }
* @return {ABQuery.where} / { Rule }
*/
whereCleanUp(curr) {
if (curr) {
if (curr.glue && curr.rules) {
// this is a logical Block (AND, OR)
// we need to filter the children
let newValue = { glue: curr.glue, rules: [] };
curr.rules.forEach((r) => {
let cleanRule = this.whereCleanUp(r);
// don't add values that didn't pass
if (cleanRule) {
newValue.rules.push(cleanRule);
}
});

// if we have a non empty block, then return it:
if (newValue.rules.length > 0) {
return newValue;
}

// this isn't really a valid conditional, so null
return null;
}

// This is a specific rule, that isn't null so:
// if it isn't {}, then return it
if (Object.keys(curr).length > 0) return curr;

// otherwise we skip this as well
return null;
}
return null;
}
};
2 changes: 1 addition & 1 deletion ABProcessCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ module.exports = class ABProcessCore extends ABMLClass {
// : values[0]
// : null;

var tasksToAsk = this.allPreviousTasks(currElement)
var tasksToAsk = this.allPreviousTasks(currElement);
var values = queryPreviousTasks(tasksToAsk, "processData", params, this);
return values.length > 0
? values.length > 1
Expand Down
2 changes: 1 addition & 1 deletion ABScopeCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = class ABScopeCore {
createdBy: this.createdBy,
filter: this.filter,
allowAll: this.allowAll || false,
objectIds: this.objects().map((o) => o.id)
objectIds: this.objects().map((o) => o.id),
};
}

Expand Down
1 change: 1 addition & 0 deletions ABViewManagerCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var AllViews = [
require("../platform/views/ABViewLayout"),
require("../platform/views/ABViewList"),
require("../platform/views/ABViewMenu"),
require("../platform/views/ABViewOrgChart"),
require("../platform/views/ABViewPage"),
require("../platform/views/ABViewPDFImporter"),
require("../platform/views/ABViewPivot"),
Expand Down
Loading

0 comments on commit df54b63

Please sign in to comment.