[AAE-16968] Add boolean type (#8972)

* [AAE-16968] Update variable mapper service

* Update DetaColumnComponent

* [AAE-16968] Update DataColumnTypes interface

* [AAE-16968] Handle boolean column on UI

* [AAE-16968] Create BooleanCellComponent

* [AAE-16968] Delete comment

* [AAE-16968] Update BooleanCellComponent

* [AAE-16968] Delete unnecessary css classes

* [AAE-16968] Allow for string values

* [AAE-16968] Update test for datatable

* [AAE-16968] Update tests for boolean cell

* [AAE-16968] Update tests for VariableMapperService

* [AAE-16968] Add boolean pipe

* [AAE-16968] Update pipe

* [AAE-16968] Update code formatting

* [AAE-16968] Add doc for the boolean pipe

* [AAE-16968] Update DataColumnComponent doc

* [AAE-16968] Delete unnecessary class

* [AAE-16968] Fix title bug

* [AAE-16968] Update BooleanCell tests

* [AAE-16968] Update Boolean pipe

* [AAE-16968] Update tests for variable mapper service

* [AAE-16968] Update PipesModule

* [AAE-16968] Small fix

* [AAE-16968] Fix lint error
This commit is contained in:
Wiktor Danielewski
2023-10-19 09:00:27 +02:00
committed by GitHub
parent cda12730f6
commit b49c86fda5
15 changed files with 538 additions and 16 deletions

View File

@@ -20,27 +20,31 @@ import { getProcessInstanceVariableMock } from '../mock/process-instance-variabl
import { ProcessListDataColumnCustomData } from '../models/data-column-custom-data';
import { ProcessInstanceVariable } from '../models/process-instance-variable.model';
import { VariableMapperService } from './variable-mapper.sevice';
import { getDataColumnMock } from '@alfresco/adf-core';
import { DataColumn, getDataColumnMock } from '@alfresco/adf-core';
describe('VariableMapperService', () => {
let service: VariableMapperService;
let variable: ProcessInstanceVariable;
let column: DataColumn<ProcessListDataColumnCustomData>;
let objectWithVariables: { variables: ProcessInstanceVariable[] };
const checkTypeMapping = (processVariableType: string, expectedColumnType: string) => {
variable.type = processVariableType;
const viewModel = service.mapVariablesByColumnTitle([objectWithVariables], [column]);
expect(viewModel[0].variablesMap[column.title].type).toEqual(expectedColumnType);
};
beforeEach(() => {
service = new VariableMapperService();
});
it('should map variables by column title', () => {
const variable: ProcessInstanceVariable = getProcessInstanceVariableMock({
variable = getProcessInstanceVariableMock({
processDefinitionKey: 'processKey',
name: 'variableName'
});
const objectWithVariables = {
variables: [variable]
};
const column = getDataColumnMock<ProcessListDataColumnCustomData>({
title: 'column name',
column = getDataColumnMock<ProcessListDataColumnCustomData>({
title: 'Column Name',
key: '',
customData: {
variableDefinitionsPayload: ['processKey/variableName'],
@@ -49,8 +53,12 @@ describe('VariableMapperService', () => {
}
});
const viewModel = service.mapVariablesByColumnTitle([objectWithVariables], [column]);
objectWithVariables = {
variables: [variable]
};
});
it('should map variables by column title', () => {
const expectedObjectWithVariableMap = {
...objectWithVariables,
variablesMap: {
@@ -58,6 +66,34 @@ describe('VariableMapperService', () => {
}
};
const viewModel = service.mapVariablesByColumnTitle([objectWithVariables], [column]);
expect(viewModel).toEqual([expectedObjectWithVariableMap]);
});
describe('should map correct column type according to process variable type in case of', () => {
it('date type', () => {
checkTypeMapping('boolean', 'boolean');
});
it('integer type', () => {
checkTypeMapping('integer', 'text');
});
it('string type', () => {
checkTypeMapping('string', 'text');
});
it('date type', () => {
checkTypeMapping('date', 'date');
});
it('datetime type', () => {
checkTypeMapping('datetime', 'date');
});
it('other types', () => {
checkTypeMapping('custom', 'text');
});
});
});

View File

@@ -78,6 +78,7 @@ export class VariableMapperService {
private mapProcessVariableTypes(variableType: string): DataColumnType {
switch (variableType) {
case 'boolean':
return 'boolean';
case 'integer':
case 'string':
return 'text';