Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 5920424

Browse files
committed
fix entity containers
1 parent 8ad1b1d commit 5920424

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

sandbox-app/src/app/entities/containers/entity-list/entity-list.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Observable } from 'rxjs';
55
import { shareReplay } from 'rxjs/operators';
66

77
import {
8-
getAllBriebugEntitiesAsArray,
9-
getLoading,
10-
getError
8+
briebug,
9+
briebugLoading,
10+
briebugError
1111
} from '@state/briebug';
1212
import { BriebugState } from '@state/briebug/briebug.reducer';
1313
import {
@@ -22,10 +22,10 @@ import { Briebug } from '@state/briebug/briebug.model';
2222
changeDetection: ChangeDetectionStrategy.OnPush
2323
})
2424
export class BriebugListComponent implements OnInit {
25-
briebugEntities$ = this.store.pipe(select(getAllBriebugEntitiesAsArray));
26-
isLoading$ = this.store.pipe(select(getLoading));
25+
briebugEntities$ = this.store.pipe(select(briebug));
26+
isLoading$ = this.store.pipe(select(briebugLoading));
2727
errorMessage$ = this.store.pipe(
28-
select(getError),
28+
select(briebugError),
2929
// This allows us to use the async pipe twice without creating two subscriptions:
3030
shareReplay()
3131
);

sandbox-app/src/app/entities/containers/entity/entity.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
SelectBriebugById,
1818
LoadBriebugByIdFail,
1919
UpdateBriebug,
20-
InsertBriebug
20+
CreateBriebug
2121
} from '@state/briebug/briebug.actions';
2222
import { skip } from 'rxjs/operators';
2323

@@ -164,15 +164,15 @@ describe('BriebugComponent', () => {
164164
);
165165
});
166166

167-
it('should dispatch InsertBriebug if an ID is not present', () => {
167+
it("should dispatch CreateBriebug if an ID is not present", () => {
168168
component.valid = true;
169169
component.briebugEdits = generateBriebug();
170170
delete component.briebugEdits.id;
171171

172172
component.onSubmit();
173173

174174
expect(store.dispatch).toHaveBeenCalledWith(
175-
new InsertBriebug({ briebug: component.briebugEdits })
175+
new CreateBriebug({ briebug: component.briebugEdits })
176176
);
177177
});
178178
});

sandbox-app/src/app/entities/containers/entity/entity.component.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import {
1212
combineLatest
1313
} from 'rxjs/operators';
1414

15-
import { getLoading, getSelectedBriebug, getError } from '@state/briebug';
15+
import { briebugLoading, currentBriebug, briebugError } from "@state/briebug";
1616
import { Briebug } from '@state/briebug/briebug.model';
1717
import {
1818
LoadBriebugById,
19-
InsertBriebug,
19+
CreateBriebug,
2020
UpdateBriebug,
2121
SelectBriebugById
22-
} from '@state/briebug/briebug.actions';
22+
} from "@state/briebug/briebug.actions";
2323
import { BriebugState } from '@state/briebug/briebug.reducer';
2424

2525
@Component({
@@ -39,21 +39,21 @@ export class BriebugComponent implements OnInit {
3939
const BriebugAction = id ? LoadBriebugById : SelectBriebugById;
4040
this.store.dispatch(new BriebugAction({ id: +id || null }));
4141
}),
42-
switchMap(() => this.store.pipe(select(getSelectedBriebug))),
42+
switchMap(() => this.store.pipe(select(currentBriebug))),
4343
map((briebug) => ({ ...briebug }))
4444
);
4545
// The following shareReplay calls allow us to use the async pipe multiple
4646
// times without creating multiple subscriptions:
4747
errorMessage$ = this.store.pipe(
48-
select(getError),
48+
select(briebugError),
4949
shareReplay()
5050
);
5151
isLoading$ = this.store.pipe(
52-
select(getLoading),
52+
select(briebugLoading),
5353
shareReplay()
5454
);
5555

56-
briebugEdits: Briebug;
56+
briebugEdits: Briebug
5757
showFormErrors: boolean;
5858
valid: boolean;
5959

@@ -78,7 +78,9 @@ export class BriebugComponent implements OnInit {
7878
return;
7979
}
8080

81-
const BriebugAction = this.briebugEdits.id ? UpdateBriebug : InsertBriebug;
81+
const BriebugAction = this.briebugEdits.id
82+
? UpdateBriebug
83+
: CreateBriebug;
8284
this.store.dispatch(new BriebugAction({ briebug: this.briebugEdits }));
8385
}
8486
}

0 commit comments

Comments
 (0)