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
2f4096bf
Commit
2f4096bf
authored
Nov 18, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改ticket
parent
ebe129b3
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
22 deletions
+40
-22
models.py
apps/authentication/models.py
+2
-1
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+23
-17
ticket.py
apps/tickets/models/ticket.py
+7
-1
ticket.py
apps/tickets/serializers/ticket.py
+3
-1
ticket_detail.html
apps/tickets/templates/tickets/ticket_detail.html
+1
-1
views.py
apps/tickets/views.py
+4
-1
No files found.
apps/authentication/models.py
View file @
2f4096bf
...
...
@@ -54,13 +54,14 @@ class LoginConfirmSetting(CommonModelMixin):
if
request
:
remote_addr
=
get_request_ip
(
request
)
city
=
get_ip_city
(
remote_addr
)
datetime
=
timezone
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
body
=
__
(
"{user_key}: {username}<br>"
"IP: {ip}<br>"
"{city_key}: {city}<br>"
"{date_key}: {date}<br>"
)
.
format
(
user_key
=
__
(
"User"
),
username
=
self
.
user
,
ip
=
remote_addr
,
city_key
=
_
(
"City"
),
city
=
city
,
date_key
=
__
(
"Datetime"
),
date
=
timezone
.
now
()
date_key
=
__
(
"Datetime"
),
date
=
datetime
)
else
:
body
=
''
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
2f4096bf
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
2f4096bf
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-1
5 17:39
+0800\n"
"POT-Creation-Date: 2019-11-1
8 11:41
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -259,7 +259,7 @@ msgstr "创建日期"
#: perms/templates/perms/remote_app_permission_detail.html:94
#: settings/models.py:34 terminal/models.py:33
#: terminal/templates/terminal/terminal_detail.html:63
#: tickets/templates/tickets/ticket_detail.html:10
6
users/models/group.py:15
#: tickets/templates/tickets/ticket_detail.html:10
4
users/models/group.py:15
#: users/models/user.py:443 users/templates/users/user_detail.html:130
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_list.html:37
...
...
@@ -527,7 +527,7 @@ msgstr "创建远程应用"
#: settings/templates/settings/terminal_setting.html:107
#: terminal/templates/terminal/session_list.html:36
#: terminal/templates/terminal/terminal_list.html:36
#: tickets/templates/tickets/ticket_list.html:9
3
#: tickets/templates/tickets/ticket_list.html:9
4
#: users/templates/users/_granted_assets.html:34
#: users/templates/users/user_group_list.html:38
#: users/templates/users/user_list.html:41
...
...
@@ -1127,9 +1127,9 @@ msgstr "默认资产组"
#: terminal/templates/terminal/command_list.html:65
#: terminal/templates/terminal/session_list.html:27
#: terminal/templates/terminal/session_list.html:71 tickets/models/ticket.py:32
#: tickets/models/ticket.py:
85
tickets/templates/tickets/ticket_detail.html:32
#: tickets/models/ticket.py:
104
tickets/templates/tickets/ticket_detail.html:32
#: tickets/templates/tickets/ticket_list.html:22
#: tickets/templates/tickets/ticket_list.html:8
8
users/forms.py:339
#: tickets/templates/tickets/ticket_list.html:8
9
users/forms.py:339
#: users/models/user.py:149 users/models/user.py:165 users/models/user.py:537
#: users/serializers/group.py:21
#: users/templates/users/user_group_detail.html:78
...
...
@@ -2306,7 +2306,7 @@ msgstr "原因"
#: audits/models.py:88 audits/templates/audits/login_log_list.html:64
#: tickets/templates/tickets/ticket_detail.html:34
#: tickets/templates/tickets/ticket_list.html:24
#: tickets/templates/tickets/ticket_list.html:
89
#: tickets/templates/tickets/ticket_list.html:
90
#: xpack/plugins/cloud/models.py:275 xpack/plugins/cloud/models.py:310
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:70
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:65
...
...
@@ -2366,7 +2366,7 @@ msgstr "ID"
msgid "UA"
msgstr "Agent"
#: audits/templates/audits/login_log_list.html:61 authentication/models.py:6
2
#: audits/templates/audits/login_log_list.html:61 authentication/models.py:6
3
msgid "City"
msgstr "城市"
...
...
@@ -4208,7 +4208,7 @@ msgstr "批量命令"
msgid "Task monitor"
msgstr "任务监控"
#: templates/_nav.html:128 tickets/views.py:17 tickets/views.py:3
2
#: templates/_nav.html:128 tickets/views.py:17 tickets/views.py:3
4
msgid "Tickets"
msgstr "工单管理"
...
...
@@ -4562,7 +4562,8 @@ msgid "Accept"
msgstr "接受"
#: terminal/templates/terminal/terminal_list.html:80
#: tickets/models/ticket.py:30 tickets/templates/tickets/ticket_list.html:95
#: tickets/models/ticket.py:30 tickets/templates/tickets/ticket_detail.html:101
#: tickets/templates/tickets/ticket_list.html:96
msgid "Reject"
msgstr "拒绝"
...
...
@@ -4600,11 +4601,11 @@ msgid ""
msgstr "你可以使用ssh客户端工具连接终端"
#: tickets/models/ticket.py:17 tickets/models/ticket.py:69
#: tickets/templates/tickets/ticket_list.html:9
0
#: tickets/templates/tickets/ticket_list.html:9
1
msgid "Open"
msgstr "开启"
#: tickets/models/ticket.py:18 tickets/templates/tickets/ticket_list.html:9
1
#: tickets/models/ticket.py:18 tickets/templates/tickets/ticket_list.html:9
2
msgid "Closed"
msgstr "关闭"
...
...
@@ -4616,20 +4617,21 @@ msgstr "一般"
msgid "Login confirm"
msgstr "登录复核"
#: tickets/models/ticket.py:29 tickets/templates/tickets/ticket_list.html:94
#: tickets/models/ticket.py:29 tickets/templates/tickets/ticket_detail.html:100
#: tickets/templates/tickets/ticket_list.html:95
msgid "Approve"
msgstr "同意"
#: tickets/models/ticket.py:33 tickets/models/ticket.py:
86
#: tickets/models/ticket.py:33 tickets/models/ticket.py:
105
msgid "User display name"
msgstr "用户显示名称"
#: tickets/models/ticket.py:35 tickets/templates/tickets/ticket_list.html:21
#: tickets/templates/tickets/ticket_list.html:8
7
#: tickets/templates/tickets/ticket_list.html:8
8
msgid "Title"
msgstr "标题"
#: tickets/models/ticket.py:36 tickets/models/ticket.py:
87
#: tickets/models/ticket.py:36 tickets/models/ticket.py:
106
msgid "Body"
msgstr "内容"
...
...
@@ -4657,8 +4659,12 @@ msgstr "待处理人名称"
msgid "{} {} this ticket"
msgstr "{} {} 这个工单"
#: tickets/models/ticket.py:81
msgid "this ticket"
msgstr "这个工单"
#: tickets/templates/tickets/ticket_detail.html:66
#: tickets/templates/tickets/ticket_detail.html:8
1
#: tickets/templates/tickets/ticket_detail.html:8
0
msgid "ago"
msgstr "前"
...
...
@@ -4738,7 +4744,7 @@ msgstr ""
msgid "Ticket list"
msgstr "工单列表"
#: tickets/views.py:3
3
#: tickets/views.py:3
5
msgid "Ticket detail"
msgstr "工单详情"
...
...
apps/tickets/models/ticket.py
View file @
2f4096bf
...
...
@@ -78,7 +78,7 @@ class Ticket(CommonModelMixin):
def
create_action_comment
(
self
,
action
,
user
):
action_display
=
dict
(
self
.
ACTION_CHOICES
)
.
get
(
action
)
body
=
'{} {} {}'
.
format
(
user
,
action_display
,
_
(
"this
order
"
))
body
=
'{} {} {}'
.
format
(
user
,
action_display
,
_
(
"this
ticket
"
))
self
.
comments
.
create
(
body
=
body
,
user
=
user
,
user_display
=
str
(
user
))
def
perform_action
(
self
,
action
,
user
):
...
...
@@ -89,6 +89,12 @@ class Ticket(CommonModelMixin):
self
.
assignees_display
=
str
(
user
)
self
.
save
()
def
is_assignee
(
self
,
user
):
return
self
.
assignees
.
filter
(
id
=
user
.
id
)
.
exists
()
def
is_user
(
self
,
user
):
return
self
.
user
==
user
class
Meta
:
ordering
=
(
'-date_created'
,)
...
...
apps/tickets/serializers/ticket.py
View file @
2f4096bf
...
...
@@ -13,7 +13,7 @@ class TicketSerializer(serializers.ModelSerializer):
fields
=
[
'id'
,
'user'
,
'user_display'
,
'title'
,
'body'
,
'assignees'
,
'assignees_display'
,
'status'
,
'date_created'
,
'date_updated'
,
'status'
,
'
action'
,
'
date_created'
,
'date_updated'
,
'type_display'
,
'action_display'
,
]
read_only_fields
=
[
...
...
@@ -32,6 +32,8 @@ class TicketSerializer(serializers.ModelSerializer):
if
action
and
user
not
in
instance
.
assignees
.
all
():
error
=
{
"action"
:
"Only assignees can update"
}
raise
serializers
.
ValidationError
(
error
)
print
(
validated_data
)
print
(
instance
.
status
)
if
instance
.
status
==
instance
.
STATUS_CLOSED
:
validated_data
.
pop
(
'action'
)
instance
=
super
()
.
update
(
instance
,
validated_data
)
...
...
apps/tickets/templates/tickets/ticket_detail.html
View file @
2f4096bf
...
...
@@ -96,7 +96,7 @@
</div>
</div>
<div
class=
"text-right"
>
{% if
object.type == object.TYPE_LOGIN_CONFIRM
%}
{% if
has_action_perm
%}
<a
class=
"btn btn-sm btn-primary btn-update btn-action"
data-action=
"approve"
><i
class=
"fa fa-check"
></i>
{% trans 'Approve' %}
</a>
<a
class=
"btn btn-sm btn-warning btn-update btn-action"
data-action=
"reject"
><i
class=
"fa fa-ban"
></i>
{% trans 'Reject' %}
</a>
{% endif %}
...
...
apps/tickets/views.py
View file @
2f4096bf
...
...
@@ -27,9 +27,12 @@ class TicketDetailView(PermissionsMixin, mixins.TicketMixin, DetailView):
queryset
=
Ticket
.
objects
.
all
()
def
get_context_data
(
self
,
**
kwargs
):
ticket
=
self
.
get_object
()
has_action_perm
=
ticket
.
is_assignee
(
self
.
request
.
user
)
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
"Tickets"
),
'action'
:
_
(
"Ticket detail"
)
'action'
:
_
(
"Ticket detail"
),
'has_action_perm'
:
has_action_perm
,
})
return
context
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