提交 e1cc1d56 编写于 作者: E Eugene Pankov

fixes

上级 df2f4d4a
.mb-4
.terminus-logo
h1.terminus-title Terminus
sup α
sup α
.container
.text-center.mb-5 Thank you for downloading Terminus!
......@@ -10,10 +10,20 @@
.header
.title Enable analytics
.description Help us track the number of Terminus installs across the world!
toggle(
[(ngModel)]='config.store.enableAnalytics',
(ngModelChange)='config.save(); config.requestRestart()',
)
toggle([(ngModel)]='config.store.enableAnalytics')
.form-line
.header
.title Enable SSH plugin
.description Adds an SSH connection manager UI to Terminus
toggle([(ngModel)]='enableSSH')
.form-line
.header
.title Enable Serial plugin
.description Allows attaching Terminus to serial ports
toggle([(ngModel)]='enableSerial')
.text-center.mt-5
button.btn.btn-primary((click)='closeAndDisable()') Close and never show again
import { Component } from '@angular/core'
import { BaseTabComponent } from './baseTab.component'
import { ConfigService } from '../services/config.service'
import { AppService } from '../services/app.service'
import { HostAppService } from '../services/hostApp.service'
/** @hidden */
@Component({
......@@ -10,17 +10,29 @@ import { AppService } from '../services/app.service'
styles: [require('./welcomeTab.component.scss')],
})
export class WelcomeTabComponent extends BaseTabComponent {
enableSSH = false
enableSerial = false
constructor (
private app: AppService,
private hostApp: HostAppService,
public config: ConfigService,
) {
super()
this.setTitle('Welcome')
this.enableSSH = !config.store.pluginBlacklist.includes('ssh')
this.enableSerial = !config.store.pluginBlacklist.includes('serial')
}
closeAndDisable () {
this.config.store.enableWelcomeTab = false
this.config.store.pluginBlacklist = []
if (!this.enableSSH) {
this.config.store.pluginBlacklist.push('ssh')
}
if (!this.enableSerial) {
this.config.store.pluginBlacklist.push('serial')
}
this.config.save()
this.app.closeTab(this)
this.hostApp.getWindow().reload()
}
}
......@@ -191,8 +191,8 @@ export class ConfigService {
const ngModule = window['rootModule'].ɵinj
for (const imp of ngModule.imports) {
const module = imp['ngModule'] || imp
if (module.ngInjectorDef && module.ngInjectorDef.providers) {
this.servicesCache[module['pluginName']] = module.ngInjectorDef.providers.map(provider => {
if (module.ɵinj?.providers) {
this.servicesCache[module['pluginName']] = module.ɵinj.providers.map(provider => {
return provider['useClass'] || provider
})
}
......
import { BehaviorSubject, Observable } from 'rxjs'
import { debounceTime, distinctUntilChanged, first, tap, flatMap, map } from 'rxjs/operators'
import * as semver from 'semver'
import semverGt from 'semver/functions/gt'
import { Component, Input } from '@angular/core'
import { ConfigService, ElectronService } from 'terminus-core'
......@@ -48,7 +48,7 @@ export class PluginsSettingsTabComponent {
return plugins
})).subscribe(available => {
for (const plugin of this.pluginManager.installedPlugins) {
this.knownUpgrades[plugin.name] = available.find(x => x.name === plugin.name && semver.gt(x.version, plugin.version)) || null
this.knownUpgrades[plugin.name] = available.find(x => x.name === plugin.name && semverGt(x.version, plugin.version)) || null
}
})
}
......
import { Component } from '@angular/core'
import { Component, NgZone } from '@angular/core'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { ToastrService } from 'ngx-toastr'
import { ConfigService, AppService } from 'terminus-core'
import { SettingsTabComponent } from 'terminus-settings'
import { SerialService } from '../services/serial.service'
import { SerialConnection, SerialPortInfo, BAUD_RATES } from '../api'
import { SerialTabComponent } from './serialTab.component'
/** @hidden */
@Component({
......@@ -22,6 +23,7 @@ export class SerialModalComponent {
private config: ConfigService,
private serial: SerialService,
private app: AppService,
private zone: NgZone,
private toastr: ToastrService,
) { }
......@@ -61,15 +63,23 @@ export class SerialModalComponent {
this.lastConnection = null
}
connect (connection: SerialConnection) {
async connect (connection: SerialConnection) {
this.close()
this.serial.openTab(connection).catch(error => {
this.toastr.error(`Could not connect: ${error}`)
}).then(() => {
try {
const tab = this.zone.run(() => this.app.openNewTab(
SerialTabComponent,
{ connection }
) as SerialTabComponent)
if (connection.color) {
(this.app.getParentTab(tab) || tab).color = connection.color
}
setTimeout(() => {
this.app.activeTab.emitFocused()
})
})
} catch (error) {
this.toastr.error(`Could not connect: ${error}`)
}
}
manageConnections () {
......
import { Injectable, NgZone } from '@angular/core'
import SerialPort from 'serialport'
import { ToastrService } from 'ngx-toastr'
import { AppService, LogService } from 'terminus-core'
import { LogService } from 'terminus-core'
import { SerialConnection, SerialSession, SerialPortInfo } from '../api'
import { SerialTabComponent } from '../components/serialTab.component'
@Injectable({ providedIn: 'root' })
export class SerialService {
private constructor (
private log: LogService,
private app: AppService,
private zone: NgZone,
private toastr: ToastrService,
) { }
......@@ -21,17 +19,6 @@ export class SerialService {
}))
}
async openTab (connection: SerialConnection): Promise<SerialTabComponent> {
const tab = this.zone.run(() => this.app.openNewTab(
SerialTabComponent,
{ connection }
) as SerialTabComponent)
if (connection.color) {
(this.app.getParentTab(tab) || tab).color = connection.color
}
return tab
}
createSession (connection: SerialConnection): SerialSession {
const session = new SerialSession(connection)
session.logger = this.log.create(`serial-${connection.port}`)
......
import { Component } from '@angular/core'
import { Component, NgZone } from '@angular/core'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { ToastrService } from 'ngx-toastr'
import { ConfigService, AppService } from 'terminus-core'
import { SettingsTabComponent } from 'terminus-settings'
import { SSHService } from '../services/ssh.service'
import { SSHConnection, SSHConnectionGroup } from '../api'
import { SSHTabComponent } from './sshTab.component'
/** @hidden */
@Component({
......@@ -22,9 +22,9 @@ export class SSHModalComponent {
constructor (
public modalInstance: NgbActiveModal,
private config: ConfigService,
private ssh: SSHService,
private app: AppService,
private toastr: ToastrService,
private zone: NgZone,
) { }
ngOnInit () {
......@@ -63,15 +63,24 @@ export class SSHModalComponent {
this.lastConnection = null
}
connect (connection: SSHConnection) {
async connect (connection: SSHConnection) {
this.close()
this.ssh.openTab(connection).catch(error => {
this.toastr.error(`Could not connect: ${error}`)
}).then(() => {
try {
const tab = this.zone.run(() => this.app.openNewTab(
SSHTabComponent,
{ connection }
) as SSHTabComponent)
if (connection.color) {
(this.app.getParentTab(tab) || tab).color = connection.color
}
setTimeout(() => {
this.app.activeTab.emitFocused()
this.app.activeTab?.emitFocused()
})
})
} catch (error) {
this.toastr.error(`Could not connect: ${error}`)
}
}
manageConnections () {
......
......@@ -8,10 +8,9 @@ import { execFile } from 'mz/child_process'
import * as path from 'path'
import * as sshpk from 'sshpk'
import { ToastrService } from 'ngx-toastr'
import { AppService, HostAppService, Platform, Logger, LogService, ElectronService } from 'terminus-core'
import { HostAppService, Platform, Logger, LogService, ElectronService } from 'terminus-core'
import { SSHConnection, SSHSession } from '../api'
import { PromptModalComponent } from '../components/promptModal.component'
import { SSHTabComponent } from '../components/sshTab.component'
import { PasswordStorageService } from './passwordStorage.service'
import { SSH2Stream } from 'ssh2-streams'
......@@ -25,7 +24,6 @@ export class SSHService {
private constructor (
private log: LogService,
private app: AppService,
private electron: ElectronService,
private zone: NgZone,
private ngbModal: NgbModal,
......@@ -36,17 +34,6 @@ export class SSHService {
this.logger = log.create('ssh')
}
async openTab (connection: SSHConnection): Promise<SSHTabComponent> {
const tab = this.zone.run(() => this.app.openNewTab(
SSHTabComponent,
{ connection }
) as SSHTabComponent)
if (connection.color) {
(this.app.getParentTab(tab) || tab).color = connection.color
}
return tab
}
createSession (connection: SSHConnection): SSHSession {
const session = new SSHSession(connection)
session.logger = this.log.create(`ssh-${connection.host}-${connection.port}`)
......
{
"compilerOptions": {
"module": "es2015",
"target": "es2016",
"target": "es2017",
"moduleResolution": "node",
"noImplicitAny": false,
"removeComments": false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册