Skip to content

Commit

Permalink
Merge pull request #1598 from SCADA-LTS/patch/sms_domain_fix
Browse files Browse the repository at this point in the history
Patch and fix version 2.6.0 issues
  • Loading branch information
radek2s authored Mar 30, 2021
2 parents 1a29a17 + 6738139 commit abbe291
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 26 deletions.
12 changes: 11 additions & 1 deletion scadalts-ui/src/store/dataPoint/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,17 @@ export const chartRenderersTemplates = [
];

export const eventRenderersTemplates = [
{},
{
typeName: 'eventTextRendererNone',
def: {
id: 0,
name: 'eventTextRendererNone',
exportName: 'EVENT_NONE',
nameKey: 'textRenderer.none',
supportedDataTypes: [1,2,3,4,5],
},
text: null,
},
{
zeroLabel: '',
oneLabel: '',
Expand Down
4 changes: 2 additions & 2 deletions scadalts-ui/src/store/systemSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ const storeSystemSettings = {

saveSmsDomainSettings({ state, dispatch }) {
return dispatch('requestPost', {
url: `/systemSettings/saveSMSDomain/${state.smsDomainSettings}`,
data: null,
url: `/systemSettings/saveSMSDomain`,
data: {'domainName':state.smsDomainSettings},
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,26 @@ export default {
eventRenderersList() {
let renderers = [{ id: -1, label: 'None' }];
if (!!this.data) {
if (this.data.pointLocator.dataTypeId === 1) {
// Binary datapoint
renderers.push(
this.$store.state.dataPoint.textRenderesList.filter((e) => {
return e.id === 1;
})[0],
})[0]
);
} else if (this.data.pointLocator.dataTypeId === 2) {
// Multistate datapoint
renderers.push(
this.$store.state.dataPoint.textRenderesList.filter((e) => {
return e.id === 2;
})[0],
})[0]
);
} else if (this.data.pointLocator.dataTypeId === 3) {
// Numeric datapoint
renderers.push(
this.$store.state.dataPoint.textRenderesList.filter((e) => {
return e.id === 4;
})[0],
})[0]
);
}
}
Expand Down Expand Up @@ -236,23 +235,22 @@ export default {
methods: {
watchEventRendererChange(val) {
if (val === -1) {
this.data.eventTextRenderer = null;
} else {
let template = JSON.parse(
JSON.stringify(this.$store.state.dataPoint.eventRenderersTemplates[val]),
);
if (!!this.data.eventTextRenderer) {
if (this.data.eventTextRenderer.def.exportName === template.def.exportName) {
return;
}
val = 0;
}
let template = JSON.parse(
JSON.stringify(this.$store.state.dataPoint.eventRenderersTemplates[val])
);
if (!!this.data.eventTextRenderer) {
if (this.data.eventTextRenderer.def.exportName === template.def.exportName) {
return;
}
this.data.eventTextRenderer = template;
}
this.data.eventTextRenderer = template;
},
addRangeValue() {
this.data.eventTextRenderer.rangeEventValues.push(
Object.assign({}, this.rangeRenderer),
Object.assign({}, this.rangeRenderer)
);
this.rangeRenderer = {
from: 0,
Expand All @@ -264,21 +262,21 @@ export default {
this.data.eventTextRenderer.rangeEventValues = this.data.eventTextRenderer.rangeEventValues.filter(
(e) => {
return e.text !== val.text;
},
}
);
},
addMultistateValue() {
this.data.eventTextRenderer.multistateEventValues.push(
Object.assign({}, this.multistateRenderer),
Object.assign({}, this.multistateRenderer)
);
this.rangeRenderer = { key: 0, text: '' };
},
delMultistateValue(val) {
this.data.eventTextRenderer.multistateEventValues = this.data.eventTextRenderer.multistateEventValues.filter(
(e) => {
return e.key !== val.key;
},
}
);
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<div>{{$t('recipientlistDetails.activetime.table.day.sunday')}}</div>
</div>
<div v-for="h in 24" :key="h" class="day">
{{ formatHours(h) }}
{{ formatHours(h-1) }}
<div v-for="d in 7" :key="d" class="hour">
<span
v-for="m in 4"
Expand Down
7 changes: 3 additions & 4 deletions src/org/scada_lts/web/mvc/api/SystemSettingsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.scada_lts.mango.service.SystemSettingsService;
import org.scada_lts.web.mvc.api.dto.FolderPointHierarchy;
import org.scada_lts.web.mvc.api.json.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -170,13 +169,13 @@ public ResponseEntity<String> saveSMSDomain(
return result;
}

@PostMapping(value = "/saveSMSDomain", consumes = "application/json")
public ResponseEntity<String> saveSMSMail(HttpServletRequest request, @RequestBody JsonSettingsEmail jsonSettingsEmail) {
@PostMapping(value = "/saveSMSDomain", consumes = {"text/plain", "application/*"})
public ResponseEntity<String> saveSMSDomainPost(HttpServletRequest request, @RequestBody JsonSettingsSmsDomain smsDomain) {
LOG.info("/api/systemSettings/saveSMSDomain");
try {
User user = Common.getUser(request);
if (user != null && user.isAdmin()) {
systemSettingsService.saveEmailSettings(jsonSettingsEmail);
systemSettingsService.saveSMSDomain(smsDomain.getDomainName());
return new ResponseEntity<>(SAVED_MSG, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
Expand Down
21 changes: 21 additions & 0 deletions src/org/scada_lts/web/mvc/api/json/JsonSettingsSmsDomain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.scada_lts.web.mvc.api.json;

public class JsonSettingsSmsDomain {

String domainName;

public JsonSettingsSmsDomain() {
}

public JsonSettingsSmsDomain(String domainName) {
this.domainName = domainName;
}

public String getDomainName() {
return domainName;
}

public void setDomainName(String domainName) {
this.domainName = domainName;
}
}

0 comments on commit abbe291

Please sign in to comment.