Skip to content

Commit

Permalink
#2974 synoptic panel state not loading correctly
Browse files Browse the repository at this point in the history
- The api shows a datapoint is disabled if datasource is disabled
  • Loading branch information
YuaFox committed Aug 21, 2024
1 parent 66edbc1 commit 51f1ca2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/org/scada_lts/web/mvc/api/PointValueAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,13 @@ public class PointValueAPI {
private static final Log LOG = LogFactory.getLog(PointValueAPI.class);

private DataPointService dataPointService = new DataPointService();
private DataSourceService dataSourceService = new DataSourceService();

@Resource
private PointValueService pointValueService;

@Resource
private DataSourceService dataSourceService;

private String getValue(MangoValue value, String type) {

if (value instanceof AlphanumericValue) {
Expand Down Expand Up @@ -365,6 +367,11 @@ 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
DataSourceVO<?> dataSourceVO = dataSourceService.getDataSource(dpvo.getDataSourceId());
dpvo.setEnabled(dpvo.isEnabled() && dataSourceVO.isEnabled());

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

Expand Down Expand Up @@ -402,6 +409,11 @@ 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
DataSourceVO<?> dataSourceVO = dataSourceService.getDataSource(dpvo.getDataSourceId());
dpvo.setEnabled(dpvo.isEnabled() && dataSourceVO.isEnabled());

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

Expand Down

0 comments on commit 51f1ca2

Please sign in to comment.