Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(frontend:spaces): improve server connection error handling and UI feedback
johaven097b2307a586
diff --git a/frontend/src/app/app.constants.ts b/frontend/src/app/app.constants.tsindex 2ca72dd4..02ce7825 100644--- a/frontend/src/app/app.constants.ts+++ b/frontend/src/app/app.constants.ts@@ -16,3 +16,5 @@ export const APP_MENU: AppMenu = {level: 0,submenus: []} as const++export const SERVER_CONNECTION_ERROR = 'Server connection error'diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.html b/frontend/src/app/applications/spaces/components/spaces-browser.component.htmlindex 8e3b64f4..29c6e5fc 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.html+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.html@@ -459,19 +459,19 @@<!--Start Common Messages--><ng-template #CommonMessages>@if (forbiddenResource) {- <div class="fs-sm text-center text-danger fw-bold no-select">+ <div class="fs-sm text-center text-danger fw-bold no-select p-4"><span l10nTranslate>Forbidden resource</span></div>} @else if (locationNotFound) {- <div class="fs-sm text-center text-danger fw-bold no-select">+ <div class="fs-sm text-center text-danger fw-bold no-select p-4"><span l10nTranslate>Location not found</span></div>- } @else if (serverError) {- <div class="fs-sm text-center text-danger fw-bold no-select">- <span l10nTranslate>Server Error</span>+ } @else if (serverConnectionError) {+ <div class="fs-sm text-center text-danger fw-bold no-select p-4">+ <span l10nTranslate>{{ serverConnectionErrorMessage }}</span></div>} @else if (!isTrashRepo && !loading && !stats.elements) {- <div class="fs-sm text-center text-muted fw-bold no-select">+ <div class="fs-sm text-center text-muted fw-bold no-select p-4"><span l10nTranslate>Drag and drop your files here</span></div>}diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.tsindex 67fcce9c..4bf34b2c 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts@@ -46,6 +46,7 @@ import { BsModalRef } from 'ngx-bootstrap/modal'import { TooltipModule } from 'ngx-bootstrap/tooltip'import { Subscription } from 'rxjs'import { take } from 'rxjs/operators'+import { SERVER_CONNECTION_ERROR } from '../../../app.constants'import { FilterComponent } from '../../../common/components/filter.component'import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'@@ -153,7 +154,8 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroyprotected loading = falseprotected locationNotFound = falseprotected forbiddenResource = false- protected serverError = false+ protected serverConnectionError = false+ protected serverConnectionErrorMessage = SERVER_CONNECTION_ERRORprotected isFilesRepo: booleanprotected isSharesRepo: booleanprotected isTrashRepo: boolean@@ -321,7 +323,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroythis.loading = truethis.forbiddenResource = falsethis.locationNotFound = false- this.serverError = false+ this.serverConnectionError = falsethis.inputFilter.clear()this.resetFilesSelection()this.spacesBrowser.loadFiles().subscribe({@@ -354,8 +356,8 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroyif (e.status !== 401) {this.forbiddenResource = e.status === 403this.locationNotFound = e.status === 404- this.serverError = e.status === 0- this.layout.sendNotification('error', 'Files', e.error.message)+ this.serverConnectionError = e.status === 0+ this.layout.sendNotification('error', 'Files', e.error.message || this.serverConnectionErrorMessage)}this.loading = false}diff --git a/frontend/src/app/auth/auth.interceptor.ts b/frontend/src/app/auth/auth.interceptor.tsindex eb78831d..8a3922b2 100644--- a/frontend/src/app/auth/auth.interceptor.ts+++ b/frontend/src/app/auth/auth.interceptor.ts@@ -3,6 +3,7 @@ import { inject, Injectable, Injector } from '@angular/core'import { API_AUTH_LOGIN, API_AUTH_LOGOUT, API_AUTH_REFRESH } from '@sync-in-server/backend/src/authentication/constants/routes'import { BehaviorSubject, concatMap, delay, Observable, of, retryWhen, throwError } from 'rxjs'import { catchError, filter, finalize, switchMap, take } from 'rxjs/operators'+import { SERVER_CONNECTION_ERROR } from '../app.constants'import { hasReservedUrlChars } from '../common/utils/functions'import { AuthService } from './auth.service'@@ -69,9 +70,12 @@ export class AuthInterceptor implements HttpInterceptor {retryWhen((error) =>error.pipe(concatMap((error, count) => {- if (count < this.retryCount && error.status == 0) {+ if (count < this.retryCount) {return of(error)}+ if (error.status === 0) {+ error.message = SERVER_CONNECTION_ERROR+ }return throwError(() => error)}),delay(this.retryWaitMilliSeconds)diff --git a/frontend/src/styles/components/_app.scss b/frontend/src/styles/components/_app.scssindex 382d1edf..a1ef35a7 100755--- a/frontend/src/styles/components/_app.scss+++ b/frontend/src/styles/components/_app.scss@@ -13,6 +13,7 @@padding: 2rem 5rem 2rem 5rem;border-radius: 8px;min-width: 400px;+ max-width: 425px;.content {display: flex;