Skip to content

feat/AB#87619_ABC-in-web-Widgets-when-navigating-between-pages-disable-screen-and-show-loading-indicator #2443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
<router-outlet></router-outlet>
<!-- Router outlet content load and disable state panel-->
<ng-container *ngIf="isNavigationLoading">
<div
class="z-[9999] absolute inset-0 bg-white opacity-70 flex items-center justify-center"
>
<ui-spinner></ui-spinner>
</div>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { Subject, debounceTime, takeUntil } from 'rxjs';
import { isEmpty } from 'lodash';
import { ShadowDomService } from '@oort-front/ui';
import { Router } from '@angular/router';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';

/**
* Application as Web Widget.
Expand Down Expand Up @@ -90,6 +90,8 @@ export class AppWidgetComponent
pages = new EventEmitter<any[]>();
/** Trigger subscription teardown on component destruction */
private destroy$: Subject<void> = new Subject<void>();
/** Navigation in SUI is loading */
public isNavigationLoading = false;

/**
* Application as Web Widget.
Expand Down Expand Up @@ -139,6 +141,14 @@ export class AppWidgetComponent
this.pages.emit([]);
}
});
this.router.events.pipe(takeUntil(this.destroy$)).subscribe((event) => {
if (event instanceof NavigationStart) {
this.isNavigationLoading = true;
}
if (event instanceof NavigationEnd) {
this.isNavigationLoading = false;
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SidenavContainerModule } from '@oort-front/ui';
import { SidenavContainerModule, SpinnerModule } from '@oort-front/ui';
import { AppWidgetComponent } from './app-widget.component';
import { RouterModule } from '@angular/router';

/** Application Web widget module. */
@NgModule({
declarations: [AppWidgetComponent],
imports: [CommonModule, RouterModule, SidenavContainerModule],
imports: [CommonModule, RouterModule, SidenavContainerModule, SpinnerModule],
exports: [AppWidgetComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
Expand Down