2017-03-24 21:24:12 +00:00
|
|
|
import { Injectable } from '@angular/core'
|
2017-03-25 17:12:43 +00:00
|
|
|
import { ToolbarButtonProvider, IToolbarButton, AppService } from 'api'
|
2017-03-24 21:24:12 +00:00
|
|
|
import { SessionsService } from './services/sessions'
|
|
|
|
import { TerminalTab } from './tab'
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
2017-03-25 17:12:43 +00:00
|
|
|
export class ButtonProvider extends ToolbarButtonProvider {
|
2017-03-24 21:24:12 +00:00
|
|
|
constructor (
|
|
|
|
private app: AppService,
|
|
|
|
private sessions: SessionsService,
|
|
|
|
) {
|
2017-03-25 17:12:43 +00:00
|
|
|
super()
|
2017-03-24 21:24:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
provide (): IToolbarButton[] {
|
|
|
|
return [{
|
|
|
|
icon: 'plus',
|
|
|
|
title: 'New terminal',
|
2017-03-25 20:00:16 +00:00
|
|
|
click: async () => {
|
|
|
|
let session = await this.sessions.createNewSession({ command: 'zsh' })
|
2017-03-24 21:24:12 +00:00
|
|
|
this.app.openTab(new TerminalTab(session))
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|