Browse Source

master data initialization handling

- progress circle centered
master
Flo Smilari 4 years ago
parent
commit
56fc99546d
2 changed files with 6 additions and 5 deletions
  1. 4
    3
      Pages/IndexPage.razor
  2. 2
    2
      wwwroot/service-worker.js

+ 4
- 3
Pages/IndexPage.razor View File

@page "/" @page "/"
@using CaritasPWA.Shared.Services; @using CaritasPWA.Shared.Services;
@using System.Threading;
@inject NavigationManager NavigationManager; @inject NavigationManager NavigationManager;
@inject AppState AppState; @inject AppState AppState;
@inject IStringLocalizer<Resources> i18n @inject IStringLocalizer<Resources> i18n
<div class="row align-items-center justify-content-center vw-100 h-25"> <div class="row align-items-center justify-content-center vw-100 h-25">
<div> <div>
@if (showProgressCircle) { @if (showProgressCircle) {
<MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" Style="padding-left:1.2rem" />
<div style="width:48px;margin:0 auto;">
<MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
</div>
<h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Masterdata.Initializing"]</h6> <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Masterdata.Initializing"]</h6>
} }
</div> </div>
Console.WriteLine("First activation"); Console.WriteLine("First activation");
showProgressCircle = true; showProgressCircle = true;
StateHasChanged(); StateHasChanged();
//await MasterDataService.SynchronizeMasterdata();
//showProgressCircle = false;
try { try {
await MasterDataService.SynchronizeMasterdata(); await MasterDataService.SynchronizeMasterdata();
} catch (Exception ex) { } catch (Exception ex) {

+ 2
- 2
wwwroot/service-worker.js View File

// This is because caching would make development more difficult (changes would not // This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change). // be reflected on the first load after each change).
const staticCacheName = 'site-static-v1';
const staticCacheName = 'site-static-v1'; // IMPORTANT: CHANGE THE VERSION IN THIS NAME EVERY TIME THE APP IS DEPLOYED ON SERVER WITH CHANGES!!!
const assets = [ const assets = [
'./', './',
'/index.html', '/index.html',
// activate event // activate event
self.addEventListener('activate', event => { self.addEventListener('activate', event => {
//delete any caches that aren't in expectedCaches //delete any caches that aren't in expectedCaches
//which will get rid of site-static-v1
//which will get rid of site-static-v<n-1>
event.waitUntil( event.waitUntil(
caches.keys().then(keys => Promise.all( caches.keys().then(keys => Promise.all(
keys.map(key => { keys.map(key => {

Loading…
Cancel
Save