@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
106 lines (105 loc) • 4.34 kB
TypeScript
import { OnDestroy } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { LoadingEmitter } from '../../utility/loading-emitter';
import { Pagination } from '../../resources/interface/pagination';
import { LoggerService } from '../../logger/services/logger.service';
import { SnackBarService } from '../../snack-bar/services/snack-bar.service';
import { TranslateService } from '@ngx-translate/core';
import { HttpParams } from '@angular/common/http';
import { LdapGroup } from '../../resources/interface/ldapGroupResponseBody';
import { LdapGroupResourceService } from '../../resources/engine-endpoint/ldap-group-resource.service';
import { MessageResource } from '../../resources/interface/message-resource';
import * as i0 from "@angular/core";
export interface LdapGroupListItem extends LdapGroup {
selected: boolean;
roles: Set<string>;
toggle(): void;
}
export declare class LdapGroupListService implements OnDestroy {
protected _resources: LdapGroupResourceService;
protected _log: LoggerService;
protected _snackbar: SnackBarService;
protected _translate: TranslateService;
/**
* Ldap Group Value array stream, that represents ldap group loading from backend.
*/
protected readonly _ldapGroups$: Observable<Array<LdapGroupListItem>>;
/**
* Emit ldap group loading status from backend.
*/
protected _loading$: LoadingEmitter;
/**
* Number stream of next page ldap group list, that to be requested from backend.
*/
protected _nextPage$: BehaviorSubject<number>;
/**
* Signals the end of loaded ldap groups.
*/
protected _endOfData: boolean;
/**
* Necessary for pagination parameters in ldap group assign loading from backend.
*/
protected _pagination: Pagination;
/**
* Signals if response is empty or no.
*/
protected _clear: boolean;
/**
* The search content that should be applied to the request
*/
protected _searchQuery: string;
/**
* Roles that should be applied to the request
*/
rolesQuery: Array<string>;
/**
* negative Roles that should be applied to the request
*/
negativeRolesQuery: Array<string>;
protected _updateProgress$: LoadingEmitter;
protected _ldapGroupsReload$: Subject<void>;
/**
* Inject services.
* Initialize declared attributes.
*
* Loading and mapped stream of ldap groups.
* @param _resources Loading ldap groups from backend.
* @param _log Logging action status.
* @param _snackbar Display info about loading from backend for ldap group.
* @param _translate Translate messages for ldap group.
*/
constructor(_resources: LdapGroupResourceService, _log: LoggerService, _snackbar: SnackBarService, _translate: TranslateService);
ngOnDestroy(): void;
get loading(): boolean;
get loading$(): Observable<boolean>;
get ldapGroupsReload$(): Observable<void>;
get ldapGroups$(): Observable<Array<LdapGroupListItem>>;
get updating$(): Observable<boolean>;
get totalLdapGroups(): number;
/**
* Get all ldapGroups from backend and mapped to [ldapGroupValue]{@link ldapGroupValue} interface with catching errors.
* @param page Page number that is requested. / Next page ldapGroups list.
*/
loadPage(page: number): Observable<{
[k: string]: LdapGroupListItem;
}>;
/**
* Set value to nextPage stream as next page ldapGroups list.
* @param lastRendered Last rendered ldapGroup index.
* @param totalRendered Total loaded size ldapGroups.
*/
nextPage(lastRendered: number, totalRendered: number): void;
/**
* Reload page with ldapGroups.
*/
reload(newSearchQuery?: string): void;
updateRoles(selectedLdapGroups: Array<LdapGroupListItem>, selectedRoles?: Array<string>): Observable<Array<MessageResource>>;
/**
* Returns HttpParams with page params addition.
* @param params Existing HttpParams.
* @param page Page number that is requested. / Next page ldapGroups list.
*/
protected addPageParams(params: HttpParams, page?: number): HttpParams;
static ɵfac: i0.ɵɵFactoryDeclaration<LdapGroupListService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<LdapGroupListService>;
}