/** Core */ import { CoreComponent } from "cmf.core/src/core"; import Cmf from "cmf.lbos"; import { OperationListViewItem } from "../operationListView/operationListView"; import { EntityHistoryFiltersDef } from "./entityHistoryFilters"; import { Changes, ProcessedChanges } from "./entityHistoryChanges"; import { ListViewItem } from "cmf.core.controls/src/components/listView/listView"; /** Angular */ import * as ng from "@angular/core"; /** * Represents the possible component tab values */ export declare enum TabValue { All = 0, Comments = 1 } /** * Represents a tab item - used for tabs and for selected operation level breadcrumb */ export interface TabItem { value: TabValue; text: string; } /** * Representation of a service */ export interface ServiceItemModel { serviceName: string; serviceHistoryId: string; user: string; startDateTime: string; endDateTime: string; comment?: string; } /** * Interface used to hold the data for a list of operations */ export interface OperationData { /** * List of operations loaded */ operations: Array; /** * Current operation pageNumber */ pageNumber: number; /** * Boolean that indicated wether everything is loaded or the user can still load more */ isLoaded: boolean; } /** * Interface for each of the items of the selected tab */ export interface OperationsBreadCrumbTabItem { /** * Id of the operation in the operation cache */ cacheKey: string; /** * Display text on the select list */ text: string; } /** * @whatItDoes * * This component presents the history of an entity. The user can select services, which load the corresponding operations. * From the operations, the user can check the property changes. * The operations are displayed in a nested way, which means it is possible to have multiple operations inside operations. * The user can also filter or search for specific operations, or look just at the services comments in a separate tab. * * @howToUse * * This component is used with the inputs and outputs mentioned below. * * ### Inputs * `string` : **instance** - The instance for which the history will be shown. * `boolean` : **displayInstance** - Boolean that controls wether the actual instance navigation appears on the top left. Defaults to false. * * @description * * ## EntityHistory Component * * ### Dependencies * * #### Components * * Navigation : `cmf.core.business.controls` * * SelectList : `cmf.core.controls` * * VerticalStepList : `cmf.core.controls` * * PopUp : `cmf.core.controls` * * OperationListView : `cmf.core.business.controls` * * PropertyViewer : `cmf.core.business.controls` * * EntityHistoryFilters : `cmf.core.business.controls` * * InfoSlider : `cmf.core.controls` * * EntityHistoryChanges : `cmf.core.business.controls` * * #### Services * _The component component does not depend on any service_ * * #### Directives * * ProgressIndicator : `cmf.core.controls` * * ElementQuery : `cmf.core.controls` * */ export declare class EntityHistory extends CoreComponent implements ng.OnChanges, ng.AfterViewInit, ng.OnDestroy { private elementRef; /** * Element ref to the operation details container */ private _operationsDetails; /** * Element ref to the services container */ private _servicesContainer; /** * Element ref to the top most container */ private _topMostContainer; /** * Element ref to the services vertical step list */ private _verticalStepList; /** * Available Tabs */ _tabs: Array; /** * Selected Tab */ _selectedTab: TabItem; /** * All services */ private _allServicesData; /** * Filtered services */ _filteredServicesData: ServiceItemModel[]; /** * Comments data */ _commentsData: ServiceItemModel[]; /** * Initially loaded services */ _initialServicesData: ServiceItemModel[]; /** * Selected service */ _selectedService: ServiceItemModel; /** * Currently selected service */ _selectedServiceIndex: number; /** * Operations breadcrumb. * When adding new level, the field 'index' should be incremented by 1 */ _operations: Array; /** * Selected operation level */ _selectedOperation: OperationsBreadCrumbTabItem; /** * Operations data. * The position in array represents the selected operation. This way we keep information of the previously selected operations. * e.g. position 0: first selected operation; position 1: second selected operation * This cannot be undefined or the component will be invalid. Must be empty - [[]] */ private _loadedOperationsData; /** * The filtered operations */ private _filteredOperationsData; /** * Current operations to be displayed */ _currentOperationsData: OperationData; /** * Loaded changes - keep them 'cached', in order to avoid loading same changes multiple times * Map key is "serviceId|operationHistorySequence|subOperationSequence" (with the pipe) */ private _loadedChanges; /** * Currently selected change. After closing change, this should be set to null. */ _currentChange: Changes; /** * Current change operation being viewed */ private _currentChangeOperation; /** * Current sorting */ _sorting: Cmf.Foundation.Common.FieldSort; /** * Indicates wether there is any comments in all the services */ _hasComments: boolean; /** * Current filters applied on the history */ _filters: EntityHistoryFiltersDef; /** * Controls wether the user has applied custom filters */ _hasFilters: boolean; /** * Flag that controls wether history is being loaded */ _isLoading: boolean; /** * The entity instance selected in the settings page. */ instance: Cmf.Foundation.BusinessObjects.Entity; /** * Display instance on the top left (defaults to true) */ displayInstance: boolean; /** * Defines if all services are loaded or not */ areAllServicesLoaded: boolean; /** * Defines if all comments are loaded or not */ areAllCommentsLoaded: boolean; /** * Current page number */ private _pageNumber; /** * Current page number of the comments section */ private _commentsPageNumber; /** * Current page size, used for both the operations and services page size */ private _pageSize; /** * Total rows of history as informed by the service */ _totalRows: number; /** * Total rows of comments */ private _commentsTotalRows; /** * Controls if we are currently loading services */ loadingServices: boolean; /** * Stores the element query */ private _elementQuery; /** * Boolean that controls if the display is the small case */ isSmall: boolean; /** * Currently visible comment */ _currentComment: string; /** * Popup visible */ _popupVisible: { open: boolean; }; /** * EntityHistory constructor * * @param viewContainerRef View Container Ref */ constructor(elementRef: ng.ElementRef, viewContainerRef: ng.ViewContainerRef); /** * Handle the data from the services and update the component * @param output Output from the service */ private handleServiceHistoryOutput; /** * Load more callback */ loadMoreCallback: (currentData: any[]) => Promise; /** * Load more callback */ operationLoadMoreCallback: (currentData: OperationListViewItem[]) => Promise; commentsLoadMoreCallback: (currentData: any[]) => Promise; /** * Loads the right side services for this instance and converts them to the services item model */ private loadServicesData; /** * Loads history according to the user settings * @param elementRef Element ref to trigger the progress indicator on */ private loadHistory; /** * Loads all entity comments */ private loadComments; /** * On instance change, get its history services. * * @param changes Changes */ ngOnChanges(changes: ng.SimpleChanges): void; /** * Set the event handler for the content resize change */ ngAfterViewInit(): void; /** * Updates the display type based on the size of the entity history * @param width Width to consider for calculations */ updateSizeDisplay(width: number): void; /** * Resets the selected operation and switches to the services view */ resetSelectedOperation(): void; /** * On click of sorting, reorder the services */ toggleSorting(): void; /** * When the user selects the COMMENTS tab, loads all comments (if not loaded yet) * @param tab Selected tab emitted by the SelectList */ changedSelectedTab(): void; /** * Change the selected service index * @param change number of index to increase or decrease to the current index */ changeServiceIndex(change: number): void; /** * On service changed, get its inner operations * * @param element Clicked service * @param newIndex New index of the selected element */ onServiceChanged(element: any, newIndex?: number): void; /** * Load operations data for a certain service / operation sequence * @param serviceHistoryId Service selected * @param pageNumber Page number * @param parentOperationSequence Optional parent operation */ private loadOperationData; /** * On breadcrumb operation change, delete forward operations and keep till the selected one. * * @param element Selected element */ onOperationBreadcrumbChange(element: OperationsBreadCrumbTabItem): void; /** * On expand clicked, get its' inner operations * * @param item Selected operation */ expandClicked(item: ListViewItem): void; /** * On changes clicked, get changed properties * * @param item Selected operation */ changesClicked(item: OperationListViewItem): void; /** * Updates the value of a changes item in the cache */ updateChangesCache(changes: ProcessedChanges): void; /** * On close of operation changes */ onChangesClose(): void; /** * When filter is clicked open the modal for the user to select the filters */ onFilterClick(): void; /** * Shows the popup with the service comments */ showPopup(comment: string): void; /** * Hide the popup with the service comments */ hidePopup(): void; ngOnDestroy(): void; } export declare class EntityHistoryModule { }