mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-12 07:29:59 +00:00
Have multiple recent connections in history instead of just one
This commit is contained in:
parent
2773c61677
commit
d1f5ebd546
@ -1,22 +1,25 @@
|
|||||||
.modal-body
|
.modal-body
|
||||||
input.form-control(
|
input.form-control(
|
||||||
type='text',
|
type='text',
|
||||||
[(ngModel)]='quickTarget',
|
[(ngModel)]='quickTarget',
|
||||||
autofocus,
|
autofocus,
|
||||||
placeholder='Quick connect: [user@]host[:port]',
|
placeholder='Quick connect: [user@]host[:port]',
|
||||||
(ngModelChange)='refresh()',
|
(ngModelChange)='refresh()',
|
||||||
(keyup.enter)='quickConnect()'
|
(keyup.enter)='quickConnect()'
|
||||||
)
|
)
|
||||||
|
|
||||||
.list-group.mt-3(*ngIf='lastConnection')
|
.list-group.mt-3(*ngIf='recentConnections')
|
||||||
a.list-group-item.list-group-item-action.d-flex.align-items-center((click)='connect(lastConnection)')
|
a.list-group-item.list-group-item-action.d-flex.align-items-center(
|
||||||
|
*ngFor='let connection of recentConnections',
|
||||||
|
(click)='connect(connection)'
|
||||||
|
)
|
||||||
i.fas.fa-fw.fa-history
|
i.fas.fa-fw.fa-history
|
||||||
.mr-auto {{lastConnection.name}}
|
.mr-auto {{connection.name}}
|
||||||
button.btn.btn-outline-danger.btn-sm((click)='clearLastConnection(); $event.stopPropagation()')
|
button.btn.btn-outline-danger.btn-sm((click)='clearConnection(connection); $event.stopPropagation()')
|
||||||
i.fas.fa-trash
|
i.fas.fa-trash
|
||||||
|
|
||||||
.list-group.mt-3.connections-list(*ngIf='childGroups.length')
|
.list-group.mt-3.connections-list(*ngIf='childGroups.length')
|
||||||
ng-container(*ngFor='let group of childGroups')
|
ng-container(*ngFor='let group of childGroups')
|
||||||
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
.list-group-item.list-group-item-action.d-flex.align-items-center(
|
||||||
(click)='groupCollapsed[group.name] = !groupCollapsed[group.name]'
|
(click)='groupCollapsed[group.name] = !groupCollapsed[group.name]'
|
||||||
)
|
)
|
||||||
@ -25,8 +28,8 @@
|
|||||||
.ml-2 {{group.name || "Ungrouped"}}
|
.ml-2 {{group.name || "Ungrouped"}}
|
||||||
ng-container(*ngIf='!groupCollapsed[group.name]')
|
ng-container(*ngIf='!groupCollapsed[group.name]')
|
||||||
.list-group-item.list-group-item-action.pl-5.d-flex.align-items-center(
|
.list-group-item.list-group-item-action.pl-5.d-flex.align-items-center(
|
||||||
*ngFor='let connection of group.connections',
|
*ngFor='let connection of group.connections',
|
||||||
(click)='connect(connection)'
|
(click)='connect(connection)'
|
||||||
)
|
)
|
||||||
.mr-2 {{connection.name}}
|
.mr-2 {{connection.name}}
|
||||||
.text-muted {{connection.host}}
|
.text-muted {{connection.host}}
|
||||||
|
@ -16,7 +16,7 @@ export class SSHModalComponent {
|
|||||||
connections: SSHConnection[]
|
connections: SSHConnection[]
|
||||||
childFolders: SSHConnectionGroup[]
|
childFolders: SSHConnectionGroup[]
|
||||||
quickTarget: string
|
quickTarget: string
|
||||||
lastConnection: SSHConnection|null = null
|
recentConnections: SSHConnection[]
|
||||||
childGroups: SSHConnectionGroup[]
|
childGroups: SSHConnectionGroup[]
|
||||||
groupCollapsed: {[id: string]: boolean} = {}
|
groupCollapsed: {[id: string]: boolean} = {}
|
||||||
|
|
||||||
@ -30,9 +30,7 @@ export class SSHModalComponent {
|
|||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.connections = this.config.store.ssh.connections
|
this.connections = this.config.store.ssh.connections
|
||||||
if (window.localStorage.lastConnection) {
|
this.recentConnections = this.config.store.ssh.recentConnections
|
||||||
this.lastConnection = JSON.parse(window.localStorage.lastConnection)
|
|
||||||
}
|
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,13 +53,21 @@ export class SSHModalComponent {
|
|||||||
user,
|
user,
|
||||||
port,
|
port,
|
||||||
}
|
}
|
||||||
window.localStorage.lastConnection = JSON.stringify(connection)
|
this.recentConnections.unshift(connection)
|
||||||
|
if (this.recentConnections.length > 5) {
|
||||||
|
this.recentConnections.pop()
|
||||||
|
}
|
||||||
|
this.config.store.ssh.recentConnections = this.recentConnections
|
||||||
|
this.config.save()
|
||||||
this.connect(connection)
|
this.connect(connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
clearLastConnection () {
|
clearConnection (connection) {
|
||||||
window.localStorage.lastConnection = null
|
this.recentConnections = this.recentConnections.filter(function (el) {
|
||||||
this.lastConnection = null
|
return el === connection
|
||||||
|
})
|
||||||
|
this.config.store.ssh.recentConnections = this.recentConnections
|
||||||
|
this.config.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect (connection: SSHConnection) {
|
async connect (connection: SSHConnection) {
|
||||||
|
@ -5,6 +5,7 @@ export class SSHConfigProvider extends ConfigProvider {
|
|||||||
defaults = {
|
defaults = {
|
||||||
ssh: {
|
ssh: {
|
||||||
connections: [],
|
connections: [],
|
||||||
|
recentConnections: [],
|
||||||
options: {
|
options: {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user