mirror of
https://github.com/Eugeny/tabby.git
synced 2025-01-05 09:34:56 +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 { NotifyService } from 'services/notify'
|
||||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||||
import { QuitterService } from 'services/quitter'
|
import { QuitterService } from 'services/quitter'
|
||||||
import { SessionsService } from 'services/sessions'
|
|
||||||
import { DockingService } from 'services/docking'
|
import { DockingService } from 'services/docking'
|
||||||
|
|
||||||
import { AppComponent } from 'components/app'
|
import { AppComponent } from 'components/app'
|
||||||
import { CheckboxComponent } from 'components/checkbox'
|
import { CheckboxComponent } from 'components/checkbox'
|
||||||
import { TabBodyComponent } from 'components/tabBody'
|
import { TabBodyComponent } from 'components/tabBody'
|
||||||
import { TabHeaderComponent } from 'components/tabHeader'
|
import { TabHeaderComponent } from 'components/tabHeader'
|
||||||
import { TerminalTabComponent } from 'components/terminalTab'
|
|
||||||
import { TitleBarComponent } from 'components/titleBar'
|
import { TitleBarComponent } from 'components/titleBar'
|
||||||
|
|
||||||
|
|
||||||
let plugins = [
|
let plugins = [
|
||||||
require('./settings').default,
|
require('./settings').default,
|
||||||
|
require('./terminal').default,
|
||||||
]
|
]
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -48,17 +47,14 @@ let plugins = [
|
|||||||
NotifyService,
|
NotifyService,
|
||||||
PluginDispatcherService,
|
PluginDispatcherService,
|
||||||
QuitterService,
|
QuitterService,
|
||||||
SessionsService,
|
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
TerminalTabComponent,
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
CheckboxComponent,
|
CheckboxComponent,
|
||||||
TabBodyComponent,
|
TabBodyComponent,
|
||||||
TabHeaderComponent,
|
TabHeaderComponent,
|
||||||
TerminalTabComponent,
|
|
||||||
TitleBarComponent,
|
TitleBarComponent,
|
||||||
],
|
],
|
||||||
bootstrap: [
|
bootstrap: [
|
||||||
|
@ -8,10 +8,10 @@ import { LogService } from 'services/log'
|
|||||||
import { QuitterService } from 'services/quitter'
|
import { QuitterService } from 'services/quitter'
|
||||||
import { ConfigService } from 'services/config'
|
import { ConfigService } from 'services/config'
|
||||||
import { DockingService } from 'services/docking'
|
import { DockingService } from 'services/docking'
|
||||||
import { SessionsService } from 'services/sessions'
|
// import { SessionsService } from 'services/sessions'
|
||||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||||
|
|
||||||
import { Tab, TerminalTab } from 'models/tab'
|
import { Tab } from 'models/tab'
|
||||||
|
|
||||||
import 'angular2-toaster/lib/toaster.css'
|
import 'angular2-toaster/lib/toaster.css'
|
||||||
import 'global.less'
|
import 'global.less'
|
||||||
@ -48,7 +48,7 @@ export class AppComponent {
|
|||||||
lastTabIndex = 0
|
lastTabIndex = 0
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private sessions: SessionsService,
|
// private sessions: SessionsService,
|
||||||
private docking: DockingService,
|
private docking: DockingService,
|
||||||
private electron: ElectronService,
|
private electron: ElectronService,
|
||||||
public hostApp: HostAppService,
|
public hostApp: HostAppService,
|
||||||
@ -146,11 +146,7 @@ export class AppComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newTab () {
|
newTab () {
|
||||||
this.addTerminalTab(this.sessions.createNewSession({command: 'zsh'}))
|
const tab = this.pluginDispatcher.temp2('zsh')
|
||||||
}
|
|
||||||
|
|
||||||
addTerminalTab (session) {
|
|
||||||
let tab = new TerminalTab(session)
|
|
||||||
this.tabs.push(tab)
|
this.tabs.push(tab)
|
||||||
this.selectTab(tab)
|
this.selectTab(tab)
|
||||||
}
|
}
|
||||||
@ -192,9 +188,9 @@ export class AppComponent {
|
|||||||
|
|
||||||
closeTab (tab) {
|
closeTab (tab) {
|
||||||
tab.destroy()
|
tab.destroy()
|
||||||
if (tab.session) {
|
/* if (tab.session) {
|
||||||
this.sessions.destroySession(tab.session)
|
this.sessions.destroySession(tab.session)
|
||||||
}
|
} */
|
||||||
let newIndex = Math.max(0, this.tabs.indexOf(tab) - 1)
|
let newIndex = Math.max(0, this.tabs.indexOf(tab) - 1)
|
||||||
this.tabs = this.tabs.filter((x) => x != tab)
|
this.tabs = this.tabs.filter((x) => x != tab)
|
||||||
if (tab == this.activeTab) {
|
if (tab == this.activeTab) {
|
||||||
@ -203,6 +199,7 @@ export class AppComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
/*
|
||||||
this.sessions.recoverAll().then((recoveredSessions) => {
|
this.sessions.recoverAll().then((recoveredSessions) => {
|
||||||
if (recoveredSessions.length > 0) {
|
if (recoveredSessions.length > 0) {
|
||||||
recoveredSessions.forEach((session) => {
|
recoveredSessions.forEach((session) => {
|
||||||
@ -213,6 +210,7 @@ export class AppComponent {
|
|||||||
this.showSettings();
|
this.showSettings();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
showSettings() {
|
showSettings() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { EventEmitter } from '@angular/core'
|
import { EventEmitter } from '@angular/core'
|
||||||
import { BaseTabComponent } from 'components/baseTab'
|
import { BaseTabComponent } from 'components/baseTab'
|
||||||
import { Session } from 'services/sessions'
|
|
||||||
|
|
||||||
export declare type ComponentType<T extends Tab> = new (...args: any[]) => BaseTabComponent<T>
|
export declare type ComponentType<T extends Tab> = new (...args: any[]) => BaseTabComponent<T>
|
||||||
|
|
||||||
@ -25,16 +24,3 @@ export class Tab {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import { TerminalTabComponent } from 'components/terminalTab'
|
|
||||||
|
|
||||||
export class TerminalTab extends Tab {
|
|
||||||
constructor (public session: Session) {
|
|
||||||
super()
|
|
||||||
}
|
|
||||||
|
|
||||||
getComponentType (): ComponentType<TerminalTab> {
|
|
||||||
return TerminalTabComponent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -7,6 +7,7 @@ import { ElectronService } from 'services/electron'
|
|||||||
export class PluginDispatcherService {
|
export class PluginDispatcherService {
|
||||||
plugins = []
|
plugins = []
|
||||||
temp: any
|
temp: any
|
||||||
|
temp2: any
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
|
@ -5,9 +5,9 @@ import { ConfigService } from 'services/config'
|
|||||||
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
import { PluginDispatcherService } from 'services/pluginDispatcher'
|
||||||
|
|
||||||
import { BaseTabComponent } from 'components/baseTab'
|
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({
|
@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",
|
"sass-loader": "^6.0.3",
|
||||||
"style-loader": "^0.13.1",
|
"style-loader": "^0.13.1",
|
||||||
"to-string-loader": "^1.1.5",
|
"to-string-loader": "^1.1.5",
|
||||||
"tslint": "4.2.0",
|
"tslint": "4.5.0",
|
||||||
|
"tslint-eslint-rules": "^3.5.1",
|
||||||
"typescript": "2.2.1",
|
"typescript": "2.2.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"val-loader": "^0.5.0",
|
"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"
|
"yaml-loader": "^0.4.0"
|
||||||
},
|
},
|
||||||
"build": {
|
"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": {
|
"rules": {
|
||||||
"indent": [true, "spaces"],
|
"no-console": [
|
||||||
"quotemark": [true, "single"],
|
true,
|
||||||
"semicolon": false,
|
"log"
|
||||||
"no-inferrable-types": [true, "ignore-params"],
|
],
|
||||||
"curly": true,
|
"no-duplicate-imports": true,
|
||||||
"no-duplicate-variable": true,
|
"no-duplicate-variable": true,
|
||||||
"no-empty": true,
|
"no-jasmine-focus": true,
|
||||||
|
"no-var-keyword": true,
|
||||||
"no-eval": true,
|
"no-eval": true,
|
||||||
"no-invalid-this": true,
|
|
||||||
"no-shadowed-variable": true,
|
"no-shadowed-variable": true,
|
||||||
"no-undef": true,
|
"no-undef": true,
|
||||||
"no-unused-expression": true,
|
"no-unused-expression": true,
|
||||||
"no-unused-new": true,
|
"no-unused-new": true,
|
||||||
"no-unused-variable": true,
|
"no-unused-variable": true,
|
||||||
"no-use-before-declare": true,
|
"no-use-before-declare": true,
|
||||||
"no-var-keyword": true,
|
"require-internal-with-underscore": true,
|
||||||
"new-parens": true
|
"semicolon": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"variable-name": [
|
||||||
|
true,
|
||||||
|
"ban-keywords"
|
||||||
|
],
|
||||||
|
"no-inner-declarations": [
|
||||||
|
true,
|
||||||
|
"function"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user