[ACS-7429] cleanup APS1 task-list before refactorings (#9650)

This commit is contained in:
Denys Vuika
2024-05-07 14:51:56 -04:00
committed by GitHub
parent e749473a32
commit 20ee286902
42 changed files with 266 additions and 992 deletions

View File

@@ -55,7 +55,6 @@ import { CloudViewerComponent } from './components/cloud/cloud-viewer.component'
import { ProcessDetailsCloudDemoComponent } from './components/cloud/process-details-cloud-demo.component';
import { StartTaskCloudDemoComponent } from './components/cloud/start-task-cloud-demo.component';
import { StartProcessCloudDemoComponent } from './components/cloud/start-process-cloud-demo.component';
import { CloudBreadcrumbsComponent } from './components/cloud/cloud-breadcrumb-component';
import { CloudFiltersDemoComponent } from './components/cloud/cloud-filters-demo.component';
import { FormCloudDemoComponent } from './components/app-layout/cloud/form-demo/cloud-form-demo.component';
import { environment } from '../environments/environment';
@@ -119,7 +118,6 @@ import { FolderDirectiveModule } from './folder-directive';
ProcessDetailsCloudDemoComponent,
StartTaskCloudDemoComponent,
StartProcessCloudDemoComponent,
CloudBreadcrumbsComponent,
CloudFiltersDemoComponent,
FormCloudDemoComponent,
CustomEditorComponent,

View File

@@ -1,4 +0,0 @@
<adf-toolbar>
<div class="app-crumb">{{appName + ' >'}} </div>
<div class="app-filter-crumb"> {{filterName | translate}}</div>
</adf-toolbar>

View File

@@ -1,14 +0,0 @@
app-cloud-breadcrumbs {
.app-app-crumb {
opacity: 0.5;
}
.app-filter-crumb {
opacity: 0.8;
margin-left: 5px;
}
adf-toolbar {
display: flex;
}
}

View File

@@ -1,43 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-cloud-breadcrumbs',
templateUrl: './cloud-breadcrumb-component.html',
styleUrls: ['./cloud-breadcrumb-component.scss'],
encapsulation: ViewEncapsulation.None
})
export class CloudBreadcrumbsComponent implements OnInit {
appName: string;
filterName: string;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.route.parent.params.subscribe(params => {
this.appName = params.appName;
});
this.route.queryParams.subscribe(params => {
if (params.filterName) {
this.filterName = params.filterName;
}
});
}
}

View File

@@ -3,7 +3,10 @@
<adf-sidenav-layout [sidenavMin]="70" [sidenavMax]="270" [stepOver]="780">
<adf-sidenav-layout-header>
<ng-template>
<app-cloud-breadcrumbs></app-cloud-breadcrumbs>
<div class="app-cloud-layout-toolbar">
<span>{{appName}}</span>
<span *ngIf="filterName">{{ ' > ' + (filterName | translate)}}</span>
</div>
</ng-template>
</adf-sidenav-layout-header>
<adf-sidenav-layout-navigation>

View File

@@ -2,10 +2,6 @@
overflow: auto;
}
.app-cloud-layout-tab-body .mat-tab-body-wrapper {
height: 100%;
}
app-cloud-layout {
.app-cloud-layout-tab-body {
height: 100%;
@@ -18,5 +14,13 @@ app-cloud-layout {
box-sizing: border-box;
display: flex;
}
& > div {
height: 100%;
}
}
.app-cloud-layout-toolbar {
display: flex;
}
}

View File

@@ -26,14 +26,10 @@ import { CloudLayoutService } from './services/cloud-layout.service';
encapsulation: ViewEncapsulation.None
})
export class CloudLayoutComponent implements OnInit {
displayMenu = true;
appName: string;
filterName: string;
constructor(
private router: Router,
private route: ActivatedRoute,
private cloudLayoutService: CloudLayoutService
) { }
constructor(private router: Router, private route: ActivatedRoute, private cloudLayoutService: CloudLayoutService) {}
ngOnInit() {
let root: string = '';
@@ -53,6 +49,10 @@ export class CloudLayoutComponent implements OnInit {
if (root === 'processes' && params.id) {
this.cloudLayoutService.setCurrentProcessFilterParam({ id: params.id });
}
if (params.filterName) {
this.filterName = params.filterName;
}
});
}

View File

