Skip to content

Commit 6a72b9d

Browse files
committed
Expose vue-app git commit build
1 parent cc62021 commit 6a72b9d

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

config/prod.env.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
'use strict'
2+
const cp = require('child_process')
3+
const lastCommit = '"' + cp.execSync('git rev-parse HEAD').toString().trim().substring(0, 7) + '"'
4+
25
module.exports = {
36
NODE_ENV: '"production"',
47
// Backend location. Must point to the exposed Flask instance
58
CB_ENDPOINT: '""',
69
// Legacy APIs
710
APIv1: '""',
811
// New API, exposed by Connexion
9-
APIv2: '"/v2"'
12+
APIv2: '"/v2"',
13+
lastCommit: lastCommit
1014
}

src/components/Settings.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
<h3 class="text-xs-left">Sistema </h3>
3737
<v-card>
3838
<div class="cardContent">
39+
3940
<v-select v-model="settings.progLevel" :items="blocklyToolboxItems" label="Livello Toolbox Blockly"></v-select>
4041
<!--<v-text-field v-model="settings.cbName" label="Nome CoderBot"></v-text-field>
4142
<br>-->
4243
<div v-for="(value, key, index) in cb.info">
4344
{{ key }}: <code>{{ value }}</code>
4445
</div>
46+
Vue app commit build: <code> {{ lastCommit }} </code>
4547
</div>
4648
</v-card>
4749
<br>
@@ -76,8 +78,13 @@
7678
<h3 class="text-xs-left"> Aggiornamento </h3>
7779
<v-card>
7880
<div class="cardContent">
81+
<template v-if="updateStatus==1">
7982
{{ counter }} %
80-
{{ updateStatusText }}
83+
84+
</template>
85+
<template v-if="updateStatus==2">
86+
{{ updateStatusText }}
87+
</template>
8188
<template v-if="updateStatus==0">
8289
<v-text-field label="Seleziona il pacchetto di aggiornamento" @click='pickFile' v-model='fileName' prepend-icon='attach_file'></v-text-field>
8390
<input type="file" style="display: none" ref="file" @change="onFilePicked">
@@ -257,7 +264,6 @@ export default {
257264
}
258265
},
259266
upload() {
260-
console.log(this.fileObj)
261267
var formdata = new FormData();
262268
formdata.append('file_to_upload', this.fileObj)
263269
const config = {
@@ -266,12 +272,14 @@ export default {
266272
this.counter = Math.floor((progressEvent.loaded * 100) / progressEvent.total);
267273
}
268274
}
275+
this.updateStatus = 1
269276
this.$axios.post(this.CB + '/uploadFile', formdata, config).then(result => {
270277
this.uploadCompleted = true;
271278
this.uploadInProgress = false;
272279
console.dir(result.data);
280+
this.updateStatus = 2
273281
this.updateStatusText = 'Upload completato. Aggiornamento in corso...'
274-
this.updateStatus = 1
282+
275283
})
276284
277285
},
@@ -488,6 +496,7 @@ export default {
488496
data() {
489497
return {
490498
status: null,
499+
lastCommit: process.env.lastCommit,
491500
CB: process.env.CB_ENDPOINT + process.env.APIv2,
492501
CBv1: process.env.CB_ENDPOINT,
493502
snackbar: null,

0 commit comments

Comments
 (0)