blob: d107389f8dde15534cf0fc7d929b41a96d2c6b42 [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { BaseListSandbox } from '@shared/sandbox/base-list.sandbox';
import { Injectable } from '@angular/core';
import { Store, ActionsSubject } from '@ngrx/store';
import * as store from '@shared/store';
import { Observable } from 'rxjs';
import { ILoadGridFailuresSuccess } from '@shared/store/actions/grid-failures.action';
import * as gridFailureActions from '@shared/store/actions/grid-failures.action';
import { take } from 'rxjs/operators';
import { ofType } from '@ngrx/effects';
@Injectable()
export class GridFailureSandbox extends BaseListSandbox {
public gridFailureList$ = this.appState$.select(store.getGridFailuresData);
public gridFailureListLoading$: Observable<boolean> = this.appState$.select(store.getGridFailuresLoading);
constructor(protected appState$: Store<store.State>, protected actionsSubject: ActionsSubject) {
super(appState$);
}
public loadGridFailures(): Observable<ILoadGridFailuresSuccess> {
this.appState$.dispatch(gridFailureActions.loadGridFailures());
return this.actionsSubject.pipe(ofType(gridFailureActions.loadGridFailuresSuccess), take(1));
}
}