Skip to content

Commit

Permalink
[ACS-7427] Process Services improvements and cleanup (#9664)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika authored and DaryaBalvanovich committed May 23, 2024
1 parent 9e990ed commit 6dc9a4c
Show file tree
Hide file tree
Showing 174 changed files with 1,736 additions and 3,933 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,18 @@
*/

import { EcmUserModel, PeopleContentService } from '@alfresco/adf-content-services';
import { BpmUserModel, PeopleProcessService } from '@alfresco/adf-process-services';
import {
AuthenticationService,
BasicAlfrescoAuthService,
IdentityUserModel,
IdentityUserService,
UserInfoMode
} from '@alfresco/adf-core';
import { PeopleProcessService } from '@alfresco/adf-process-services';
import { AuthenticationService, BasicAlfrescoAuthService, IdentityUserModel, IdentityUserService, UserInfoMode } from '@alfresco/adf-core';
import { Component, OnInit, Input } from '@angular/core';
import { MenuPositionX, MenuPositionY } from '@angular/material/menu';
import { Observable, of } from 'rxjs';
import { UserRepresentation } from '@alfresco/js-api';

@Component({
selector: 'app-shell-user-info',
templateUrl: './user-info.component.html'
})
export class UserInfoComponent implements OnInit {

/** Custom choice for opening the menu at the bottom. Can be `before` or `after`. */
@Input()
menuPositionX: MenuPositionX = 'after';
Expand All @@ -44,17 +38,17 @@ export class UserInfoComponent implements OnInit {

mode: UserInfoMode;
ecmUser$: Observable<EcmUserModel>;
bpmUser$: Observable<BpmUserModel>;
bpmUser$: Observable<UserRepresentation>;
identityUser$: Observable<IdentityUserModel>;
selectedIndex: number;
userInfoMode = UserInfoMode;

constructor(private peopleContentService: PeopleContentService,
private peopleProcessService: PeopleProcessService,
private identityUserService: IdentityUserService,
private basicAlfrescoAuthService: BasicAlfrescoAuthService,
private authService: AuthenticationService) {
}
constructor(
private peopleContentService: PeopleContentService,
private peopleProcessService: PeopleProcessService,
private identityUserService: IdentityUserService,
private basicAlfrescoAuthService: BasicAlfrescoAuthService,
private authService: AuthenticationService
) {}

ngOnInit() {
this.getUserInfo();
Expand All @@ -69,7 +63,6 @@ export class UserInfoComponent implements OnInit {
this.mode = UserInfoMode.CONTENT_SSO;
this.loadEcmUserInfo();
}

} else if (this.isAllLoggedIn()) {
this.loadEcmUserInfo();
this.loadBpmUserInfo();
Expand Down Expand Up @@ -103,7 +96,10 @@ export class UserInfoComponent implements OnInit {
}

private isAllLoggedIn() {
return (this.authService.isEcmLoggedIn() && this.authService.isBpmLoggedIn()) || (this.authService.isALLProvider() && this.basicAlfrescoAuthService.isKerberosEnabled());
return (
(this.authService.isEcmLoggedIn() && this.authService.isBpmLoggedIn()) ||
(this.authService.isALLProvider() && this.basicAlfrescoAuthService.isKerberosEnabled())
);
}

private isBpmLoggedIn() {
Expand All @@ -114,4 +110,3 @@ export class UserInfoComponent implements OnInit {
return this.authService.isEcmLoggedIn() || (this.authService.isECMProvider() && this.basicAlfrescoAuthService.isKerberosEnabled());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl, A
import { ActivatedRoute, Params } from '@angular/router';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ProcessInstanceQueryRepresentationSort, ProcessInstanceQueryRepresentationState } from '@alfresco/js-api';

const DEFAULT_SIZE = 20;

@Component({
templateUrl: './process-list-demo.component.html',
styleUrls: [`./process-list-demo.component.scss`]
})

export class ProcessListDemoComponent implements OnInit, OnDestroy {
minValue = 0;
processListForm: UntypedFormGroup;
appId: number;
processDefId: string;
processInsId: string;
state: string;
sort: string;
state: ProcessInstanceQueryRepresentationState;
sort: ProcessInstanceQueryRepresentationSort;
size: number = DEFAULT_SIZE;
page: number = 0;

Expand All @@ -48,15 +48,13 @@ export class ProcessListDemoComponent implements OnInit, OnDestroy {
];

sortOptions = [
{value: 'created-asc', title: 'Created (asc)'},
{value: 'created-desc', title: 'Created (desc)'}
{ value: 'created-asc', title: 'Created (asc)' },
{ value: 'created-desc', title: 'Created (desc)' }
];

private onDestroy$ = new Subject<boolean>();

constructor(private route: ActivatedRoute,
private formBuilder: UntypedFormBuilder) {
}
constructor(private route: ActivatedRoute, private formBuilder: UntypedFormBuilder) {}

ngOnInit() {
this.resetQueryParameters();
Expand Down Expand Up @@ -91,12 +89,11 @@ export class ProcessListDemoComponent implements OnInit, OnDestroy {
this.processListForm.valueChanges
.pipe(takeUntil(this.onDestroy$))
.pipe(debounceTime(500))
.subscribe(processFilter => {
.subscribe((processFilter) => {
if (this.isFormValid()) {
this.filterProcesses(processFilter);
}
});

}

filterProcesses(processFilter: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@

import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { AppDefinitionRepresentationModel } from '@alfresco/adf-process-services';
import { AppDefinitionRepresentation } from '@alfresco/js-api';

@Component({
selector: 'app-process-list-view',
templateUrl: './apps-view.component.html'
})
export class AppsViewComponent {
constructor(private router: Router) {}

constructor(private router: Router) {
onAppClicked(app: AppDefinitionRepresentation) {
this.router.navigate(['/activiti/apps', app.id || 0, 'tasks']);
}

onAppClicked(app: AppDefinitionRepresentationModel) {
this.router.navigate(['/activiti/apps', app.id || 0, 'tasks']);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,12 @@
*/

import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import {
ProcessAttachmentListComponent,
ProcessInstance,
ProcessService,
ProcessUploadService
} from '@alfresco/adf-process-services';
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { ProcessAttachmentListComponent, ProcessService, ProcessUploadService } from '@alfresco/adf-process-services';
import { UploadService } from '@alfresco/adf-content-services';
import { PreviewService } from '../../services/preview.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

/**
* Provide a factory for process upload service
*
* @param api api client
* @param config config service
* @param discoveryApiService discovery service
* @returns factory function
*/
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService, discoveryApiService: DiscoveryApiService) {
return new ProcessUploadService(api, config, discoveryApiService);
}
import { ProcessInstanceRepresentation } from '@alfresco/js-api';

@Component({
selector: 'app-process-attachments',
Expand All @@ -47,41 +30,31 @@ export function processUploadServiceFactory(api: AlfrescoApiService, config: App
providers: [
{
provide: UploadService,
useFactory: (processUploadServiceFactory),
deps: [AlfrescoApiService, AppConfigService, DiscoveryApiService]
useClass: ProcessUploadService
}
],
encapsulation: ViewEncapsulation.None
})

export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy {

@ViewChild('processAttachList')
processAttachList: ProcessAttachmentListComponent;

@Input()
processInstanceId: string;

processInstance: ProcessInstance;
processInstance: ProcessInstanceRepresentation;

private onDestroy$ = new Subject<boolean>();

constructor(
private uploadService: UploadService,
private processService: ProcessService,
private preview: PreviewService
) {}
constructor(private uploadService: UploadService, private processService: ProcessService, private preview: PreviewService) {}

ngOnInit() {
this.uploadService.fileUploadComplete
.pipe(takeUntil(this.onDestroy$))
.subscribe(value => this.onFileUploadComplete(value.data));
this.uploadService.fileUploadComplete.pipe(takeUntil(this.onDestroy$)).subscribe((value) => this.onFileUploadComplete(value.data));
}

ngOnChanges() {
if (this.processInstanceId) {
this.processService.getProcess(this.processInstanceId)
.subscribe((processInstance: ProcessInstance) => {
this.processService.getProcess(this.processInstanceId).subscribe((processInstance) => {
this.processInstance = processInstance;
});
}
Expand All @@ -103,5 +76,4 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
isCompletedProcess(): boolean {
return this.processInstance?.ended != null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
[title]="'Start Process'"
[name]="defaultProcessName"
(formContentClicked)="onContentClick($event)"
(start)="onStartProcessInstance($event)"
(start)="onStartProcessInstance($event.id)"
(cancel)="onCancelProcessInstance()"
(error)="onStartProcessError($event)">
</adf-start-process>
Expand Down
Loading

0 comments on commit 6dc9a4c

Please sign in to comment.