use event bus

This commit is contained in:
Mutasem 2022-03-31 23:07:55 +02:00
parent b8ae4a628a
commit 31a3360b2d
2 changed files with 13 additions and 8 deletions

View file

@ -9,7 +9,7 @@
@opened="showDocumentHelp = true" @opened="showDocumentHelp = true"
> >
<div class="data-display" v-if="node" > <div class="data-display" v-if="node" >
<NodeSettings ref="settings" @valueChanged="valueChanged" /> <NodeSettings :eventBus="settingsEventBus" @valueChanged="valueChanged" />
<RunData @openSettings="openSettings" /> <RunData @openSettings="openSettings" />
</div> </div>
</el-dialog> </el-dialog>
@ -32,6 +32,7 @@ import NodeSettings from '@/components/NodeSettings.vue';
import RunData from '@/components/RunData.vue'; import RunData from '@/components/RunData.vue';
import mixins from 'vue-typed-mixins'; import mixins from 'vue-typed-mixins';
import Vue from 'vue';
export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
name: 'DataDisplay', name: 'DataDisplay',
@ -43,6 +44,7 @@ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
return { return {
basePath: this.$store.getters.getBaseUrl, basePath: this.$store.getters.getBaseUrl,
showDocumentHelp: false, showDocumentHelp: false,
settingsEventBus: new Vue(),
}; };
}, },
computed: { computed: {
@ -69,10 +71,7 @@ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
}, },
methods: { methods: {
openSettings() { openSettings() {
const settings = this.$refs.settings as Vue | null; this.settingsEventBus.$emit('openSettings');
if (settings) {
settings.$emit('openSettings');
}
}, },
valueChanged (parameterData: IUpdateInformation) { valueChanged (parameterData: IUpdateInformation) {
this.$emit('valueChanged', parameterData); this.$emit('valueChanged', parameterData);

View file

@ -148,6 +148,10 @@ export default mixins(
return this.nodeType.properties; return this.nodeType.properties;
}, },
}, },
props: {
eventBus: {
},
},
data () { data () {
return { return {
nodeValid: true, nodeValid: true,
@ -519,9 +523,11 @@ export default mixins(
}, },
mounted () { mounted () {
this.setNodeValues(); this.setNodeValues();
this.$on('openSettings', () => { if (this.eventBus) {
(this.eventBus as Vue).$on('openSettings', () => {
this.openPanel = 'settings'; this.openPanel = 'settings';
}); });
}
}, },
}); });
</script> </script>