2018-05-28 09:58:13 +00:00
|
|
|
import { RPCClientError } from '@loafer/ng-rpc';
|
|
|
|
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
|
2018-05-26 09:08:40 +00:00
|
|
|
import { Selector, createSelector } from '@ngrx/store';
|
|
|
|
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
|
|
|
|
|
2018-05-28 09:58:13 +00:00
|
|
|
export const probeListContainerAdapter = createEntityAdapter<ProbeHost, RPCClientError>();
|
|
|
|
export interface State extends EntityState<ProbeHost, RPCClientError> {
|
2018-05-26 09:08:40 +00:00
|
|
|
pending: boolean;
|
|
|
|
}
|
2018-05-28 09:58:13 +00:00
|
|
|
export const initialState: State = probeListContainerAdapter.getInitialState({
|
2018-05-26 09:08:40 +00:00
|
|
|
pending: false,
|
2018-05-28 09:58:13 +00:00
|
|
|
});
|
2018-05-26 09:08:40 +00:00
|
|
|
|
|
|
|
export function getSelectors<S>(selector: Selector<any, State>) {
|
|
|
|
return {
|
2018-05-28 09:58:13 +00:00
|
|
|
...probeListContainerAdapter.getSelectors(selector),
|
2018-05-26 09:08:40 +00:00
|
|
|
selectPending: createSelector(selector, (state: State) => state.pending),
|
|
|
|
};
|
|
|
|
}
|