mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-22 01:51:36 +03:00
allow custom baud rates - fixes #2490
This commit is contained in:
parent
bb9c9d8313
commit
6f11beb8c4
@ -25,10 +25,11 @@
|
||||
.col-6
|
||||
.form-group
|
||||
label Baud Rate
|
||||
select.form-control(
|
||||
input.form-control(
|
||||
type='number',
|
||||
[(ngModel)]='connection.baudrate',
|
||||
[ngbTypeahead]='baudratesAutocomplete',
|
||||
)
|
||||
option([value]='x', *ngFor='let x of baudRates') {{x}}
|
||||
|
||||
.row
|
||||
.col-6
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { Observable } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'
|
||||
import { ElectronService, HostAppService } from 'terminus-core'
|
||||
import { SerialConnection, LoginScript, SerialPortInfo, BAUD_RATES } from '../api'
|
||||
import { SerialService } from '../services/serial.service'
|
||||
// import { PromptModalComponent } from './promptModal.component'
|
||||
|
||||
/** @hidden */
|
||||
@Component({
|
||||
@ -14,7 +14,6 @@ import { SerialService } from '../services/serial.service'
|
||||
export class EditConnectionModalComponent {
|
||||
connection: SerialConnection
|
||||
foundPorts: SerialPortInfo[]
|
||||
baudRates = BAUD_RATES
|
||||
inputModes = [
|
||||
{ key: null, name: 'Normal', description: 'Input is sent as you type' },
|
||||
{ key: 'readline', name: 'Line by line', description: 'Line editor, input is sent after you press Enter' },
|
||||
@ -52,6 +51,12 @@ export class EditConnectionModalComponent {
|
||||
return this.foundPorts.map(x => x.name)
|
||||
}))
|
||||
|
||||
baudratesAutocomplete = text$ => text$.pipe(
|
||||
debounceTime(200),
|
||||
distinctUntilChanged(),
|
||||
map(q => BAUD_RATES.filter(x => !q || x.toString().startsWith(q)))
|
||||
)
|
||||
|
||||
portsFormatter = port => {
|
||||
const p = this.foundPorts.find(x => x.name === port)
|
||||
if (p?.description) {
|
||||
|
Loading…
Reference in New Issue
Block a user