feat: Add copy button to ssh connection

This commit is contained in:
Zenghai Liang 2020-10-14 15:43:12 +08:00
parent c9d75d81e4
commit 1c25747de0
No known key found for this signature in database
GPG key ID: B389E2148C1B2E0D
2 changed files with 14 additions and 0 deletions

View file

@ -20,6 +20,8 @@ h3 Connections
.mr-auto
div {{connection.name}}
.text-muted {{connection.host}}
button.btn.btn-outline-info.ml-1((click)='$event.stopPropagation(); copyConnection(connection)')
i.fas.fa-copy
button.btn.btn-outline-danger.ml-1((click)='$event.stopPropagation(); deleteConnection(connection)')
i.fas.fa-trash

View file

@ -46,6 +46,18 @@ export class SSHSettingsTabComponent {
})
}
copyConnection (connection) {
connection.name += ' Copy'
const modal = this.ngbModal.open(EditConnectionModalComponent)
modal.componentInstance.connection = connection
modal.result.then(result => {
this.connections.push(result)
this.config.store.ssh.connections = this.connections
this.config.save()
this.refresh()
})
}
editConnection (connection: SSHConnection) {
const modal = this.ngbModal.open(EditConnectionModalComponent, { size: 'lg' })
modal.componentInstance.connection = Object.assign({}, connection)