Skip to content

Commit

Permalink
#852: Tied lock receipt to main menus and 'lockable' toolbar menus. U…
Browse files Browse the repository at this point in the history
…pdated for Guess.
  • Loading branch information
Matthew Mulholland committed Jun 27, 2019
1 parent 1b6eea2 commit 3a12060
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/main/rendererToMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ ipc.on('hasHeaderRow', (event, arg) => {
subMenu.checked = arg
})

ipc.on('hasLockedColumns', (event, arg) => {
let subMenu = getSubMenuFromMenu('Tools', 'Lock Column Properties')
subMenu.checked = arg
ipc.on('hasLockedActiveTable', (event, arg) => {
let lockedSubMenu = getSubMenuFromMenu('Tools', 'Lock Column Properties')
lockedSubMenu.checked = arg
// for locked table (ie: lock is enabled), value is true, so any menu 'enabled': set to false
let guessSubMenu = getSubMenuFromMenu('Tools', 'Guess Column Properties')
guessSubMenu.enabled = !arg
})

ipc.on('showErrorsWindow', (event, arg) => {
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<li
v-for="(menu, index) in toolbarMenus"
:key="index"
:class="{ 'active': toolbarIndex === index}"
:class="{ 'active': toolbarIndex === index, 'disabled':isActiveTabLocked && menu.lockable}"
@click="updateToolbarMenu(index)">
<a
v-tooltip="tooltip(menu.tooltipId)"
Expand Down Expand Up @@ -457,7 +457,7 @@ export default {
this.$subscribeTo(allTableLocks$, async function(allTablesLocks) {
self.isActiveTabLocked = _.includes(allTablesLocks, self.currentHotId)
ipc.send('hasLockedColumns', self.isActiveTabLocked)
ipc.send('hasLockedActiveTable', self.isActiveTabLocked)
})
// request may be coming from another page - get focus first
ipc.on('showErrorCell', async function(event, arg) {
Expand Down Expand Up @@ -1034,6 +1034,9 @@ export default {
}
},
updateToolbarMenu: function(index) {
if (this.isActiveTabLocked && this.toolbarMenus[index].lockable) {
return false
}
if (this.isSideNavToolbarMenu(index)) {
this.updateToolbarMenuForSideNav(index)
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/toolbarMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const toolbarMenus = [{
id: 'guess-column-properties',
image: 'static/img/guess-column-properties.svg',
tooltipId: 'tooltip-guess',
tooltipView: 'tooltipGuess'
tooltipView: 'tooltipGuess',
lockable: true
},
{
name: 'Column',
Expand Down

0 comments on commit 3a12060

Please sign in to comment.