cob-cli 2.6.1 → 2.7.0
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/package.json +1 -1
- package/templates/frontend/common/css/_dualColumn.css +45 -0
- package/templates/frontend/common/css/customizations.__MERGE__.css +2 -1
- package/templates/keywords/audit/backend/scripts/_audit.groovy +14 -16
- package/templates/keywords/audit/frontend/js/cob/_audit.js +3 -3
- package/templates/keywords/calc/backend/scripts/_calc.groovy +5 -4
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* Overall good practive - not column related but specialy relevant inside columns */
|
|
2
|
+
li.custom-dualColumn ol.fields > li > table > tbody > tr > td:nth-child(1) {
|
|
3
|
+
min-width: 70px;
|
|
4
|
+
}
|
|
5
|
+
li.custom-dualColumn ol.fields > li > table > tbody > tr > td:nth-child(2) {
|
|
6
|
+
min-width: 160px;
|
|
7
|
+
}
|
|
8
|
+
li.custom-dualColumn ol.fields li > table > tbody > tr > td:nth-child(3),
|
|
9
|
+
li.custom-dualColumn ol.fields li > table > tbody > tr > td:nth-child(3) * {
|
|
10
|
+
max-width: 230px !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* $style[dualColumn] */
|
|
14
|
+
li.custom-dualColumn > ol.fields{
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
}
|
|
18
|
+
li.custom-dualColumn > ol.fields > li {
|
|
19
|
+
flex-basis:49%;
|
|
20
|
+
}
|
|
21
|
+
li.custom-dualColumn ol.fields > li > table > tbody > tr > td:nth-child(3) {
|
|
22
|
+
width: unset;
|
|
23
|
+
}
|
|
24
|
+
li.custom-dualColumn ol.fields > li > table > tbody > tr > td:nth-child(4) {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* $style[singleColumn] */
|
|
29
|
+
li.custom-dualColumn > ol.fields > li.custom-singleColumn {
|
|
30
|
+
flex-basis:100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* $style[column] */
|
|
34
|
+
li.custom-column > table {
|
|
35
|
+
display: none
|
|
36
|
+
}
|
|
37
|
+
.cob-app .instance-detail-container div.instance-container li.custom-column > ol.fields {
|
|
38
|
+
border:none;
|
|
39
|
+
background-color: unset;
|
|
40
|
+
margin:unset;
|
|
41
|
+
}
|
|
42
|
+
.cob-app .instance-detail-container .instance-container .fields-container li.custom-column.field-group {
|
|
43
|
+
margin:unset;
|
|
44
|
+
padding: unset;
|
|
45
|
+
}
|
|
@@ -5,40 +5,39 @@ import com.google.common.cache.*
|
|
|
5
5
|
import java.util.concurrent.TimeUnit
|
|
6
6
|
|
|
7
7
|
// ========================================================================================================
|
|
8
|
+
if (msg.product != "recordm-definition" && msg.product != "recordm" ) return
|
|
9
|
+
|
|
8
10
|
@Field static cacheOfAuditFieldsForDefinition = CacheBuilder.newBuilder()
|
|
9
11
|
.expireAfterWrite(5, TimeUnit.MINUTES)
|
|
10
12
|
.build();
|
|
11
13
|
|
|
12
14
|
if (msg.product == "recordm-definition") cacheOfAuditFieldsForDefinition.invalidate(msg.type)
|
|
13
|
-
def auditFields = cacheOfAuditFieldsForDefinition.get(msg.type, { getAuditFields(msg.type) })
|
|
14
15
|
|
|
15
16
|
// ========================================================================================================
|
|
16
|
-
|
|
17
|
+
def auditFields = cacheOfAuditFieldsForDefinition.get(msg.type, { getAuditFields(msg.type) })
|
|
17
18
|
if (auditFields.size() > 0
|
|
18
|
-
&& msg.product == "recordm"
|
|
19
19
|
&& msg.user != "integrationm"
|
|
20
20
|
&& msg.action =~ "add|update" ) {
|
|
21
21
|
|
|
22
|
-
def updates =
|
|
22
|
+
def updates = getAuditFieldsUpdates(auditFields,msg.instance.fields)
|
|
23
23
|
def result = actionPacks.recordm.update(msg.type, "recordmInstanceId:" + msg.instance.id, updates);
|
|
24
|
-
|
|
24
|
+
if(updates) log.info("[\$audit] UPDATE '${msg.type}' id:${msg.instance.id}, updates: ${updates}, result:${result.getStatus()} | ${result.getStatusInfo()} ");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// ========================================================================================================
|
|
28
|
-
def
|
|
29
|
-
def userm = actionPacks.get("userm");
|
|
28
|
+
def getAuditFieldsUpdates(auditFields,instanceFields) {
|
|
30
29
|
def updates = [:]
|
|
31
30
|
auditFields.each { auditField ->
|
|
32
|
-
if( auditField.op == "creator" && msg.action == "update" && msg.value(auditField.name) != null) return
|
|
33
|
-
if(
|
|
34
|
-
|
|
31
|
+
if( auditField.op == "creator" && msg.action == "update" && msg.value(auditField.name) != null) return // 'creator' fields are only changed in 'update' if the previous value was empty (meaning it was a field that was not visible)
|
|
32
|
+
if( msg.action == 'update' && !msg.diff) return // Only continues if there is at least one change
|
|
33
|
+
if( auditField.args == "uri") {
|
|
34
|
+
updates << [(auditField.name) : actionPacks.get("userm").getUser(msg.user).data._links.self]
|
|
35
35
|
|
|
36
36
|
} else if( auditField.args == "username") {
|
|
37
37
|
updates << [(auditField.name) : msg.user]
|
|
38
38
|
|
|
39
39
|
} else if( auditField.args == "time") {
|
|
40
40
|
if(msg.action == 'add' && Math.abs(msg.value(auditField.name, Long.class)?:0 - msg._timestamp_) < 30000) return // Ignore changes less then 30s
|
|
41
|
-
if(msg.action == 'update' && !msg.diff) return // Only continues if there is at least one change
|
|
42
41
|
updates << [(auditField.name) : "" + msg._timestamp_]
|
|
43
42
|
}
|
|
44
43
|
}
|
|
@@ -47,8 +46,7 @@ def updateUser(auditFields,instanceFields) {
|
|
|
47
46
|
|
|
48
47
|
// ========================================================================================================
|
|
49
48
|
def getAuditFields(definitionName) {
|
|
50
|
-
|
|
51
|
-
/**/log.info("[\$audit] Update auditFields for $definitionName ... ");
|
|
49
|
+
log.info("[\$audit] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
|
52
50
|
|
|
53
51
|
// Obtém detalhes da definição
|
|
54
52
|
def definitionEncoded = URLEncoder.encode(definitionName, "utf-8").replace("+", "%20")
|
|
@@ -69,14 +67,14 @@ def getAuditFields(definitionName) {
|
|
|
69
67
|
// Finalmente obtém a lista de campos que é necessário calcular
|
|
70
68
|
def auditFields = [];
|
|
71
69
|
fields.each { fieldId,field ->
|
|
72
|
-
def matcher = field.description =~ /[$]audit\.(creator|updater)\.(username|
|
|
70
|
+
def matcher = field.description =~ /[$]audit\.(creator|updater)\.(username|uri|time)/
|
|
73
71
|
if(matcher) {
|
|
74
72
|
def op = matcher[0][1]
|
|
75
73
|
def arg = matcher[0][2]
|
|
76
74
|
auditFields << [fieldId: fieldId, name:field.name, op : op, args: arg]
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
log.info("[\$audit]
|
|
80
|
-
|
|
77
|
+
log.info("[\$audit] Update 'auditFields' for '$definitionName': $auditFields");
|
|
78
|
+
log.info("[\$audit] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
|
81
79
|
return auditFields
|
|
82
80
|
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
cob.custom.customize.push(function (core, utils, ui) {
|
|
3
3
|
core.customizeAllInstances((instance, presenter) =>
|
|
4
4
|
{
|
|
5
|
-
let userFPs = presenter.findFieldPs( fp => /[$]audit\.(creator|updater)\.(username|
|
|
5
|
+
let userFPs = presenter.findFieldPs( fp => /[$]audit\.(creator|updater)\.(username|uri|time)/.exec(fp.field.fieldDefinition.description) )
|
|
6
6
|
userFPs.forEach( fp => {
|
|
7
7
|
fp.disable()
|
|
8
|
-
if(!instance.isNew() || presenter.isGroupEdit()) return //
|
|
8
|
+
if(fp.getValue() && (!instance.isNew() || presenter.isGroupEdit())) return //Don't do nothing if field is not empty AND it's an update interface (updates will only be changed by the backend)
|
|
9
9
|
if(/[$]audit\.(creator|updater)\.username/.exec(fp.field.fieldDefinition.description)) {
|
|
10
10
|
fp.setValue(core.getCurrentLoggedInUser())
|
|
11
11
|
}
|
|
12
|
-
if(/[$]audit\.(creator|updater)\.
|
|
12
|
+
if(/[$]audit\.(creator|updater)\.uri/.exec(fp.field.fieldDefinition.description)) {
|
|
13
13
|
fp.setValue(core.getCurrentLoggedInUserUri())
|
|
14
14
|
}
|
|
15
15
|
if(/[$]audit\.(creator|updater)\.time/.exec(fp.field.fieldDefinition.description)) {
|
|
@@ -7,14 +7,16 @@ import com.google.common.cache.*
|
|
|
7
7
|
import java.util.concurrent.TimeUnit
|
|
8
8
|
|
|
9
9
|
// ========================================================================================================
|
|
10
|
+
if (msg.product != "recordm-definition" && msg.product != "recordm" ) return
|
|
11
|
+
|
|
10
12
|
@Field static cacheOfCalcFieldsForDefinition = CacheBuilder.newBuilder()
|
|
11
13
|
.expireAfterWrite(5, TimeUnit.MINUTES)
|
|
12
14
|
.build();
|
|
13
15
|
|
|
14
16
|
if (msg.product == "recordm-definition") cacheOfCalcFieldsForDefinition.invalidate(msg.type)
|
|
15
|
-
def calculationFields = cacheOfCalcFieldsForDefinition.get(msg.type, { getAllCalculationFields(msg.type) })
|
|
16
17
|
|
|
17
18
|
// ========================================================================================================
|
|
19
|
+
def calculationFields = cacheOfCalcFieldsForDefinition.get(msg.type, { getAllCalculationFields(msg.type) })
|
|
18
20
|
if (calculationFields.size() > 0
|
|
19
21
|
&& msg.product == "recordm"
|
|
20
22
|
&& msg.user != "integrationm"
|
|
@@ -22,7 +24,7 @@ if (calculationFields.size() > 0
|
|
|
22
24
|
|
|
23
25
|
def updates = executeCalculations(calculationFields, msg.instance.fields)
|
|
24
26
|
def result = actionPacks.recordm.update(messageMap.type, "recordmInstanceId:" + messageMap.instance.id, updates);
|
|
25
|
-
log.info("[\$calc]
|
|
27
|
+
if(updates) log.info("[\$calc] UPDATE '${msg.type}' id:${msg.instance.id}, updates: ${updates}, result:${result.getStatus()} | ${result.getStatusInfo()} ");
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
// ==================================================
|
|
@@ -117,7 +119,6 @@ def getAllAplicableValuesForVarName(fieldId,varName,varFieldIds,instanceFields,t
|
|
|
117
119
|
// ========================================================================================================
|
|
118
120
|
def getAllCalculationFields(definitionName) {
|
|
119
121
|
log.info("[\$calc] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
|
120
|
-
log.info("[\$calc] update calculationFields for $definitionName... ");
|
|
121
122
|
|
|
122
123
|
// Obtém detalhes da definição
|
|
123
124
|
def definitionEncoded = URLEncoder.encode(definitionName, "utf-8").replace("+", "%20")
|
|
@@ -154,7 +155,7 @@ def getAllCalculationFields(definitionName) {
|
|
|
154
155
|
}
|
|
155
156
|
previousId = fieldId
|
|
156
157
|
}
|
|
157
|
-
log.info("[\$calc]
|
|
158
|
+
log.info("[\$calc] Update 'calculationFields' for '$definitionName': $calculationFields");
|
|
158
159
|
log.info("[\$calc] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
|
159
160
|
return calculationFields
|
|
160
161
|
}
|