App.razor 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. @using RackPeek.Domain.Helpers
  2. @using RackPeek.Domain.Persistence
  3. @using RackPeek.Web.Viewer.Pages
  4. @using Shared.Rcl.Servers
  5. @inject IResourceCollection Resources
  6. @if (!_ready)
  7. {
  8. <p>Loading…</p>
  9. }
  10. else
  11. {
  12. <Router AppAssembly="@typeof(App).Assembly"
  13. AdditionalAssemblies="new[] { typeof(ServersListPage).Assembly }"
  14. NotFoundPage="typeof(NotFound)">
  15. <Found Context="routeData">
  16. <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
  17. </Found>
  18. </Router>
  19. }
  20. @code {
  21. private bool _ready;
  22. protected override async Task OnInitializedAsync()
  23. {
  24. try
  25. {
  26. await Resources.LoadAsync();
  27. }
  28. catch (ConfigLoadException)
  29. {
  30. // Same contract as the server host: a config that cannot be read must not
  31. // leave the app stuck on "Loading…" — the YAML editor is how it is fixed.
  32. // Here the store is browser storage, so this is a bad import rather than
  33. // an interrupted write (#337).
  34. }
  35. _ready = true;
  36. }
  37. }