fix: Error when logout from a Window. (#225)
parent
cd1c2a1b53
commit
371387dd92
|
@ -135,12 +135,11 @@ export const contextMixin = {
|
||||||
return this.$store.getters.getDataRecordAndSelection(this.containerUuid).record
|
return this.$store.getters.getDataRecordAndSelection(this.containerUuid).record
|
||||||
},
|
},
|
||||||
getDataRecord() {
|
getDataRecord() {
|
||||||
var record = this.getterDataRecordsAll.filter(fieldItem => {
|
return this.getterDataRecordsAll.filter(fieldItem => {
|
||||||
if (this.recordUuid === fieldItem.UUID) {
|
if (this.recordUuid === fieldItem.UUID) {
|
||||||
return fieldItem
|
return fieldItem
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return record
|
|
||||||
},
|
},
|
||||||
getterDataLog() {
|
getterDataLog() {
|
||||||
if (this.panelType === 'window') {
|
if (this.panelType === 'window') {
|
||||||
|
@ -326,15 +325,25 @@ export const contextMixin = {
|
||||||
},
|
},
|
||||||
generateContextMenu() {
|
generateContextMenu() {
|
||||||
this.metadataMenu = this.getterContextMenu
|
this.metadataMenu = this.getterContextMenu
|
||||||
|
|
||||||
|
// the function is broken avoiding that an error is generated when closing
|
||||||
|
// session being in a window, since the store of vuex is cleaned, being
|
||||||
|
// this.metadataMenu with value undefined
|
||||||
|
if (this.isEmptyValue(this.metadataMenu)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this.panelType === 'window') {
|
if (this.panelType === 'window') {
|
||||||
this.$store.dispatch('getPrivateAccessFromServer', {
|
this.$store.dispatch('getPrivateAccessFromServer', {
|
||||||
tableName: this.$route.params.tableName,
|
tableName: this.$route.params.tableName,
|
||||||
recordId: this.$route.params.recordId
|
recordId: this.$route.params.recordId
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(privateAccessResponse => {
|
||||||
|
if (!this.isEmptyValue(privateAccessResponse)) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.validatePrivateAccess(response)
|
this.validatePrivateAccess(privateAccessResponse)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.actions = this.metadataMenu.actions
|
this.actions = this.metadataMenu.actions
|
||||||
|
@ -605,17 +614,41 @@ export const contextMixin = {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
validatePrivateAccess(response) {
|
validatePrivateAccess({ isLocked, tableName, recordId }) {
|
||||||
if (response.isLocked) {
|
if (isLocked) {
|
||||||
this.actions.find(item => item.action === 'unlockRecord').hidden = false
|
this.actions = this.actions.map(actionItem => {
|
||||||
this.actions.find(item => item.action === 'unlockRecord').tableName = response.tableName
|
if (actionItem.action === 'unlockRecord') {
|
||||||
this.actions.find(item => item.action === 'unlockRecord').recordId = response.recordId
|
return {
|
||||||
this.actions.find(item => item.action === 'lockRecord').hidden = true
|
...actionItem,
|
||||||
|
hidden: false,
|
||||||
|
tableName,
|
||||||
|
recordId
|
||||||
|
}
|
||||||
|
} else if (actionItem.action === 'lockRecord') {
|
||||||
|
return {
|
||||||
|
...actionItem,
|
||||||
|
hidden: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return actionItem
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.actions.find(item => item.action === 'lockRecord').hidden = false
|
this.actions = this.actions.map(actionItem => {
|
||||||
this.actions.find(item => item.action === 'lockRecord').tableName = response.tableName
|
if (actionItem.action === 'lockRecord') {
|
||||||
this.actions.find(item => item.action === 'lockRecord').recordId = response.recordId
|
return {
|
||||||
this.actions.find(item => item.action === 'unlockRecord').hidden = true
|
...actionItem,
|
||||||
|
hidden: false,
|
||||||
|
tableName,
|
||||||
|
recordId
|
||||||
|
}
|
||||||
|
} else if (actionItem.action === 'unlockRecord') {
|
||||||
|
return {
|
||||||
|
...actionItem,
|
||||||
|
hidden: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return actionItem
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue