mirror of
https://github.com/Eugeny/tabby
synced 2024-12-04 18:40:16 +00:00
refactoring Eugeny/tabby#8589 (shouldTabBeDestroyedOnSessionClose)
This commit is contained in:
parent
7f2340e701
commit
27c8b920ea
2 changed files with 6 additions and 9 deletions
|
@ -789,7 +789,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
|||
* Method called when session is closed.
|
||||
*/
|
||||
protected onSessionClosed (destroyOnSessionClose = false): void {
|
||||
if (destroyOnSessionClose || this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
if (destroyOnSessionClose || this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.destroy()
|
||||
}
|
||||
}
|
||||
|
@ -797,12 +797,9 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
|||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
if (behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
|||
if (this.frontend) {
|
||||
if (this.profile.behaviorOnSessionEnd === 'reconnect' && !this.isDisconnectedByHand) {
|
||||
this.reconnect()
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.offerReconnection()
|
||||
}
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
|||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
if (this.isDisconnectedByHand) {
|
||||
return false
|
||||
}
|
||||
return super.doesTabShouldBeDestroyedOnSessionClosed()
|
||||
return super.shouldTabBeDestroyedOnSessionClose()
|
||||
}
|
||||
|
||||
async getRecoveryToken (options?: GetRecoveryTokenOptions): Promise<RecoveryToken> {
|
||||
|
|
Loading…
Reference in a new issue