progressbar of message list is added

This commit is contained in:
병준 박 2019-10-08 15:25:00 +09:00
parent c8f32c04e8
commit 62b19d90b8
5 changed files with 34 additions and 3 deletions

View File

@ -34,7 +34,10 @@
</div> </div>
</mat-toolbar> </mat-toolbar>
<!-- / CHAT TOOLBAR --> <!-- / CHAT TOOLBAR -->
<mat-progress-bar
*ngIf="eventListProcessing$ | async"
mode="indeterminate"
></mat-progress-bar>
<!-- CHAT CONTENT --> <!-- CHAT CONTENT -->
<div fxFlex="1 1 auto" class="chat-content"> <div fxFlex="1 1 auto" class="chat-content">
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->

View File

@ -25,6 +25,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
eventList$: Observable<Info[]>; eventList$: Observable<Info[]>;
roomInfo: RoomInfo; roomInfo: RoomInfo;
roomInfoSubscription: Subscription; roomInfoSubscription: Subscription;
eventListProcessing$: Observable<boolean>;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
@ -53,6 +54,10 @@ export class MessagesComponent implements OnInit, OnDestroy {
) )
.subscribe(); .subscribe();
this.eventListProcessing$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoListProcessing)
);
this.eventList$ = this.store.pipe( this.eventList$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoList) select(AppStore.MessengerSelector.EventSelector.infoList)
); );

View File

@ -8,6 +8,7 @@ import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
@ -31,6 +32,7 @@ import { DIALOGS } from './dialogs';
MatDialogModule, MatDialogModule,
MatIconModule, MatIconModule,
MatMenuModule, MatMenuModule,
MatProgressBarModule,
MatTabsModule, MatTabsModule,
MatToolbarModule, MatToolbarModule,
UCapUiModule, UCapUiModule,

View File

@ -1,14 +1,29 @@
import { createReducer, on } from '@ngrx/store'; import { createReducer, on } from '@ngrx/store';
import { initialState } from './state'; import { initialState } from './state';
import { infoSuccess, appendInfoList } from './actions'; import { infoSuccess, appendInfoList, info, infoFailure } from './actions';
export const reducer = createReducer( export const reducer = createReducer(
initialState, initialState,
on(info, (state, action) => {
return {
...state,
infoListProcessing: true
};
}),
on(infoSuccess, (state, action) => { on(infoSuccess, (state, action) => {
return { return {
...state, ...state,
infoList: action.infoList, infoList: action.infoList,
infoStatus: action.res infoStatus: action.res,
infoListProcessing: false
};
}),
on(infoFailure, (state, action) => {
return {
...state,
infoListProcessing: false
}; };
}), }),

View File

@ -2,17 +2,23 @@ import { Selector, createSelector } from '@ngrx/store';
import { InfoResponse, Info } from '@ucap-webmessenger/protocol-event'; import { InfoResponse, Info } from '@ucap-webmessenger/protocol-event';
export interface State { export interface State {
infoListProcessing: boolean;
infoList: Info[] | null; infoList: Info[] | null;
infoStatus: InfoResponse | null; infoStatus: InfoResponse | null;
} }
export const initialState: State = { export const initialState: State = {
infoListProcessing: false,
infoList: null, infoList: null,
infoStatus: null infoStatus: null
}; };
export function selectors<S>(selector: Selector<any, State>) { export function selectors<S>(selector: Selector<any, State>) {
return { return {
infoListProcessing: createSelector(
selector,
(state: State) => state.infoListProcessing
),
infoList: createSelector( infoList: createSelector(
selector, selector,
(state: State) => state.infoList (state: State) => state.infoList