|
17 | 17 | <template v-if="button.type == 'text'">
|
18 | 18 | <v-btn @click="_self[button.action]()" text>
|
19 | 19 | <v-icon>{{ button.icon }}</v-icon>
|
20 |
| - {{ button.label }} |
| 20 | + {{ $t(button.label) }} |
21 | 21 | </v-btn>
|
22 | 22 | </template>
|
23 | 23 | <template v-else>
|
24 | 24 | <v-btn @click="_self[button.action]()" style="height: 70%" :color="button.colorBtn"
|
25 | 25 | :class="button.colorText">
|
26 |
| - {{ button.label }} |
| 26 | + {{ $t(button.label) }} |
27 | 27 | <v-icon right dark>{{ button.icon }}</v-icon>
|
28 | 28 | </v-btn>
|
29 | 29 | </template>
|
@@ -373,106 +373,29 @@ export default {
|
373 | 373 | mounted() {
|
374 | 374 | this.settings = this.$store.getters.settings;
|
375 | 375 | // Get the activity
|
376 |
| - const axios = this.$axios; |
377 |
| - const { |
378 |
| - CB |
379 |
| - } = this; |
| 376 | + let activityName = this.$route.params.name; |
| 377 | + let activityDefault = false; |
380 | 378 | if (this.$route.path == '/program') {
|
381 |
| - console.log('Loading the default activity'); |
382 |
| - this.activity = { |
383 |
| - bodyFont: 'Roboto', |
384 |
| - buttons: [ |
385 |
| - { |
386 |
| - action: 'clearProgramDlg', |
387 |
| - icon: 'clear', |
388 |
| - label: this.$i18n.t('message.activity_program_clear'), |
389 |
| - type: 'text', |
390 |
| - }, |
391 |
| - { |
392 |
| - action: 'saveProgram', |
393 |
| - icon: 'save', |
394 |
| - label: this.$i18n.t('message.activity_program_save'), |
395 |
| - type: 'text', |
396 |
| - }, |
397 |
| - { |
398 |
| - action: 'toggleSaveAs', |
399 |
| - icon: 'edit', |
400 |
| - label: this.$i18n.t('message.activity_program_save_as'), |
401 |
| - type: 'text', |
402 |
| - }, |
403 |
| - { |
404 |
| - action: 'loadProgramList', |
405 |
| - icon: 'folder_open', |
406 |
| - label: this.$i18n.t('message.activity_program_load'), |
407 |
| - type: 'text', |
408 |
| - }, |
409 |
| - { |
410 |
| - action: 'runProgram', |
411 |
| - icon: 'play_arrow', |
412 |
| - label: this.$i18n.t('message.activity_program_run'), |
413 |
| - type: 'text', |
414 |
| - }, |
415 |
| - { |
416 |
| - action: 'getProgramCode', |
417 |
| - icon: 'code', |
418 |
| - label: this.$i18n.t('message.activity_program_show_code'), |
419 |
| - type: 'text', |
420 |
| - }, |
421 |
| - { |
422 |
| - action: 'exportProgram', |
423 |
| - icon: 'fa-file-export', |
424 |
| - label: this.$i18n.t('message.activity_program_export'), |
425 |
| - type: 'text', |
426 |
| - }, |
427 |
| - { |
428 |
| - action: 'pickFile', |
429 |
| - icon: 'fa-file-import', |
430 |
| - label: this.$i18n.t('message.activity_program_import'), |
431 |
| - type: 'text', |
432 |
| - }, |
433 |
| - ], |
434 |
| - capsSwitch: false, |
435 |
| - codeFont: 'ubuntumono', |
436 |
| - description: null, |
437 |
| - drawerEnabled: true, |
438 |
| - exec: { |
439 |
| - camera: true, |
440 |
| - log: true, |
441 |
| - }, |
442 |
| - fontSize: 'Medio', |
443 |
| - name: this.$i18n.t('message.activity_program_title'), |
444 |
| - showName: true, |
445 |
| - maxBlocks: null, |
446 |
| - }; |
447 |
| - const toolboxLevel = this.settings.progLevel; |
448 |
| - // Decode it and get the clean serialized XML as plain string |
449 |
| - this.toolbox = require(`../assets/toolbox_${toolboxLevel}.json`); |
450 |
| - this.settings.maxBlocks = null; // default |
451 |
| - } else { |
452 |
| - console.log('Loading activity', this.$route.params.name); |
453 |
| - this.saved = true; |
454 |
| - axios.get(`${CB}/loadActivity`, { |
455 |
| - params: { |
456 |
| - name: this.$route.params.name, |
457 |
| - }, |
458 |
| - }).then((response) => { |
459 |
| - console.log('Activity loaded', response.data); |
460 |
| - this.activity = response.data; |
461 |
| - this.settings.maxBlocks = this.activity.maxBlocks; |
462 |
| - this.updateCssProps(); |
463 |
| -
|
464 |
| - let toolboxJSON = null; |
465 |
| - if (this.activity.toolbox == null) { |
466 |
| - const toolboxLevel = this.settings.progLevel; |
467 |
| - // Decode it and get the clean serialized XML as plain string |
468 |
| - toolboxJSON = require(`../assets/toolbox_${toolboxLevel}.json`); |
469 |
| - } else { |
470 |
| - toolboxJSON = this.activity.toolbox; |
471 |
| - } |
472 |
| - console.log(this.settings); |
473 |
| - this.toolbox = toolboxJSON; |
474 |
| - }); |
| 379 | + activityName = this.$route.params.name; |
| 380 | + activityDefault = true; |
475 | 381 | }
|
| 382 | + this.$coderbot.loadActivity(activityName, activityDefault).then((activity) => { |
| 383 | + this.activity = activity.data; |
| 384 | +
|
| 385 | + this.settings.maxBlocks = this.activity.maxBlocks; |
| 386 | + this.updateCssProps(); |
| 387 | +
|
| 388 | + let toolboxJSON = null; |
| 389 | + if (this.activity.toolbox == null) { |
| 390 | + const toolboxLevel = this.settings.progLevel; |
| 391 | + // Decode it and get the clean serialized XML as plain string |
| 392 | + toolboxJSON = require(`../assets/toolbox_${toolboxLevel}.json`); |
| 393 | + } else { |
| 394 | + toolboxJSON = this.activity.toolbox; |
| 395 | + } |
| 396 | + console.log(this.settings); |
| 397 | + this.toolbox = toolboxJSON; |
| 398 | + }); |
476 | 399 |
|
477 | 400 | this.status = null;
|
478 | 401 | this.pollStatus();
|
|
0 commit comments