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
Currently, there is just a timer after the dataHub.megaSignalCommand is issued to make sure that it has been executed. This is non-deterministic and is not guaranteed to work. There needs to be a way for the DataHub to let the web page know when the MetaSignalCommand has executed.
An example of code that uses a timer when a better solution is needed is the addNewSignals function in io-mapping-scripts.js:
$scope.addNewSignals=function(){varpromises=[];$.each($scope.mapping.Type.Fields,function(i,f){varms={'AnalyticProjectName': $('#proj'+f.Identifier).val(),'AnalyticInstanceName': $('#inst'+f.Identifier).val(),'DeviceID': '00000000-0000-0000-0000-000000000000','RuntimeID': 0,'SignalID': $('#signalID'+f.Identifier).val(),'PointTag': $('#point'+f.Identifier).val(),'SignalType': $('#type'+f.Identifier).val(),'Description': $('#desc'+f.Identifier).val()}$scope.mapping.FieldMappings[i].Expression=$('#point'+f.Identifier).val();promises.push(dataHub.metaSignalCommand(ms));});$(promises).whenAll().done(function(){// TODO: The setTimout is a temporary solution. A more permanent solution would involve maintaining a count of the number of metasignals sent and received// and refreshing the metadata when we know that all metasignal commands have been executed sucessfully.setTimeout(function(){$(window).one('metaDataReceived',function(){dataHub.getMeasurementDetails().done(function(md){$.each($scope.mapping.Type.Fields,function(i,f){varsignals=$.grep(md,function(d){returnd.PointTag==$('#point'+f.Identifier).val()});if(signals.length>0){$('#signalID'+f.Identifier).val(signals[0].SignalID);}});});});dataHub.refreshMetaData();},1100);// If it's not working, make this number bigger. See: TODO above.});$scope.signalsAdded=true;$('#signalDialog').modal('hide');}
The text was updated successfully, but these errors were encountered:
Currently, there is just a timer after the dataHub.megaSignalCommand is issued to make sure that it has been executed. This is non-deterministic and is not guaranteed to work. There needs to be a way for the DataHub to let the web page know when the MetaSignalCommand has executed.
An example of code that uses a timer when a better solution is needed is the addNewSignals function in
io-mapping-scripts.js:
The text was updated successfully, but these errors were encountered: