Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
2e81a165
T
Tabby
项目概览
后端镜像
/
Tabby
通知
27
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2e81a165
编写于
6月 03, 2017
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
.
上级
3ceaaec8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
89 addition
and
30 deletion
+89
-30
app/src/plugins.ts
app/src/plugins.ts
+1
-1
terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug
...n-manager/src/components/pluginsSettingsTab.component.pug
+32
-14
terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts
...in-manager/src/components/pluginsSettingsTab.component.ts
+42
-11
terminus-plugin-manager/src/services/pluginManager.service.ts
...inus-plugin-manager/src/services/pluginManager.service.ts
+10
-1
terminus-terminal/src/components/terminalTab.component.ts
terminus-terminal/src/components/terminalTab.component.ts
+4
-3
未找到文件。
app/src/plugins.ts
浏览文件 @
2e81a165
...
...
@@ -32,7 +32,7 @@ const userPluginsPath = path.join(
Object
.
assign
(
window
,
{
builtinPluginsPath
,
userPluginsPath
})
nodeModule
.
globalPaths
.
unshift
(
builtinPluginsPath
)
nodeModule
.
globalPaths
.
unshift
(
userPluginsPath
)
nodeModule
.
globalPaths
.
unshift
(
path
.
join
(
userPluginsPath
,
'
node_modules
'
)
)
if
(
process
.
env
.
TERMINUS_PLUGINS
)
{
process
.
env
.
TERMINUS_PLUGINS
.
split
(
'
:
'
).
map
(
x
=>
nodeModule
.
globalPaths
.
unshift
(
normalizePath
(
x
)))
...
...
terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug
浏览文件 @
2e81a165
.alert.alert-danger(*ngIf='errorMessage')
strong Error in {{erroredPlugin}}:
pre {{errorMessage}}
h3 Installed
.list-group
ng-container(*ngFor='let plugin of pluginManager.installedPlugins')
.list-group-item.flex-column.align-items-start(*ngIf='knownUpgrades[plugin.name]')
.d-flex.w-100
h
6
.mr-auto.mb-0 {{plugin.name}}
h
5
.mr-auto.mb-0 {{plugin.name}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-primary((click)='upgradePlugin(plugin)')
i.fa.fa-arrow-up
button.btn.btn-outline-primary(
(click)='upgradePlugin(plugin)',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-arrow-up(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
span Upgrade ({{knownUpgrades[plugin.name].version}})
small.mb-0 {{plugin.description}}
small.
text-muted.
mb-0 {{plugin.description}}
ng-container(*ngFor='let plugin of pluginManager.installedPlugins')
.list-group-item.flex-column.align-items-start(*ngIf='!knownUpgrades[plugin.name]')
.d-flex.w-100
h
6
.mr-auto.mb-0 {{plugin.name}}
h
5
.mr-auto.mb-0 {{plugin.name}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-danger((click)='uninstallPlugin(plugin)', *ngIf='!plugin.isBuiltin')
i.fa.fa-trash-o
small.mb-0 {{plugin.description}}
button.btn.btn-outline-danger(
(click)='uninstallPlugin(plugin)',
*ngIf='!plugin.isBuiltin',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-trash-o(*ngIf='busy[plugin.name] != BusyState.Uninstalling')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Uninstalling')
small.text-muted.mb-0 {{plugin.description}}
h3.mt-4 Available
...
...
@@ -30,17 +43,22 @@ h3.mt-4 Available
input.form-control(
type='text',
'[(ngModel)]'='_1',
(ngModelChange)='
availablePluginsQuery$.next
(_1)',
(ngModelChange)='
searchAvailable
(_1)',
placeholder='Search plugins'
)
.list-group(*ngIf='availablePlugins$')
ng-container(*ngFor='let plugin of (availablePlugins$|async)')
.list-group-item.flex-column.align-items-start(*ngIf='!isAlreadyInstalled(plugin)')
.d-flex.w-100
h
6
.mr-auto.mb-0 {{plugin.name}}
h
5
.mr-auto.mb-0 {{plugin.name}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-primary((click)='installPlugin(plugin)')
i.fa.fa-download
span Install
small.mb-0 {{plugin.description}}
button.btn.btn-outline-primary(
(click)='installPlugin(plugin)',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
span Install
small.text-muted.mb-0 {{plugin.description}}
terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts
浏览文件 @
2e81a165
import
{
BehaviorSubject
,
Observable
}
from
'
rxjs
'
import
*
as
fs
from
'
fs-promise
'
import
*
as
path
from
'
path
'
import
*
as
semver
from
'
semver
'
import
{
exec
}
from
'
mz/child_process
'
import
{
Component
,
Inject
,
ChangeDetectionStrategy
}
from
'
@angular/core
'
import
{
Component
,
Input
}
from
'
@angular/core
'
import
{
ConfigService
}
from
'
terminus-core
'
import
{
IPluginInfo
,
PluginManagerService
}
from
'
../services/pluginManager.service
'
enum
BusyState
{
Installing
,
Uninstalling
}
@
Component
({
template
:
require
(
'
./pluginsSettingsTab.component.pug
'
),
styles
:
[
require
(
'
./pluginsSettingsTab.component.scss
'
)],
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
export
class
PluginsSettingsTabComponent
{
availablePlugins$
:
Observable
<
IPluginInfo
[]
>
availablePluginsQuery$
=
new
BehaviorSubject
<
string
>
(
''
)
availablePluginsReady
=
false
knownUpgrades
:
{[
id
:
string
]:
IPluginInfo
}
=
{}
busy
:
boolean
BusyState
=
BusyState
@
Input
()
availablePlugins$
:
Observable
<
IPluginInfo
[]
>
@
Input
()
availablePluginsQuery$
=
new
BehaviorSubject
<
string
>
(
''
)
@
Input
()
availablePluginsReady
=
false
@
Input
()
knownUpgrades
:
{[
id
:
string
]:
IPluginInfo
}
=
{}
@
Input
()
busy
:
{[
id
:
string
]:
BusyState
}
=
{}
@
Input
()
erroredPlugin
:
string
@
Input
()
errorMessage
:
string
constructor
(
private
config
:
ConfigService
,
public
pluginManager
:
PluginManagerService
)
{
}
...
...
@@ -41,12 +44,40 @@ export class PluginsSettingsTabComponent {
})
}
searchAvailable
(
query
:
string
)
{
this
.
availablePluginsQuery$
.
next
(
query
)
}
isAlreadyInstalled
(
plugin
:
IPluginInfo
):
boolean
{
return
this
.
pluginManager
.
installedPlugins
.
some
(
x
=>
x
.
name
===
plugin
.
name
)
}
async
installPlugin
(
plugin
:
IPluginInfo
):
Promise
<
void
>
{
this
.
busy
=
true
this
.
busy
[
plugin
.
name
]
=
BusyState
.
Installing
try
{
await
this
.
pluginManager
.
installPlugin
(
plugin
)
delete
this
.
busy
[
plugin
.
name
]
this
.
config
.
requestRestart
()
}
catch
(
err
)
{
this
.
erroredPlugin
=
plugin
.
name
this
.
errorMessage
=
err
delete
this
.
busy
[
plugin
.
name
]
throw
err
}
}
async
uninstallPlugin
(
plugin
:
IPluginInfo
):
Promise
<
void
>
{
this
.
busy
[
plugin
.
name
]
=
BusyState
.
Uninstalling
try
{
await
this
.
pluginManager
.
uninstallPlugin
(
plugin
)
delete
this
.
busy
[
plugin
.
name
]
this
.
config
.
requestRestart
()
}
catch
(
err
)
{
this
.
erroredPlugin
=
plugin
.
name
this
.
errorMessage
=
err
delete
this
.
busy
[
plugin
.
name
]
throw
err
}
}
async
upgradePlugin
(
plugin
:
IPluginInfo
):
Promise
<
void
>
{
...
...
terminus-plugin-manager/src/services/pluginManager.service.ts
浏览文件 @
2e81a165
import
*
as
fs
from
'
fs-promise
'
import
{
Observable
}
from
'
rxjs
'
import
{
Injectable
}
from
'
@angular/core
'
import
{
Logger
,
LogService
}
from
'
terminus-core
'
import
{
exec
}
from
'
mz/child_process
'
import
axios
from
'
axios
'
const
NAME_PREFIX
=
'
terminus-
'
...
...
@@ -45,5 +45,14 @@ export class PluginManagerService {
}
async
installPlugin
(
plugin
:
IPluginInfo
)
{
let
result
=
await
exec
(
`npm --prefix "
${
this
.
userPluginsPath
}
" install
${
plugin
.
packageName
}
@
${
plugin
.
version
}
`
)
console
.
log
(
result
)
this
.
installedPlugins
=
this
.
installedPlugins
.
filter
(
x
=>
x
.
packageName
!==
plugin
.
packageName
)
this
.
installedPlugins
.
push
(
plugin
)
}
async
uninstallPlugin
(
plugin
:
IPluginInfo
)
{
await
exec
(
`npm --prefix "
${
this
.
userPluginsPath
}
" remove
${
plugin
.
packageName
}
`
)
this
.
installedPlugins
=
this
.
installedPlugins
.
filter
(
x
=>
x
.
packageName
!==
plugin
.
packageName
)
}
}
terminus-terminal/src/components/terminalTab.component.ts
浏览文件 @
2e81a165
import
{
Observable
,
BehaviorSubject
,
ReplaySubject
,
Subject
,
Subscription
}
from
'
rxjs
'
import
{
BehaviorSubject
,
ReplaySubject
,
Subject
,
Subscription
}
from
'
rxjs
'
import
'
rxjs/add/operator/bufferTime
'
import
{
Component
,
NgZone
,
Inject
,
Optional
,
ViewChild
,
HostBinding
,
Input
}
from
'
@angular/core
'
import
{
AppService
,
ConfigService
,
BaseTabComponent
,
ThemesService
,
HostAppService
,
Platform
}
from
'
terminus-core
'
...
...
@@ -51,8 +51,9 @@ export class TerminalTabComponent extends BaseTabComponent {
this
.
session
=
this
.
sessions
.
addSession
(
Object
.
assign
({},
this
.
sessionOptions
,
resizeEvent
)
)
this
.
session
.
output$
.
bufferTime
(
10
).
subscribe
((
datas
)
=>
{
let
data
=
datas
.
join
(
''
)
// this.session.output$.bufferTime(10).subscribe((datas) => {
this
.
session
.
output$
.
subscribe
(
data
=>
{
// let data = datas.join('')
this
.
zone
.
run
(()
=>
{
this
.
output$
.
next
(
data
)
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录