mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-19 18:07:58 +00:00
moved spinner intro baseTerminalTab
This commit is contained in:
@@ -17,8 +17,7 @@
|
||||
"author": "Eugene Pankov",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "14.14.31",
|
||||
"cli-spinner": "^0.2.10"
|
||||
"@types/node": "14.14.31"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/animations": "^9.1.9",
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import colors from 'ansi-colors'
|
||||
import { Spinner } from 'cli-spinner'
|
||||
import { Component, Injector } from '@angular/core'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Platform, RecoveryToken } from 'tabby-core'
|
||||
@@ -19,13 +18,6 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
|
||||
profile?: TelnetProfile
|
||||
session: TelnetSession|null = null
|
||||
private reconnectOffered = false
|
||||
private spinner = new Spinner({
|
||||
text: 'Connecting',
|
||||
stream: {
|
||||
write: x => this.write(x),
|
||||
},
|
||||
})
|
||||
private spinnerActive = false
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor (
|
||||
@@ -84,13 +76,11 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
|
||||
this.setSession(session)
|
||||
|
||||
try {
|
||||
this.startSpinner()
|
||||
this.startSpinner('Connecting')
|
||||
|
||||
this.attachSessionHandler(session.serviceMessage$, msg => {
|
||||
this.pauseSpinner(() => {
|
||||
this.write(`\r${colors.black.bgWhite(' Telnet ')} ${msg}\r\n`)
|
||||
session.resize(this.size.columns, this.size.rows)
|
||||
})
|
||||
this.write(`\r${colors.black.bgWhite(' Telnet ')} ${msg}\r\n`)
|
||||
session.resize(this.size.columns, this.size.rows)
|
||||
})
|
||||
|
||||
try {
|
||||
@@ -133,24 +123,4 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
|
||||
}
|
||||
)).response === 1
|
||||
}
|
||||
|
||||
private startSpinner () {
|
||||
this.spinner.setSpinnerString(6)
|
||||
this.spinner.start()
|
||||
this.spinnerActive = true
|
||||
}
|
||||
|
||||
private stopSpinner () {
|
||||
this.spinner.stop(true)
|
||||
this.spinnerActive = false
|
||||
}
|
||||
|
||||
private pauseSpinner (work: () => void) {
|
||||
const wasActive = this.spinnerActive
|
||||
this.stopSpinner()
|
||||
work()
|
||||
if (wasActive) {
|
||||
this.startSpinner()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user