vcomply-workflow-engine 2.8.1 → 2.8.3

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.
@@ -28082,7 +28082,7 @@
28082
28082
  error: function (err) { }
28083
28083
  });
28084
28084
  };
28085
- WorkflowProgramComponent.prototype.fetchUsersAssociatedWithRoles = function () {
28085
+ WorkflowProgramComponent.prototype.fetchUsersAssociatedWithRoles = function (calledFrom) {
28086
28086
  var _this = this;
28087
28087
  var _a, _b;
28088
28088
  var loggedInUser = this.currentUser();
@@ -28105,7 +28105,7 @@
28105
28105
  _this.setFormField('program_owners', res === null || res === void 0 ? void 0 : res.data);
28106
28106
  }
28107
28107
  else {
28108
- _this.setDefaultOwners(res === null || res === void 0 ? void 0 : res.data);
28108
+ _this.setDefaultOwners(res === null || res === void 0 ? void 0 : res.data, calledFrom);
28109
28109
  }
28110
28110
  },
28111
28111
  error: function (err) { }
@@ -28137,15 +28137,22 @@
28137
28137
  }
28138
28138
  });
28139
28139
  };
28140
- WorkflowProgramComponent.prototype.setDefaultOwners = function (userList) {
28140
+ WorkflowProgramComponent.prototype.setDefaultOwners = function (userList, calledFrom) {
28141
+ var _a, _b;
28141
28142
  var loggedInuser = this.currentUser();
28142
28143
  var defaultOwner = userList.filter(function (ele) { return ['ADMIN', 'KEY_ADMIN'].includes(ele === null || ele === void 0 ? void 0 : ele.user_role) && (ele === null || ele === void 0 ? void 0 : ele.member_id) != (loggedInuser === null || loggedInuser === void 0 ? void 0 : loggedInuser.member_id); });
28143
28144
  this.lists.NON_REMOVABLE_OWNERS = this.uniqueByProp(__spreadArray(__spreadArray([], [loggedInuser]), __read(defaultOwner)), 'member_id');
28144
28145
  // this.setFormField('program_owners', this.lists.NON_REMOVABLE_OWNERS);
28145
- if (this.mode !== 'EDIT') {
28146
- this.setFormField('program_owners', this.lists.NON_REMOVABLE_OWNERS);
28146
+ var preSelectedUsers = this.getPreSelectedOwners((_b = (_a = this.controls) === null || _a === void 0 ? void 0 : _a.program_owners) === null || _b === void 0 ? void 0 : _b.value, userList);
28147
+ if (calledFrom !== 'getProgramDetails') {
28148
+ this.setFormField('program_owners', preSelectedUsers !== null && preSelectedUsers !== void 0 ? preSelectedUsers : this.lists.NON_REMOVABLE_OWNERS);
28147
28149
  }
28148
28150
  };
28151
+ WorkflowProgramComponent.prototype.getPreSelectedOwners = function (previousSelectedUsers, currentUsers) {
28152
+ var finalUsers = [];
28153
+ finalUsers = previousSelectedUsers === null || previousSelectedUsers === void 0 ? void 0 : previousSelectedUsers.filter(function (previous) { return currentUsers === null || currentUsers === void 0 ? void 0 : currentUsers.some(function (current) { return (previous === null || previous === void 0 ? void 0 : previous.member_id) === (current === null || current === void 0 ? void 0 : current.member_id); }); });
28154
+ return finalUsers;
28155
+ };
28149
28156
  WorkflowProgramComponent.prototype.fetchOrganizationUsers = function (data) {
28150
28157
  var _this = this;
28151
28158
  this.listLoadingState.USERS = true;
@@ -28532,7 +28539,7 @@
28532
28539
  }
28533
28540
  _this.populateMembers(res);
28534
28541
  _this.populateGroups(res);
28535
- _this.fetchUsersAssociatedWithRoles();
28542
+ _this.fetchUsersAssociatedWithRoles('getProgramDetails');
28536
28543
  _this.fetchGroupsAssociatedWithRoles();
28537
28544
  _this.fetchOrganizationGroup();
28538
28545
  _this.fetchOrganizationUsers();