Skip to content

Commit cfb7876

Browse files
Sync'd dev UI
1 parent e49a3d8 commit cfb7876

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

Source/Applications/openHistorian/openHistorian/wwwroot/AddSynchrophasorDeviceDev.cshtml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,12 +1345,18 @@
13451345
for (let i = 0; i < deviceCount; i++) {
13461346
const cell = self.configFrame().Cells[i];
13471347
1348+
// For an existing device the lat/long loaded from the database via queryDeviceByID is
1349+
// authoritative; do not let the (possibly stale, or parent-derived) coordinates carried in the
1350+
// config frame / auto-saved JSON mapping overwrite it. Only seed the screen-level lat/long from
1351+
// cell values when defining a new device (fresh analyze / config import).
13481352
// TODO: Update screen to accommodate lat/long at the device level
1349-
if (!isEmpty(cell.Latitude))
1350-
self.latitude(cell.Latitude);
1353+
if (deviceID === 0) {
1354+
if (!isEmpty(cell.Latitude))
1355+
self.latitude(cell.Latitude);
13511356
1352-
if (!isEmpty(cell.Longitude))
1353-
self.longitude(cell.Longitude);
1357+
if (!isEmpty(cell.Longitude))
1358+
self.longitude(cell.Longitude);
1359+
}
13541360
13551361
let cellAcronym = cell.IDLabel;
13561362
@@ -2633,6 +2639,10 @@
26332639
if (!nextVoltage)
26342640
continue;
26352641
2642+
// See if this line current has already been matched
2643+
if (lineCurrentExists(lines, nextCurrent))
2644+
continue;
2645+
26362646
// See if this next current is for matching line based on label minus phase designations
26372647
if (match === nextCurrent.Label().trim().toUpperCase().replace(/[ABCRYB]/gi, "")) {
26382648
line[nextPhase] = {
@@ -3628,6 +3638,13 @@
36283638
device.AccessID = cell.IDCode;
36293639
device.Acronym = cell.IDLabel();
36303640
3641+
// Save lat/long for child devices: prefer the cell's own coordinates when present,
3642+
// otherwise fall back to the on-screen value - matches parent / direct-connected device
3643+
// behavior. A zero or null coordinate is treated as "unset" by isEmpty, consistent with
3644+
// the load-time logic that pushes cell coordinates onto the screen.
3645+
device.Longitude = isEmpty(cell.Longitude) ? viewModel.longitude() : cell.Longitude;
3646+
device.Latitude = isEmpty(cell.Latitude) ? viewModel.latitude() : cell.Latitude;
3647+
36313648
if (isEmpty(device.Name))
36323649
device.Name = device.Acronym;
36333650
@@ -3766,14 +3783,18 @@
37663783
device.ProtocolID = configFrame.ProtocolID;
37673784
device.FrameRate = configFrame.FrameRate;
37683785
device.AccessID = configFrame.IDCode;
3769-
device.IsConcentrator = !isEmpty(connectionString) && (configFrame.IsConcentrator || configFrame.Cells.length > 1);
37703786
37713787
if (isEmpty(device.Name))
37723788
device.Name = device.Acronym;
37733789
3774-
// Only update connection string if one has been defined, prevents changing any existing one to blank
3775-
if (connectionString.length > 0)
3790+
// Only update connection string and concentrator flag when a connection string has been defined.
3791+
// This prevents changing any existing connection string to blank and, just as importantly, prevents
3792+
// clearing the concentrator flag on an existing PDC when it is re-saved from an auto-loaded JSON config
3793+
// that does not carry a connection string (see connection string preservation for auto-JSON config I/O).
3794+
if (connectionString.length > 0) {
37763795
device.ConnectionString = connectionString;
3796+
device.IsConcentrator = configFrame.IsConcentrator || configFrame.Cells.length > 1;
3797+
}
37773798
37783799
device.AutoStartDataParsingSequence = autoStartDataParsingSequence;
37793800
device.SkipDisableRealTimeData = skipDisableRealTimeData;

0 commit comments

Comments
 (0)