mirror of https://github.com/jumpserver/jumpserver
[Update] 添加加入会话按钮
parent
e9fc56c056
commit
29b099efc0
|
@ -243,6 +243,11 @@ class Session(OrgModelMixin):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def can_join(self):
|
||||||
|
if self.protocol in ['ssh', 'telnet', 'mysql']:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def save_to_storage(self, f):
|
def save_to_storage(self, f):
|
||||||
local_path = self.get_local_path()
|
local_path = self.get_local_path()
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SessionSerializer(BulkOrgResourceModelSerializer):
|
||||||
"user_id", "asset_id", "system_user_id",
|
"user_id", "asset_id", "system_user_id",
|
||||||
"login_from", "login_from_display", "remote_addr",
|
"login_from", "login_from_display", "remote_addr",
|
||||||
"is_success", "is_finished", "has_replay", "can_replay",
|
"is_success", "is_finished", "has_replay", "can_replay",
|
||||||
"protocol", "date_start", "date_end",
|
"can_join", "protocol", "date_start", "date_end",
|
||||||
"terminal",
|
"terminal",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,15 @@ function initTable() {
|
||||||
.replace("sessionID", cellData)
|
.replace("sessionID", cellData)
|
||||||
.replace("terminalID", rowData.terminal)
|
.replace("terminalID", rowData.terminal)
|
||||||
}
|
}
|
||||||
|
var joinBtn = ' <a disabled data-session="sessionID" class="btn btn-xs btn-info btn-join" >{% trans "Join" %}</a>';
|
||||||
|
joinBtn = joinBtn.replace("sessionID", rowData.id);
|
||||||
|
if (rowData.can_join){
|
||||||
|
joinBtn = joinBtn.replace("disabled", "")
|
||||||
|
}
|
||||||
if (rowData.is_finished) {
|
if (rowData.is_finished) {
|
||||||
btnGroup += replayBtn + downloadBtn
|
btnGroup += replayBtn + downloadBtn
|
||||||
} else {
|
} else {
|
||||||
btnGroup += termBtn;
|
btnGroup += termBtn + joinBtn;
|
||||||
}
|
}
|
||||||
$(td).html(btnGroup);
|
$(td).html(btnGroup);
|
||||||
}},
|
}},
|
||||||
|
@ -246,6 +251,11 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
window.open(downloadUrl)
|
window.open(downloadUrl)
|
||||||
})
|
})
|
||||||
|
.on('click', '.btn-join', function () {
|
||||||
|
var sessionID = $(this).data("session");
|
||||||
|
var joinUrl = "/luna/join/?shareroom=" + sessionID;
|
||||||
|
window.open(joinUrl, "height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no");
|
||||||
|
})
|
||||||
.on("click", '#session_table_filter input', function (e) {
|
.on("click", '#session_table_filter input', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
Loading…
Reference in New Issue