Skip to content

Commit 64d9be9

Browse files
authored
Merge pull request #442 from ioet/436-fix-technologies-component
fix: #436 fix technologies component
2 parents 56a7e03 + 84224a6 commit 64d9be9

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/app/modules/shared/components/technologies/technologies.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<span class="input-group-text span-width">Technology</span>
44
</div>
55
<input
6-
(input)="queryTechnologies($event)"
6+
autocomplete="off"
7+
(keyup)="queryTechnologies($event)"
78
id="technologies"
89
type="text"
910
class="form-control"
@@ -12,8 +13,9 @@
1213
[(ngModel)]="query"
1314
/>
1415
</div>
15-
16-
<div *ngIf="isLoading">LOADING...</div>
16+
<div style="text-align: center;" *ngIf="isLoading">
17+
<img src="assets/img/spinner.gif"/>
18+
</div>
1719
<div #technologiesDropdown *ngIf="technology && showList" class="d-flex flex-column technologies-dropdown-container">
1820
<div
1921
*ngFor="let item of technology.items"

src/app/modules/shared/components/technologies/technologies.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, Renderer2, ViewChild} from '@angular/core';
22
import * as actions from '../../store/technology.actions';
3-
import {select, Store} from '@ngrx/store';
3+
import { select, Store } from '@ngrx/store';
44
import {TechnologyState} from '../../store/technology.reducers';
55
import {allTechnologies} from '../../store/technology.selectors';
66
import {Technology} from '../../models';
@@ -48,8 +48,12 @@ export class TechnologiesComponent implements OnInit {
4848
const technologies$ = this.store.pipe(select(allTechnologies));
4949
technologies$.subscribe((response) => {
5050
this.isLoading = response.isLoading;
51-
const filteredItems = response.technologyList.items.filter(item => !this.selectedTechnologies.includes(item.name));
52-
this.technology = {items: filteredItems};
51+
if ( response.technologyList.items ) {
52+
const filteredItems = response.technologyList.items.filter(item => !this.selectedTechnologies.includes(item.name));
53+
this.technology = {items: filteredItems};
54+
} else {
55+
this.technology = {items: []};
56+
}
5357
});
5458
}
5559

src/app/modules/shared/store/technology.effects.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ToastrService } from 'ngx-toastr';
21
import { Injectable } from '@angular/core';
32
import { ofType, Actions, Effect } from '@ngrx/effects';
43
import { Action } from '@ngrx/store';
@@ -10,7 +9,7 @@ import * as actions from './technology.actions';
109
@Injectable()
1110
export class TechnologyEffects {
1211

13-
constructor(private toastrService: ToastrService, private actions$: Actions, private technologyService: TechnologyService) { }
12+
constructor(private actions$: Actions, private technologyService: TechnologyService) { }
1413

1514
@Effect()
1615
findTechnology$: Observable<Action> = this.actions$.pipe(
@@ -22,7 +21,6 @@ export class TechnologyEffects {
2221
return new actions.FindTechnologySuccess(technology);
2322
}),
2423
catchError((error) => {
25-
this.toastrService.error(error.error.message);
2624
return of(new actions.FindTechnologyFail(error));
2725
})
2826
)

src/assets/img/spinner.gif

35 KB
Loading

0 commit comments

Comments
 (0)