@@ -21,14 +21,8 @@ DataBlockBase as a prop, and save from within DataBlockBase -->
21
21
type =" text"
22
22
class =" form-control"
23
23
:class =" { 'is-invalid': wavelengthParseError }"
24
- @keydown.enter ="
25
- parseWavelength();
26
- updateBlock();
27
- "
28
- @blur ="
29
- parseWavelength();
30
- updateBlock();
31
- "
24
+ @keydown.enter =" parseUpdateWavelength()"
25
+ @blur =" parseUpdateWavelength()"
32
26
/>
33
27
<div v-if =" wavelengthParseError" class =" alert alert-danger mt-2 mx-auto" >
34
28
{{ wavelengthParseError }}
@@ -51,7 +45,6 @@ import FileSelectDropdown from "@/components/FileSelectDropdown";
51
45
import BokehPlot from " @/components/BokehPlot" ;
52
46
53
47
import { createComputedSetterForBlockField } from " @/field_utils.js" ;
54
- import { updateBlockFromServer } from " @/server_fetch_utils.js" ;
55
48
56
49
export default {
57
50
components: {
@@ -86,23 +79,27 @@ export default {
86
79
file_id: createComputedSetterForBlockField (" file_id" ),
87
80
},
88
81
methods: {
89
- parseWavelength () {
82
+ parseUpdateWavelength () {
90
83
if (isNaN (this .wavelength ) || isNaN (parseFloat (this .wavelength ))) {
91
84
this .wavelengthParseError = " Please provide a valid number" ;
92
85
} else {
93
86
this .wavelengthParseError = " " ;
94
87
}
95
- },
96
- updateBlock () {
97
- updateBlockFromServer (
98
- this .item_id ,
99
- this .block_id ,
100
- this .$store .state .all_item_data [this .item_id ][" blocks_obj" ][this .block_id ],
101
- );
88
+
89
+ if (! this .wavelengthParseError ) {
90
+ const event = new CustomEvent (
91
+ " bokehStateUpdate" ,
92
+ {
93
+ detail: {
94
+ event_name: " set_wavelength" ,
95
+ wavelength: parseFloat (this .wavelength ),
96
+ },
97
+ },
98
+ { bubbles: true },
99
+ );
100
+ document .dispatchEvent (event );
101
+ }
102
102
},
103
103
},
104
- // mounted() {
105
- // this.makeBokehPlot()
106
- // }
107
104
};
108
105
</script >
0 commit comments