mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Merge branch 'enhancement/server-details' into 'dev'
Retain tab when navigating back to server_details See merge request crafty-controller/crafty-4!667
This commit is contained in:
commit
12b9b5976b
@ -6,6 +6,8 @@ TBD
|
|||||||
- Remove webhook `custom` option from webook provider list as it's not currently an option ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/664))
|
- Remove webhook `custom` option from webook provider list as it's not currently an option ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/664))
|
||||||
### Tweaks
|
### Tweaks
|
||||||
- Homogenize Panel logos/branding ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/666))
|
- Homogenize Panel logos/branding ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/666))
|
||||||
|
- Retain previous tab when revisiting server details page (#272)([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/667))
|
||||||
|
- Add server name tag in panel header (#272)([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/667))
|
||||||
### Lang
|
### Lang
|
||||||
TBD
|
TBD
|
||||||
<br><br>
|
<br><br>
|
||||||
|
@ -36,6 +36,7 @@ class ServersController(metaclass=Singleton):
|
|||||||
self.management_helper = management_helper
|
self.management_helper = management_helper
|
||||||
self.servers_list = []
|
self.servers_list = []
|
||||||
self.stats = Stats(self.helper, self)
|
self.stats = Stats(self.helper, self)
|
||||||
|
self.server_subpage = {}
|
||||||
|
|
||||||
# **********************************************************************************
|
# **********************************************************************************
|
||||||
# Generic Servers Methods
|
# Generic Servers Methods
|
||||||
|
@ -481,6 +481,12 @@ class PanelHandler(BaseHandler):
|
|||||||
subpage = nh3.clean(self.get_argument("subpage", ""))
|
subpage = nh3.clean(self.get_argument("subpage", ""))
|
||||||
|
|
||||||
server_id = self.check_server_id()
|
server_id = self.check_server_id()
|
||||||
|
# load page the user was on last
|
||||||
|
server_subpage = self.controller.servers.server_subpage.get(server_id, "")
|
||||||
|
if subpage == "" and server_subpage != "":
|
||||||
|
subpage = self.controller.servers.server_subpage.get(server_id, "")
|
||||||
|
else:
|
||||||
|
self.controller.servers.server_subpage[server_id] = subpage
|
||||||
if server_id is None:
|
if server_id is None:
|
||||||
return
|
return
|
||||||
if not self.failed_server:
|
if not self.failed_server:
|
||||||
|
@ -82,6 +82,9 @@
|
|||||||
<span class="mdi mdi-chevron-double-left"></span>
|
<span class="mdi mdi-chevron-double-left"></span>
|
||||||
<span class="mdi mdi-chevron-double-right"></span>
|
<span class="mdi mdi-chevron-double-right"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<span class="badge-pill badge-outline-primary" id="server-name-nav" style="display: none;"></span>
|
||||||
|
|
||||||
|
|
||||||
{% include notify.html %}
|
{% include notify.html %}
|
||||||
|
|
||||||
|
@ -248,12 +248,38 @@
|
|||||||
$("#player-body").html(text);
|
$("#player-body").html(text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
|
||||||
|
function getCookie(name) {
|
||||||
|
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
||||||
|
return r ? r[1] : undefined;
|
||||||
|
}
|
||||||
|
const token = getCookie("_xsrf")
|
||||||
$(window).ready(function () {
|
$(window).ready(function () {
|
||||||
console.log("ready!");
|
console.log("ready!");
|
||||||
|
|
||||||
//if (webSocket) {
|
//if (webSocket) {
|
||||||
webSocket.on('update_server_details', update_server_details);
|
webSocket.on('update_server_details', update_server_details);
|
||||||
|
add_server_name();
|
||||||
//}
|
//}
|
||||||
});
|
});
|
||||||
|
async function add_server_name(){
|
||||||
|
let res = await fetch(`/api/v2/servers/${serverId}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'X-XSRFToken': token
|
||||||
|
},
|
||||||
|
});
|
||||||
|
let responseData = await res.json();
|
||||||
|
if (responseData.status === "ok") {
|
||||||
|
console.log(responseData)
|
||||||
|
$("#server-name-nav").html(`${responseData.data['server_name']}`)
|
||||||
|
$("#server-name-nav").show();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
bootbox.alert({
|
||||||
|
title: responseData.error,
|
||||||
|
message: responseData.error_data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user