strongly typed partial profiles wip

This commit is contained in:
Eugene Pankov
2021-07-13 23:44:23 +02:00
parent 5ddf36d4c1
commit 2f13f3a401
16 changed files with 118 additions and 107 deletions

View File

@@ -9,7 +9,7 @@ import { SerialService } from '../services/serial.service'
@Component({
template: require('./serialProfileSettings.component.pug'),
})
export class SerialProfileSettingsComponent implements ProfileSettingsComponent {
export class SerialProfileSettingsComponent implements ProfileSettingsComponent<SerialProfile> {
profile: SerialProfile
foundPorts: SerialPortInfo[]
Platform = Platform

View File

@@ -10,7 +10,7 @@ import { SerialService } from './services/serial.service'
import { BAUD_RATES, SerialProfile } from './api'
@Injectable({ providedIn: 'root' })
export class SerialProfilesService extends ProfileProvider {
export class SerialProfilesService extends ProfileProvider<SerialProfile> {
id = 'serial'
name = 'Serial'
settingsComponent = SerialProfileSettingsComponent

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import SerialPort from 'serialport'
import { ProfilesService } from 'tabby-core'
import { PartialProfile, ProfilesService } from 'tabby-core'
import { SerialPortInfo, SerialProfile } from '../api'
import { SerialTabComponent } from '../components/serialTab.component'
@@ -24,19 +24,12 @@ export class SerialService {
baudrate = parseInt(path.split('@')[1])
path = path.split('@')[0]
}
const profile: SerialProfile = {
const profile: PartialProfile<SerialProfile> = {
name: query,
type: 'serial',
options: {
port: path,
baudrate: baudrate,
databits: 8,
parity: 'none',
rtscts: false,
stopbits: 1,
xany: false,
xoff: false,
xon: false,
},
}
window.localStorage.lastSerialConnection = JSON.stringify(profile)