mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 09:52:29 +02:00
Getting "fake" cache size from getInfos.
Displaying infos in maintenance page
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
function displayResponse(domElem, values, mDivs, mValues) {
|
||||
|
||||
for (let index = 0; index < domElem.length; index++) {
|
||||
domElem[index].html(values[index])
|
||||
}
|
||||
|
||||
for (let index = 0; index < mDivs.length; index++) {
|
||||
mDivs[index].title = mValues[index] + "Mo";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".refresh-cache-size").on("click", function test () {
|
||||
$(this).children("span").addClass("spin6").removeClass("icon-arrows-cw")
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
jQuery.ajax({
|
||||
url: "ws.php?format=json&method=pwg.getInfos",
|
||||
type: "POST",
|
||||
data: {
|
||||
param : "test_param",
|
||||
service : "test_service"
|
||||
},
|
||||
success: function (raw_data) {
|
||||
data = jQuery.parseJSON(raw_data);
|
||||
if (data.stat === "ok") {
|
||||
res();
|
||||
|
||||
var domElemToRefresh = [$(".cache-size-value"), $(".multiple-pictures-sizes"), $(".multiple-compiledTemplate-sizes")];
|
||||
var multipleSizes = $(".delete-check-container").children(".delete-size-check");
|
||||
var domElemValues = [data.result.infos[3].value, 69, 42];
|
||||
var multipleSizesValues = [11, 10, 9, 8, 7, 6, 4, 3, 2, 1, 0]
|
||||
|
||||
displayResponse(domElemToRefresh , domElemValues, multipleSizes, multipleSizesValues);
|
||||
|
||||
$(".refresh-icon").addClass("icon-arrows-cw").removeClass("spin6");
|
||||
|
||||
} else {
|
||||
rej(raw_data);
|
||||
}
|
||||
},
|
||||
error: function(message) {
|
||||
rej(message);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
@@ -94,6 +94,9 @@ $(".delete-size-check").change(function() {
|
||||
})
|
||||
|
||||
{/footer_script}
|
||||
|
||||
{combine_script id='ajax' load='footer' path='admin/themes/default/js/maintenance.js'}
|
||||
|
||||
<fieldset class="">
|
||||
<legend><span class="icon-globe icon-blue"></span>Global Gallery Actions</legend>
|
||||
<div style="display:flex;flex-wrap: wrap;">
|
||||
@@ -130,7 +133,7 @@ $(".delete-size-check").change(function() {
|
||||
<span class="cache-size-value">999 Go</span>
|
||||
<span class="cache-lastCalculated-text">{'calculated'|@translate}</span>
|
||||
<span class="cache-lastCalculated-value">42 {'months ago'|@translate}</span>
|
||||
<a><span class="icon-arrows-cw"></span>{'Refresh'|@translate}</a>
|
||||
<a class="refresh-cache-size"><span class="refresh-icon icon-arrows-cw"></span>{'Refresh'|@translate}</a>
|
||||
</div>
|
||||
<a href="{$U_MAINT_COMPILED_TEMPLATES}" class="icon-doc maintenance-action">{'Purge compiled templates'|@translate} <span class="multiple-compiledTemplate-sizes"> 999 Go </span></a>
|
||||
</div>
|
||||
@@ -140,8 +143,8 @@ $(".delete-size-check").change(function() {
|
||||
<span id="label-delete-size-checkbox">{'Delete multiple size images'|@translate} <span class="multiple-pictures-sizes"> 999 Go </span></span>
|
||||
<div class="delete-check-container">
|
||||
{foreach from=$purge_derivatives key=name item=url name=loop}
|
||||
<div class="delete-size-check" data-selected="0" name="{$url}">
|
||||
<span class="select-checkbox"><i class="icon-ok" style="margin-left:8px"></i></span><span class="picture-deletion-size" title="Poids : 999Go" style="font-size:14px;margin-left:5px;padding-top:2px;">{$name}</span>
|
||||
<div class="delete-size-check" title="Poids : 999Go" data-selected="0" name="{$url}">
|
||||
<span class="select-checkbox"><i class="icon-ok" style="margin-left:8px"></i></span><span class="picture-deletion-size" style="font-size:14px;margin-left:5px;padding-top:2px;">{$name}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
@@ -195,4 +198,16 @@ $(".delete-size-check").change(function() {
|
||||
width:max-content;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.rotate-anim {
|
||||
animation: spin 4s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,3 +1,5 @@
|
||||
{combine_script id='ajax' load='footer' path='admin/themes/default/js/maintenance.js'}
|
||||
|
||||
<fieldset id="environment">
|
||||
<legend><span class="icon-television icon-red"></span> {'Environment'|@translate}</legend>
|
||||
<ul style="font-weight:bold">
|
||||
@@ -13,7 +15,7 @@
|
||||
<span class="cache-size-value">999 Go</span>
|
||||
<span class="cache-lastCalculated-text">{'calculated'|@translate}</span>
|
||||
<span class="cache-lastCalculated-value">{'42 months ago'|@translate}</span>
|
||||
<a><span class="icon-arrows-cw"></span>{'Refresh'|@translate}</a>
|
||||
<a class="refresh-cache-size"><span class="refresh-icon icon-arrows-cw"></span>{'Refresh'|@translate}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user