node player groups wip

This commit is contained in:
jr-k 2024-07-16 18:05:21 +02:00
parent 86548dd4aa
commit e64c899cfd
9 changed files with 84 additions and 78 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
let onPickedElement = function(element) {};
let onPickedElement = function (element) {
};
jQuery(function ($) {
@ -163,6 +164,14 @@ jQuery(function ($) {
event.preventDefault();
selectEpxlrLink($(this));
});
$(document).on('click', 'a.explr-pick-element', function (event) {
event.preventDefault();
const callback = $(this).attr('data-callback');
if (callback) {
window[callback]($(this));
}
});
$(document).on('dblclick', 'a.explr-link', function (event) {
event.preventDefault();
$(this).off('click');
@ -191,7 +200,7 @@ jQuery(function ($) {
});
$(document).on('click', '.modal-explr-picker .explr-pick-element', function () {
onPickedElement(JSON.parse($(this).attr('data-json')));
onPickedElement(JSON.parse($(this).parents('li:eq(0)').attr('data-entity-json')));
hidePicker();
});

View File

@ -21,9 +21,9 @@ jQuery(document).ready(function ($) {
$(document).on('click', '.node-player-group-player-assign', function () {
const route = $(this).attr('data-route');
showPickers('modal-node-player-explr-picker', function(node_player) {
if (!node_player.group_id || (node_player.group_id && confirm(l.js_fleet_node_player_assign_confirmation))) {
document.location.href = route.replace('__id__', node_player.id);
showPickers('modal-node-player-explr-picker', function(nodePlayer) {
if (!nodePlayer.group_id || (nodePlayer.group_id && confirm(l.js_fleet_nodePlayer_assign_confirmation))) {
document.location.href = route.replace('__id__', nodePlayer.id);
}
});
});

View File

@ -4,13 +4,14 @@ jQuery(document).ready(function ($) {
inputOperatingSystemUpdate();
};
window.nodePlayerEdit = function ($this) {
window.explrNodePlayerEdit = function ($this) {
const nodePlayer = JSON.parse($this.parents('li:eq(0)').attr('data-entity-json'));
showModal('modal-node-player-edit');
$('.modal-node-player-edit input:visible:eq(0)').focus().select();
$('#node-player-edit-name').val(nodePlayer.name);
$('#node-player-edit-host').val(nodePlayer.host);
$('#node-player-edit-id').val(nodePlayer.id);
$('#node-player-edit-operating-system').val(nodePlayer.operating_system);
$('#node-player-edit-group-label').val(nodePlayer.group_label);
$('.group-edit-link').attr('href', 'javascript:void(0);');
$('.form-group-for-group-id').addClass('hidden');

View File

@ -8,7 +8,6 @@
background: transparent;
padding: 10px;
ul.breadcrumb {
background: #222;
padding: 6px 4px 5px 4px;
@ -21,8 +20,13 @@
align-items: center;
list-style: none;
margin: 0;
overflow-x: auto;
max-width: 65vw;
white-space: nowrap;
li {
display: inline-block;
&.divider {
margin: 0 5px;
@ -47,7 +51,6 @@
}
}
&:hover {
a {
color: #fff;
@ -59,7 +62,5 @@
margin-right: 0;
}
}
}
}

View File

@ -137,7 +137,6 @@ form {
}
&.input-naked {
padding-left: 0;
color: #BBB;
}

View File

@ -3,8 +3,7 @@
{% set has_children = folder.children or node_player_children %}
<li class="icon-folder li-explr-folder li-explr-folder-{{ folder.id }}">
<a href="{% if use_href %}{{ url_for('fleet_node_player_cd') }}?path=
{{ folder.path }}{% else %}javascript:void(0);{% endif %}"
<a href="{% if use_href %}{{ url_for('fleet_node_player_cd') }}?path={{ folder.path }}{% else %}javascript:void(0);{% endif %}"
class="{% if folder.path == working_folder_path %}active{% endif %} {{ 'explr-pick-folder' if not use_href }}">
{{ folder.name }}
</a>
@ -17,17 +16,16 @@
{% for node_player in node_player_children %}
{% set icon = enum_operating_system.get_fa_icon(node_player.operating_system) %}
{% set color = enum_operating_system.get_color_icon(node_player.operating_system) %}
<li class="explr-item">
<li class="explr-item" data-entity-json="{{ json_dumps(node_player.to_dict()) }}">
<i class="fa {{ icon }} {{ color }} main"></i>
{% if node_player.group_id %}
<sub>
<i class="fa fa-layer-group"></i>
</sub>
{% endif %}
<a href="
{% if use_href %}{{ url_for('fleet_node_player_edit', node_player_id=node_player.id) }}{% else %}javascript:void(0);{% endif %}"
class="{{ 'explr-pick-element' if not use_href }}"
data-json="{{ json_dumps(node_player.to_dict()) }}">
<a href="javascript:void(0);"
class="explr-pick-element"
{% if use_href %}data-callback="explrNodePlayerEdit"{% endif %}>
{{ node_player.name }}
</a>
</li>

View File

@ -153,9 +153,9 @@
{% set group_label = groups[node_player.group_id]|default(l.common_empty) %}
<li class="draggable" data-path="{{ working_folder_path }}" data-id="{{ node_player.id }}"
data-folder="0" data-entity-json="{{ node_player.to_json({"group_label": group_label}) }}">
<a href="{{ url_for('fleet_node_player_edit', node_player_id=node_player.id) }}"
<a href="javascript:void(0);"
class="explr-link explr-item-selectable explr-item-actionable explr-item-entity"
data-callback="nodePlayerEdit">
data-callback="explrNodePlayerEdit">
<i class="fa {{ icon }} {{ color }} main"></i>
{% if node_player.group_id %}
<sub>

View File

@ -3,8 +3,7 @@
{% set has_children = folder.children or content_children %}
<li class="icon-folder li-explr-folder li-explr-folder-{{ folder.id }}">
<a href="{% if use_href %}{{ url_for('slideshow_content_cd') }}?path=
{{ folder.path }}{% else %}javascript:void(0);{% endif %}"
<a href="{% if use_href %}{{ url_for('slideshow_content_cd') }}?path={{ folder.path }}{% else %}javascript:void(0);{% endif %}"
class="{% if folder.path == working_folder_path %}active{% endif %} {{ 'explr-pick-folder' if not use_href }}">
{{ folder.name }}
</a>
@ -18,7 +17,7 @@
{% set slides = slides_with_content[content.id]|default([]) %}
{% set icon = enum_content_type.get_fa_icon(content.type) %}
{% set color = enum_content_type.get_color_icon(content.type) %}
<li class="explr-item">
<li class="explr-item" data-entity-json="{{ json_dumps(content.to_dict()) }}">
<i class="fa {{ icon }} {{ color }}"></i>
{% if slides|length > 0 %}
<sub>
@ -27,8 +26,7 @@
{% endif %}
<a href="
{% if use_href %}{{ url_for('slideshow_content_edit', content_id=content.id) }}{% else %}javascript:void(0);{% endif %}"
class="{{ 'explr-pick-element' if not use_href }}"
data-json="{{ json_dumps(content.to_dict()) }}">
class="{{ 'explr-pick-element' if not use_href }}">
{{ content.name }}
</a>
</li>