UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

89 lines (88 loc) 5.45 kB
import { LoggerService } from '../../logger/services/logger.service'; import { TaskContentService } from '../../task-content/services/task-content.service'; import { TaskResourceService } from '../../resources/engine-endpoint/task-resource.service'; import { SnackBarService } from '../../snack-bar/services/snack-bar.service'; import { TranslateService } from '@ngx-translate/core'; import { TaskRequestStateService } from './task-request-state.service'; import { TaskDataService } from './task-data.service'; import { TaskHandlingService } from './task-handling-service'; import { TaskOperations } from '../interfaces/task-operations'; import { CallChainService } from '../../utility/call-chain/call-chain.service'; import { SelectedCaseService } from './selected-case.service'; import { TaskEventService } from '../../task-content/services/task-event.service'; import { EventQueueService } from '../../event-queue/services/event-queue.service'; import { AfterAction } from '../../utility/call-chain/after-action'; import { ChangedFieldsService } from '../../changed-fields/services/changed-fields.service'; import { EventService } from '../../event/services/event.service'; import { TaskEventOutcome } from '../../event/model/event-outcomes/task-outcomes/task-event-outcome'; import { FrontActionService } from '../../actions/services/front-action.service'; import * as i0 from "@angular/core"; /** * Service that handles the logic of finishing a task. */ export declare class FinishTaskService extends TaskHandlingService { protected _log: LoggerService; protected _taskResourceService: TaskResourceService; protected _snackBar: SnackBarService; protected _translate: TranslateService; protected _taskState: TaskRequestStateService; protected _taskDataService: TaskDataService; protected _callChain: CallChainService; protected _taskEvent: TaskEventService; protected _eventQueue: EventQueueService; protected _eventService: EventService; protected _changedFieldsService: ChangedFieldsService; protected _taskOperations: TaskOperations; protected _frontActionService: FrontActionService; constructor(_log: LoggerService, _taskResourceService: TaskResourceService, _snackBar: SnackBarService, _translate: TranslateService, _taskState: TaskRequestStateService, _taskDataService: TaskDataService, _callChain: CallChainService, _taskEvent: TaskEventService, _eventQueue: EventQueueService, _eventService: EventService, _changedFieldsService: ChangedFieldsService, _taskOperations: TaskOperations, _selectedCaseService: SelectedCaseService, _taskContentService: TaskContentService, _frontActionService: FrontActionService); /** * Updates the task data to their current state from backend, checks the validity of the data and * sends a finish request to backend. * * Finish request is not sent if the task contains invalid data. * * If an update to the data is already in progress waits for it's successful completion and sends the finish request after. * * @param afterAction if finish request completes successfully `true` will be emitted into this Subject, * otherwise `false` will be emitted */ validateDataAndFinish(afterAction?: AfterAction): void; /** * Sends the finish request to backend and notifies the user about the outcome of the operation via a snack bar message. * * Doesn't send any requests if the loading indicator is in it's active state. * Otherwise sets the indicator to the active state and disables it once the request response is received. * * The argument can be used to chain operations together, * or to execute code conditionally based on the success state of the finish request. * * If the task held within the {@link TaskContentService} changes before a response is received, the response will be ignored * and the `afterAction` will not be executed. * @param afterAction if finish request completes successfully `true` will be emitted into this Subject, * otherwise `false` will be emitted */ protected queueFinishTaskRequest(afterAction: AfterAction): void; /** * Performs a `finish` request on the task currently stored in the `taskContent` service * @param afterAction the action that should be performed after the request is processed * @param nextEvent indicates to the event queue that the next event can be processed */ protected performFinishRequest(afterAction: AfterAction, nextEvent: AfterAction): void; /** * Completes all the action streams and sends the notification, with the provided result */ protected completeActions(afterAction: AfterAction, nextEvent: AfterAction, result: boolean, outcome?: TaskEventOutcome): void; /** * Publishes a finish notification to the {@link TaskEventService} * @param success whether the finish operation was successful or not * @param outcome TaskEventOutcome */ protected sendNotification(success: boolean, outcome?: TaskEventOutcome): void; /** * Checks data size * @return boolean whether the task contains data or not */ private dataIsEmpty; static ɵfac: i0.ɵɵFactoryDeclaration<FinishTaskService, [null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, null, null]>; static ɵprov: i0.ɵɵInjectableDeclaration<FinishTaskService>; }