mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-21 02:48:00 +00:00
refactoring Eugeny/tabby#8589 (shouldTabBeDestroyedOnSessionClose)
This commit is contained in:
@@ -789,7 +789,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
|||||||
* Method called when session is closed.
|
* Method called when session is closed.
|
||||||
*/
|
*/
|
||||||
protected onSessionClosed (destroyOnSessionClose = false): void {
|
protected onSessionClosed (destroyOnSessionClose = false): void {
|
||||||
if (destroyOnSessionClose || this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
if (destroyOnSessionClose || this.shouldTabBeDestroyedOnSessionClose()) {
|
||||||
this.destroy()
|
this.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -797,12 +797,9 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
|||||||
/**
|
/**
|
||||||
* Return true if tab should be destroyed on session closed.
|
* Return true if tab should be destroyed on session closed.
|
||||||
*/
|
*/
|
||||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||||
const behavior = this.profile.behaviorOnSessionEnd
|
const behavior = this.profile.behaviorOnSessionEnd
|
||||||
if (behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
return behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -68,7 +68,7 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
|||||||
if (this.frontend) {
|
if (this.frontend) {
|
||||||
if (this.profile.behaviorOnSessionEnd === 'reconnect' && !this.isDisconnectedByHand) {
|
if (this.profile.behaviorOnSessionEnd === 'reconnect' && !this.isDisconnectedByHand) {
|
||||||
this.reconnect()
|
this.reconnect()
|
||||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.shouldTabBeDestroyedOnSessionClose()) {
|
||||||
this.offerReconnection()
|
this.offerReconnection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,11 +93,11 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
|||||||
/**
|
/**
|
||||||
* Return true if tab should be destroyed on session closed.
|
* Return true if tab should be destroyed on session closed.
|
||||||
*/
|
*/
|
||||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||||
if (this.isDisconnectedByHand) {
|
if (this.isDisconnectedByHand) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return super.doesTabShouldBeDestroyedOnSessionClosed()
|
return super.shouldTabBeDestroyedOnSessionClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecoveryToken (options?: GetRecoveryTokenOptions): Promise<RecoveryToken> {
|
async getRecoveryToken (options?: GetRecoveryTokenOptions): Promise<RecoveryToken> {
|
||||||
|
Reference in New Issue
Block a user