You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alert(`Skipping change on row ${parseInt(row)+1} because this would create a duplicate key! Check:\n\n * [${slot_name}] change to "${change.value}"\n`);
801
+
returnfalse;
802
+
}
803
+
}
804
+
}
805
+
806
+
/*
807
+
* If a class has more than one slot in its unique_key then multiple
808
+
* changes to key must be tested for duplicates as well as multiple
809
+
* possible impacts on dependent tables.
810
+
*
811
+
* NOTE: user can be updating one field of a primary key; neets to
812
+
* be able to edit it in incomplete form.
813
+
*
814
+
* Determine if change(s) (including cut & paste changes to more
815
+
* than one slot) contribute to a complete unique_key, and if so
816
+
* test if there's a duplication of that key. If key slot data entry
817
+
* is unfinished, then no need to throw error.
818
+
* Requires that we iterate through class's unique_keys list,
819
+
* seeing if any new column (changes[0]) value (changes[3]) pertains
820
+
* to one. If so, test to see if key has a value. If no value,
821
+
* then skip key, otherwise test new key uniqueness.
822
+
*
823
+
* Additional case: turning a component of a unique key into null
824
+
* in itself doesn't necessarily trigger anything other than a
825
+
* validation error on that construct when user presses "Validate".
826
+
* Note: Validator.js validate() also has step for applying the
827
+
* doUniquenessValidation() method on unique_key_slots.
828
+
*
829
+
* However, any field being used as the target of a foreign key of
830
+
* another table, if it had a value and that changes, leaving no
831
+
* other key with the same value that foreign table key could use
832
+
* in its place, necessitates a cancel of that operation.
833
+
*
834
+
* Only route to making a change to a unique key is in the
835
+
* "change_primary_key" right-click menu option above.
836
+
*
837
+
* [class]: {
838
+
* "unique_keys": {
839
+
* "grdisample_id": {
840
+
* "unique_key_name": "grdisample_id",
841
+
* "unique_key_slots": [
842
+
* "sample_collector_sample_id"
843
+
* ],
844
+
*/
845
+
// FUTURE slot_ptr version of self.context.relations for efficiency.
alert(`Your change cannot be completed because it would lead to a primary key [${key_name}] duplicate on row ${parseInt(row)+1}! Check:\n\n ${change_log}`);
879
+
returnfalse;
880
+
};
881
+
}// end if of keyVals construction.
882
+
}// end forEach of unique_keys
883
+
884
+
}// end of row in row_change
885
+
886
+
lettriggered_changes=[];
887
+
for(constchangeofgrid_changes){
888
+
// When a change in one field triggers a change in another field.
0 commit comments