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 ($) { jQuery(function ($) {
@ -163,6 +164,14 @@ jQuery(function ($) {
event.preventDefault(); event.preventDefault();
selectEpxlrLink($(this)); 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) { $(document).on('dblclick', 'a.explr-link', function (event) {
event.preventDefault(); event.preventDefault();
$(this).off('click'); $(this).off('click');
@ -191,7 +200,7 @@ jQuery(function ($) {
}); });
$(document).on('click', '.modal-explr-picker .explr-pick-element', 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(); hidePicker();
}); });

View File

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

View File

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

View File

@ -1,65 +1,66 @@
.breadcrumb-container { .breadcrumb-container {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
align-self: stretch; align-self: stretch;
border-bottom: $layoutBorder; border-bottom: $layoutBorder;
background: transparent; background: transparent;
padding: 10px; padding: 10px;
ul.breadcrumb {
background: #222;
padding: 6px 4px 5px 4px;
box-shadow: 1px 1px .5px .5px inset rgba(0, 0, 0, 0.2);
border: 1px solid #222;
border-radius: $baseRadius;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
list-style: none;
margin: 0;
overflow-x: auto;
max-width: 65vw;
white-space: nowrap;
ul.breadcrumb { li {
background: #222; display: inline-block;
padding: 6px 4px 5px 4px;
box-shadow: 1px 1px .5px .5px inset rgba(0, 0, 0, 0.2);
border: 1px solid #222;
border-radius: $baseRadius;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
list-style: none;
margin: 0;
li { &.divider {
&.divider { margin: 0 5px;
margin: 0 5px;
i { i {
color: #AAA; color: #AAA;
} }
} }
span, span,
a { a {
border-radius: $baseRadius; border-radius: $baseRadius;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: $white; color: $white;
text-align: center; text-align: center;
padding: 0 3px; padding: 0 3px;
i { i {
margin-right: 5px; margin-right: 5px;
} }
} }
&:hover {
a {
color: #fff;
background: $seaBlue;
}
}
&:hover { &:last-child a {
a { margin-right: 0;
color: #fff; }
background: $seaBlue; }
} }
} }
&:last-child a {
margin-right: 0;
}
}
}
}

View File

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

View File

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

View File

@ -153,9 +153,9 @@
{% set group_label = groups[node_player.group_id]|default(l.common_empty) %} {% 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 }}" <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}) }}"> 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" 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> <i class="fa {{ icon }} {{ color }} main"></i>
{% if node_player.group_id %} {% if node_player.group_id %}
<sub> <sub>

View File

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