Reorganize repos
This commit is contained in:
67
app/static/main.js
Normal file
67
app/static/main.js
Normal file
@ -0,0 +1,67 @@
|
||||
function renameNode(nodeId) {
|
||||
var newName = $("#newName").val();
|
||||
var url = `${nodeId}/rename/${newName}`;
|
||||
$.ajax({
|
||||
url: url,
|
||||
xhrFields: {
|
||||
withCredentials: true,
|
||||
},
|
||||
success: function (data) {
|
||||
$("#renameModal").modal("hide");
|
||||
$("#givenName").html(data.newName);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function createPKA(username) {
|
||||
console.log(username);
|
||||
var url = `${username}/pakcreate`;
|
||||
var ephemereal = $("#ephemereal").is(":checked");
|
||||
var reusable = $("#reusable").is(":checked");
|
||||
var expiration = $("#expiration").val();
|
||||
console.log(expiration);
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
xhrFields: {
|
||||
withCredentials: true,
|
||||
},
|
||||
data: JSON.stringify({
|
||||
ephemeral: ephemereal,
|
||||
reusable: reusable,
|
||||
expiration: expiration,
|
||||
}),
|
||||
|
||||
success: function (data) {
|
||||
$("#createPKA").modal("hide");
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function copyToClipboard(obj) {
|
||||
var span = $(obj);
|
||||
var value = span.attr("value");
|
||||
var original = span.html();
|
||||
try {
|
||||
navigator.clipboard.writeText(value);
|
||||
span.html("copied!");
|
||||
setTimeout(function () {
|
||||
span.html(original);
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
span.html("error");
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleExpired(obj) {
|
||||
var toggle = $(obj);
|
||||
if (toggle.is(":checked")) {
|
||||
$(".pka-expired").removeClass("pka-hide");
|
||||
} else {
|
||||
$(".pka-expired").addClass("pka-hide");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user