owl-cli 6.16.0 → 6.17.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.
|
@@ -16,9 +16,13 @@ function isEqual(r1,r2){
|
|
|
16
16
|
if(r1==null || r2==null){
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
+
if(isScalar(r1) || isScalar(r2)){
|
|
20
|
+
return r1===r2;
|
|
21
|
+
}
|
|
19
22
|
//now assert a1!=null && r2!=null
|
|
20
23
|
var ks1 = Object.keys(r1);
|
|
21
24
|
var ks2 = Object.keys(r2);
|
|
25
|
+
|
|
22
26
|
if(ks1.length!==ks2.length){
|
|
23
27
|
return false;
|
|
24
28
|
}
|
|
@@ -35,6 +39,7 @@ function isEqual(r1,r2){
|
|
|
35
39
|
function diffArray(a1, a2,parentKey){
|
|
36
40
|
//a1是旧的,a2是新的
|
|
37
41
|
|
|
42
|
+
var temp_matched = [];
|
|
38
43
|
var result = [];
|
|
39
44
|
if(!a1){
|
|
40
45
|
a1 = [];
|
|
@@ -49,21 +54,39 @@ function diffArray(a1, a2,parentKey){
|
|
|
49
54
|
var r2 = a2[j];
|
|
50
55
|
if(isEqual(r1,r2)){
|
|
51
56
|
found = true;
|
|
52
|
-
r2
|
|
57
|
+
if(isScalar(r2)){
|
|
58
|
+
temp_matched.push(r2);
|
|
59
|
+
}
|
|
60
|
+
else{
|
|
61
|
+
r2._matched = true;
|
|
62
|
+
}
|
|
63
|
+
|
|
53
64
|
break;
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
if(!found){
|
|
57
68
|
//r1不存在于a2中,说明r1被删除了
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
result.push({
|
|
70
|
+
type:'deleted',
|
|
71
|
+
r:r1
|
|
72
|
+
});
|
|
60
73
|
}
|
|
61
74
|
}
|
|
62
75
|
for(var i=0; i<a2.length; i++){
|
|
63
76
|
r2 = a2[i];
|
|
64
|
-
if(
|
|
65
|
-
r2
|
|
66
|
-
|
|
77
|
+
if(isScalar(r2)){
|
|
78
|
+
if(temp_matched.indexOf(r2)==-1){
|
|
79
|
+
result.push({
|
|
80
|
+
type:'added',
|
|
81
|
+
r:r2
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if(!r2._matched){
|
|
86
|
+
result.push({
|
|
87
|
+
type:'added',
|
|
88
|
+
r:r2
|
|
89
|
+
});
|
|
67
90
|
}
|
|
68
91
|
|
|
69
92
|
}
|
|
@@ -164,15 +187,15 @@ function diff(obj1, obj2,parentKey){
|
|
|
164
187
|
});
|
|
165
188
|
}
|
|
166
189
|
else{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
190
|
+
for(var kv in v2){
|
|
191
|
+
result.push({
|
|
192
|
+
type:'added',
|
|
193
|
+
fieldKey : kv,
|
|
194
|
+
parentKey: parentKey+"." + k2,
|
|
195
|
+
oldv:null,
|
|
196
|
+
newv:v2[kv]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
176
199
|
}
|
|
177
200
|
}
|
|
178
201
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
var diffResult = {}
|
|
45
45
|
if (!id || action=='add') {
|
|
46
46
|
//adding
|
|
47
47
|
if(!modelObject._orgId){
|
|
@@ -53,10 +53,11 @@
|
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
modelObject._orgIds = [modelObject._orgId].concat(getParentOrgIds(modelObject._orgId));
|
|
56
|
+
diffResult = diff(oldObj,modelObject,"");
|
|
56
57
|
var newdata = @projectCodeService.update( modelObject,env);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
|
|
61
62
|
var ret = {
|
|
62
63
|
state: 'ok',
|