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
6aaa106a
Commit
6aaa106a
authored
Jan 10, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复以下bug
1. 查看执行历史异常 2. 用户授权资产页显示message
parent
d415e81a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
models.py
apps/ops/models.py
+2
-2
serializers.py
apps/ops/serializers.py
+2
-2
_message.html
apps/templates/_message.html
+2
-2
No files found.
apps/ops/models.py
View file @
6aaa106a
...
@@ -218,8 +218,8 @@ class AdHoc(models.Model):
...
@@ -218,8 +218,8 @@ class AdHoc(models.Model):
history
.
result
=
raw
history
.
result
=
raw
history
.
summary
=
summary
history
.
summary
=
summary
return
raw
,
summary
return
raw
,
summary
except
:
except
Exception
as
e
:
return
{},
{}
return
{},
{
"dark"
:
{
"all"
:
str
(
e
)},
"contacted"
:
[]
}
finally
:
finally
:
history
.
date_finished
=
timezone
.
now
()
history
.
date_finished
=
timezone
.
now
()
history
.
timedelta
=
time
.
time
()
-
time_start
history
.
timedelta
=
time
.
time
()
-
time_start
...
...
apps/ops/serializers.py
View file @
6aaa106a
...
@@ -43,8 +43,8 @@ class AdHocRunHistorySerializer(serializers.ModelSerializer):
...
@@ -43,8 +43,8 @@ class AdHocRunHistorySerializer(serializers.ModelSerializer):
def
get_stat
(
obj
):
def
get_stat
(
obj
):
return
{
return
{
"total"
:
len
(
obj
.
adhoc
.
hosts
),
"total"
:
len
(
obj
.
adhoc
.
hosts
),
"success"
:
len
(
obj
.
summary
[
"contacted"
]
),
"success"
:
len
(
obj
.
summary
.
get
(
"contacted"
,
[])
),
"failed"
:
len
(
obj
.
summary
[
"dark"
]
),
"failed"
:
len
(
obj
.
summary
.
get
(
"dark"
,
[])
),
}
}
def
get_field_names
(
self
,
declared_fields
,
info
):
def
get_field_names
(
self
,
declared_fields
,
info
):
...
...
apps/templates/_message.html
View file @
6aaa106a
{% load i18n %}
{% load i18n %}
{% block first_login_message %}
{% block first_login_message %}
{% if
user.is_authenticated and
user.is_first_login %}
{% if
request.user.is_authenticated and request.
user.is_first_login %}
<div
class=
"alert alert-danger help-message"
>
<div
class=
"alert alert-danger help-message"
>
{% url 'users:user-first-login' as first_login_url %}
{% url 'users:user-first-login' as first_login_url %}
{% blocktrans %}
{% blocktrans %}
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
{% endif %}
{% endif %}
{% endblock %}
{% endblock %}
{% block update_public_key_message %}
{% block update_public_key_message %}
{% if
user.is_authenticated and not
user.is_public_key_valid %}
{% if
request.user.is_authenticated and not request.
user.is_public_key_valid %}
<div
class=
"alert alert-danger help-message"
>
<div
class=
"alert alert-danger help-message"
>
{% url 'users:user-pubkey-update' as user_pubkey_update %}
{% url 'users:user-pubkey-update' as user_pubkey_update %}
{% blocktrans %}
{% blocktrans %}
...
...
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