UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

87 lines (86 loc) 5.93 kB
import { LoggerService } from '../../logger/services/logger.service'; import { TaskContentService } from '../../task-content/services/task-content.service'; import { TaskEventService } from '../../task-content/services/task-event.service'; import { TaskResourceService } from '../../resources/engine-endpoint/task-resource.service'; import { TranslateService } from '@ngx-translate/core'; import { SnackBarService } from '../../snack-bar/services/snack-bar.service'; import { TaskRequestStateService } from './task-request-state.service'; import { TaskHandlingService } from './task-handling-service'; import { TaskOperations } from '../interfaces/task-operations'; import { UserComparatorService } from '../../user/services/user-comparator.service'; import { SelectedCaseService } from './selected-case.service'; import { TaskDataService } from './task-data.service'; import { TaskViewService } from '../../view/task-view/service/task-view.service'; import { EventQueueService } from '../../event-queue/services/event-queue.service'; import { AfterAction } from '../../utility/call-chain/after-action'; import { PermissionService } from '../../authorization/permission/permission.service'; 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 canceling a task. */ export declare class CancelTaskService extends TaskHandlingService { protected _log: LoggerService; protected _taskEventService: TaskEventService; protected _taskResourceService: TaskResourceService; protected _translate: TranslateService; protected _snackBar: SnackBarService; protected _taskState: TaskRequestStateService; protected _userComparator: UserComparatorService; protected _taskEvent: TaskEventService; protected _taskDataService: TaskDataService; protected _eventQueue: EventQueueService; protected _eventService: EventService; protected _changedFieldsService: ChangedFieldsService; protected _taskOperations: TaskOperations; protected _taskViewService: TaskViewService; protected permissionService: PermissionService; protected _frontActionService: FrontActionService; constructor(_log: LoggerService, _taskEventService: TaskEventService, _taskResourceService: TaskResourceService, _translate: TranslateService, _snackBar: SnackBarService, _taskState: TaskRequestStateService, _userComparator: UserComparatorService, _taskEvent: TaskEventService, _taskDataService: TaskDataService, _eventQueue: EventQueueService, _eventService: EventService, _changedFieldsService: ChangedFieldsService, _taskOperations: TaskOperations, _selectedCaseService: SelectedCaseService, _taskViewService: TaskViewService, _taskContentService: TaskContentService, permissionService: PermissionService, _frontActionService: FrontActionService); /** * Performs the 'cancel' operation on the task held by {@link TaskContentService}. * * 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 cancel operation. * * 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 cancel completes successfully `true` will be emitted into this Subject, otherwise `false` will be emitted */ cancel(afterAction?: AfterAction): void; /** * Performs a `cancel` 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 * @param forceReload whether a force reload of the task data should be performed after cancel. * If set to `false` a regular reload is performed instead. */ protected performCancelRequest(afterAction: AfterAction, nextEvent: AfterAction, forceReload: boolean): void; /** * Calls the endpoint and processes the possible responses. * @param afterAction the action that should be performed after the request is processed * @param canceledTaskId the id of the task that is being canceled * @param nextEvent indicates to the event queue that the next event can be processed * @param forceReload whether a force reload of the task data should be performed after cancel. * If set to `false` a regular reload is performed instead. */ protected cancelRequest(afterAction: AfterAction, canceledTaskId: string, nextEvent: AfterAction, forceReload: boolean): void; /** * complete all action streams and send notification with selected boolean */ protected completeActions(afterAction: AfterAction, nextEvent: AfterAction, bool: boolean, outcome?: TaskEventOutcome): void; /** * Publishes a cancel notification to the {@link TaskEventService} * @param success whether the cancel operation was successful or not * @param outcome */ protected sendNotification(success: boolean, outcome?: TaskEventOutcome): void; static ɵfac: i0.ɵɵFactoryDeclaration<CancelTaskService, [null, null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, null, null, null]>; static ɵprov: i0.ɵɵInjectableDeclaration<CancelTaskService>; }