@@ -347,7 +347,6 @@
</section>
<div *ngIf="!acceptedFilesTypeShow">
<adf-upload-button
#uploadButton
[disabled]="!enableUpload"
[rootFolderId]="documentList.currentFolderId"
[multipleFiles]="multipleFileUpload"
@@ -362,7 +361,6 @@
</div>
<div *ngIf="acceptedFilesTypeShow">
<adf-upload-button
#uploadButton
[disabled]="!enableUpload"
[rootFolderId]="documentList.currentFolderId"
[acceptedFilesType]="acceptedFilesType"

View File

@@ -10,7 +10,7 @@
</adf-form>
</div>
<div class="app-console" #console>
<div class="app-console">
<h3>Error log:</h3>
<p *ngFor="let error of errorFields">Error {{ error.name }} {{error.validationSummary.message | translate}}</p>
</div>

View File

@@ -15,8 +15,16 @@
* limitations under the License.
*/
import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService, CoreAutomationService, FormRenderingService } from '@alfresco/adf-core';
import { Component, inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import {
FormModel,
FormFieldModel,
FormService,
FormOutcomeEvent,
NotificationService,
CoreAutomationService,
FormRenderingService
} from '@alfresco/adf-core';
import { ProcessFormRenderingService } from '@alfresco/adf-process-services';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { Subject } from 'rxjs';
@@ -33,6 +41,10 @@ import { takeUntil } from 'rxjs/operators';
encapsulation: ViewEncapsulation.None
})
export class FormComponent implements OnInit, OnDestroy {
private formService = inject(FormService);
private notificationService = inject(NotificationService);
private automationService = inject(CoreAutomationService);
form: FormModel;
errorFields: FormFieldModel[] = [];
formConfig: string;
@@ -49,25 +61,16 @@ export class FormComponent implements OnInit, OnDestroy {
private onDestroy$ = new Subject<boolean>();
constructor(@Inject(FormService) private formService: InMemoryFormService,
private notificationService: NotificationService,
private automationService: CoreAutomationService) {
}
logErrors(errorFields: FormFieldModel[]) {
this.errorFields = errorFields;
}
ngOnInit() {
this.formService.executeOutcome
.pipe(takeUntil(this.onDestroy$))
.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
formOutcomeEvent.preventDefault();
});
this.formService.executeOutcome.pipe(takeUntil(this.onDestroy$)).subscribe((formOutcomeEvent: FormOutcomeEvent) => {
formOutcomeEvent.preventDefault();
});
this.formConfig = JSON.stringify(
this.automationService.forms.getFormDefinition()
);
this.formConfig = JSON.stringify(this.automationService.forms.getFormDefinition());
this.parseForm();
}

View File

@@ -1,53 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable */
import { Component, NgModule } from '@angular/core';
import { WidgetComponent } from '@alfresco/adf-core';
@Component({
selector: 'custom-editor',
template: `
<div style="color: red">Look, I'm a custom editor!</div>
`
})
export class CustomEditorComponent extends WidgetComponent {
constructor() {
super();
}
}
@Component({
selector: 'custom-stencil-01',
template: `<div style="color: green">ADF version of custom ProcessService stencil</div>`
})
export class CustomStencil01 extends WidgetComponent {
constructor() {
super();
}
}
@NgModule({
declarations: [ CustomEditorComponent, CustomStencil01 ],
exports: [ CustomEditorComponent, CustomStencil01 ]
})
export class CustomEditorsModule {
}

View File

@@ -50,17 +50,16 @@
class="app-grid-item app-tasks-details"
*ngIf="!isStartTaskMode()"
data-automation-id="app-tasks-details">
<adf-task-details #activitiDetails
[debugMode]="true"
[taskId]="currentTaskId"
[showFormTitle]="true"
[fieldValidators]="fieldValidators"
[showHeaderContent]="true"
(formCompleted)="onFormCompleted()"
(formContentClicked)="onContentClick($event)"
(taskCreated)="onTaskCreated($event)"
(assignTask)="onAssignTask()"
(taskDeleted)="onTaskDeleted()">
<adf-task-details
[taskId]="currentTaskId"
[showFormTitle]="true"
[fieldValidators]="fieldValidators"
[showHeaderContent]="true"
(formCompleted)="onFormCompleted()"
(formContentClicked)="onContentClick($event)"
(taskCreated)="onTaskCreated($event)"
(assignTask)="onAssignTask()"
(taskDeleted)="onTaskDeleted()">
</adf-task-details>
<div *ngIf="currentTaskId">
@@ -129,14 +128,12 @@
<adf-pagination
*ngIf="processList"
[target]="processList"
(changePageSize)="onChangePageSize($event)"
#processListPagination>
(changePageSize)="onChangePageSize($event)">
</adf-pagination>
</div>
<div class="app-grid-item app-processes-details" *ngIf="!isStartProcessMode()">
<adf-process-instance-details
#activitiProcessDetails
[processInstanceId]="currentProcessInstanceId"
(processCancelled)="processCancelled()"
(showProcessDiagram)="onShowProcessDiagram($event)"

