- fix: check if need refresh.. part 1
- keytab in todo...
This commit is contained in:
@@ -277,9 +277,12 @@ self.addEventListener('sync', function (event) {
|
||||
})
|
||||
.then(function (resData) {
|
||||
console.log('Result CALL ', method, ' OK? =', resData.ok);
|
||||
if (resData.ok) {
|
||||
deleteItemFromData(table, rec._id);
|
||||
}
|
||||
|
||||
// Anyway Delete this, otherwise in some cases will return error, but it's not a problem.
|
||||
// for example if I change a record and then I deleted ...
|
||||
// if (resData.ok) {
|
||||
deleteItemFromData(table, rec._id);
|
||||
// }
|
||||
|
||||
console.log('DELETE: ', mystrparam)
|
||||
deleteItemFromData('swmsg', mystrparam)
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class SingleTodo extends Vue {
|
||||
}
|
||||
|
||||
|
||||
@Watch('itemtodo.descr',) valueChanged5() {
|
||||
@Watch('itemtodo.descr') valueChanged5() {
|
||||
this.precDescr = this.itemtodo.descr
|
||||
}
|
||||
|
||||
@@ -234,6 +234,8 @@ export default class SingleTodo extends Vue {
|
||||
|
||||
exitEdit(singola: boolean = false) {
|
||||
if (this.inEdit) {
|
||||
if (this.precDescr !== this.itemtodo.descr)
|
||||
this.updateTodo()
|
||||
// console.log('exitEdit')
|
||||
this.inEdit = false
|
||||
this.updateClasses
|
||||
@@ -243,11 +245,30 @@ export default class SingleTodo extends Vue {
|
||||
|
||||
|
||||
keyDownArea(e) {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault()
|
||||
/*
|
||||
if ((e.key === 'ArrowUp') && !e.shiftKey) {
|
||||
e.key = 'Tab'
|
||||
e.shiftKey = true
|
||||
}
|
||||
|
||||
if ((e.key === 'ArrowDown') && !e.shiftKey) {
|
||||
let nextInput = inputs.get(inputs.index(this) + 1)
|
||||
if (nextInput) {
|
||||
nextInput.focus()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (((e.key === 'Enter') || (e.key === 'Tab')) && !e.shiftKey) {
|
||||
this.updateTodo()
|
||||
this.deselectRiga()
|
||||
this.faiFocus('insertTask', true)
|
||||
|
||||
if ((e.key === 'Tab') && !e.shiftKey) {
|
||||
|
||||
} else {
|
||||
e.preventDefault()
|
||||
this.deselectRiga()
|
||||
this.faiFocus('insertTask', true)
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('keyDownArea', e)
|
||||
@@ -261,6 +282,9 @@ export default class SingleTodo extends Vue {
|
||||
}
|
||||
|
||||
updateTodo() {
|
||||
if (this.itemtodo.descr === this.precDescr)
|
||||
return
|
||||
|
||||
this.itemtodo.descr = this.precDescr
|
||||
console.log('updateTodo', this.precDescr, this.itemtodo.descr)
|
||||
this.watchupdate()
|
||||
|
||||
@@ -41,6 +41,7 @@ export default class Todo extends Vue {
|
||||
itemDragStart: any = null
|
||||
itemDragEnd: any = null
|
||||
selrowid: number = 0
|
||||
polling = null
|
||||
|
||||
fieldtochange: String [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'id_next', 'pos', 'enableExpiring', 'progress']
|
||||
|
||||
@@ -307,6 +308,10 @@ export default class Todo extends Vue {
|
||||
// console.log('Array PRIOR:', this.arrPrior)
|
||||
}
|
||||
|
||||
beforedestroy() {
|
||||
clearInterval(this.polling)
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
||||
this.todos_arr = [...Todos.state.todos]
|
||||
@@ -323,6 +328,9 @@ export default class Todo extends Vue {
|
||||
|
||||
await this.updatetable()
|
||||
|
||||
|
||||
this.checkUpdate_everytime()
|
||||
|
||||
/*
|
||||
this.todos_arr.forEach((elem, index) => {
|
||||
this.logelem('LOAD ' + index, elem)
|
||||
@@ -331,6 +339,13 @@ export default class Todo extends Vue {
|
||||
|
||||
}
|
||||
|
||||
// Call to check if need to refresh
|
||||
checkUpdate_everytime() {
|
||||
this.polling = setInterval(() => {
|
||||
this.checkUpdate()
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
copy(o) {
|
||||
let output, v, key
|
||||
output = Array.isArray(o) ? [] : {}
|
||||
|
||||
@@ -2,6 +2,6 @@ import indexdb from './indexdb'
|
||||
|
||||
export default async (context, cmd, table, data = null, id = '') => {
|
||||
const descr = data !== null ? data.descr : ''
|
||||
console.log('globalroutines', cmd, table, descr, id)
|
||||
// console.log('globalroutines', cmd, table, descr, id)
|
||||
return await indexdb(context, cmd, table, data, id)
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ namespace Actions {
|
||||
|
||||
await aspettansec(1000)
|
||||
|
||||
console.log('waitAndcheckPendingMsg')
|
||||
// console.log('waitAndcheckPendingMsg')
|
||||
|
||||
return await checkPendingMsg(context)
|
||||
.then(ris => {
|
||||
console.log('ris = ', ris)
|
||||
if (ris) {
|
||||
console.log('ris = ', ris)
|
||||
const result = sendSwMsgIfAvailable()
|
||||
.then(something => {
|
||||
if (something) {
|
||||
@@ -132,7 +132,7 @@ namespace Actions {
|
||||
}
|
||||
|
||||
async function checkPendingMsg(context) {
|
||||
console.log('checkPendingMsg')
|
||||
// console.log('checkPendingMsg')
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
@@ -145,8 +145,8 @@ namespace Actions {
|
||||
// Check if there is something
|
||||
globalroutines(null, 'count', 'swmsg')
|
||||
.then(function (count) {
|
||||
console.log('count = ', count)
|
||||
if (count > 0) {
|
||||
console.log('count = ', count)
|
||||
return resolve(true)
|
||||
} else {
|
||||
return resolve(false)
|
||||
|
||||
Reference in New Issue
Block a user