Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
7d258167
T
Tabby
项目概览
后端镜像
/
Tabby
通知
37
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,发现更多精彩内容 >>
提交
7d258167
编写于
9月 04, 2018
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more cleanup
上级
d6f163b0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
84 addition
and
90 deletion
+84
-90
terminus-ssh/src/api.ts
terminus-ssh/src/api.ts
+25
-29
terminus-ssh/src/components/editConnectionModal.component.pug
...inus-ssh/src/components/editConnectionModal.component.pug
+40
-43
terminus-ssh/src/components/editConnectionModal.component.ts
terminus-ssh/src/components/editConnectionModal.component.ts
+16
-15
terminus-ssh/src/components/sshModal.component.ts
terminus-ssh/src/components/sshModal.component.ts
+1
-1
terminus-ssh/src/components/sshSettingsTab.component.ts
terminus-ssh/src/components/sshSettingsTab.component.ts
+1
-1
terminus-ssh/src/services/ssh.service.ts
terminus-ssh/src/services/ssh.service.ts
+1
-1
未找到文件。
terminus-ssh/src/api.ts
浏览文件 @
7d258167
...
...
@@ -21,7 +21,7 @@ export class SSHSession extends BaseSession {
constructor
(
private
shell
:
any
,
conn
:
SSHConnection
)
{
super
()
this
.
scripts
=
conn
.
scripts
?
[...
conn
.
scripts
]
:
[]
this
.
scripts
=
conn
.
scripts
||
[]
}
start
()
{
...
...
@@ -31,23 +31,21 @@ export class SSHSession extends BaseSession {
let
dataString
=
data
.
toString
()
this
.
emitOutput
(
dataString
)
if
(
this
.
scripts
&&
this
.
scripts
.
length
>
0
)
{
if
(
this
.
scripts
)
{
let
found
=
false
for
(
let
i
=
0
;
i
<
this
.
scripts
.
length
;
i
++
)
{
if
(
dataString
.
indexOf
(
this
.
scripts
[
i
].
expect
)
>=
0
)
{
console
.
log
(
"
Executing:
"
+
this
.
scripts
[
i
].
send
)
this
.
shell
.
write
(
this
.
scripts
[
i
].
send
+
"
\n
"
)
this
.
scripts
.
splice
(
i
,
1
)
i
--
for
(
let
script
of
this
.
scripts
)
{
if
(
dataString
.
includes
(
script
.
expect
))
{
console
.
log
(
'
Executing script:
'
,
script
.
send
)
this
.
shell
.
write
(
script
.
send
+
'
\n
'
)
this
.
scripts
=
this
.
scripts
.
filter
(
x
=>
x
!==
script
)
found
=
true
}
else
{
break
;
}
else
{
break
}
}
if
(
found
)
{
this
.
executeScripts
()
this
.
execute
Unconditional
Scripts
()
}
}
})
...
...
@@ -58,23 +56,7 @@ export class SSHSession extends BaseSession {
}
})
this
.
executeScripts
()
}
executeScripts
()
{
if
(
this
.
scripts
&&
this
.
scripts
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
this
.
scripts
.
length
;
i
++
)
{
if
(
!
this
.
scripts
[
i
].
expect
)
{
console
.
log
(
"
Executing:
"
+
this
.
scripts
[
i
].
send
)
this
.
shell
.
write
(
this
.
scripts
[
i
].
send
+
"
\n
"
)
this
.
scripts
.
splice
(
i
,
1
)
i
--
}
else
{
break
;
}
}
}
this
.
executeUnconditionalScripts
()
}
resize
(
columns
,
rows
)
{
...
...
@@ -100,6 +82,20 @@ export class SSHSession extends BaseSession {
async
getWorkingDirectory
():
Promise
<
string
>
{
return
null
}
private
executeUnconditionalScripts
()
{
if
(
this
.
scripts
)
{
for
(
let
script
of
this
.
scripts
)
{
if
(
!
script
.
expect
)
{
console
.
log
(
'
Executing script:
'
,
script
.
send
)
this
.
shell
.
write
(
script
.
send
+
'
\n
'
)
this
.
scripts
=
this
.
scripts
.
filter
(
x
=>
x
!==
script
)
}
else
{
break
}
}
}
}
}
export
interface
ISSHConnectionGroup
{
...
...
terminus-ssh/src/components/editConnectionModal.component.pug
浏览文件 @
7d258167
...
...
@@ -4,7 +4,6 @@
ng-template(ngbTabTitle)
| Basic Setting
ng-template(ngbTabContent)
h4 Basic Setting
.form-group
label Name
input.form-control(
...
...
@@ -59,52 +58,50 @@
ng-template(ngbTabTitle)
| Login Scripts
ng-template(ngbTabContent)
h4 Login Scripts
.list-group
table
tr
th String to wait
th String to be sent
th Actions
tr(*ngFor='let script of connection.scripts')
td
input.form-control(
type='text',
value='{{script.expect}}',
)
td
input.form-control(
type='text',
value='{{script.send}}',
)
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='up(script)')
i.fa.fa-arrow-up
button.btn.btn-outline-info.ml-0((click)='down(script)')
i.fa.fa-arrow-down
button.btn.btn-outline-danger.ml-0((click)='delete(script)')
i.fa.fa-trash-o
tr
td
input.form-control(
table
tr
th String to expect
th String to be sent
th Actions
tr(*ngFor='let script of connection.scripts')
td
input.form-control(
type='text',
placeholder='Enter a string to wait',
[(ngModel)]='newScript.expect'
value='{{script.expect}}',
)
td
input.form-control(
td
input.form-control(
type='text',
placeholder='Enter a string to be sent',
[(ngModel)]='newScript.send'
value='{{script.send}}',
)
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='add()')
i.fa.fa-save
button.btn.btn-outline-danger.ml-0((click)='clear()')
i.fa.fa-trash-o
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='moveScriptUp(script)')
i.fa.fa-arrow-up
button.btn.btn-outline-info.ml-0((click)='moveScriptDown(script)')
i.fa.fa-arrow-down
button.btn.btn-outline-danger.ml-0((click)='deleteScript(script)')
i.fa.fa-trash-o
tr
td
input.form-control(
type='text',
placeholder='Enter a string to expect',
[(ngModel)]='newScript.expect'
)
td
input.form-control(
type='text',
placeholder='Enter a string to be sent',
[(ngModel)]='newScript.send'
)
td
.input-group.flex-nowrap
button.btn.btn-outline-info.ml-0((click)='addScript()')
i.fa.fa-check
button.btn.btn-outline-danger.ml-0((click)='clearScript()')
i.fa.fa-trash-o
.modal-footer
button.btn.btn-outline-primary((click)='save()') Save
button.btn.btn-outline-danger((click)='cancel()') Cancel
terminus-ssh/src/components/editConnectionModal.component.ts
浏览文件 @
7d258167
...
...
@@ -15,7 +15,7 @@ export class EditConnectionModalComponent {
private
electron
:
ElectronService
,
private
hostApp
:
HostAppService
,
)
{
this
.
newScript
=
{
expect
:
""
,
send
:
""
}
this
.
newScript
=
{
expect
:
''
,
send
:
''
}
}
selectPrivateKey
()
{
...
...
@@ -38,37 +38,38 @@ export class EditConnectionModalComponent {
this
.
modalInstance
.
dismiss
()
}
u
p
(
script
:
LoginScript
)
{
moveScriptU
p
(
script
:
LoginScript
)
{
let
index
=
this
.
connection
.
scripts
.
indexOf
(
script
)
if
(
index
>
0
)
{
this
.
connection
.
scripts
.
splice
(
index
,
1
)
;
this
.
connection
.
scripts
.
splice
(
index
-
1
,
0
,
script
)
;
this
.
connection
.
scripts
.
splice
(
index
,
1
)
this
.
connection
.
scripts
.
splice
(
index
-
1
,
0
,
script
)
}
}
d
own
(
script
:
LoginScript
)
{
moveScriptD
own
(
script
:
LoginScript
)
{
let
index
=
this
.
connection
.
scripts
.
indexOf
(
script
)
if
(
index
>=
0
&&
index
<
this
.
connection
.
scripts
.
length
-
1
)
{
this
.
connection
.
scripts
.
splice
(
index
,
1
)
;
this
.
connection
.
scripts
.
splice
(
index
+
1
,
0
,
script
)
;
this
.
connection
.
scripts
.
splice
(
index
,
1
)
this
.
connection
.
scripts
.
splice
(
index
+
1
,
0
,
script
)
}
}
delete
(
script
:
LoginScript
)
{
delete
Script
(
script
:
LoginScript
)
{
if
(
confirm
(
`Delete?`
))
{
this
.
connection
.
scripts
=
this
.
connection
.
scripts
.
filter
(
x
=>
x
!==
script
)
}
}
add
()
{
if
(
!
this
.
connection
.
scripts
)
add
Script
()
{
if
(
!
this
.
connection
.
scripts
)
{
this
.
connection
.
scripts
=
[]
this
.
connection
.
scripts
.
push
(
Object
.
assign
({},
this
.
newScript
))
this
.
clear
();
}
this
.
connection
.
scripts
.
push
({...
this
.
newScript
})
this
.
clearScript
()
}
clear
()
{
this
.
newScript
.
expect
=
""
this
.
newScript
.
send
=
""
clear
Script
()
{
this
.
newScript
.
expect
=
''
this
.
newScript
.
send
=
''
}
}
terminus-ssh/src/components/sshModal.component.ts
浏览文件 @
7d258167
...
...
@@ -74,7 +74,7 @@ export class SSHModalComponent {
let
connections
=
this
.
connections
if
(
this
.
quickTarget
)
{
connections
=
connections
.
filter
(
connection
=>
(
connection
.
name
+
connection
.
group
).
toLowerCase
().
in
dexOf
(
this
.
quickTarget
)
>=
0
)
connections
=
connections
.
filter
(
connection
=>
(
connection
.
name
+
connection
.
group
).
toLowerCase
().
in
cludes
(
this
.
quickTarget
)
)
}
for
(
let
connection
of
connections
)
{
...
...
terminus-ssh/src/components/sshSettingsTab.component.ts
浏览文件 @
7d258167
...
...
@@ -61,7 +61,7 @@ export class SSHSettingsTabComponent {
editGroup
(
group
:
ISSHConnectionGroup
)
{
let
modal
=
this
.
ngbModal
.
open
(
PromptModalComponent
)
modal
.
componentInstance
.
prompt
=
'
New group name
'
modal
.
componentInstance
.
value
=
group
modal
.
componentInstance
.
value
=
group
.
name
modal
.
result
.
then
(
result
=>
{
if
(
result
)
{
for
(
let
connection
of
this
.
connections
.
filter
(
x
=>
x
.
group
===
group
.
name
))
{
...
...
terminus-ssh/src/services/ssh.service.ts
浏览文件 @
7d258167
...
...
@@ -55,7 +55,7 @@ export class SSHService {
modal
.
componentInstance
.
password
=
true
try
{
privateKeyPassphrase
=
await
modal
.
result
}
catch
(
_err
)
{
}
}
catch
(
_err
)
{
}
// tslint:disable-line
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录