Skip to content
Snippets Groups Projects
Commit c4395f11 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Update bootstrap to 4.4.1

Remove btn-secondary class on datatables button
btn-outline-secondary shouldn't be added with btn-secondary anymore with
4.4.1

JIRA INFRA-2021 #action In Progress
parent 0b4a061d
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
$(document).ready(function() {
$(document).ready(function () {
function group_type_update() {
var hosts_selectize = $("#hosts")[0].selectize;
if ($("#type option:selected").text() == "STATIC") {
......@@ -10,7 +10,7 @@ $(document).ready(function() {
}
// Disable or enable hosts on group type update
$("#type").on("change", function() {
$("#type").on("change", function () {
group_type_update();
});
......@@ -22,13 +22,13 @@ $(document).ready(function() {
if ($("#groupForm").length || $("#editGroupForm").length) {
var groupVarsEditor = CodeMirror.fromTextArea(vars, {
lineNumbers: true,
mode: "yaml"
mode: "yaml",
});
groupVarsEditor.setSize(null, 120);
var handle = cmResize(groupVarsEditor, {
minHeight: 120,
resizableWidth: false,
resizableHeight: true
resizableHeight: true,
});
}
......@@ -39,7 +39,7 @@ $(document).ready(function() {
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
ajax: {
url: $SCRIPT_ROOT + "/network/_retrieve_groups",
type: "POST"
type: "POST",
},
processing: true,
serverSide: true,
......@@ -52,19 +52,19 @@ $(document).ready(function() {
columns: [
{
data: "name",
render: function(data, type, row) {
render: function (data, type, row) {
// render funtion to create link to group view page
if (data === null) {
return data;
}
var url = $SCRIPT_ROOT + "/network/groups/view/" + data;
return '<a href="' + url + '">' + data + "</a>";
}
},
},
{
data: "vars",
orderable: false,
render: function(data, type, row) {
render: function (data, type, row) {
if (data === null) {
return "";
}
......@@ -73,24 +73,24 @@ $(document).ready(function() {
JSON.stringify(data, null, 2) +
"</pre>"
);
}
},
},
{ data: "type" },
{
data: "children",
orderable: false,
render: function(data, type, row) {
render: function (data, type, row) {
return data.join(", ");
}
},
},
{
data: "hosts",
orderable: false,
render: function(data, type, row) {
render: function (data, type, row) {
return data.join(", ");
}
}
]
},
},
],
});
if ($("#groups_table").length) {
......@@ -99,14 +99,15 @@ $(document).ready(function() {
{
text: "Reset",
className: "btn-outline-secondary",
action: function(e, dt, node, conf) {
action: function (e, dt, node, conf) {
dt.state.clear();
dt.search("")
.order([])
.draw();
}
}
]
dt.search("").order([]).draw();
},
init: function (api, node, config) {
$(node).removeClass("btn-secondary");
},
},
],
});
groups_table
......
$(document).ready(function() {
$(document).ready(function () {
function render_host_link(data) {
// render funtion to create link to Host view page
if (data === null) {
......@@ -20,13 +20,13 @@ $(document).ready(function() {
if ($("#hostForm").length || $("#editHostForm").length) {
var hostVarsEditor = CodeMirror.fromTextArea(ansible_vars, {
lineNumbers: true,
mode: "yaml"
mode: "yaml",
});
hostVarsEditor.setSize(null, 120);
var handle = cmResize(hostVarsEditor, {
minHeight: 120,
resizableWidth: false,
resizableHeight: true
resizableHeight: true,
});
}
......@@ -38,7 +38,7 @@ $(document).ready(function() {
$("#ip").removeClass("is-invalid");
$.getJSON(
$SCRIPT_ROOT + "/network/_retrieve_first_available_ip/" + network_id,
function(json) {
function (json) {
$("#ip").val(json.data);
}
);
......@@ -49,13 +49,9 @@ $(document).ready(function() {
function update_device_type_attributes() {
var device_type = $("#device_type_id option:selected").text();
if (device_type.startsWith("Virtual")) {
$("#random_mac")
.prop("checked", true)
.change();
$("#random_mac").prop("checked", true).change();
} else {
$("#random_mac")
.prop("checked", false)
.change();
$("#random_mac").prop("checked", false).change();
}
}
......@@ -63,7 +59,9 @@ $(document).ready(function() {
// Empty the field otherwise
function fill_mac_address() {
if ($("#random_mac").prop("checked")) {
$.getJSON($SCRIPT_ROOT + "/network/_generate_random_mac", function(json) {
$.getJSON($SCRIPT_ROOT + "/network/_generate_random_mac", function (
json
) {
$("#mac").val(json.data.mac);
$("#mac").prop("readonly", true);
});
......@@ -101,17 +99,15 @@ $(document).ready(function() {
// or click a dropdown item
$("#network_id")
.next(".selectize-control")
.on("click", function() {
.on("click", function () {
var network_id_selectize = $("#network_id")[0].selectize;
network_id_selectize.clear(true);
});
// Set the default IP when changing network
$("#network_id").on("change", function() {
$("#network_id").on("change", function () {
$(this).removeClass("is-invalid");
$(this)
.next(".selectize-control")
.removeClass("is-invalid");
$(this).next(".selectize-control").removeClass("is-invalid");
set_default_ip();
});
......@@ -121,7 +117,7 @@ $(document).ready(function() {
update_device_type_attributes();
// And change
$("#device_type_id").on("change", function() {
$("#device_type_id").on("change", function () {
update_device_type_attributes();
});
}
......@@ -132,7 +128,7 @@ $(document).ready(function() {
}
// Fill or clear MAC address depending on random_mac checkbox
$("#random_mac").on("change", function() {
$("#random_mac").on("change", function () {
fill_mac_address();
});
......@@ -143,7 +139,7 @@ $(document).ready(function() {
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
ajax: {
url: $SCRIPT_ROOT + "/network/_retrieve_hosts",
type: "POST"
type: "POST",
},
processing: true,
serverSide: true,
......@@ -155,14 +151,14 @@ $(document).ready(function() {
pageLength: 20,
lengthMenu: [
[20, 50, 100],
[20, 50, 100]
[20, 50, 100],
],
columns: [
{
data: "name",
render: function(data, type, row) {
render: function (data, type, row) {
return render_host_link(data);
}
},
},
{ data: "device_type" },
{ data: "description", orderable: false },
......@@ -170,13 +166,13 @@ $(document).ready(function() {
{ data: "interfaces.0.mac", defaultContent: "", orderable: false },
{
data: "interfaces.0.network",
render: function(data, type, row) {
render: function (data, type, row) {
return render_network_link(data);
},
defaultContent: "",
orderable: false
}
]
orderable: false,
},
],
});
if ($("#hosts_table").length) {
......@@ -185,14 +181,15 @@ $(document).ready(function() {
{
text: "Reset",
className: "btn-outline-secondary",
action: function(e, dt, node, conf) {
action: function (e, dt, node, conf) {
dt.state.clear();
dt.search("")
.order([])
.draw();
}
}
]
dt.search("").order([]).draw();
},
init: function (api, node, config) {
$(node).removeClass("btn-secondary");
},
},
],
});
hosts_table
......
$(document).ready(function() {
$(document).ready(function () {
function render_item_link(data) {
// render funtion to create link to Item view page
if (data === null) {
......@@ -18,14 +18,14 @@ $(document).ready(function() {
var jira_tag = {
type: "lang",
regex: /(TAG-\d+)/g,
replace: "[$1](https://jira.esss.lu.se/browse/$1)"
replace: "[$1](https://jira.esss.lu.se/browse/$1)",
};
// Register the extension
showdown.extension("jira_tag", jira_tag);
var converter = new showdown.Converter({
extensions: ["jira_tag"],
simplifiedAutoLink: true
simplifiedAutoLink: true,
});
if ($("#commentLivePreview").length) {
......@@ -33,14 +33,14 @@ $(document).ready(function() {
$("#commentLivePreview").html(converter.makeHtml($("#body").val()));
// Live rendering of markdown comment to HTML
$("#body").keyup(function(event) {
$("#body").keyup(function (event) {
var comment = $(this).val();
$("#commentLivePreview").html(converter.makeHtml(comment));
});
}
// render existing comments to HTML
$(".item-comment").each(function() {
$(".item-comment").each(function () {
var raw = $(this).html();
$(this).html(converter.makeHtml(raw));
});
......@@ -51,18 +51,18 @@ $(document).ready(function() {
$.ajax({
url: $SCRIPT_ROOT + "/inventory/items/_generate_excel_file",
method: "GET",
success: function(data, status, request) {
success: function (data, status, request) {
$modal.modal({
backdrop: "static",
keyboard: false
keyboard: false,
});
status_url = request.getResponseHeader("Location");
check_job_status(status_url, $modal);
},
error: function(jqXHR, textStatus, errorThrown) {
error: function (jqXHR, textStatus, errorThrown) {
$modal.modal("hide");
flash_alert(JSON.parse(jqXHR.responseText).message, "danger", false);
}
},
});
}
......@@ -73,7 +73,7 @@ $(document).ready(function() {
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
ajax: {
url: $SCRIPT_ROOT + "/inventory/_retrieve_items",
type: "POST"
type: "POST",
},
processing: true,
serverSide: true,
......@@ -85,14 +85,14 @@ $(document).ready(function() {
pageLength: 20,
lengthMenu: [
[20, 50, 100],
[20, 50, 100]
[20, 50, 100],
],
columns: [
{
data: "ics_id",
render: function(data, type, row) {
render: function (data, type, row) {
return render_item_link(data);
}
},
},
{ data: "created_at" },
{ data: "updated_at" },
......@@ -104,11 +104,11 @@ $(document).ready(function() {
{ data: "status" },
{
data: "parent",
render: function(data, type, row) {
render: function (data, type, row) {
return render_item_link(data);
}
}
]
},
},
],
});
if ($("#items_table").length) {
......@@ -118,21 +118,25 @@ $(document).ready(function() {
text:
'<span class="oi oi-data-transfer-download" title="Export to excel file" aria-hidden="true"></span> Excel',
className: "btn-outline-secondary",
action: function(e, dt, node, conf) {
action: function (e, dt, node, conf) {
download_excel();
}
},
init: function (api, node, config) {
$(node).removeClass("btn-secondary");
},
},
{
text: "Reset",
className: "btn-outline-secondary",
action: function(e, dt, node, conf) {
action: function (e, dt, node, conf) {
dt.state.clear();
dt.search("")
.order([])
.draw();
}
}
]
dt.search("").order([]).draw();
},
init: function (api, node, config) {
$(node).removeClass("btn-secondary");
},
},
],
});
items_table
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment