Skip to content

Commit

Permalink
Merge pull request #2979 from SCADA-LTS/fix/#2974_Synoptic_panel_stat…
Browse files Browse the repository at this point in the history
…e_not_loading_correctly2

#2974 synoptic panel state not loading correctly
  • Loading branch information
Limraj authored Aug 24, 2024
2 parents 43ac248 + a67e8db commit 56ff260
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 7 additions & 2 deletions scadalts-ui/src/components/SynopticPanel/slts/State.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,13 @@ export default {
onPointEnabledUpdate(enabled) {
if(enabled) {
this.changeComponentText(`${this.componentId}_value`, this.lastValue);
this.changeComponentColor(`${this.componentId}`, this.enabledColor);
if(this.lastValue){
this.onPointValueUpdate(this.lastValue)
}else{
// Point does not have any data
this.changeComponentText(`${this.componentId}_value`, "N/A");
this.changeComponentColor(`${this.componentId}`, this.enabledColor);
}
} else {
this.changeComponentText(`${this.componentId}_value`, "N/A");
this.changeComponentColor(`${this.componentId}`, "#d6d5d5");
Expand Down
6 changes: 5 additions & 1 deletion src/org/scada_lts/mango/service/DataPointService.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.scada_lts.dao.*;
import org.scada_lts.dao.model.point.PointValue;
import org.scada_lts.dao.pointhierarchy.PointHierarchyDAO;
import org.scada_lts.dao.PointLinkDAO;
import org.scada_lts.dao.pointvalues.PointValueAmChartDAO;
import org.scada_lts.dao.pointvalues.PointValueDAO;
import org.scada_lts.dao.pointvalues.PointValueDAO4REST;
Expand Down Expand Up @@ -681,6 +680,11 @@ public List<DataPointVO> getDataPointsByXid(Set<String> xids) {
return pointIds;
}

public boolean isDataPointRunning(DataPointVO dataPoint){
DataSourceVO<?> dataSourceVO = dataSourceDAO.getDataSource(dataPoint.getDataSourceId());
return dataPoint.isEnabled() && dataSourceVO.isEnabled();
}

private List<PointValueAmChartDAO.DataPointSimpleValue> aggregateValuesFromRange(long startTs, long endTs,
List<DataPointVO> pointIds,
AggregateSettings aggregateSettings) {
Expand Down
8 changes: 8 additions & 0 deletions src/org/scada_lts/web/mvc/api/PointValueAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ public ResponseEntity<String> getValue(@PathVariable("xid") String xid, HttpServ
if (user != null) {
DataPointVO dpvo = dataPointService.getDataPoint(xid);
PointValueTime pvt = pointValueService.getLatestPointValue(dpvo.getId());

// API should show datapoint is disabled if datasource is disabled
dpvo.setEnabled(dataPointService.isDataPointRunning(dpvo));

String json = null;
ObjectMapper mapper = new ObjectMapper();

Expand Down Expand Up @@ -402,6 +406,10 @@ public ResponseEntity<String> getValue(@PathVariable("id") int id, HttpServletRe
if (user != null) {
DataPointVO dpvo = dataPointService.getDataPoint(id);
PointValueTime pvt = pointValueService.getLatestPointValue(dpvo.getId());

// API should show datapoint is disabled if datasource is disabled
dpvo.setEnabled(dataPointService.isDataPointRunning(dpvo));

String json = null;
ObjectMapper mapper = new ObjectMapper();

Expand Down

0 comments on commit 56ff260

Please sign in to comment.