mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-7429] cleanup APS1 task-list before refactorings (#9650)
This commit is contained in:
@@ -50,8 +50,6 @@ const missingRepositories = {
|
||||
'@webassemblyjs/helper-fsm': 'https://github.com/xtuc/webassemblyjs',
|
||||
'@webassemblyjs/ieee754': 'https://github.com/xtuc/webassemblyjs',
|
||||
'@webassemblyjs/leb128': 'https://github.com/xtuc/webassemblyjs',
|
||||
'adf-tslint-rules': 'https://github.com/Alfresco/alfresco-ng2-components',
|
||||
'adf-monaco-extension': 'https://github.com/eromano/aca-monaco-extension',
|
||||
indexof: 'https://github.com/component/indexof',
|
||||
'rxjs-compat': 'https://github.com/ReactiveX/rxjs/tree/master/compat'
|
||||
};
|
||||
|
@@ -62,7 +62,7 @@ export class ChecklistComponent implements OnChanges {
|
||||
|
||||
checklist: TaskDetailsModel[] = [];
|
||||
|
||||
constructor(private activitiTaskList: TaskListService, private dialog: MatDialog) {}
|
||||
constructor(private taskListService: TaskListService, private dialog: MatDialog) {}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
const taskId = changes['taskId'];
|
||||
@@ -75,7 +75,7 @@ export class ChecklistComponent implements OnChanges {
|
||||
getTaskChecklist() {
|
||||
this.checklist = [];
|
||||
if (this.taskId) {
|
||||
this.activitiTaskList.getTaskChecklist(this.taskId).subscribe(
|
||||
this.taskListService.getTaskChecklist(this.taskId).subscribe(
|
||||
(taskDetailsModel) => {
|
||||
taskDetailsModel.forEach((task) => {
|
||||
this.checklist.push(task);
|
||||
@@ -100,7 +100,7 @@ export class ChecklistComponent implements OnChanges {
|
||||
parentTaskId: this.taskId,
|
||||
assignee: { id: this.assignee }
|
||||
});
|
||||
this.activitiTaskList.addTask(newTask).subscribe(
|
||||
this.taskListService.addTask(newTask).subscribe(
|
||||
(taskDetailsModel) => {
|
||||
this.checklist.push(taskDetailsModel);
|
||||
this.checklistTaskCreated.emit(taskDetailsModel);
|
||||
@@ -114,7 +114,7 @@ export class ChecklistComponent implements OnChanges {
|
||||
}
|
||||
|
||||
public delete(taskId: string) {
|
||||
this.activitiTaskList.deleteTask(taskId).subscribe(
|
||||
this.taskListService.deleteTask(taskId).subscribe(
|
||||
() => {
|
||||
this.checklist = this.checklist.filter((check) => check.id !== taskId);
|
||||
this.checklistTaskDeleted.emit(taskId);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<div class="adf-task-details-core">
|
||||
<div class="adf-task-details-core-form">
|
||||
<div *ngIf="isAssigned()">
|
||||
<adf-task-form
|
||||
<adf-task-form #taskForm
|
||||
[taskId]="taskDetails.id"
|
||||
[showFormTitle]="showFormTitle"
|
||||
[showFormRefreshButton]="showFormRefreshButton"
|
||||
@@ -33,9 +33,9 @@
|
||||
(executeOutcome)='onFormExecuteOutcome($event)'
|
||||
(taskClaimed)="onClaimAction($event)"
|
||||
(taskUnclaimed)="onUnclaimAction($event)"
|
||||
(error)="onFormError($event)" #activitiTaskForm>
|
||||
(error)="onFormError($event)">
|
||||
</adf-task-form>
|
||||
<adf-attach-form *ngIf="isShowAttachForm()"
|
||||
<adf-attach-form *ngIf="showAttachForm"
|
||||
[taskId]="taskDetails.id"
|
||||
[formKey]="taskDetails.formKey"
|
||||
(cancelAttachForm)="onCancelAttachForm()"
|
||||
@@ -68,7 +68,7 @@
|
||||
(claim)="onClaimAction($event)"
|
||||
(unclaim)="onUnclaimAction($event)">
|
||||
</adf-task-header>
|
||||
<adf-people *ngIf="showInvolvePeople" #people
|
||||
<adf-people *ngIf="showInvolvePeople"
|
||||
[people]="taskPeople"
|
||||
[readOnly]="internalReadOnlyForm"
|
||||
[taskId]="taskDetails.id">
|
||||
@@ -79,7 +79,6 @@
|
||||
<mat-card *ngIf="showComments">
|
||||
<mat-card-content>
|
||||
<adf-task-comments
|
||||
#activitiComments
|
||||
[readOnly]="isReadOnlyComment()"
|
||||
[taskId]="taskDetails.id"
|
||||
>
|
||||
@@ -92,12 +91,12 @@
|
||||
|
||||
<div *ngIf="showHeaderContent" class="adf-task-details-core-sidebar-checklist">
|
||||
<div *ngIf="showChecklist">
|
||||
<adf-checklist #activitiChecklist
|
||||
[readOnly]="internalReadOnlyForm"
|
||||
[taskId]="taskDetails.id"
|
||||
[assignee]="$any(taskDetails)?.assignee?.id"
|
||||
(checklistTaskCreated)="onChecklistTaskCreated($event)"
|
||||
(checklistTaskDeleted)="onChecklistTaskDeleted($event)">
|
||||
<adf-checklist
|
||||
[readOnly]="internalReadOnlyForm"
|
||||
[taskId]="taskDetails.id"
|
||||
[assignee]="$any(taskDetails)?.assignee?.id"
|
||||
(checklistTaskCreated)="onChecklistTaskCreated($event)"
|
||||
(checklistTaskDeleted)="onChecklistTaskDeleted($event)">
|
||||
</adf-checklist>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -311,7 +311,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activitiComments as any).readOnly).toBe(true);
|
||||
expect(component.isReadOnlyComment()).toBe(true);
|
||||
});
|
||||
|
||||
it('should comments be readonly if the task is complete and user are NOT involved', () => {
|
||||
@@ -323,7 +323,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activitiComments as any).readOnly).toBe(true);
|
||||
expect(component.isReadOnlyComment()).toBe(true);
|
||||
});
|
||||
|
||||
it('should comments NOT be readonly if the task is NOT complete and user are NOT involved', () => {
|
||||
@@ -335,7 +335,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails.endDate = null;
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activitiComments as any).readOnly).toBe(false);
|
||||
expect(component.isReadOnlyComment()).toBe(false);
|
||||
});
|
||||
|
||||
it('should comments NOT be readonly if the task is complete and user are involved', () => {
|
||||
@@ -347,7 +347,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activitiComments as any).readOnly).toBe(false);
|
||||
expect(component.isReadOnlyComment()).toBe(false);
|
||||
});
|
||||
|
||||
it('should comments be present if showComments is true', () => {
|
||||
@@ -358,7 +358,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.activitiComments).toBeDefined();
|
||||
expect(component.showComments).toBe(true);
|
||||
});
|
||||
|
||||
it('should comments NOT be present if showComments is false', () => {
|
||||
@@ -368,7 +368,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.activitiComments).not.toBeDefined();
|
||||
expect(component.showComments).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import {
|
||||
CardViewUpdateService,
|
||||
ClickNotification,
|
||||
CommentsComponent,
|
||||
ContentLinkModel,
|
||||
FormFieldValidator,
|
||||
FormModel,
|
||||
@@ -55,22 +54,12 @@ import { PeopleProcessService } from '../../common/services/people-process.servi
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@ViewChild('activitiComments')
|
||||
activitiComments: CommentsComponent;
|
||||
|
||||
@ViewChild('activitiChecklist')
|
||||
activitiChecklist: any;
|
||||
|
||||
@ViewChild('errorDialog')
|
||||
errorDialog: TemplateRef<any>;
|
||||
|
||||
@ViewChild('activitiTaskForm')
|
||||
@ViewChild('taskForm')
|
||||
taskFormComponent: TaskFormComponent;
|
||||
|
||||
/** Toggles debug mode. */
|
||||
@Input()
|
||||
debugMode: boolean = false;
|
||||
|
||||
/** (**required**) The id of the task whose details we are asking for. */
|
||||
@Input()
|
||||
taskId: string;
|
||||
@@ -177,9 +166,9 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
taskFormName: string = null;
|
||||
taskPeople: UserProcessModel[] = [];
|
||||
noTaskDetailsTemplateComponent: TemplateRef<any>;
|
||||
showAssignee: boolean = false;
|
||||
showAttachForm: boolean = false;
|
||||
internalReadOnlyForm: boolean = false;
|
||||
showAssignee = false;
|
||||
showAttachForm = false;
|
||||
internalReadOnlyForm = false;
|
||||
errorDialogRef: MatDialogRef<TemplateRef<any>>;
|
||||
peopleSearch: Observable<UserProcessModel[]>;
|
||||
data: any;
|
||||
@@ -222,14 +211,6 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
isShowAttachForm(): boolean {
|
||||
return this.showAttachForm;
|
||||
}
|
||||
|
||||
isTaskActive() {
|
||||
return this.taskDetails && this.taskDetails.duration === null;
|
||||
}
|
||||
|
||||
isAssigned(): boolean {
|
||||
return !!this.taskDetails.assignee;
|
||||
}
|
||||
|
@@ -58,7 +58,6 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
unclaim: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
properties: any[] = [];
|
||||
inEdit: boolean = false;
|
||||
displayDateClearAction = false;
|
||||
dateFormat: string;
|
||||
dateLocale: string;
|
||||
@@ -196,10 +195,20 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
return this.taskDetails?.isCompleted() ? 'Completed' : 'Running';
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit the claim event
|
||||
*
|
||||
* @param taskId the id of the task to claim
|
||||
*/
|
||||
onClaimTask(taskId: string) {
|
||||
this.claim.emit(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit the unclaim event
|
||||
*
|
||||
* @param taskId the id of the task to unclaim
|
||||
*/
|
||||
onUnclaimTask(taskId: string) {
|
||||
this.unclaim.emit(taskId);
|
||||
}
|
||||
@@ -213,15 +222,25 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
return !!this.taskDetails?.endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the form is clickable
|
||||
*
|
||||
* @returns `true` if the form is clickable, otherwise `false`
|
||||
*/
|
||||
isFormClickable(): boolean {
|
||||
return !!this.formName && !this.isCompleted();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the task duration
|
||||
*
|
||||
* @returns the task duration in milliseconds
|
||||
*/
|
||||
getTaskDuration(): string {
|
||||
return this.taskDetails.duration ? `${this.taskDetails.duration} ms` : '';
|
||||
}
|
||||
|
||||
private initDefaultProperties(parentInfoMap): any[] {
|
||||
private initDefaultProperties(parentInfoMap: Map<string, string>): any[] {
|
||||
return [
|
||||
new CardViewTextItemModel({
|
||||
label: 'ADF_TASK_LIST.PROPERTIES.ASSIGNEE',
|
||||
|
@@ -1,43 +1,44 @@
|
||||
<div *ngIf="!requestNode">{{ 'ADF_TASK_LIST.FILTERS.MESSAGES.NONE' | translate }}</div>
|
||||
<ng-container *ngIf="requestNode">
|
||||
<adf-datatable
|
||||
[data]="data"
|
||||
[rows]="rows"
|
||||
[columns]="columns"
|
||||
[sorting]="sorting"
|
||||
[loading]="isLoading"
|
||||
[isResizingEnabled]="isResizingEnabled"
|
||||
[blurOnResize]="blurOnResize"
|
||||
[stickyHeader]="stickyHeader"
|
||||
[multiselect]="multiselect"
|
||||
[selectionMode]="selectionMode"
|
||||
[contextMenu]="showContextMenu"
|
||||
(showRowContextMenu)="onShowRowContextMenu($event)"
|
||||
(row-select)="onRowSelect($any($event))"
|
||||
(row-unselect)="onRowUnselect($any($event))"
|
||||
(rowClick)="onRowClick($any($event))"
|
||||
(row-keyup)="onRowKeyUp($any($event))">
|
||||
<adf-loading-content-template>
|
||||
<ng-template>
|
||||
<!--Add your custom loading template here-->
|
||||
<mat-progress-spinner
|
||||
*ngIf="!customLoadingContent"
|
||||
class="adf-task-list-loading-margin"
|
||||
color="primary"
|
||||
mode="indeterminate">
|
||||
</mat-progress-spinner>
|
||||
<ng-content select="adf-custom-loading-content-template"></ng-content>
|
||||
</ng-template>
|
||||
</adf-loading-content-template>
|
||||
<adf-no-content-template>
|
||||
<ng-template>
|
||||
<adf-empty-content *ngIf="!customEmptyContent"
|
||||
icon="assignment"
|
||||
[title]="'ADF_TASK_LIST.LIST.MESSAGES.TITLE' | translate"
|
||||
[subtitle]="'ADF_TASK_LIST.LIST.MESSAGES.SUBTITLE' | translate">
|
||||
</adf-empty-content>
|
||||
<ng-content select="adf-custom-empty-content-template"></ng-content>
|
||||
</ng-template>
|
||||
</adf-no-content-template>
|
||||
</adf-datatable>
|
||||
</ng-container>
|
||||
<adf-datatable
|
||||
*ngIf="requestNode; else noMessagesTemplate"
|
||||
[data]="data"
|
||||
[rows]="rows"
|
||||
[columns]="columns"
|
||||
[sorting]="sorting"
|
||||
[loading]="isLoading"
|
||||
[isResizingEnabled]="isResizingEnabled"
|
||||
[blurOnResize]="blurOnResize"
|
||||
[stickyHeader]="stickyHeader"
|
||||
[multiselect]="multiselect"
|
||||
[selectionMode]="selectionMode"
|
||||
[contextMenu]="showContextMenu"
|
||||
(showRowContextMenu)="onShowRowContextMenu($event)"
|
||||
(row-select)="onRowSelect($any($event))"
|
||||
(row-unselect)="onRowUnselect($any($event))"
|
||||
(rowClick)="onRowClick($any($event))"
|
||||
(row-keyup)="onRowKeyUp($any($event))"
|
||||
>
|
||||
<adf-loading-content-template>
|
||||
<ng-template>
|
||||
<!--Add your custom loading template here-->
|
||||
<mat-progress-spinner *ngIf="!customLoadingContent" class="adf-task-list-loading-margin" color="primary" mode="indeterminate">
|
||||
</mat-progress-spinner>
|
||||
<ng-content select="adf-custom-loading-content-template"></ng-content>
|
||||
</ng-template>
|
||||
</adf-loading-content-template>
|
||||
<adf-no-content-template>
|
||||
<ng-template>
|
||||
<adf-empty-content
|
||||
*ngIf="!customEmptyContent"
|
||||
icon="assignment"
|
||||
[title]="'ADF_TASK_LIST.LIST.MESSAGES.TITLE' | translate"
|
||||
[subtitle]="'ADF_TASK_LIST.LIST.MESSAGES.SUBTITLE' | translate"
|
||||
>
|
||||
</adf-empty-content>
|
||||
<ng-content select="adf-custom-empty-content-template"></ng-content>
|
||||
</ng-template>
|
||||
</adf-no-content-template>
|
||||
</adf-datatable>
|
||||
|
||||
<ng-template #noMessagesTemplate>
|
||||
<div>{{ 'ADF_TASK_LIST.FILTERS.MESSAGES.NONE' | translate }}</div>
|
||||
</ng-template>
|
||||
|
@@ -23,29 +23,26 @@ import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angu
|
||||
styleUrls: ['./task-standalone.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
export class TaskStandaloneComponent {
|
||||
|
||||
/** Name of the task. */
|
||||
@Input()
|
||||
taskName;
|
||||
taskName: string;
|
||||
|
||||
/** Id of the task. */
|
||||
@Input()
|
||||
taskId;
|
||||
taskId: string;
|
||||
|
||||
/** If true then Task completed message is shown and `Complete` and `Cancel` buttons are hidden. */
|
||||
@Input()
|
||||
isCompleted: boolean = false;
|
||||
isCompleted = false;
|
||||
|
||||
/** Toggles rendering of the `Complete` button. */
|
||||
@Input()
|
||||
hasCompletePermission: boolean = true;
|
||||
hasCompletePermission = true;
|
||||
|
||||
// TODO: rename all with show prefix
|
||||
/** Toggles rendering of the `Cancel` button. */
|
||||
@Input()
|
||||
hideCancelButton: boolean = true;
|
||||
hideCancelButton = true;
|
||||
|
||||
/** Emitted when the "Cancel" button is clicked. */
|
||||
@Output()
|
||||
@@ -59,8 +56,6 @@ export class TaskStandaloneComponent {
|
||||
@Output()
|
||||
showAttachForm = new EventEmitter<void>();
|
||||
|
||||
constructor() { }
|
||||
|
||||
onCancelButtonClick(): void {
|
||||
this.cancel.emit();
|
||||
}
|
||||
|
Reference in New Issue
Block a user