Skip to content

Commit a009a6a

Browse files
committed
fix(app-loader): should not circulate redirect apps
start load multiple at the same time, it may circulate navigate in multiple apps
1 parent bece78b commit a009a6a

16 files changed

+408
-260
lines changed

Diff for: examples/portal/src/app/app-routing.module.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
33
import { AboutComponent } from './about/about.component';
44
import { HostContainerComponent } from './host-container/host-container.component';
5-
import { HelpComponent } from './help/help.component';
5+
import { SettingsComponent } from './settings/settings.component';
66

77
const routes: Routes = [
88
{
@@ -15,8 +15,8 @@ const routes: Routes = [
1515
component: AboutComponent
1616
},
1717
{
18-
path: 'help',
19-
component: HelpComponent
18+
path: 'settings',
19+
component: SettingsComponent
2020
},
2121
{
2222
path: 'app1',
@@ -51,7 +51,7 @@ const routes: Routes = [
5151
];
5252

5353
@NgModule({
54-
imports: [RouterModule.forRoot(routes)],
54+
imports: [RouterModule.forRoot(routes, { paramsInheritanceStrategy: 'always' })],
5555
exports: [RouterModule]
5656
})
5757
export class AppRoutingModule {}

Diff for: examples/portal/src/app/app.component.html

+25-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,31 @@
22
<thy-sidebar class="app-nav">
33
<img class="logo" src="/assets/images/logo.svg" />
44
<thy-nav [thyVertical]="'true'" class="mt-2" [thyType]="'primary'">
5-
<a thyNavLink [routerLink]="['/app1']" routerLinkActive="active">App1</a>
6-
<a thyNavLink [routerLink]="['/app2']" routerLinkActive="active">App2</a>
7-
<a thyNavLink [routerLink]="['/about']" routerLinkActive="active">About</a>
8-
<!-- <a thyNavLink [routerLink]="['/help']" routerLinkActive="active">Help</a> -->
5+
<a
6+
thyNavLink
7+
thyTooltip="App1"
8+
thyTooltipPlacement="right"
9+
[routerLink]="['/app1']"
10+
routerLinkActive="active"
11+
thyTooltip="App1"
12+
thyTooltipPlacement="right"
13+
>
14+
<thy-icon thyIconName="application"></thy-icon>
15+
</a>
16+
<a thyNavLink [routerLink]="['/app2']" routerLinkActive="active" thyTooltip="App2" thyTooltipPlacement="right">
17+
<thy-icon thyIconName="app-agile"></thy-icon>
18+
</a>
19+
<a thyNavLink [routerLink]="['/about']" routerLinkActive="active" thyTooltip="About" thyTooltipPlacement="right">
20+
<thy-icon thyIconName="smile"></thy-icon>
21+
</a>
22+
<a
23+
thyNavLink
24+
[routerLink]="['/settings']"
25+
routerLinkActive="active"
26+
thyTooltip="Settings"
27+
thyTooltipPlacement="right"
28+
><thy-icon thyIconName="settings"></thy-icon
29+
></a>
930
</thy-nav>
1031
</thy-sidebar>
1132
<router-outlet></router-outlet>

Diff for: examples/portal/src/app/app.component.scss

+16-5
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,27 @@ $app-nav-width: 70px;
1717
opacity: 0.8;
1818
min-width: $app-nav-width;
1919
color: $white;
20+
height: $app-nav-width;
21+
text-align: center;
22+
display: flex;
23+
align-items: center;
24+
.thy-icon {
25+
color: $white;
26+
font-size: $font-size-xlg;
27+
}
2028
&.active,
2129
&:hover {
2230
background: rgb(57, 65, 76);
2331
color: $white;
32+
.thy-icon {
33+
color: $white;
34+
}
2435
}
2536
}
2637

27-
.thy-nav--vertical {
28-
.nav-link {
29-
border-left-width: 4px;
30-
}
31-
}
38+
// .thy-nav--vertical {
39+
// .nav-link {
40+
// border-left-width: 0px;
41+
// }
42+
// }
3243
}

Diff for: examples/portal/src/app/app.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit, ChangeDetectorRef, ApplicationRef, NgZone } from '@angular/core';
22
import { Planet, SwitchModes, GlobalEventDispatcher, ApplicationStatus, PlanetApplication } from 'ngx-planet';
3-
import { Router, NavigationEnd, RouterEvent } from '@angular/router';
3+
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
44
import { ThyDialog } from 'ngx-tethys/dialog';
55
import { ADetailComponent } from './a-detail/a-detail.component';
66
import { ThyConfirmService, ThyNotifyService } from 'ngx-tethys';
@@ -20,6 +20,8 @@ export class AppComponent implements OnInit {
2020
}
2121

