11<template >
22 <div class =" ray-type-lock" >
3- <button :disabled =" disabled" @click =" continueExecution"
4- class =" btn btn--continue active:bg-grey-300" >
5- <span class =" w-3 h-3 block" >
6- <svg xmlns =" http://www.w3.org/2000/svg" width =" 100%" height =" 100%" viewBox =" 0 0 20 20" >
7- <path fill =" green" fill-rule =" evenodd"
8- d =" M16.75 10.83L4.55 19A1 1 0 0 1 3 18.13V1.87A1 1 0 0 1 4.55 1l12.2 8.13a1 1 0 0 1 0 1.7z" />
9- </svg >
10- </span >
3+ <button
4+ :disabled =" disabled"
5+ class =" btn btn--continue active:bg-grey-300"
6+ @click =" continueExecution"
7+ >
8+ <span class =" w-3 h-3 block" >
9+ <svg
10+ xmlns =" http://www.w3.org/2000/svg"
11+ width =" 100%"
12+ height =" 100%"
13+ viewBox =" 0 0 20 20"
14+ >
15+ <path
16+ fill =" green"
17+ fill-rule =" evenodd"
18+ d =" M16.75 10.83L4.55 19A1 1 0 0 1 3 18.13V1.87A1 1 0 0 1 4.55 1l12.2 8.13a1 1 0 0 1 0 1.7z"
19+ />
20+ </svg >
21+ </span >
1122
1223 <span >Continue</span >
1324 </button >
14- <button :disabled =" disabled" @click =" stopExecution"
15- class =" btn btn--stop active:bg-grey-300" >
25+ <button
26+ :disabled =" disabled"
27+ class =" btn btn--stop active:bg-grey-300"
28+ @click =" stopExecution"
29+ >
1630 <span class =" w-3 h-3 bg-red-700 block" ></span >
1731 <span >Stop execution</span >
1832 </button >
1933 </div >
2034</template >
2135
2236<script lang="ts">
23- import {defineComponent , PropType } from " vue" ;
24- import {RayPayload } from " ~/config/types" ;
25- import {apiTransport } from ' ~/utils/events-transport'
26-
27- const {
28- rayStopExecution,
29- rayContinueExecution
30- } = apiTransport ({onEventReceiveCb : () => {}})
37+ import { defineComponent , PropType } from " vue" ;
38+ import { RayPayload } from " ~/config/types" ;
39+ import { useNuxtApp } from " #app" ;
3140
3241export default defineComponent ({
3342 props: {
@@ -36,26 +45,41 @@ export default defineComponent({
3645 required: true ,
3746 },
3847 },
48+ setup() {
49+ if (process .client ) {
50+ const { $rayExecution } = useNuxtApp ();
51+
52+ return {
53+ rayContinueExecution: $rayExecution .continue ,
54+ rayStopExecution: $rayExecution .stop ,
55+ };
56+ }
57+
58+ return {
59+ rayContinueExecution : () => undefined ,
60+ rayStopExecution : () => undefined ,
61+ };
62+ },
3963 data() {
4064 return {
4165 disabled: false ,
42- }
66+ };
67+ },
68+ computed: {
69+ hash() {
70+ return this .payload .content .name ;
71+ },
4372 },
4473 methods: {
4574 continueExecution() {
46- this .disabled = true
47- rayContinueExecution (this .hash )
75+ this .disabled = true ;
76+ this . rayContinueExecution (this .hash );
4877 },
4978 stopExecution() {
50- this .disabled = true
51- rayStopExecution (this .hash )
52- }
79+ this .disabled = true ;
80+ this . rayStopExecution (this .hash );
81+ },
5382 },
54- computed: {
55- hash() {
56- return this .payload .content .name
57- }
58- }
5983});
6084 </script >
6185
0 commit comments