Ver código fonte

Update 'src/app/core/models/application/actions/action.js'

Some fixes to allow the MidPoint creation through GEO file with the correct ID
(e.g. one with "1:3" was been created with ID=1)
To avoid error "do not generate item '1:...' when ID=0: changed "if (this.id)" by:
if (this.id!=undefined) strC += `${this.d(GEO_FILE.ID, this.id)}, `;
leo 2 anos atrás
pai
commit
f183527deb
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      src/app/core/models/application/actions/action.js

+ 6 - 5
src/app/core/models/application/actions/action.js

@@ -54,9 +54,10 @@ export class Action {
   toString () {
     //  Items of GEO line: Id, Type, Definition, List, Label, Defined, Color, Hidden, Pixel, Font, LabelColor;
     //  Correspon. values: 1   0     2           3     4      5        6      7       8      9     10
-    var strC = "", tam;
+    var strC = "", strId = "", tam;
     try {
-    if (this.id)         strC += `${this.d(GEO_FILE.ID, this.id)}, `;
+    if (this.id!=undefined) strC += `${this.d(GEO_FILE.ID, this.id)}, `;
+    strId = strC;
     strC += `${this.d(GEO_FILE.TYPE, this.type)}, `;                                  // TYPE is 0 and JavaScript interpret it as false (do not use "if")
     if (this.definition) strC += `${this.d(GEO_FILE.DEFINITION, this.definition)}, `;
     if (this.list)       strC += `${this.d(GEO_FILE.LIST, this.list)}, `;
@@ -74,7 +75,7 @@ export class Action {
       strC = strC.substring(0, tam-1).trim();
     } catch (error) { console.log("action.js!toString(): error " + error); }
     strC = "{" + strC + "}!\n";
-    console.log("action.js!toString(): \n" + strC);
+    console.log("action.js!toString(): id=" + strId + "\n" + strC);
     //D console.trace();
     return strC;
     } // toString()
@@ -88,8 +89,8 @@ export class Action {
     }
 
   rehydrate () {
-    console.log("action.js!rehydrate(): inicial"); //D
-    this.id = this.genericObject.id;
+    console.log("action.js!rehydrate(): inicial - this.genericObject.id=" + this.genericObject.id); //D
+    this.id = this.genericObject.id; // Attention, caution with ID=0
     this.type = this.genericObject.elementClass;
     this.definition = this.r(this.genericObject.definitions.map(x => x.id).toString());
     this.list = this.r(this.genericObject.dependentsOnThis.map(x => x.id).toString());