View File

@@ -16,32 +16,26 @@
*/
// eslint-disable-next-line
import {
AfterViewInit,
Component,
ElementRef,
Input,
OnDestroy,
OnInit,
ViewChild,
ViewEncapsulation,
EventEmitter,
Output
} from '@angular/core';
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi } from '@alfresco/js-api';
import {
FORM_FIELD_VALIDATORS, FormRenderingService, FormService, AppConfigService, PaginationComponent, UserPreferenceValues,
AlfrescoApiService, UserPreferencesService, NotificationService
FORM_FIELD_VALIDATORS,
FormRenderingService,
FormService,
AppConfigService,
PaginationComponent,
UserPreferenceValues,
AlfrescoApiService,
UserPreferencesService,
NotificationService
} from '@alfresco/adf-core';
import {
ProcessFiltersComponent,
ProcessInstance,
ProcessInstanceDetailsComponent,
ProcessInstanceListComponent,
StartProcessInstanceComponent,
FilterRepresentationModel,
TaskDetailsComponent,
TaskDetailsEvent,
TaskFiltersComponent,
TaskListComponent,
@@ -51,7 +45,6 @@ import {
DynamicTableRow
} from '@alfresco/adf-process-services';
import { Subject } from 'rxjs';
import { CustomStencil01 } from './custom-editor/custom-editor.component';
import { DemoFieldValidator } from './demo-field-validator';
import { PreviewService } from '../../services/preview.service';
import { Location } from '@angular/common';
@@ -69,18 +62,12 @@ const REPORT_ROUTE = 2;
templateUrl: './process-service.component.html',
styleUrls: ['./process-service.component.scss'],
encapsulation: ViewEncapsulation.None,
providers: [
{ provide: FormRenderingService, useClass: ProcessFormRenderingService }
]
providers: [{ provide: FormRenderingService, useClass: ProcessFormRenderingService }]
})
export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit {
@ViewChild('activitiFilter')
activitiFilter: TaskFiltersComponent;
@ViewChild('processListPagination')
processListPagination: PaginationComponent;
@ViewChild('taskListPagination')
taskListPagination: PaginationComponent;
@@ -93,12 +80,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
@ViewChild('processList')
processList: ProcessInstanceListComponent;
@ViewChild('activitiProcessDetails')
activitiProcessDetails: ProcessInstanceDetailsComponent;
@ViewChild('activitiDetails')
activitiDetails: TaskDetailsComponent;
@ViewChild('activitiStartProcess')
activitiStartProcess: StartProcessInstanceComponent;
@@ -133,40 +114,31 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
presetColumn = 'default';
showApplications: boolean;
applicationId: number;
processDefinitionName: string;
fieldValidators = [
...FORM_FIELD_VALIDATORS,
new DemoFieldValidator()
];
fieldValidators = [...FORM_FIELD_VALIDATORS, new DemoFieldValidator()];
private onDestroy$ = new Subject<boolean>();
private scriptFileApi: ScriptFilesApi;
constructor(private elementRef: ElementRef,
private route: ActivatedRoute,
private router: Router,
private apiService: AlfrescoApiService,
private appConfig: AppConfigService,
private preview: PreviewService,
formRenderingService: FormRenderingService,
formService: FormService,
private location: Location,
private notificationService: NotificationService,
private preferenceService: UserPreferencesService) {
constructor(
private elementRef: ElementRef,
private route: ActivatedRoute,
private router: Router,
private apiService: AlfrescoApiService,
private appConfig: AppConfigService,
private preview: PreviewService,
formService: FormService,
private location: Location,
private notificationService: NotificationService,
private preferenceService: UserPreferencesService
) {
this.scriptFileApi = new ScriptFilesApi(this.apiService.getInstance());
this.defaultProcessName = this.appConfig.get<string>('adf-start-process.name');
this.defaultProcessDefinitionName = this.appConfig.get<string>('adf-start-process.processDefinitionName');
this.defaultTaskName = this.appConfig.get<string>('adf-start-task.name');
this.processDefinitionName = this.defaultProcessDefinitionName;
// Uncomment this line to replace all 'text' field editors with custom component
// formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true);
// Uncomment this line to map 'custom_stencil_01' to local editor component
formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
this.preferenceService
.select(UserPreferenceValues.PaginationSize)
@@ -177,22 +149,18 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
formService.validateDynamicTableRow
.pipe(takeUntil(this.onDestroy$))
.subscribe(
(validateDynamicTableRowEvent: ValidateDynamicTableRowEvent) => {
const row: DynamicTableRow = validateDynamicTableRowEvent.row;
if (row?.value && row.value.name === 'admin') {
validateDynamicTableRowEvent.summary.isValid = false;
validateDynamicTableRowEvent.summary.message = 'Sorry, wrong value. You cannot use "admin".';
validateDynamicTableRowEvent.preventDefault();
}
.subscribe((validateDynamicTableRowEvent: ValidateDynamicTableRowEvent) => {
const row: DynamicTableRow = validateDynamicTableRowEvent.row;
if (row?.value && row.value.name === 'admin') {
validateDynamicTableRowEvent.summary.isValid = false;
validateDynamicTableRowEvent.summary.message = 'Sorry, wrong value. You cannot use "admin".';
validateDynamicTableRowEvent.preventDefault();
}
);
formService.formContentClicked
.pipe(takeUntil(this.onDestroy$))
.subscribe((content) => {
this.showContentPreview(content);
});
formService.formContentClicked.pipe(takeUntil(this.onDestroy$)).subscribe((content) => {
this.showContentPreview(content);
});
}
ngOnInit() {

View File

@@ -18,7 +18,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { Pagination, ResultSetPaging } from '@alfresco/js-api';
import { SearchConfiguration, SearchForm, SearchQueryBuilderService, SearchService } from '@alfresco/adf-content-services';
import { SearchConfiguration, SearchQueryBuilderService, SearchService } from '@alfresco/adf-content-services';
import { ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
import { combineLatest, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@@ -26,11 +26,10 @@ import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-search-filter-chips',
templateUrl: './search-filter-chips.component.html',
styleUrls: [ './search-filter-chips.component.scss' ],
styleUrls: ['./search-filter-chips.component.scss'],
providers: [SearchService]
})
export class SearchFilterChipsComponent implements OnInit, OnDestroy {
queryParamName = 'q';
searchedWord = '';
data: ResultSetPaging;
@@ -38,15 +37,16 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
isLoading = true;
sorting = ['name', 'asc'];
searchForms: SearchForm[];
showHeader = ShowHeaderMode.Always;
private onDestroy$ = new Subject<boolean>();
constructor(public router: Router,
private preferences: UserPreferencesService,
private queryBuilder: SearchQueryBuilderService,
private route: ActivatedRoute) {
constructor(
public router: Router,
private preferences: UserPreferencesService,
private queryBuilder: SearchQueryBuilderService,
private route: ActivatedRoute
) {
combineLatest([this.route.params, this.queryBuilder.configUpdated])
.pipe(takeUntil(this.onDestroy$))
.subscribe(([params, searchConfig]) => {
@@ -56,7 +56,7 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
if (query) {
this.queryBuilder.userQuery = query;
}
});
});
queryBuilder.paging = {
maxItems: this.preferences.paginationSize,
@@ -69,21 +69,17 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
this.sorting = this.getSorting();
this.queryBuilder.updated
.pipe(takeUntil(this.onDestroy$))
.subscribe(() => {
this.sorting = this.getSorting();
this.isLoading = true;
});
this.queryBuilder.updated.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
this.sorting = this.getSorting();
this.isLoading = true;
});
this.queryBuilder.executed
.pipe(takeUntil(this.onDestroy$))
.subscribe((resultSetPaging: ResultSetPaging) => {
this.queryBuilder.paging.skipCount = 0;
this.queryBuilder.executed.pipe(takeUntil(this.onDestroy$)).subscribe((resultSetPaging: ResultSetPaging) => {
this.queryBuilder.paging.skipCount = 0;
this.onSearchResultLoaded(resultSetPaging);
this.isLoading = false;
});
this.onSearchResultLoaded(resultSetPaging);
this.isLoading = false;
});
if (this.route) {
this.route.params.forEach((params: Params) => {
@@ -92,18 +88,20 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
this.queryBuilder.update();
} else {
this.queryBuilder.userQuery = null;
this.queryBuilder.executed.next(new ResultSetPaging({
list: {
pagination: { totalItems: 0 },
entries: []
}
}));
this.queryBuilder.executed.next(
new ResultSetPaging({
list: {
pagination: { totalItems: 0 },
entries: []
}
})
);
}
});
}
}
private formatSearchQuery(userInput: string, fields = ['cm:name']) {
private formatSearchQuery(userInput: string, fields = ['cm:name']) {
if (!userInput) {
return null;
}