@huntsman-cancer-institute/cod 17.1.0 → 17.1.1

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.
@@ -882,7 +882,7 @@ class AttributeService {
882
882
  let avs = this.attributeValueSetSubject.getValue();
883
883
  //Remove all old values for row
884
884
  let index = avs.attributeValues.findIndex((av) => (av.groupAttributeRowId === groupAttributeRowId && av.idGroupAttribute === idGroupAttribute));
885
- while (index > 0) {
885
+ while (index >= 0) {
886
886
  //Remove value
887
887
  avs.attributeValues.splice(index, 1);
888
888
  //Find the next one
@@ -931,6 +931,46 @@ class AttributeService {
931
931
  this.loadingSubject.next(false);
932
932
  });
933
933
  }
934
+ /**
935
+ * Used to refresh a grid row after plugin execution without affecting other attribute values
936
+ * Normally saving the grid row updates the values, but some applications execute a subsequent plugin and need an extra refresh to pick up changes.
937
+ *
938
+ * @param {AttributeValueGridRow} avgr
939
+ */
940
+ refreshGridRow(avgr) {
941
+ let url = this.attributeEndpoint + "attribute-value-grid-row/";
942
+ let ac = this.attributeConfigurationSubject.getValue();
943
+ let queryParams = new HttpParams()
944
+ .set("idGroupAttribute", avgr.idGroupAttribute)
945
+ .set("groupAttributeRowId", avgr.groupAttributeRowId)
946
+ .set("idAttributeValueSet", avgr.idAttributeValueSet)
947
+ .set("codeAttributeSecurityContext", ac.codeAttributeSecurityContext)
948
+ .set("codeAttributeContext", ac.codeAttributeContext)
949
+ .set("idParentObject", (this.idParentObject) ? this.idParentObject.toString() : "");
950
+ this.loadingSubject.next(true);
951
+ this.http.get(url, { params: queryParams }).subscribe((attributeValueGridRow) => {
952
+ //Note that the sliced and updated values for the grid row were already cleaned up during the save
953
+ //Remove the grid row from the original attribute values
954
+ let avs = this.attributeValueSetSubject.getValue();
955
+ //Remove all old values for row
956
+ let index = avs.attributeValues.findIndex((av) => (av.groupAttributeRowId === attributeValueGridRow.groupAttributeRowId && av.idGroupAttribute === attributeValueGridRow.idGroupAttribute));
957
+ while (index >= 0) {
958
+ //Remove value
959
+ avs.attributeValues.splice(index, 1);
960
+ //Find the next one
961
+ index = avs.attributeValues.findIndex((av) => (av.groupAttributeRowId === attributeValueGridRow.groupAttributeRowId && av.idGroupAttribute === attributeValueGridRow.idGroupAttribute));
962
+ }
963
+ //Add all the current values
964
+ for (let i = 0; i < attributeValueGridRow.attributeValues.length; i++) {
965
+ avs.attributeValues.push(attributeValueGridRow.attributeValues[i]);
966
+ }
967
+ this.attributeValueSetSubject.next(avs);
968
+ this.loadingSubject.next(false);
969
+ }, (error) => {
970
+ console.error(error);
971
+ this.loadingSubject.next(false);
972
+ });
973
+ }
934
974
  /**
935
975
  * Push an attribute to the attribute map.
936
976
  *