Skip to content

Commit

Permalink
Merge pull request #2742 from SCADA-LTS/feature/#2663_Added_Edit_form…
Browse files Browse the repository at this point in the history
…_cancel_restores_data_point_to_initial_state

#2663 Added Edit form cancel restores data point to initial state
  • Loading branch information
Limraj authored Nov 2, 2023
2 parents 6bfb774 + e5669ce commit 2773d0f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scadalts-ui/src/components/datasources/DataPointCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
</v-card>
</template>
<script>
import Vue from "vue";
export default {
props: {
title: {
Expand All @@ -95,8 +97,13 @@ export default {
},
},
async mounted(){
this.initialState = JSON.parse(JSON.stringify(this.datapoint));
},
data() {
return {
initialState: null,
formValid: false,
xidUnique: true,
ruleNotNull: (v) => !!v || this.$t('validation.rule.notNull'),
Expand All @@ -107,6 +114,11 @@ export default {
methods: {
cancel() {
console.debug('datasources.DataPointCreation.vue::cancel()');
for (const key in this.initialState) {
if (this.initialState.hasOwnProperty(key)) {
Vue.set(this.datapoint, key, this.initialState[key]);
}
}
this.$emit('cancel');
},
Expand Down

0 comments on commit 2773d0f

Please sign in to comment.