Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
7f467af4
Commit
7f467af4
authored
Jan 30, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Module::ShellManager) 新增测试连接功能
parent
9713e7ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
26 deletions
+82
-26
CHANGELOG.md
CHANGELOG.md
+1
-0
en.js
source/language/en.js
+3
-0
zh.js
source/language/zh.js
+3
-0
form.js
source/modules/shellmanager/list/form.js
+75
-26
No files found.
CHANGELOG.md
View file @
7f467af4
...
...
@@ -12,6 +12,7 @@
### Shell 管理
*
新增「测试连接」功能
*
其它设置增加「开启分块传输」开关,设置「最小分块」和「最大分块」。每次分块大小为
[
n, m
]
区间。

...
...
source/language/en.js
View file @
7f467af4
...
...
@@ -106,6 +106,7 @@ module.exports = {
add
:
{
title
:
'Add shell'
,
toolbar
:
{
test
:
'Test Connection'
,
add
:
'Add'
,
clear
:
'Clear'
},
...
...
@@ -117,6 +118,8 @@ module.exports = {
type
:
'Shell type'
,
encoder
:
'Encoder'
},
test_success
:
'Connection Successful!'
,
test_warning
:
'Response is null!'
,
warning
:
'Please enter the full!'
,
success
:
'Add shell success!'
,
error
:
(
err
)
=>
antSword
.
noxss
(
`Add shell failed!\n
${
err
}
`
)
...
...
source/language/zh.js
View file @
7f467af4
...
...
@@ -107,6 +107,7 @@ module.exports = {
add
:
{
title
:
'添加数据'
,
toolbar
:
{
test
:
'测试连接'
,
add
:
'添加'
,
clear
:
'清空'
},
...
...
@@ -118,6 +119,8 @@ module.exports = {
type
:
'连接类型'
,
encoder
:
'编码器'
},
test_success
:
'连接成功!'
,
test_warning
:
'返回数据为空'
,
warning
:
'请输入完整!'
,
success
:
'添加数据成功!'
,
error
:
(
err
)
=>
antSword
.
noxss
(
`添加数据失败!\n
${
err
}
`
)
...
...
source/modules/shellmanager/list/form.js
View file @
7f467af4
...
...
@@ -27,36 +27,82 @@ class Form {
// toolbar点击事件
this
.
toolbar
.
attachEvent
(
'onClick'
,
(
id
)
=>
{
if
(
id
===
'clear'
)
{
return
this
.
baseForm
.
clear
();
}
// 检测表单数据
if
(
!
this
.
baseForm
.
validate
()
||
!
this
.
httpForm
.
validate
()
||
!
this
.
otherForm
.
validate
()
)
{
return
toastr
.
warning
(
LANG
[
'list'
][
'add'
][
'warning'
],
LANG_T
[
'warning'
]);
};
// 回调数据
if
(
callback
)
{
win
.
progressOn
();
setTimeout
(()
=>
{
callback
(
this
.
_parseFormData
(
switch
(
id
){
case
'clear'
:
this
.
baseForm
.
clear
();
break
;
case
'test'
:
if
(
!
this
.
baseForm
.
validate
()
||
!
this
.
httpForm
.
validate
()
||
!
this
.
otherForm
.
validate
()
)
{
return
toastr
.
warning
(
LANG
[
'list'
][
'add'
][
'warning'
],
LANG_T
[
'warning'
]);
};
let
opts
=
this
.
_parseFormData
(
this
.
baseForm
.
getValues
(),
this
.
httpForm
.
getValues
(),
this
.
otherForm
.
getValues
()
)).
then
((
msg
)
=>
{
// 添加/保存完毕后回调
win
.
close
();
toastr
.
success
(
msg
,
LANG_T
[
'success'
]);
}).
catch
((
msg
)
=>
{
// 添加/保存错误
);
let
opt
=
{
"url"
:
opts
.
base
[
'url'
],
"pwd"
:
opts
.
base
[
'pwd'
],
"type"
:
opts
.
base
[
'type'
],
"encode"
:
opts
.
base
[
'encode'
],
"encoder"
:
opts
.
base
[
'encoder'
],
"httpConf"
:
opts
.
http
,
"otherConf"
:
opts
.
other
,
}
win
.
progressOn
();
let
core
=
new
antSword
[
"core"
][
opt
[
'type'
]](
opt
);
core
.
request
(
core
.
base
.
info
()
)
.
then
((
ret
)
=>
{
if
(
ret
[
'text'
].
length
>
0
){
toastr
.
success
(
LANG
[
'list'
][
'add'
][
'test_success'
],
LANG_T
[
'success'
]);
}
else
{
toastr
.
warning
(
LANG
[
'list'
][
'add'
][
'test_warning'
],
LANG_T
[
'warning'
]);
}
win
.
progressOff
();
})
.
catch
((
err
)
=>
{
toastr
.
error
(
JSON
.
stringify
(
err
),
LANG_T
[
'error'
]);
win
.
progressOff
();
toastr
.
error
(
msg
,
LANG_T
[
'error'
]);
});
},
100
);
};
break
;
case
'act'
:
// 检测表单数据
if
(
!
this
.
baseForm
.
validate
()
||
!
this
.
httpForm
.
validate
()
||
!
this
.
otherForm
.
validate
()
)
{
return
toastr
.
warning
(
LANG
[
'list'
][
'add'
][
'warning'
],
LANG_T
[
'warning'
]);
};
// 回调数据
if
(
callback
)
{
win
.
progressOn
();
setTimeout
(()
=>
{
callback
(
this
.
_parseFormData
(
this
.
baseForm
.
getValues
(),
this
.
httpForm
.
getValues
(),
this
.
otherForm
.
getValues
()
)).
then
((
msg
)
=>
{
// 添加/保存完毕后回调
win
.
close
();
toastr
.
success
(
msg
,
LANG_T
[
'success'
]);
}).
catch
((
msg
)
=>
{
// 添加/保存错误
win
.
progressOff
();
toastr
.
error
(
msg
,
LANG_T
[
'error'
]);
});
},
100
);
};
break
;
default
:
break
;
}
});
}
...
...
@@ -109,7 +155,10 @@ class Form {
type
:
'button'
,
icon
:
'remove'
,
text
:
LANG
[
'list'
][
'add'
][
'toolbar'
][
'clear'
]
}]);
},
{
type
:
'separator'
},
{
id
:
'test'
,
type
:
'button'
,
'icon'
:
'spinner'
,
text
:
LANG
[
'list'
][
'add'
][
'toolbar'
][
'test'
]
},
]);
return
toolbar
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment