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
a2c15de9
Commit
a2c15de9
authored
Jun 28, 2016
by
antoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the add-shell features
更新添加数据功能
parent
ae97f7dd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
12 deletions
+38
-12
database.js
modules/database.js
+9
-7
contextmenu.js
source/modules/shellmanager/list/contextmenu.js
+15
-1
form.js
source/modules/shellmanager/list/form.js
+14
-4
No files found.
modules/database.js
View file @
a2c15de9
...
...
@@ -114,17 +114,19 @@ class Database {
addShell
(
event
,
opts
)
{
logger
.
info
(
'addShell'
,
opts
);
this
.
_url2ip
(
opts
[
'url'
])
this
.
_url2ip
(
opts
.
base
[
'url'
])
.
then
((
ret
)
=>
{
this
.
cursor
.
insert
({
category
:
opts
[
'category'
]
||
'default'
,
url
:
opts
[
'url'
],
pwd
:
opts
[
'pwd'
],
type
:
opts
[
'type'
],
category
:
opts
.
base
[
'category'
]
||
'default'
,
url
:
opts
.
base
[
'url'
],
pwd
:
opts
.
base
[
'pwd'
],
type
:
opts
.
base
[
'type'
],
ip
:
ret
[
'ip'
],
addr
:
ret
[
'addr'
],
encode
:
opts
[
'encode'
],
encoder
:
opts
[
'encoder'
],
encode
:
opts
.
base
[
'encode'
],
encoder
:
opts
.
base
[
'encoder'
],
httpConf
:
opts
.
http
,
otherConf
:
opts
.
other
,
ctime
:
+
new
Date
,
utime
:
+
new
Date
},
(
_err
,
_ret
)
=>
{
...
...
source/modules/shellmanager/list/contextmenu.js
View file @
a2c15de9
...
...
@@ -188,7 +188,21 @@ class ContextMenu {
icon
:
'plus-circle'
,
text
:
LANG
[
'list'
][
'add'
][
'toolbar'
][
'add'
]
},
{},
(
data
)
=>
{
console
.
log
(
'addData'
,
data
);
return
new
Promise
((
res
,
rej
)
=>
{
// 获取当前分类
data
[
'base'
][
'category'
]
=
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
getActiveItem
();
// 通知后台插入数据
const
ret
=
antSword
.
ipcRenderer
.
sendSync
(
'shell-add'
,
data
);
if
(
ret
instanceof
Object
)
{
// 重新加载数据
antSword
.
modules
.
shellmanager
.
reloadData
({
category
:
data
[
'base'
][
'category'
]
});
return
res
();
}
else
{
return
rej
(
ret
.
totring
());
}
});
})
}
...
...
source/modules/shellmanager/list/form.js
View file @
a2c15de9
...
...
@@ -39,13 +39,22 @@ class Form {
return
toastr
.
warning
(
LANG
[
'list'
][
'add'
][
'warning'
],
LANG_T
[
'warning'
]);
};
// 回调数据
callback
?
callback
(
this
.
_parseFormData
(
if
(
callback
)
{
win
.
progressOn
();
callback
(
this
.
_parseFormData
(
this
.
baseForm
.
getValues
(),
this
.
httpForm
.
getValues
(),
this
.
otherForm
.
getValues
()
)
)
:
null
;
)).
then
(()
=>
{
// 添加/保存完毕后回调
win
.
close
();
toastr
.
success
(
LANG
[
'list'
][
'add'
][
'success'
],
LANG_T
[
'success'
]);
}).
catch
((
e
)
=>
{
// 添加/保存错误
win
.
progressOff
();
toastr
.
error
(
LANG
[
'list'
][
'add'
][
'error'
](
e
.
toString
()),
LANG_T
[
'error'
]);
});
};
});
}
...
...
@@ -200,6 +209,7 @@ class Form {
let
_baseData
=
{
url
:
base
[
'url'
],
pwd
:
base
[
'pwd'
],
type
:
base
[
'type'
],
encode
:
base
[
'encode'
],
encoder
:
base
[
`encoder_
${
base
[
'type'
]}
`
]
};
...
...
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