2017-03-24 22:29:54 +00:00
|
|
|
import { Injectable } from '@angular/core'
|
2017-03-25 17:12:43 +00:00
|
|
|
import { Tab, TabRecoveryProvider } from 'api'
|
2017-03-24 22:29:54 +00:00
|
|
|
import { TerminalTab } from './tab'
|
|
|
|
import { SessionsService } from './services/sessions'
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
2017-03-25 17:12:43 +00:00
|
|
|
export class RecoveryProvider extends TabRecoveryProvider {
|
|
|
|
constructor (private sessions: SessionsService) {
|
|
|
|
super()
|
|
|
|
}
|
2017-03-24 22:29:54 +00:00
|
|
|
|
|
|
|
recover (recoveryToken: any): Tab {
|
|
|
|
if (recoveryToken.type == 'app:terminal') {
|
|
|
|
const options = this.sessions.recoveryProvider.getRecoverySession(recoveryToken.recoveryId)
|
|
|
|
let session = this.sessions.createSession(options)
|
|
|
|
session.recoveryId = recoveryToken.recoveryId
|
|
|
|
return new TerminalTab(session)
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|