2222
constructor(
23+
private router: Router,
24+
private route: ActivatedRoute,
2325
private planet: Planet,
2426
private globalEventDispatcher: GlobalEventDispatcher,
2527
private thyDialog: ThyDialog,

Diff for: examples/portal/src/app/app.module.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserModule } from '@angular/platform-browser';
1+
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33

44
import { AppRoutingModule } from './app-routing.module';
@@ -7,16 +7,20 @@ import { NgxTethysModule } from 'ngx-tethys';
77
import { AboutComponent } from './about/about.component';
88
import { HostContainerComponent } from './host-container/host-container.component';
99
import { NgxPlanetModule } from 'ngx-planet';
10-
import { ThyDialogModule } from 'ngx-tethys/dialog';
10+
import { ThyDialogModule, ThyIconRegistry } from 'ngx-tethys';
1111
import { ADetailComponent } from './a-detail/a-detail.component';
12-
import { HelpComponent } from './help/help.component';
12+
import { SettingsComponent } from './settings/settings.component';
1313
import { AppRootContext, DemoCommonModule } from '@demo/common';
1414

1515
@NgModule({
16-
declarations: [AppComponent, AboutComponent, HelpComponent, HostContainerComponent, ADetailComponent],
16+
declarations: [AppComponent, AboutComponent, SettingsComponent, HostContainerComponent, ADetailComponent],
1717
imports: [BrowserModule, NgxTethysModule, ThyDialogModule, AppRoutingModule, NgxPlanetModule, DemoCommonModule],
1818
providers: [AppRootContext],
1919
bootstrap: [AppComponent],
2020
entryComponents: [ADetailComponent]
2121
})
22-
export class AppModule {}
22+
export class AppModule {
23+
constructor(iconRegistry: ThyIconRegistry, domSanitizer: DomSanitizer) {
24+
iconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('/assets/icons/sprite.defs.svg'));
25+
}
26+
}

Diff for: examples/portal/src/app/help/help.component.html

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<section-card title="Settings">
2+
<label thyCheckbox name="Preload">App1 Preload</label>
3+
</section-card>

Diff for: examples/portal/src/app/help/help.component.ts renamed to examples/portal/src/app/settings/settings.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { ADetailComponent } from '../a-detail/a-detail.component';
55
import { AppRootContext } from '@demo/common';
66

77
@Component({
8-
selector: 'app-help',
9-
templateUrl: './help.component.html',
10-
styleUrls: ['./help.component.scss']
8+
selector: 'app-settings',
9+
templateUrl: './settings.component.html',
10+
styleUrls: ['./settings.component.scss']
1111
})
12-
export class HelpComponent implements OnInit {
12+
export class SettingsComponent implements OnInit {
1313
@HostBinding(`class.thy-layout-content`) isThyLayoutContent = true;
1414

1515
constructor(private router: Router, private thyDialog: ThyDialog, public appRootContext: AppRootContext) {}

Diff for: examples/portal/src/assets/icons/sprite.defs.svg

+1
Loading

0 commit comments

Comments
 (0)