mirror of
https://github.com/Eugeny/tabby.git
synced 2024-09-11 13:13:59 +03:00
.
This commit is contained in:
parent
2a373231fd
commit
3b47047052
@ -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
|
||||
}
|
||||
}
|
@ -25,11 +25,13 @@
|
||||
"sass-loader": "^6.0.3",
|
||||
"style-loader": "^0.13.1",
|
||||
"to-string-loader": "^1.1.5",
|
||||
"tslint": "4.2.0",
|
||||
"tslint": "4.5.0",
|
||||
"tslint-eslint-rules": "^3.5.1",
|
||||
"typescript": "2.2.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"val-loader": "^0.5.0",
|
||||
"webpack": "2.2.0-rc.4",
|
||||
"vrsource-tslint-rules": "^4.0.1",
|
||||
"webpack": "2.2.0",
|
||||
"yaml-loader": "^0.4.0"
|
||||
},
|
||||
"build": {
|
||||
|
32
tslint.json
32
tslint.json
@ -1,21 +1,35 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/vrsource-tslint-rules/rules",
|
||||
"node_modules/tslint-eslint-rules/dist/rules"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [true, "spaces"],
|
||||
"quotemark": [true, "single"],
|
||||
"semicolon": false,
|
||||
"no-inferrable-types": [true, "ignore-params"],
|
||||
"curly": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"log"
|
||||
],
|
||||
"no-duplicate-imports": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-jasmine-focus": true,
|
||||
"no-var-keyword": true,
|
||||
"no-eval": true,
|
||||
"no-invalid-this": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-undef": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-new": true,
|
||||
"no-unused-variable": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"new-parens": true
|
||||
"require-internal-with-underscore": true,
|
||||
"semicolon": [
|
||||
false
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"ban-keywords"
|
||||
],
|
||||
"no-inner-declarations": [
|
||||
true,
|
||||
"function"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user