Remember last device, open all folders on search
This commit is contained in:
parent
7feeacea42
commit
5635c2af1a
2 changed files with 36 additions and 7 deletions
|
|
@ -71,6 +71,7 @@ export class Application {
|
|||
async connectDevice(devName) {// {{{
|
||||
this.resetDeviceState()
|
||||
if (devName == '-') {
|
||||
this.settings.set('last_device', '')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -84,6 +85,9 @@ export class Application {
|
|||
|
||||
const records = await this.currentDevice.retrieveRecords()
|
||||
this.records = this.parseRecords(records)
|
||||
|
||||
this.settings.set('last_device', this.currentDevice.name())
|
||||
|
||||
this.createFolders()
|
||||
this.renderDevice()
|
||||
} catch (err) {
|
||||
|
|
@ -184,6 +188,9 @@ export class Application {
|
|||
}
|
||||
|
||||
this.deviceSelector.render()
|
||||
const lastDevice = this.settings.get('last_device')
|
||||
if (lastDevice !== '')
|
||||
this.deviceSelector.selectDevice(lastDevice)
|
||||
}// }}}
|
||||
|
||||
// renderDevice creates the device specific elements and also updates them.
|
||||
|
|
@ -293,7 +300,7 @@ export class Application {
|
|||
break
|
||||
|
||||
case 'f':
|
||||
this.searchField.focus()
|
||||
this.searchWidget.searchField.focus()
|
||||
break
|
||||
|
||||
default:
|
||||
|
|
@ -317,7 +324,6 @@ export class Application {
|
|||
document.body.classList.remove('boxed-folders')
|
||||
}// }}}
|
||||
|
||||
|
||||
// search sets the search filter and re-renders the records tree.
|
||||
search() {// {{{
|
||||
this.recordsTree.remove()
|
||||
|
|
@ -325,6 +331,7 @@ export class Application {
|
|||
this.recordsTree = null
|
||||
|
||||
this.createFolders()
|
||||
this.topFolder.openFolder(true)
|
||||
this.renderDevice()
|
||||
}// }}}
|
||||
}
|
||||
|
|
@ -435,6 +442,10 @@ class DeviceSelectWidget {
|
|||
this.currentlySelected = devName
|
||||
_mbus.dispatch('device_selected', { devName })
|
||||
}// }}}
|
||||
selectDevice(devname) {// {{{
|
||||
this.elDeviceSelect.value = devname
|
||||
this.notifyDeviceSelect()
|
||||
}// }}}
|
||||
}
|
||||
|
||||
class Folder {
|
||||
|
|
@ -742,6 +753,7 @@ class Record {
|
|||
return [this.imgIcon, this.divFQDN, this.divType, this.divValue, this.divTTL, this.divActions]
|
||||
}// }}}
|
||||
mouseEnter() {// {{{
|
||||
this.imgIcon.classList.add('mouse-over')
|
||||
this.divFQDN.classList.add('mouse-over')
|
||||
this.divType.classList.add('mouse-over')
|
||||
this.divValue.classList.add('mouse-over')
|
||||
|
|
@ -749,6 +761,7 @@ class Record {
|
|||
this.divActions.classList.add('mouse-over')
|
||||
}// }}}
|
||||
mouseLeave() {// {{{
|
||||
this.imgIcon.classList.remove('mouse-over')
|
||||
this.divFQDN.classList.remove('mouse-over')
|
||||
this.divType.classList.remove('mouse-over')
|
||||
this.divValue.classList.remove('mouse-over')
|
||||
|
|
@ -899,6 +912,7 @@ class Settings {
|
|||
this.settings = new Map([
|
||||
['boxed_folders', false],
|
||||
['toplevel_open', false],
|
||||
['last_device', ''],
|
||||
])
|
||||
|
||||
// Read any configured settings from local storage, but keeping default value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue