mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
API keys can now have a description
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
var apiKeysTable = $('#apikeys-table').DataTable({
|
||||
'order': [[4, 'desc']],
|
||||
'order': [[6, 'desc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
@@ -8,12 +8,6 @@
|
||||
$('#apikeys-table tbody').removeClass("d-none");
|
||||
apiKeysTable.columns.adjust().draw();
|
||||
|
||||
var createdApiKeyId = GetUriParam('CreatedApiKeyId');
|
||||
if (createdApiKeyId !== undefined)
|
||||
{
|
||||
animateCSS("#apiKeyRow_" + createdApiKeyId, "pulse");
|
||||
}
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
@@ -33,8 +27,9 @@ $("#clear-filter-button").on("click", function()
|
||||
|
||||
$(document).on('click', '.apikey-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-apikey-apikey');
|
||||
var objectId = $(e.currentTarget).attr('data-apikey-id');
|
||||
var button = $(e.currentTarget);
|
||||
var objectName = button.attr('data-apikey-key');
|
||||
var objectId = button.attr('data-apikey-id');
|
||||
|
||||
bootbox.confirm({
|
||||
message: __t('Are you sure to delete API key "%s"?', objectName),
|
||||
@@ -68,23 +63,36 @@ $(document).on('click', '.apikey-delete-button', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
function QrCodeForApiKey(apiKeyType, apiKey)
|
||||
$(".apikey-show-qr-button").on("click", function()
|
||||
{
|
||||
var content = U('/api') + '|' + apiKey;
|
||||
if (apiKeyType === 'special-purpose-calendar-ical')
|
||||
var button = $(this);
|
||||
var apiKey = button.data("apikey-key");
|
||||
var apiKeyType = button.data("apikey-type");
|
||||
var apiKeyDescription = button.data("apikey-description");
|
||||
|
||||
var content = U("/api") + "|" + apiKey;
|
||||
if (apiKeyType === "special-purpose-calendar-ical")
|
||||
{
|
||||
content = U('/api/calendar/ical?secret=' + apiKey);
|
||||
content = U("/api/calendar/ical?secret=" + apiKey);
|
||||
}
|
||||
|
||||
return QrCodeImgHtml(content);
|
||||
}
|
||||
|
||||
$('.apikey-show-qr-button').on('click', function()
|
||||
{
|
||||
var qrcodeHtml = QrCodeForApiKey($(this).data('apikey-type'), $(this).data('apikey-key'));
|
||||
bootbox.alert({
|
||||
title: __t('API key'),
|
||||
message: "<p class='text-center'>" + qrcodeHtml + "</p>",
|
||||
message: "<h1>" + __t("API key") + "</h1><h2 class='text-muted'>" + apiKeyDescription + "</h2><p><hr>" + QrCodeImgHtml(content) + "</p>",
|
||||
closeButton: false
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
$("#add-api-key-button").on("click", function(e)
|
||||
{
|
||||
$("#add-api-key-modal").modal("show");
|
||||
});
|
||||
|
||||
$("#add-api-key-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
$("#description").focus();
|
||||
});
|
||||
|
||||
$("#new-api-key-button").on("click", function(e)
|
||||
{
|
||||
window.location.href = U("/manageapikeys/new?description=" + encodeURIComponent($("#description").val()));
|
||||
});
|
||||
|
@@ -478,12 +478,12 @@ $("#add-recipe-modal").on("shown.bs.modal", function(e)
|
||||
}
|
||||
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
})
|
||||
});
|
||||
|
||||
$("#add-note-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
$("#note").focus();
|
||||
})
|
||||
});
|
||||
|
||||
$("#add-product-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
@@ -493,12 +493,12 @@ $("#add-product-modal").on("shown.bs.modal", function(e)
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
})
|
||||
});
|
||||
|
||||
$("#copy-day-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().focus();
|
||||
})
|
||||
});
|
||||
|
||||
$(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-product-button", function(e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user