Skip to content
Snippets Groups Projects
Commit bcdf1ca9 authored by Otto Zaiser's avatar Otto Zaiser
Browse files

Fix UI

parent d4015814
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i" rel=stylesheet><link rel=stylesheet href=static/css/bootstrap.min.css><link rel=stylesheet href=static/css/style.css><link rel=stylesheet href=static/css/tsa2.css><title>Sello de Tiempo - Blockchain Federal Argentina</title><link href=tsa2.js rel=preload as=script></head><body><noscript><b>Lo sentimos pero el sello de tiempo no funciona sin JavaScript. Por favor, habilitalo para continuar.</b></noscript><nav id=navbar role=banner class="navbar navbar-default"><div class=container><div class=navbar-header><a class="logo navbar-btn pull-left" href=/ rel=home><img id=logo src=static/images/logo.svg alt="Blockchain Federal Argentina"></a></div></div></nav><main><div class=container><div class=tsa2><h1>Sello de Tiempo</h1><p>El servicio de Sello de Tiempo de BFA permite demostrar que el contenido de cualquier documento digital existió en un momento y que desde entonces, no ha cambiado. Al sellar un archivo, cualquiera podrá verificar el día y la hora en que su hash fue almacenado en Blockchain Federal Argentina. Tené en cuenta que el documento seleccionado nunca se sube a la red, garantizando su privacidad.</p><p class=font_small><a href=https://bfa.ar/sello>Si tenés un archivo con Recibo Digital (.rd) verificalo aquí</a></p><div id=app apiurl=http://200.108.146.180:3000></div></div></div><script src=tsa2.js></script></main></body></html> <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i" rel=stylesheet><link rel=stylesheet href=static/css/bootstrap.min.css><link rel=stylesheet href=static/css/style.css><link rel=stylesheet href=static/css/tsa2.css><title>Sello de Tiempo - Blockchain Federal Argentina</title><link href=tsa2.js rel=preload as=script></head><body><noscript><b>Lo sentimos pero el sello de tiempo no funciona sin JavaScript. Por favor, habilitalo para continuar.</b></noscript><nav id=navbar role=banner class="navbar navbar-default"><div class=container><div class=navbar-header><a class="logo navbar-btn pull-left" href=/ rel=home><img id=logo src=static/images/logo.svg alt="Blockchain Federal Argentina"></a></div></div></nav><main><div class=container><div class=tsa2><h1>Sello de Tiempo</h1><p>El servicio de Sello de Tiempo de BFA permite demostrar que el contenido de cualquier documento digital existió en un momento y que desde entonces, no ha cambiado. Al sellar un archivo, cualquiera podrá verificar el día y la hora en que su hash fue almacenado en Blockchain Federal Argentina. Tené en cuenta que el documento seleccionado nunca se sube a la red, garantizando su privacidad.</p><p class=font_small><a href=https://bfa.ar/sello>Si tenés un archivo con Recibo Digital (.rd) verificalo aquí</a></p><div id=app apiurl=http://localhost:3000></div></div></div><script src=tsa2.js></script></main></body></html>
\ No newline at end of file
source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
<div id="app"> <div id="app">
<div> <div>
<div v-if="state == 'stamped'" class="dropAreasuccess-stamp alert alert-success" role="alert"> <div v-if="state == 'stamped'" class="dropAreasuccess-stamp alert alert-success" role="alert">
<p><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> El archivo <b>{{archivo}}</b> fue sellado con éxito en el bloque 666 el {{ stamp.unixtimestamp }}</p> <p><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> El archivo <b>{{archivo}}</b> fue sellado con éxito en el bloque
<span v-for="stamp in stamps" v-bind:key="stamp.stamper"><b>{{ stamp.block }}</b> el {{ convertTime(stamp.blocktimestamp) }}</span>
</p>
</div> </div>
<div v-if="state=='failed-stamp'" class="fail-stamp alert alert-danger" role="alert"> <div v-if="state=='failed-stamp'" class="fail-stamp alert alert-danger" role="alert">
<p><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Se ha producido un error al intentar sellar el archivo <b>{{archivo}}</b> <p><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Se ha producido un error al intentar sellar el archivo <b>{{archivo}}</b>
...@@ -12,7 +14,7 @@ ...@@ -12,7 +14,7 @@
<p><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> El archivo <b>{{archivo}}</b> se encuentra sellado por:</p> <p><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> El archivo <b>{{archivo}}</b> se encuentra sellado por:</p>
<ul> <ul>
<li v-for="stamp in stamps" v-bind:key="stamp.stamper"> <li v-for="stamp in stamps" v-bind:key="stamp.stamper">
<b>{{ stamp.stamper }}</b> en el bloque <b>{{ stamp.block }}</b> el {{ stamp.unixtimestamp }} <b>{{ stamp.stamper }}</b> en el bloque <b>{{ stamp.block }}</b> el {{ convertTime(stamp.blocktimestamp) }}
</li> </li>
</ul> </ul>
</div> </div>
...@@ -25,8 +27,9 @@ ...@@ -25,8 +27,9 @@
</div> </div>
<DropFile <DropFile
:apiurl="apiurl" :apiurl="apiurl"
:hash="hash"
v-if="state == 'visible-drop'" v-if="state == 'visible-drop'"
v-on:stamp="onStamp()" v-on:stamp="onStamp"
v-on:failed-stamp="onFailedStamp()" v-on:failed-stamp="onFailedStamp()"
v-on:verify="onVerify" v-on:verify="onVerify"
v-on:failed-verify="onFailedVerify()" v-on:failed-verify="onFailedVerify()"
...@@ -40,7 +43,8 @@ ...@@ -40,7 +43,8 @@
export default { export default {
name: 'app', name: 'app',
props: ['apiurl'], props: ['apiurl','hash'],
data: function() { data: function() {
return { return {
state: 'visible-drop', state: 'visible-drop',
...@@ -48,9 +52,11 @@ ...@@ -48,9 +52,11 @@
stamps: [] stamps: []
} }
}, },
methods: { methods: {
continuar() { continuar() {
this.state = 'visible-drop' // history.pushState('', '', '/');
window.location.search = ''
this.state = 'visible-drop'
}, },
onVerify(stamps) { onVerify(stamps) {
this.state = 'verified' this.state = 'verified'
...@@ -59,14 +65,19 @@ ...@@ -59,14 +65,19 @@
onFailedVerify() { onFailedVerify() {
this.state = 'failed-verification' this.state = 'failed-verification'
}, },
onStamp() { onStamp(stamps) {
this.state = 'stamped' this.state = 'stamped'
this.stamps = stamps
}, },
onFailedStamp() { onFailedStamp() {
this.state = 'failed-stamp' this.state = 'failed-stamp'
}, },
onFilename (value) { onFilename (value) {
this.archivo = value this.archivo = value
},
convertTime(timestamp){
var date = new Date(timestamp*1000)
return date
} }
}, },
components: { components: {
......
...@@ -54,7 +54,7 @@ import axios from "axios" ...@@ -54,7 +54,7 @@ import axios from "axios"
export default { export default {
/* eslint-disable */ /* eslint-disable */
name: 'DropFile', name: 'DropFile',
props: ['apiurl'], props: ['apiurl','hash'],
data: function() { data: function() {
return { return {
loading: false, loading: false,
...@@ -62,6 +62,10 @@ export default { ...@@ -62,6 +62,10 @@ export default {
dragActive: false dragActive: false
}; };
}, },
created: function () {
console.log('Aca ta el hash '+this.hash);
if(this.hash != null) this.verifyHash()
},
methods: { methods: {
uploadFile() { uploadFile() {
document.getElementById("fileUpload").click() document.getElementById("fileUpload").click()
...@@ -103,13 +107,47 @@ export default { ...@@ -103,13 +107,47 @@ export default {
hashes: [self.uploadedFiles[0].hash] hashes: [self.uploadedFiles[0].hash]
}).then((res) => { }).then((res) => {
//console.log(res.data) //console.log(res.data)
self.$emit('stamp') //self.$emit('stamp');
this.verifyStamp();
}).catch((e) => { }).catch((e) => {
//console.error(e) //console.error(e)
self.$emit('failed-stamp') self.$emit('failed-stamp')
}).finally( () => self.loading = false ) }).finally( () => self.loading = false )
}, },
uploadFiles: function(f) { verifyStamp() {
var self = this;
let hash = self.uploadedFiles[0].hash
let verifyUrl = `${this.apiurl}/verify/${hash}`
self.loading = true
axios.get(verifyUrl).then((res) => {
//console.log(res.data)
if (res.data.stamped) {
self.$emit('stamp', res.data.stamps)
} else {
self.$emit('failed-stamp')
}
}).catch((e) => {
self.$emit('failed-stamp')
//console.error(e)
}).finally( () => self.loading = false )
},
verifyHash() {
var self = this;
let verifyUrl = `${this.apiurl}/verify/${this.hash}`
self.loading = true
axios.get(verifyUrl).then((res) => {
//console.log(res.data)
if (res.data.stamped) {
self.$emit('verify', res.data.stamps)
} else {
self.$emit('failed-verify')
}
}).catch((e) => {
self.$emit('failed-verify')
//console.error(e)
}).finally( () => self.loading = false )
},
uploadFiles: function(f) {
var self = this; var self = this;
this.loading = true this.loading = true
function loadFile(file) { function loadFile(file) {
...@@ -130,8 +168,7 @@ export default { ...@@ -130,8 +168,7 @@ export default {
self.loading = false self.loading = false
}; };
reader.readAsArrayBuffer(file, "UTF-8") reader.readAsArrayBuffer(file, "UTF-8")
} }
for (var i = 0; i < f.length; i++) { for (var i = 0; i < f.length; i++) {
loadFile(f[i]); loadFile(f[i]);
} }
......
...@@ -7,8 +7,9 @@ new Vue({ ...@@ -7,8 +7,9 @@ new Vue({
render(h) { render(h) {
return h(App, { return h(App, {
props: { props: {
apiurl: this.$el.attributes.apiurl.value apiurl: this.$el.attributes.apiurl.value,
hash: new URLSearchParams(window.location.search).get('hash')
} }
}) })
} }
}).$mount('#app') }).$mount('#app')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment