mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
.
This commit is contained in:
@@ -14,19 +14,18 @@ import { ModalService } from 'services/modal'
|
||||
import { NotifyService } from 'services/notify'
|
||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||
import { QuitterService } from 'services/quitter'
|
||||
import { SessionsService } from 'services/sessions'
|
||||
import { DockingService } from 'services/docking'
|
||||
|
||||
import { AppComponent } from 'components/app'
|
||||
import { CheckboxComponent } from 'components/checkbox'
|
||||
import { TabBodyComponent } from 'components/tabBody'
|
||||
import { TabHeaderComponent } from 'components/tabHeader'
|
||||
import { TerminalTabComponent } from 'components/terminalTab'
|
||||
import { TitleBarComponent } from 'components/titleBar'
|
||||
|
||||
|
||||
let plugins = [
|
||||
require('./settings').default,
|
||||
require('./terminal').default,
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
@@ -48,17 +47,14 @@ let plugins = [
|
||||
NotifyService,
|
||||
PluginDispatcherService,
|
||||
QuitterService,
|
||||
SessionsService,
|
||||
],
|
||||
entryComponents: [
|
||||
TerminalTabComponent,
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
CheckboxComponent,
|
||||
TabBodyComponent,
|
||||
TabHeaderComponent,
|
||||
TerminalTabComponent,
|
||||
TitleBarComponent,
|
||||
],
|
||||
bootstrap: [
|
||||
|
@@ -8,10 +8,10 @@ import { LogService } from 'services/log'
|
||||
import { QuitterService } from 'services/quitter'
|
||||
import { ConfigService } from 'services/config'
|
||||
import { DockingService } from 'services/docking'
|
||||
import { SessionsService } from 'services/sessions'
|
||||
// import { SessionsService } from 'services/sessions'
|
||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||
|
||||
import { Tab, TerminalTab } from 'models/tab'
|
||||
import { Tab } from 'models/tab'
|
||||
|
||||
import 'angular2-toaster/lib/toaster.css'
|
||||
import 'global.less'
|
||||
@@ -48,7 +48,7 @@ export class AppComponent {
|
||||
lastTabIndex = 0
|
||||
|
||||
constructor(
|
||||
private sessions: SessionsService,
|
||||
// private sessions: SessionsService,
|
||||
private docking: DockingService,
|
||||
private electron: ElectronService,
|
||||
public hostApp: HostAppService,
|
||||
@@ -146,11 +146,7 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
newTab () {
|
||||
this.addTerminalTab(this.sessions.createNewSession({command: 'zsh'}))
|
||||
}
|
||||
|
||||
addTerminalTab (session) {
|
||||
let tab = new TerminalTab(session)
|
||||
const tab = this.pluginDispatcher.temp2('zsh')
|
||||
this.tabs.push(tab)
|
||||
this.selectTab(tab)
|
||||
}
|
||||
@@ -192,9 +188,9 @@ export class AppComponent {
|
||||
|
||||
closeTab (tab) {
|
||||
tab.destroy()
|
||||
if (tab.session) {
|
||||
/* if (tab.session) {
|
||||
this.sessions.destroySession(tab.session)
|
||||
}
|
||||
} */
|
||||
let newIndex = Math.max(0, this.tabs.indexOf(tab) - 1)
|
||||
this.tabs = this.tabs.filter((x) => x != tab)
|
||||
if (tab == this.activeTab) {
|
||||
@@ -203,6 +199,7 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
ngOnInit () {
|
||||
/*
|
||||
this.sessions.recoverAll().then((recoveredSessions) => {
|
||||
if (recoveredSessions.length > 0) {
|
||||
recoveredSessions.forEach((session) => {
|
||||
@@ -213,6 +210,7 @@ export class AppComponent {
|
||||
this.showSettings();
|
||||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
showSettings() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { EventEmitter } from '@angular/core'
|
||||
import { BaseTabComponent } from 'components/baseTab'
|
||||
import { Session } from 'services/sessions'
|
||||
|
||||
export declare type ComponentType<T extends Tab> = new (...args: any[]) => BaseTabComponent<T>
|
||||
|
||||
@@ -25,16 +24,3 @@ export class Tab {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import { TerminalTabComponent } from 'components/terminalTab'
|
||||
|
||||
export class TerminalTab extends Tab {
|
||||
constructor (public session: Session) {
|
||||
super()
|
||||
}
|
||||
|
||||
getComponentType (): ComponentType<TerminalTab> {
|
||||
return TerminalTabComponent
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,8 @@ import { ElectronService } from 'services/electron'
|
||||
export class PluginDispatcherService {
|
||||
plugins = []
|
||||
temp: any
|
||||
|
||||
temp2: any
|
||||
|
||||
constructor (
|
||||
private config: ConfigService,
|
||||
private electron: ElectronService,
|
||||
|
@@ -5,9 +5,9 @@ import { ConfigService } from 'services/config'
|
||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||
|
||||
import { BaseTabComponent } from 'components/baseTab'
|
||||
import { TerminalTab } from 'models/tab'
|
||||
import { TerminalTab } from '../tab'
|
||||
|
||||
import { hterm, preferenceManager } from 'hterm'
|
||||
import { hterm, preferenceManager } from '../hterm'
|
||||
|
||||
|
||||
@Component({
|
37
app/src/terminal/index.ts
Normal file
37
app/src/terminal/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { BrowserModule } from '@angular/platform-browser'
|
||||
import { NgModule } from '@angular/core'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
|
||||
import { TerminalTabComponent } from './components/terminalTab'
|
||||
import { SessionsService } from './services/sessions'
|
||||
import { TerminalTab } from './tab'
|
||||
|
||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
],
|
||||
providers: [
|
||||
SessionsService,
|
||||
],
|
||||
entryComponents: [
|
||||
TerminalTabComponent,
|
||||
],
|
||||
declarations: [
|
||||
TerminalTabComponent,
|
||||
],
|
||||
})
|
||||
class TerminalModule {
|
||||
constructor (pluginDispatcher: PluginDispatcherService, sessions: SessionsService) {
|
||||
pluginDispatcher.temp2 = (command) => {
|
||||
let session = sessions.createNewSession({ command }))
|
||||
return new TerminalTab(session)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default TerminalModule
|
14
app/src/terminal/tab.ts
Normal file
14
app/src/terminal/tab.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Tab, ComponentType } from '../models/tab'
|
||||
import { TerminalTabComponent } from './components/terminalTab'
|
||||
import { Session } from './services/sessions'
|
||||
|
||||
|
||||
export class TerminalTab extends Tab {
|
||||
constructor (public session: Session) {
|
||||
super()
|
||||
}
|
||||
|
||||
getComponentType (): ComponentType<TerminalTab> {
|
||||
return TerminalTabComponent
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user