Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
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
ops
jumpserver
Commits
9219786f
Commit
9219786f
authored
Jul 15, 2019
by
八千流
Committed by
BaiJiangJie
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 创建/更新 远程应用 使用api (#2940)
* [Update] 创建/更新 远程应用 使用api * [Update] 优化 params * [Update] 修改小问题
parent
ab9744d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
remote_app_create_update.html
...ions/templates/applications/remote_app_create_update.html
+36
-1
remote_app.py
apps/applications/views/remote_app.py
+2
-0
No files found.
apps/applications/templates/applications/remote_app_create_update.html
View file @
9219786f
...
@@ -107,6 +107,18 @@ function hiddenFields(){
...
@@ -107,6 +107,18 @@ function hiddenFields(){
});
});
$
(
'.'
+
app_type
+
'-fields'
).
removeClass
(
'hidden'
);
$
(
'.'
+
app_type
+
'-fields'
).
removeClass
(
'hidden'
);
}
}
function
constructParams
(
obj
)
{
var
type
=
[
'chrome'
,
'mysql_workbench'
,
'vmware_client'
,
'custom'
];
var
params
=
{};
type
.
forEach
(
function
(
attr
)
{
if
(
obj
.
type
===
attr
){
for
(
var
k
in
obj
){
if
(
k
.
startsWith
(
obj
.
type
)){
params
[
k
]
=
obj
[
k
]}
}
}
});
return
params
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
({
$
(
'.select2'
).
select2
({
closeOnSelect
:
true
closeOnSelect
:
true
...
@@ -118,6 +130,28 @@ $(document).ready(function () {
...
@@ -118,6 +130,28 @@ $(document).ready(function () {
.
on
(
'change'
,
app_type_id
,
function
(){
.
on
(
'change'
,
app_type_id
,
function
(){
hiddenFields
();
hiddenFields
();
setDefaultValue
();
setDefaultValue
();
});
})
.
on
(
"submit"
,
"form"
,
function
(
evt
)
{
evt
.
preventDefault
();
var
the_url
=
'{% url "api-applications:remote-app-list" %}'
;
var
redirect_to
=
'{% url "applications:remote-app-list" %}'
;
var
method
=
"POST"
;
{
%
if
type
==
"update"
%
}
the_url
=
'{% url "api-applications:remote-app-detail" object.id %}'
;
method
=
"PUT"
;
{
%
endif
%
}
var
form
=
$
(
"form"
);
var
data
=
form
.
serializeObject
();
data
[
"params"
]
=
constructParams
(
data
);
var
props
=
{
url
:
the_url
,
data
:
data
,
method
:
method
,
form
:
form
,
redirect_to
:
redirect_to
};
formSubmit
(
props
);
})
;
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/applications/views/remote_app.py
View file @
9219786f
...
@@ -46,6 +46,7 @@ class RemoteAppCreateView(PermissionsMixin, SuccessMessageMixin, CreateView):
...
@@ -46,6 +46,7 @@ class RemoteAppCreateView(PermissionsMixin, SuccessMessageMixin, CreateView):
context
=
{
context
=
{
'app'
:
_
(
'Applications'
),
'app'
:
_
(
'Applications'
),
'action'
:
_
(
'Create RemoteApp'
),
'action'
:
_
(
'Create RemoteApp'
),
'type'
:
'create'
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
@@ -68,6 +69,7 @@ class RemoteAppUpdateView(PermissionsMixin, SuccessMessageMixin, UpdateView):
...
@@ -68,6 +69,7 @@ class RemoteAppUpdateView(PermissionsMixin, SuccessMessageMixin, UpdateView):
context
=
{
context
=
{
'app'
:
_
(
'Applications'
),
'app'
:
_
(
'Applications'
),
'action'
:
_
(
'Update RemoteApp'
),
'action'
:
_
(
'Update RemoteApp'
),
'type'
:
'update'
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
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