Reverted 41067b23bb because that's not needed (references #1049 and #958)

This commit is contained in:
Bernd Bestel 2020-11-17 21:10:26 +01:00
parent 7ef970a09f
commit 639ffe13f5
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 18 additions and 25 deletions

View File

@ -106,7 +106,6 @@
- Fixed that the assignment type "In alphabetic order" did not work correctly (the last person in the list was always assigned next once reached) (thanks @fipwmaqzufheoxq92ebc) - Fixed that the assignment type "In alphabetic order" did not work correctly (the last person in the list was always assigned next once reached) (thanks @fipwmaqzufheoxq92ebc)
### Equipment improvements ### Equipment improvements
- The equipment page now will never automatically reload, even when `Auto reload on external changes` is on and a change was detected (because you most probably have that page open longer to read the manual) (thanks @fipwmaqzufheoxq92ebc)
- There is now a button to download the instruction manual (next to the "expand to fullscreen"-button) - There is now a button to download the instruction manual (next to the "expand to fullscreen"-button)
### Calendar improvements/fixes ### Calendar improvements/fixes

View File

@ -15,34 +15,31 @@
// Check if the database has changed once a minute // 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, // 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 // when there is no unsaved form data and when the user enabled auto reloading
if (Grocy.DbChangedHandlingEnabledForPage) setInterval(function()
{ {
setInterval(function() Grocy.Api.Get('system/db-changed-time',
{ function(result)
Grocy.Api.Get('system/db-changed-time', {
function(result) var newDbChangedTime = moment(result.changed_time);
if (newDbChangedTime.isAfter(Grocy.DatabaseChangedTime))
{ {
var newDbChangedTime = moment(result.changed_time); if (Grocy.IdleTime >= 50)
if (newDbChangedTime.isAfter(Grocy.DatabaseChangedTime))
{ {
if (Grocy.IdleTime >= 50) if (BoolVal(Grocy.UserSettings.auto_reload_on_db_change) && $("form.is-dirty").length === 0 && !$("body").hasClass("fullscreen-card"))
{ {
if (BoolVal(Grocy.UserSettings.auto_reload_on_db_change) && $("form.is-dirty").length === 0 && !$("body").hasClass("fullscreen-card")) window.location.reload();
{
window.location.reload();
}
} }
Grocy.DatabaseChangedTime = newDbChangedTime;
} }
},
function(xhr) Grocy.DatabaseChangedTime = newDbChangedTime;
{
console.error(xhr);
} }
); },
}, 60000); function(xhr)
} {
console.error(xhr);
}
);
}, 60000);
Grocy.IdleTime = 0; Grocy.IdleTime = 0;
Grocy.ResetIdleTime = function() Grocy.ResetIdleTime = function()

View File

@ -3,7 +3,6 @@
@section('title', $__t('Equipment')) @section('title', $__t('Equipment'))
@section('activeNav', 'equipment') @section('activeNav', 'equipment')
@section('viewJsName', 'equipment') @section('viewJsName', 'equipment')
@section('DbChangedHandlingEnabledForPage', 'false')
@section('content') @section('content')
<div class="row"> <div class="row">

View File

@ -80,7 +80,6 @@
@if(file_exists(GROCY_DATAPATH . '/custom_css.html')) @if(file_exists(GROCY_DATAPATH . '/custom_css.html'))
@php include GROCY_DATAPATH . '/custom_css.html' @endphp @php include GROCY_DATAPATH . '/custom_css.html' @endphp
@endif @endif
@section('DbChangedHandlingEnabledForPage', 'true')
<script> <script>
var Grocy = { }; var Grocy = { };
Grocy.Components = { }; Grocy.Components = { };
@ -94,7 +93,6 @@
Grocy.CalendarShowWeekNumbers = {{ BoolToString(GROCY_CALENDAR_SHOW_WEEK_OF_YEAR) }}; Grocy.CalendarShowWeekNumbers = {{ BoolToString(GROCY_CALENDAR_SHOW_WEEK_OF_YEAR) }};
Grocy.GettextPo = {!! $GettextPo !!}; Grocy.GettextPo = {!! $GettextPo !!};
Grocy.FeatureFlags = {!! json_encode($featureFlags) !!}; Grocy.FeatureFlags = {!! json_encode($featureFlags) !!};
Grocy.DbChangedHandlingEnabledForPage = @yield('DbChangedHandlingEnabledForPage');
@if (GROCY_AUTHENTICATED) @if (GROCY_AUTHENTICATED)
Grocy.UserSettings = {!! json_encode($userSettings) !!}; Grocy.UserSettings = {!! json_encode($userSettings) !!};