mirror of
https://github.com/grocy/grocy.git
synced 2026-04-06 21:06:15 +02:00
Fixes #958: Disable auto-reload of equipments-page.
This commit is contained in:
parent
5719ce8493
commit
41067b23bb
|
|
@ -15,31 +15,34 @@
|
|||
// Check if the database has changed once a minute
|
||||
// If a change is detected, reload the current page, but only if already idling for at least 50 seconds,
|
||||
// when there is no unsaved form data and when the user enabled auto reloading
|
||||
setInterval(function()
|
||||
if(DbChangHandlingEnabled)
|
||||
{
|
||||
Grocy.Api.Get('system/db-changed-time',
|
||||
function(result)
|
||||
{
|
||||
var newDbChangedTime = moment(result.changed_time);
|
||||
if (newDbChangedTime.isAfter(Grocy.DatabaseChangedTime))
|
||||
setInterval(function()
|
||||
{
|
||||
Grocy.Api.Get('system/db-changed-time',
|
||||
function(result)
|
||||
{
|
||||
if (Grocy.IdleTime >= 50)
|
||||
var newDbChangedTime = moment(result.changed_time);
|
||||
if (newDbChangedTime.isAfter(Grocy.DatabaseChangedTime))
|
||||
{
|
||||
if (BoolVal(Grocy.UserSettings.auto_reload_on_db_change) && $("form.is-dirty").length === 0 && !$("body").hasClass("fullscreen-card"))
|
||||
if (Grocy.IdleTime >= 50)
|
||||
{
|
||||
window.location.reload();
|
||||
if (BoolVal(Grocy.UserSettings.auto_reload_on_db_change) && $("form.is-dirty").length === 0 && !$("body").hasClass("fullscreen-card"))
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Grocy.DatabaseChangedTime = newDbChangedTime;
|
||||
Grocy.DatabaseChangedTime = newDbChangedTime;
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}, 60000);
|
||||
);
|
||||
}, 60000);
|
||||
}
|
||||
|
||||
Grocy.IdleTime = 0;
|
||||
Grocy.ResetIdleTime = function()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
@section('title', $__t('Equipment'))
|
||||
@section('activeNav', 'equipment')
|
||||
@section('viewJsName', 'equipment')
|
||||
@section('DbChangHandlingEnabled', 'false')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
@if(file_exists(GROCY_DATAPATH . '/custom_css.html'))
|
||||
@php include GROCY_DATAPATH . '/custom_css.html' @endphp
|
||||
@endif
|
||||
|
||||
@section('DbChangHandlingEnabled', 'true')
|
||||
<script>
|
||||
var Grocy = { };
|
||||
Grocy.Components = { };
|
||||
|
|
@ -105,6 +105,7 @@
|
|||
Grocy.UserSettings = { };
|
||||
Grocy.UserId = -1;
|
||||
@endif
|
||||
const DbChangHandlingEnabled = @yield('DbChangHandlingEnabled');
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user