Show Button, when Upgrade Version is available ! (check from the server, the version number

- for debug: added led button to see when is calling the server and the IndexedDb.
This commit is contained in:
Paolo Arena
2019-02-22 10:23:00 +01:00
parent 1623a5c35d
commit 0e98ac1eaa
41 changed files with 1411 additions and 992 deletions

View File

@@ -1,7 +1,24 @@
import indexdb from './indexdb'
import { GlobalStore } from "../store/Modules";
export default async (context, cmd, table, data = null, id = '') => {
const descr = data !== null ? data.descr : ''
// console.log('globalroutines', cmd, table, descr, id)
return await indexdb(context, cmd, table, data, id)
.then(ris => {
setTimeout(function () {
GlobalStore.state.connData.uploading_indexeddb = 0
GlobalStore.state.connData.downloading_indexeddb = 0
}, 1000)
return ris
}
).catch(err => {
setTimeout(function () {
GlobalStore.state.connData.uploading_indexeddb = (GlobalStore.state.connData.uploading_indexeddb === 1) ? -1 : GlobalStore.state.connData.uploading_indexeddb
GlobalStore.state.connData.downloading_indexeddb = (GlobalStore.state.connData.downloading_indexeddb === 1) ? -1 : GlobalStore.state.connData.downloading_indexeddb
}, 1000)
console.log('ERROR INDEXEDDB: ', err)
})
}

View File

@@ -57,23 +57,35 @@ function testfunc2 () {
}
export default async (context, cmd, table, datakey = null, id = '') => {
// console.log('TABLE', table, 'cmd', cmd)
if (cmd === 'loadapp') {
// ****** LOAD APP AL CARICAMENTO ! *******
return saveConfigIndexDb(context, datakey)
} else if (cmd === 'write') {
if (GlobalStore)
GlobalStore.state.connData.uploading_indexeddb = 1
return await storage.setdata(table, datakey)
} else if (cmd === 'updatefromIndexedDbToStateTodo') {
return await readfromIndexDbToStateTodos(context, table)
} else if (cmd === 'readall') {
if (GlobalStore)
GlobalStore.state.connData.downloading_indexeddb = 1
return await storage.getalldata(table)
} else if (cmd === 'count') {
return await storage.count(table)
} else if (cmd === 'read') {
if (GlobalStore)
GlobalStore.state.connData.downloading_indexeddb = 1
return await storage.getdata(table, id)
} else if (cmd === 'delete') {
if (GlobalStore)
GlobalStore.state.connData.uploading_indexeddb = 1
return await storage.deletedata(table, id)
} else if (cmd === 'clearalldata') {
if (GlobalStore)
GlobalStore.state.connData.uploading_indexeddb = 1
return await storage.clearalldata(table)
} else if (cmd === 'log') {
consolelogpao(table)