mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Enhance action button tooltip behavior and add export functionality for services
This commit is contained in:
parent
188f58b3ce
commit
ebbfc6418d
8 changed files with 100 additions and 8 deletions
|
|
@ -513,7 +513,13 @@ $(document).ready(function () {
|
|||
|
||||
bans_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
bans_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -522,6 +528,7 @@ $(document).ready(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -505,7 +505,13 @@ $(document).ready(function () {
|
|||
|
||||
configs_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
configs_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -514,6 +520,7 @@ $(document).ready(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -622,7 +622,13 @@ $(document).ready(function () {
|
|||
|
||||
instances_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
instances_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -631,6 +637,7 @@ $(document).ready(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -402,7 +402,13 @@ $(document).ready(function () {
|
|||
|
||||
jobs_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
jobs_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -411,6 +417,7 @@ $(document).ready(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,17 @@ $(document).ready(function () {
|
|||
const editorElement = $("#raw-logs");
|
||||
const initialContent = editorElement.text().trim();
|
||||
const editor = ace.edit(editorElement[0]);
|
||||
editor.setTheme("ace/theme/cloud9_day"); // cloud9_night when dark mode is supported
|
||||
var theme = $("#theme").val();
|
||||
|
||||
function setEditorTheme() {
|
||||
if (theme === "dark") {
|
||||
editor.setTheme("ace/theme/cloud9_night");
|
||||
} else {
|
||||
editor.setTheme("ace/theme/cloud9_day");
|
||||
}
|
||||
}
|
||||
|
||||
setEditorTheme();
|
||||
editor.session.setMode("ace/mode/text");
|
||||
editor.setReadOnly(true);
|
||||
|
||||
|
|
@ -43,4 +53,11 @@ $(document).ready(function () {
|
|||
$this.tooltip("hide").attr("data-bs-original-title", "");
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
$("#dark-mode-toggle").on("change", function () {
|
||||
setTimeout(() => {
|
||||
theme = $("#theme").val();
|
||||
setEditorTheme();
|
||||
}, 30);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -497,7 +497,13 @@ $(document).ready(function () {
|
|||
|
||||
plugins_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
plugins_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -506,6 +512,7 @@ $(document).ready(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -186,6 +186,10 @@ $(function () {
|
|||
extend: "convert_services",
|
||||
text: '<span class="tf-icons bx bx-file-blank bx-18px me-2"></span>Convert to<span class="d-none d-md-inline"> draft</span>',
|
||||
},
|
||||
{
|
||||
extend: "export_services",
|
||||
text: '<span class="tf-icons bx bx-export bx-18px me-2"></span>Export',
|
||||
},
|
||||
{
|
||||
extend: "delete_services",
|
||||
className: "text-danger",
|
||||
|
|
@ -289,6 +293,25 @@ $(function () {
|
|||
},
|
||||
};
|
||||
|
||||
$.fn.dataTable.ext.buttons.export_services = {
|
||||
action: function () {
|
||||
if (actionLock) return;
|
||||
actionLock = true;
|
||||
$(".dt-button-background").click();
|
||||
|
||||
const services = getSelectedServices();
|
||||
if (services.length === 0) {
|
||||
actionLock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const baseUrl = window.location.href;
|
||||
const exportUrl = `${baseUrl}/export?services=${services.join(",")}`;
|
||||
window.open(exportUrl, "_blank");
|
||||
actionLock = false;
|
||||
},
|
||||
};
|
||||
|
||||
$.fn.dataTable.ext.buttons.delete_services = {
|
||||
text: '<span class="tf-icons bx bx-trash bx-18px me-2"></span>Delete',
|
||||
action: function () {
|
||||
|
|
@ -486,7 +509,13 @@ $(function () {
|
|||
|
||||
services_table.on("select", function (e, dt, type, indexes) {
|
||||
// Enable the actions button
|
||||
$(".action-button").removeClass("disabled").parent().tooltip("dispose");
|
||||
$(".action-button")
|
||||
.removeClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", null)
|
||||
.attr("data-bs-original-title", null)
|
||||
.attr("data-bs-placement", null)
|
||||
.tooltip("dispose");
|
||||
});
|
||||
|
||||
services_table.on("deselect", function (e, dt, type, indexes) {
|
||||
|
|
@ -495,6 +524,7 @@ $(function () {
|
|||
$(".action-button")
|
||||
.addClass("disabled")
|
||||
.parent()
|
||||
.attr("data-bs-toggle", "tooltip")
|
||||
.attr(
|
||||
"data-bs-original-title",
|
||||
"Please select one or more rows to perform an action.",
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
<td class="service-creation-date">{{ service['creation_date'].astimezone().isoformat() }}</td>
|
||||
<td class="service-last-update-date">{{ service['last_update'].astimezone().isoformat() }}</td>
|
||||
<td>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="d-flex justify-content-evenly">
|
||||
<div {% if service['is_draft'] %}data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Disabled by draft mode"{% endif %}>
|
||||
<a role="button"
|
||||
class="btn btn-outline-primary btn-sm me-1{% if service['is_draft'] %} disabled{% endif %}"
|
||||
|
|
@ -107,6 +107,16 @@
|
|||
<i class="bx bx-transfer bx-xs"></i>
|
||||
</button>
|
||||
</div>
|
||||
<a role="button"
|
||||
class="btn btn-outline-secondary btn-sm me-1 export-service"
|
||||
href="{{ url_for("services") }}/export?services={{ service['id'] }}"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="bottom"
|
||||
data-bs-original-title="Export service {{ service['id'] }} configuration"
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<i class="bx bx-export bx-xs"></i>
|
||||
</a>
|
||||
<div data-bs-toggle="tooltip"
|
||||
data-bs-placement="bottom"
|
||||
data-bs-original-title="{% if service['method'] != 'ui' or is_readonly %}Disabled by {% if is_readonly %}readonly{% else %}{{ service['method'] }}{% endif %}{% else %}Delete service {{ service['id'] }}{% endif %}">
|
||||
|
|
|
|||
Loading…
Reference in a new issue