Skip to content

Commit

Permalink
Merge pull request #2741 from SCADA-LTS/fix/#2638_Fixed_remove_one_da…
Browse files Browse the repository at this point in the history
…ta_point_from_context_script_in_meta_data_point_2

#2638 fixed remove one data point from context script in meta data point
  • Loading branch information
Limraj authored Oct 30, 2023
2 parents 4ef6672 + a1f950d commit 41554fe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scadalts-ui/src/components/datasources/MetaDataSource/point.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
<v-icon
color="red"
style="cursor: pointer; border: 0"
@click="removeDatapoint(p.dataPointXid); validateScript();"
@click="removeDatapoint(p.key); validateScript()"
>mdi-close</v-icon
>
</td>
Expand Down Expand Up @@ -495,14 +495,21 @@ export default {
},
methods: {
removeDatapoint(dataPointXid) {
removeDatapoint(key) {
this.datapoint.pointLocator.context = this.datapoint.pointLocator.context.filter(
(p) => p.dataPointXid != dataPointXid,
(p) => p.key !== key,
);
},
addDatapoint() {
const p = this.datapoints.find((x) => x.id === this.selectedDatapointId);
if (!this.datapoint.pointLocator.context.find((x) => p.xid === x.dataPointXid)) {
if (this.datapoint.pointLocator.context.find((x) => p.id === x.key)) {
let newId = p.id;
while (this.datapoint.pointLocator.context.find((x) => newId === x.key)) {
newId++;
}
p.id = newId;
}
this.datapoint.pointLocator.context.push({
key: p.id,
value: `p${p.id}`,
Expand Down

0 comments on commit 41554fe

Please sign in to comment.