4 Commits b30c4fd8b1 ... 05efd5bb6d

Author SHA1 Message Date
  thomas 05efd5bb6d add setItem username and docdt 3 years ago
  thomas aaae065369 added TM 3 years ago
  thomas 8cb11d00e2 refactor to handle subscription session and form separately 3 years ago
  thomas 93889efe54 added codes for new purchase requisition 3 years ago

+ 16 - 4
package-lock.json

@@ -10,6 +10,7 @@
       "dependencies": {
         "core-js": "^3.6.5",
         "jsonschema": "^1.4.0",
+        "lodash": "^4.17.21",
         "rfdc": "^1.1.4",
         "rxjs": "^6.6.7",
         "socket.io-client": "^2.4.0",
@@ -19,6 +20,7 @@
         "vue-property-decorator": "^9.1.2"
       },
       "devDependencies": {
+        "@types/lodash": "^4.14.170",
         "@types/rfdc": "^1.1.0",
         "@types/uuid": "^8.3.0",
         "@typescript-eslint/eslint-plugin": "^4.27.0",
@@ -1840,6 +1842,12 @@
       "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==",
       "dev": true
     },
+    "node_modules/@types/lodash": {
+      "version": "4.14.170",
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz",
+      "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==",
+      "dev": true
+    },
     "node_modules/@types/mime": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
@@ -9686,8 +9694,7 @@
     "node_modules/lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
-      "dev": true
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
     },
     "node_modules/lodash.debounce": {
       "version": "4.0.8",
@@ -17922,6 +17929,12 @@
       "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==",
       "dev": true
     },
+    "@types/lodash": {
+      "version": "4.14.170",
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz",
+      "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==",
+      "dev": true
+    },
     "@types/mime": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
@@ -24120,8 +24133,7 @@
     "lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
-      "dev": true
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
     },
     "lodash.debounce": {
       "version": "4.0.8",

+ 2 - 0
package.json

@@ -10,6 +10,7 @@
   "dependencies": {
     "core-js": "^3.6.5",
     "jsonschema": "^1.4.0",
+    "lodash": "^4.17.21",
     "rfdc": "^1.1.4",
     "rxjs": "^6.6.7",
     "socket.io-client": "^2.4.0",
@@ -19,6 +20,7 @@
     "vue-property-decorator": "^9.1.2"
   },
   "devDependencies": {
+    "@types/lodash": "^4.14.170",
     "@types/rfdc": "^1.1.0",
     "@types/uuid": "^8.3.0",
     "@typescript-eslint/eslint-plugin": "^4.27.0",

+ 70 - 1
src/assets/js/__message-util.ts

@@ -78,7 +78,7 @@ export function getSubPropertyChangeMessage(ucpId: string) {
   }, ucpId);
 }
 
-export function getNewUserProfileMessage(ucpId: string) {
+export function getNewUserProfile(ucpId: string) {
   return getMessage({
     "messageType": "Command",
     "messageName": "New User Profile (cmd)",
@@ -88,3 +88,72 @@ export function getNewUserProfileMessage(ucpId: string) {
     }
   }, ucpId);
 }
+
+export function getNewPurchaseRequisition(ucpId: string) {
+  return getMessage({
+      "messageType": "Command",
+      "messageName": "New Purchase Requisition (cmd)",
+      "command": "New",
+      "data": {
+          "serviceId": "Purchase Requisition"
+      }
+  }, ucpId)
+}
+
+export function getSetPurchaseRequisitionDocDt(ucpId: string, value: string = "2021-01-10Z") {
+  return getMessage({
+      "messageType": "Command",
+      "messageName": "Change document date to 2021 Jan 10.",
+      "command": "SetItem",
+      "data": {
+          "serviceId": "Purchase Requisition",
+          "alias": "header",
+          "notifyChanged": true,
+          "column": {
+            "row": 1,
+            "name": "doc_dt",
+            "value": value,
+          }
+      }
+  }, ucpId)
+}
+
+export function getSetUserProfileUserName(ucpId: string, value: string = "abcxyyz") {
+  return getMessage({
+      "messageType": "Command",
+      "messageName": "Set User name (cmd)",
+      "command": "SetItem",
+      "data": {
+          "serviceId": "User Profile",
+          "alias": "header",
+          "notifyChanged": true,
+          "column": {
+            "row": 1,
+            "name": "user_name",
+            "value": value,
+          }
+      }
+  }, ucpId)
+}
+
+export function getCancelUserProfile(ucpId: string ) {
+  return getMessage({
+      "messageType": "Command",
+      "messageName": "Cancel User Profile.",
+      "command": "CancelChanges",
+      "data": {
+          "serviceId": "User Profile",
+      }
+  }, ucpId)
+}
+
+export function getCancelPurchaseRequisition(ucpId: string ) {
+  return getMessage({
+      "messageType": "Command",
+      "messageName": "Cancel Purchase Requisiton.",
+      "command": "CancelChanges",
+      "data": {
+          "serviceId": "Purchase Requisition",
+      }
+  }, ucpId)
+}

+ 34 - 13
src/assets/js/__transport.socketio.js

@@ -11,23 +11,44 @@ export class TestSocketIoClient {
     this.socket.disconnect();
   }
 
-  connect(url) {
-    this.responses = new Subject()
+  async connect(url, options = {} ) {
+    const self = this;
+    return new Promise((resolve, reject) =>{
+      this.responses = new Subject()
+  
+      const ws = io.connect(url, options)
+            
+      // ws.on('connecting',     (x) => { console.info('connecting', x);     });
+      // ws.on('connect_failed', (x) => { console.info('connect_failed',x);  });
+      // ws.on('error',          (x) => { console.info('error', x);          });
+      // ws.on('disconnect',     (x) => { console.info('disconnect',x);      });
 
-    const ws = io.connect(url)
+      // https://socket.io/docs/v2/client-api/#Event-%E2%80%98connect-error%E2%80%99
+      
+      // ws.on('pong',              (x) => { console.info('pong',x);                });
+      // ws.on('ping',              (x) => { console.info('ping',x);                });
+      // ws.on('reconnect_failed',  (x) => { console.info('reconnect_failed', x);   });
+      // ws.on('reconnecting',      (x) => { console.info('reconnecting', x);       });
+      // ws.on('reconnect_attempt', (x) => { console.info('reconnect_attempt', x);  });
+      // ws.on('reconnect',         (x) => { console.info('reconnect', x);          });
+      // ws.on('connect_timeout',   (x) => { console.info('connect_timeout',x);     });
+      ws.on('connect_error', (x) => {
+        console.info('connect_error',x);
+        reject(x)
+      });
 
-    ws.on('connecting',     (x) => { console.info('connecting', x);     });
-    ws.on('reconnecting',   (x) => { console.info('reconnecting', x);   });
-    ws.on('connect_failed', (x) => { console.info('connect_failed',x);  });
-    ws.on('error',          (x) => { console.info('error', x);          });
-    ws.on('disconnect',     (x) => { console.info('disconnect',x);      });
-    ws.on('connect',        (x) => { console.info('connect', x)         });
-    
-    ws.on('response', (data) => { this.responses.next(data)  });
-
-    this.socket = ws;
+      ws.on('connect', (x) => {
+        console.info('connect', ws.id)
+        this.socket = ws;
+        resolve(ws.id)
+      });
+      
+      ws.on('response', (data) => { this.responses.next(data)  });
+      
+    })
   }
 
+  
   getStreamOfResponsesFromRequest(request) {
     const subject = new Subject();
     

File diff suppressed because it is too large
+ 3 - 3
src/components/UIClient.vue


Some files were not shown because too many files changed in this diff