diff --git a/scadalts-ui/src/components/SynopticPanel/slts/State.vue b/scadalts-ui/src/components/SynopticPanel/slts/State.vue index 53d51d6455..08f450bf66 100644 --- a/scadalts-ui/src/components/SynopticPanel/slts/State.vue +++ b/scadalts-ui/src/components/SynopticPanel/slts/State.vue @@ -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"); diff --git a/src/org/scada_lts/mango/service/DataPointService.java b/src/org/scada_lts/mango/service/DataPointService.java index ba428095cd..0e44ceb8c2 100644 --- a/src/org/scada_lts/mango/service/DataPointService.java +++ b/src/org/scada_lts/mango/service/DataPointService.java @@ -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; @@ -681,6 +680,11 @@ public List getDataPointsByXid(Set xids) { return pointIds; } + public boolean isDataPointRunning(DataPointVO dataPoint){ + DataSourceVO dataSourceVO = dataSourceDAO.getDataSource(dataPoint.getDataSourceId()); + return dataPoint.isEnabled() && dataSourceVO.isEnabled(); + } + private List aggregateValuesFromRange(long startTs, long endTs, List pointIds, AggregateSettings aggregateSettings) { diff --git a/src/org/scada_lts/web/mvc/api/PointValueAPI.java b/src/org/scada_lts/web/mvc/api/PointValueAPI.java index ad35df22a8..1d5b0c6e98 100644 --- a/src/org/scada_lts/web/mvc/api/PointValueAPI.java +++ b/src/org/scada_lts/web/mvc/api/PointValueAPI.java @@ -365,6 +365,10 @@ public ResponseEntity 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(); @@ -402,6 +406,10 @@ public ResponseEntity 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();