1+ <template >
2+ <div id =" app" >
3+ <NavBar
4+ v-on :load =" load "
5+ :name .sync =" name "
6+ :params .sync =" params "
7+ :loaded .sync =" loaded "
8+ :busy .sync =" busy "
9+ :finished .sync =" finished "
10+ />
11+
12+ <section class =" hero" v-if =" !loaded" >
13+ <div class =" hero-body" >
14+ <div class =" container has-text-centered" >
15+ <h1 class =" title" >
16+ No design loaded, yet
17+ </h1 >
18+ <h2 class =" subtitle" >
19+ Turn the switch on to start the simulation.
20+ </h2 >
21+ </div >
22+ </div >
23+ </section >
24+ </div >
25+ </template >
26+
27+ <script >
28+ import Vue from ' vue'
29+
30+ import VueResource from ' vue-resource'
31+ Vue .use (VueResource);
32+
33+ import " @mdi/font/css/materialdesignicons.css" ;
34+
35+ import Buefy from " buefy" ;
36+ import " buefy/dist/buefy.css" ;
37+ Vue .use (Buefy);
38+
39+ import NavBar from " @/components/NavBar.vue" ;
40+
41+ export default {
42+ name: ' app' ,
43+ components: {
44+ NavBar
45+ },
46+ data () {
47+ return {
48+ name: ' ' ,
49+ params: [0 , 0 , 0 ],
50+ data: {},
51+ loaded: false ,
52+ polling: null ,
53+ busy: false ,
54+ finished: false
55+ };
56+ },
57+ methods: {
58+ setPolling () {
59+ this .polling = setInterval (() => {
60+ this .$http .get (' /api/update' ).then ((r ) => {
61+ if (r .status === 200 ) {
62+ console .log (' UPDATE' , r .body )
63+ this .loaded = true ;
64+ var u = r .body [' update' ]
65+ if (u != 0 ) {
66+ this .name = r .body .name ;
67+ this .params = r .body .params ;
68+ this .data = r .body .data ;
69+ this .busy = false ;
70+ var msg = ' Data updated!'
71+ if (u == 2 ) {
72+ this .finished = true ;
73+ msg = ' Simulation finished!'
74+ }
75+ this .$toast .open ({
76+ duration: 2000 ,
77+ message: msg,
78+ position: ' is-bottom' ,
79+ type: ' is-warning'
80+ })
81+ }
82+ } else {
83+ alert (' Request failed. Returned status of ' + r .status );
84+ }
85+ })
86+ }, 2000 );
87+ },
88+ load (v ) {
89+ if (v === true ) {
90+ this .setPolling ();
91+ this .busy = true ;
92+ this .$http .get (' /api/load' ).then ((r ) => {
93+ if (r .status === 200 ) {
94+ console .log (' LOAD' , r .body )
95+ } else {
96+ alert (' Request failed. Returned status of ' + r .status );
97+ }
98+ });
99+ } else {
100+ clearInterval (this .polling );
101+ this .$http .get (' /api/unload' ).then ((r ) => {
102+ if (r .status === 200 ) {
103+ console .log (' UNLOAD' , r .body )
104+ } else {
105+ alert (' Request failed. Returned status of ' + r .status );
106+ }
107+ })
108+ }
109+ },
110+ }
111+ }
112+ </script >
113+
114+ <style >
115+ #app {
116+ font-family : ' Avenir' , Helvetica , Arial , sans-serif ;
117+ -webkit-font-smoothing : antialiased ;
118+ -moz-osx-font-smoothing : grayscale ;
119+ text-align : center ;
120+ color : #2c3e50 ;
121+ margin-top : 60px ;
122+ }
123+ </style >
124+
125+ <style lang="scss">
126+ @import " ~bulma" ;
127+ @import " ~buefy/src/scss/buefy" ;
128+
129+ @font-face {
130+ font-family : BigJohnPRORegular;
131+ src : url (" assets/fonts/BigJohnPRO-Regular.otf" );
132+ }
133+ @font-face {
134+ font-family : BigJohnPROLight;
135+ src : url (" assets/fonts/BigJohnPRO-Light.otf" );
136+ }
137+ @font-face {
138+ font-family : BigJohnPROBold;
139+ src : url (" assets/fonts/BigJohnPRO-Bold.otf" );
140+ }
141+ /*
142+ html,
143+ body,
144+ #app {
145+ height: 100%;
146+ max-height: 100%;
147+ background-color: #f2f1ef;
148+ }
149+ #view {
150+ flex-grow: 1;
151+ }
152+ #app {
153+ font-family: "Fenix", "Avenir", Helvetica, Arial, sans-serif;
154+ -webkit-font-smoothing: antialiased;
155+ -moz-osx-font-smoothing: grayscale;
156+ text-align: center;
157+ color: #202a33;
158+ display: flex;
159+ flex-direction: column;
160+ }
161+ .nothome {
162+ padding-top: 56px;
163+ }
164+ hr {
165+ height: 1px;
166+ background-color: #ec563c;
167+ margin: 1rem 0;
168+ }
169+ */
170+ </style >
0 commit comments