This commit is contained in:
iFargle
2023-03-24 12:10:38 +09:00
parent 1327a79712
commit eab0d7d3e0
2 changed files with 10 additions and 8 deletions

View File

@@ -359,7 +359,7 @@ def thread_machine_content(machine, machine_content, idx, all_routes, failover_p
class='waves-effect waves-light btn-small """+route_enabled+""" lighten-2 tooltipped'
data-position='top' data-tooltip='Click to """+route_tooltip+"""'
id='"""+route['id']+"""'
onclick="toggle_route("""+route['id']+""", '"""+str(route['enabled'])+"""')">
onclick="toggle_route("""+route['id']+""", '"""+str(route['enabled'])+"""', 'machines')">
"""+route['prefix']+"""
</p>
"""
@@ -779,8 +779,8 @@ def render_routes():
is_exit = False
# Set up the display code:
enabled = "<i class='material-icons green-text text-lighten-2'>fiber_manual_record</i>"
disabled = "<i class='material-icons red-text text-lighten-1'>fiber_manual_record</i>"
enabled = "<a href='#'><i class='material-icons green-text text-lighten-2'>fiber_manual_record</i></a>"
disabled = "<a href='#'><i class='material-icons red-text text-lighten-1'>fiber_manual_record</i></a>"
# Set the displays:
enabled_display = disabled
@@ -836,8 +836,8 @@ def render_routes():
is_exit = False
# Set up the display code:
enabled = "<a href=""><i class='material-icons green-text text-lighten-2'>fiber_manual_record</i></a>"
disabled = "<a href=""><i class='material-icons red-text text-lighten-1'>fiber_manual_record</i></a>"
enabled = "<a href='#'><i class='material-icons green-text text-lighten-2'>fiber_manual_record</i></a>"
disabled = "<a href='#'><i class='material-icons red-text text-lighten-1'>fiber_manual_record</i></a>"
# Set the displays:
enabled_display = disabled

View File

@@ -802,15 +802,17 @@ function toggle_exit(route1, route2, exit_id, current_state) {
})
}
function toggle_route(route_id, current_state, page="machines") {
function toggle_route(route_id, current_state, page) {
var data = {"route_id": route_id, "current_state": current_state}
var element = document.getElementById(route_id);
console.log("Editing route "+route_id+" for page: "+page+" (enabled? "+current_state+")")
if (page == "machines") {
var disabledClass = "waves-effect waves-light btn-small red-text lighten-2 tooltipped";
var disabledClass = "waves-effect waves-light btn-small red-text lighten-2 tooltipped";
var enabledClass = "waves-effect waves-light btn-small green-text lighten-2 tooltipped";
}
if (page == "routes") {
var disabledClass = "material-icons red-text text-lighten-2 tooltipped";
var disabledClass = "material-icons red-text text-lighten-2 tooltipped";
var enabledClass = "material-icons green-text text-lighten-2 tooltipped";
}
var disabledTooltip = "Click to enable"