Skip to content

Commit

Permalink
#852: Main page controls active tab, so receives notices for both cha…
Browse files Browse the repository at this point in the history
…ngeoftab and locks for current tab. Sends menu lock notice from both.
  • Loading branch information
Matthew Mulholland committed Jun 27, 2019
1 parent e4c7259 commit 4cd97e4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/renderer/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
:adjustSidenavFormHeight="adjustSidenavFormHeight"
:sideNavFormHeight="sideNavFormHeight"
:cIndex="currentColumnIndex"
:isLocked="isLocked"
/>
</transition>
<div
Expand Down Expand Up @@ -303,7 +304,8 @@ import {
hotIdFromTab$,
provenanceErrors$,
errorFeedback$,
updateHotDimensions$
updateHotDimensions$,
allTableLocks$
} from '@/rxSubject.js'
import VueRx from 'vue-rx'
import {
Expand All @@ -321,6 +323,7 @@ import Vue from 'vue'
import {
toolbarMenus
} from '@/toolbarMenus'
import { LockProperties } from '@/lockProperties'
Vue.use(AsyncComputed)
Vue.use(VueRx, {
Subscription
Expand Down Expand Up @@ -396,7 +399,8 @@ export default {
key: 'profile',
value: 'tabular-data-package'
}],
reportSiblingClasses: ['main-bottom-panel', 'main-middle-panel']
reportSiblingClasses: ['main-bottom-panel', 'main-middle-panel'],
isLocked: false
}
},
computed: {
Expand Down Expand Up @@ -434,12 +438,14 @@ export default {
try {
let hotId = await this.getHotIdFromTabId(tabId)
this.currentHotId = hotId
console.log(`current Hot id is: ${this.currentHotId}`)
this.reselectHotCell()
} catch (err) {
console.error('Problem with getting hot id from watched tab', err)
}
this.closeMessages()
this.sendErrorsToErrorsWindow()
console.log('hello active tab 2...')
},
messages: function() {
if (this.messages) {
Expand All @@ -449,6 +455,11 @@ export default {
},
mounted: function() {
let self = this
this.$subscribeTo(allTableLocks$, async function(allTablesLocks) {
self.isLocked = _.includes(LockProperties.getLockedTables(), hotId)
ipc.send('hasLockedColumns', self.isLocked)
})
// request may be coming from another page - get focus first
ipc.on('showErrorCell', async function(event, arg) {
await ipc.send('focusMainWindow')
Expand Down Expand Up @@ -538,13 +549,17 @@ export default {
})
},
beforeCreate: function() {
let self = this
this.$subscribeTo(hotIdFromTab$, function(hotId) {
let hot = HotRegister.getInstance(hotId)
if (hot) {
ipc.send('hasHeaderRow', hot.hasColHeaders())
}
ipc.send('hasCaseSensitiveHeader', isCaseSensitive(hotId))
remote.getGlobal('tab').activeHotId = hotId
// LockProperties.trigger()
self.isLocked = _.includes(LockProperties.getLockedTables(), hotId)
ipc.send('hasLockedColumns', self.isLocked)
})
onNextHotIdFromTabRx(getHotIdFromTabIdFunction())
},
Expand All @@ -561,7 +576,6 @@ export default {
})
this.pushDefaultPackageProperties()
ipc.send('closedFindReplace')
ipc.send('hasLockedColumns', false)
},
updated: function() {
if (this.loadingDataMessage && this.loadingDataMessage.length > 0) {
Expand Down

0 comments on commit 4cd97e4

Please sign in to comment.