Skip to content

Commit 5fe0813

Browse files
author
Alain BOUDARD
committed
fix: detail view route + empty manifest
1 parent e40b6d0 commit 5fe0813

File tree

8 files changed

+67
-7
lines changed

8 files changed

+67
-7
lines changed

application/src/main/java/com/cit/application/controllers/HelloController.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.springframework.web.bind.annotation.GetMapping;
55
import org.springframework.web.bind.annotation.RestController;
66

7-
7+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
88

99
@RestController
1010
public class HelloController {
@@ -33,10 +33,13 @@ public String index() {
3333
}
3434

3535
@GetMapping("/api/manifest")
36-
public MicroFrontend microfontend() {
36+
public EmptyObject microfontend() {
37+
return new EmptyObject();
38+
}
39+
/*public MicroFrontend microfontend() {
3740
Manifest mfe1 = new Manifest(remoteEntry, exposedModule, displayName, routePath, ngModuleName, type);
3841
return new MicroFrontend(mfe1);
39-
}
42+
}*/
4043

4144
public static class MicroFrontend {
4245
private Manifest mfe1;
@@ -114,4 +117,9 @@ public void setType(String type) {
114117

115118
}
116119

120+
@JsonSerialize
121+
public static class EmptyObject {
122+
123+
}
124+
117125
}

library/mfe1/src/app/orders/orders-routing.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
33
import { OrdersComponent } from './orders.component';
4+
import { ViewComponent } from './view/view.component';
45

5-
const routes: Routes = [{ path: '', component: OrdersComponent }];
6+
const routes: Routes = [
7+
{ path: '', component: OrdersComponent },
8+
{ path: 'view/:id', component: ViewComponent }
9+
];
610

711
@NgModule({
812
imports: [RouterModule.forChild(routes)],
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<p>orders works!</p>
1+
<h2>List of orders</h2>
22
<ng-container *ngIf="(orders$ | async) as orders">
33
<div *ngFor="let order of orders">
4-
<p>{{order.id}} / {{order.name}} / {{order.description}}</p>
4+
<p>{{order.id}} / {{order.name}} / <a [routerLink]="['view', order.id]">{{order.description}}</a></p>
55
</div>
66
</ng-container>
77

library/mfe1/src/app/orders/orders.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { CommonModule } from '@angular/common';
44

55
import { OrdersRoutingModule } from './orders-routing.module';
66
import { OrdersComponent } from './orders.component';
7+
import { ViewComponent } from './view/view.component';
78

89

910
@NgModule({
1011
declarations: [
11-
OrdersComponent
12+
OrdersComponent,
13+
ViewComponent
1214
],
1315
imports: [
1416
CommonModule,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h2>Detail view of order</h2>
2+
<h3>Order N° {{id$ | async}}</h3>

library/mfe1/src/app/orders/view/view.component.scss

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { ViewComponent } from './view.component';
4+
5+
describe('ViewComponent', () => {
6+
let component: ViewComponent;
7+
let fixture: ComponentFixture<ViewComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ ViewComponent ]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(ViewComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { ActivatedRoute } from '@angular/router';
3+
import { map, Observable } from 'rxjs';
4+
5+
@Component({
6+
selector: 'app-view',
7+
templateUrl: './view.component.html',
8+
styleUrls: ['./view.component.scss']
9+
})
10+
export class ViewComponent implements OnInit {
11+
12+
public id$: Observable<any>;
13+
14+
constructor(private activatedRoute: ActivatedRoute) {
15+
this.id$ = this.activatedRoute.params.pipe(map((p) => p['id']));
16+
}
17+
18+
ngOnInit(): void {
19+
}
20+
21+
}

0 commit comments

Comments
 (0)