Skip to content

Commit

Permalink
servershell: Add column helper buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
seqizz committed Dec 9, 2024
1 parent c4d6466 commit 53af508
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
14 changes: 14 additions & 0 deletions serveradmin/servershell/static/css/fontawesome.min.css

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion serveradmin/servershell/static/css/servershell.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ table tr:nth-child(odd) .disabled {
background-color: var(--disabled-secondary);
}

#result_table thead th {
padding-right: 1ch;
}

.results-info:last-of-type {
margin-bottom: 1rem;
}
Expand Down Expand Up @@ -127,4 +131,4 @@ table tr:nth-child(odd) .disabled {

#result_table textarea {
resize: both;
}
}
18 changes: 17 additions & 1 deletion serveradmin/servershell/static/js/servershell/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,23 @@ servershell.update_result = function() {
header.empty();
header.append('<th scope="col"></th>');
header.append('<th scope="col">#</th>');
servershell.shown_attributes.forEach((attribute, index) => header.append($('<th scope="col">').text(attribute)));
servershell.shown_attributes.forEach((attribute, index) => header.append(
$('<th scope="col">').append(
$('<span>').text(attribute),
$(`<a href="#" class="attr-tooltip" title="Order by ${attribute} attribute">`).append(
$('<i class="fa-solid fa-arrow-down-a-z">')
).click(function(e) {
e.preventDefault();
servershell.commands.orderby(attribute);
}),
$(`<a href="#" class="attr-tooltip" title="Remove ${attribute} column">`).append(
$('<i class="fa-solid fa-xmark">')
).click(function(e) {
e.preventDefault();
servershell.commands.attr(attribute);
}),
)
));

// Recreate table body
let body = table.find('tbody');
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions serveradmin/servershell/templates/servershell/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="{{ STATIC_URL }}css/states.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/servershell.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/jquery-ui.min.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/fontawesome.min.css">
{% endblock %}

{% block content %}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'static/*',
'static/css/*',
'static/js/*',
'static/webfonts/*',
'static/js/servershell/*',
'static/js/servershell/autocomplete/*',
'templates/servershell/*',
Expand Down

0 comments on commit 53af508

Please sign in to comment.