various code quality fixes (#5792)

* various code quality fixes

* reduce duplicated code

* add safety check
This commit is contained in:
Denys Vuika 2020-06-18 17:57:46 +01:00 committed by GitHub
parent dc2060fe49
commit e9350bd297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 96 additions and 154 deletions

View File

@ -27,7 +27,7 @@ var server = http.createServer(function (req, res) {
req.on('end', function() { req.on('end', function() {
if (req.url === '/') { if (req.url === '/') {
log('Received message: ' + body); log('Received message: ' + body);
} else if (req.url = '/scheduled') { } else if (req.url === '/scheduled') {
log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']); log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']);
} }

View File

@ -582,10 +582,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
} }
isCustomActionDisabled(node: MinimalNodeEntity): boolean { isCustomActionDisabled(node: MinimalNodeEntity): boolean {
if (node && node.entry && node.entry.name === 'custom') { return !(node && node.entry && node.entry.name === 'custom');
return false;
}
return true;
} }
runCustomAction(event: any) { runCustomAction(event: any) {

View File

@ -394,7 +394,7 @@ To develop the enhancement, edit the `src/app/mydatatable/mydatatable.component.
```ts ```ts
onExecuteRowAction(event: DataRowActionEvent) { onExecuteRowAction(event: DataRowActionEvent) {
if (event.value.action.title = "Greetings") { if (event.value.action.title === "Greetings") {
this.apiService.getInstance().webScript.executeWebScript( this.apiService.getInstance().webScript.executeWebScript(
'GET', 'GET',

View File

@ -101,9 +101,8 @@ describe('Upload component', () => {
afterEach(async () => { afterEach(async () => {
const nbResults = await contentServicesPage.numberOfResultsDisplayed(); const nbResults = await contentServicesPage.numberOfResultsDisplayed();
if (nbResults > 1) { if (nbResults > 1) {
const nodesPromise = await contentServicesPage.getElementsDisplayedId(); const nodeIds = await contentServicesPage.getElementsDisplayedId();
for (const node of nodesPromise) { for (const nodeId of nodeIds) {
const nodeId = await node;
await uploadActions.deleteFileOrFolder(nodeId); await uploadActions.deleteFileOrFolder(nodeId);
} }
} }

View File

@ -91,7 +91,7 @@ describe('Comment component for Processes', () => {
const taskId = taskQuery.data[0].id; const taskId = taskQuery.data[0].id;
const taskComments = await apiService.getInstance().activiti.commentsApi.getTaskComments(taskId, { 'latestFirst': true }); const taskComments = await apiService.getInstance().activiti.commentsApi.getTaskComments(taskId, { 'latestFirst': true });
await expect(await taskComments.total).toEqual(0); await expect(taskComments.total).toEqual(0);
}); });
it('[C260466] Should be able to display comments from Task on the related Process', async () => { it('[C260466] Should be able to display comments from Task on the related Process', async () => {

View File

@ -302,13 +302,16 @@ async function checkIfAppIsReleased(absentApps: any []) {
async function checkDescriptorExist(name: string) { async function checkDescriptorExist(name: string) {
logger.info(`Check descriptor ${name} exist in the list `); logger.info(`Check descriptor ${name} exist in the list `);
const descriptorList = await getDescriptors(); const descriptorList = await getDescriptors();
descriptorList.list.entries.forEach(async (descriptor: any) => {
if (descriptorList && descriptorList.list && descriptorList.entries) {
for (const descriptor of descriptorList.list.entries) {
if (descriptor.entry.name === name) { if (descriptor.entry.name === name) {
if (descriptor.entry.deployed === false) { if (descriptor.entry.deployed === false) {
await deleteDescriptor(descriptor.entry.name); await deleteDescriptor(descriptor.entry.name);
} }
} }
}); }
}
return false; return false;
} }
@ -316,7 +319,7 @@ async function importProjectAndRelease(app: any) {
await getFileFromRemote(app.file_location, app.name); await getFileFromRemote(app.file_location, app.name);
logger.warn('Project imported ' + app.name); logger.warn('Project imported ' + app.name);
const projectRelease = await importAndReleaseProject(`${app.name}.zip`); const projectRelease = await importAndReleaseProject(`${app.name}.zip`);
deleteLocalFile(`${app.name}`); await deleteLocalFile(`${app.name}`);
return projectRelease; return projectRelease;
} }

View File

@ -136,7 +136,7 @@ export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
} }
hasPreviousNodes(): boolean { hasPreviousNodes(): boolean {
return this.previousNodes ? true : false; return !!this.previousNodes;
} }
parseRoute(node: Node): PathElementEntity[] { parseRoute(node: Node): PathElementEntity[] {

View File

@ -210,7 +210,7 @@ export class ContentNodeDialogService {
actionName: action, actionName: action,
currentFolderId: contentEntry.id, currentFolderId: contentEntry.id,
imageResolver: this.imageResolver.bind(this), imageResolver: this.imageResolver.bind(this),
isSelectionValid: this.isNodeFile.bind(this), isSelectionValid: (entry: Node) => entry.isFile,
select: select, select: select,
showFilesInResult showFilesInResult
}; };
@ -234,10 +234,6 @@ export class ContentNodeDialogService {
return null; return null;
} }
private isNodeFile(entry: Node): boolean {
return entry.isFile;
}
private hasAllowableOperationsOnNodeFolder(entry: Node): boolean { private hasAllowableOperationsOnNodeFolder(entry: Node): boolean {
return this.isNodeFolder(entry) && this.contentService.hasAllowableOperations(entry, 'create'); return this.isNodeFolder(entry) && this.contentService.hasAllowableOperations(entry, 'create');
} }

View File

@ -87,7 +87,7 @@ describe('NodeSharedDirective', () => {
}); });
it('should have share button disabled when selection is empty', async () => { it('should have share button disabled when selection is empty', async () => {
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(shareButtonElement.disabled).toBe(true); expect(shareButtonElement.disabled).toBe(true);
}); });
@ -96,7 +96,7 @@ describe('NodeSharedDirective', () => {
component.documentList.selection = [selection]; component.documentList.selection = [selection];
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(shareButtonElement.disabled).toBe(false); expect(shareButtonElement.disabled).toBe(false);
}); });
@ -106,7 +106,7 @@ describe('NodeSharedDirective', () => {
component.documentList.selection = [selection]; component.documentList.selection = [selection];
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(shareButtonElement.disabled).toBe(true); expect(shareButtonElement.disabled).toBe(true);
}); });
@ -115,7 +115,7 @@ describe('NodeSharedDirective', () => {
component.documentList.selection = [selection]; component.documentList.selection = [selection];
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(shareButtonElement.title).toBe('Not Shared'); expect(shareButtonElement.title).toBe('Not Shared');
}); });
@ -124,7 +124,7 @@ describe('NodeSharedDirective', () => {
selection.entry.properties['qshare:sharedId'] = 'someId'; selection.entry.properties['qshare:sharedId'] = 'someId';
component.documentList.selection = [selection]; component.documentList.selection = [selection];
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(shareButtonElement.title).toBe('Shared'); expect(shareButtonElement.title).toBe('Shared');
@ -135,7 +135,7 @@ describe('NodeSharedDirective', () => {
component.documentList.selection = [selection]; component.documentList.selection = [selection];
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
shareButtonElement.click(); shareButtonElement.click();

View File

@ -101,7 +101,7 @@ export class SearchControlComponent implements OnDestroy {
) {} ) {}
isNoSearchTemplatePresent(): boolean { isNoSearchTemplatePresent(): boolean {
return this.emptySearchTemplate ? true : false; return !!this.emptySearchTemplate;
} }
ngOnDestroy(): void { ngOnDestroy(): void {

View File

@ -96,7 +96,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
/** /**
* Upload a list of file in the specified path * Upload a list of file in the specified path
* @param files * @param files
* @param path
*/ */
uploadFiles(files: File[]): void { uploadFiles(files: File[]): void {
const filteredFiles: FileModel[] = files const filteredFiles: FileModel[] = files
@ -152,17 +151,16 @@ export abstract class UploadBase implements OnInit, OnDestroy {
.split(',') .split(',')
.map((ext) => ext.trim().replace(/^\./, '')); .map((ext) => ext.trim().replace(/^\./, ''));
if (allowedExtensions.indexOf(file.extension) !== -1) { return allowedExtensions.indexOf(file.extension) !== -1;
return true;
}
return false;
} }
/** /**
* Creates FileModel from File * Creates FileModel from File
* *
* @param file * @param file
* @param parentId
* @param path
* @param id
*/ */
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel { protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
return new FileModel(file, { return new FileModel(file, {

View File

@ -55,7 +55,7 @@ export class VersionUploadComponent {
} }
isMajorVersion(): boolean { isMajorVersion(): boolean {
return this.semanticVersion === 'minor' ? false : true; return this.semanticVersion !== 'minor';
} }
cancelUpload() { cancelUpload() {

View File

@ -31,11 +31,7 @@ export class ButtonsMenuComponent implements AfterContentInit {
isMenuEmpty: boolean; isMenuEmpty: boolean;
ngAfterContentInit() { ngAfterContentInit() {
if (this.buttons.length > 0) { this.isMenuEmpty = this.buttons.length <= 0;
this.isMenuEmpty = false;
} else {
this.isMenuEmpty = true;
}
} }
isMobile(): boolean { isMobile(): boolean {

View File

@ -175,14 +175,14 @@ export class CommentsComponent implements OnChanges {
} }
isATask(): boolean { isATask(): boolean {
return this.taskId ? true : false; return !!this.taskId;
} }
isANode(): boolean { isANode(): boolean {
return this.nodeId ? true : false; return !!this.nodeId;
} }
private sanitize(input: string) { private sanitize(input: string): string {
return input.replace(/<[^>]+>/g, '') return input.replace(/<[^>]+>/g, '')
.replace(/^\s+|\s+$|\s+(?=\s)/g, '') .replace(/^\s+|\s+$|\s+(?=\s)/g, '')
.replace(/\r?\n/g, '<br/>'); .replace(/\r?\n/g, '<br/>');

View File

@ -285,7 +285,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
} }
isPropertyChanged(property: SimpleChange): boolean { isPropertyChanged(property: SimpleChange): boolean {
return property && property.currentValue ? true : false; return !!(property && property.currentValue);
} }
convertToRowsData(rows: any []): ObjectDataRow[] { convertToRowsData(rows: any []): ObjectDataRow[] {
@ -375,7 +375,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
this.rowMenuCache = {}; this.rowMenuCache = {};
} }
isTableEmpty() { isTableEmpty(): boolean {
return this.data === undefined || this.data === null; return this.data === undefined || this.data === null;
} }

View File

@ -44,7 +44,7 @@ export class EditJsonDialogComponent implements OnInit {
ngOnInit() { ngOnInit() {
if (this.settings) { if (this.settings) {
this.editable = this.settings.editable ? true : false; this.editable = this.settings.editable;
this.value = this.settings.value || ''; this.value = this.settings.value || '';
this.title = this.settings.title || 'JSON'; this.title = this.settings.title || 'JSON';
} }

View File

@ -98,7 +98,7 @@ export abstract class FormBaseComponent {
} }
hasForm(): boolean { hasForm(): boolean {
return this.form ? true : false; return !!this.form;
} }
isTitleEnabled(): boolean { isTitleEnabled(): boolean {

View File

@ -53,19 +53,19 @@
} }
hasPreviewStatus(): boolean { hasPreviewStatus(): boolean {
return this.previewStatus === 'supported' ? true : false; return this.previewStatus === 'supported';
} }
isTypeImage(): boolean { isTypeImage(): boolean {
return this.simpleType === 'image' ? true : false; return this.simpleType === 'image';
} }
isTypePdf(): boolean { isTypePdf(): boolean {
return this.simpleType === 'pdf' ? true : false; return this.simpleType === 'pdf';
} }
isTypeDoc(): boolean { isTypeDoc(): boolean {
return this.simpleType === 'word' || this.simpleType === 'content' ? true : false; return this.simpleType === 'word' || this.simpleType === 'content';
} }
isThumbnailReady(): boolean { isThumbnailReady(): boolean {

View File

@ -27,8 +27,8 @@ export class ErrorMessageModel {
this.attributes = new Map(); this.attributes = new Map();
} }
isActive() { isActive(): boolean {
return this.message ? true : false; return !!this.message;
} }
getAttributesAsJsonObj() { getAttributesAsJsonObj() {

View File

@ -80,7 +80,7 @@ export class RequiredFieldValidator implements FormFieldValidator {
} }
if (field.type === FormFieldTypes.BOOLEAN) { if (field.type === FormFieldTypes.BOOLEAN) {
return field.value ? true : false; return !!field.value;
} }
if (field.value === null || field.value === undefined || field.value === '') { if (field.value === null || field.value === undefined || field.value === '') {

View File

@ -221,7 +221,7 @@ export class FormFieldModel extends FormWidgetModel {
} }
private isTypeaheadFieldType(type: string): boolean { private isTypeaheadFieldType(type: string): boolean {
return type === 'typeahead' ? true : false; return type === 'typeahead';
} }
private getFieldNameWithLabel(name: string): string { private getFieldNameWithLabel(name: string): string {
@ -419,11 +419,7 @@ export class FormFieldModel extends FormWidgetModel {
* @param type * @param type
*/ */
isInvalidFieldType(type: string) { isInvalidFieldType(type: string) {
if (type === 'container') { return type === 'container';
return true;
} else {
return false;
}
} }
getOptionName(): string { getOptionName(): string {

View File

@ -154,7 +154,7 @@ export class FormModel {
} }
} }
this.isValid = errorsField.length > 0 ? false : true; this.isValid = errorsField.length <= 0;
if (this.formService) { if (this.formService) {
validateFormEvent.isValid = this.isValid; validateFormEvent.isValid = this.isValid;

View File

@ -110,7 +110,7 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit {
} }
isReadOnlyType(): boolean { isReadOnlyType(): boolean {
return this.field.type === 'readonly' ? true : false; return this.field.type === 'readonly';
} }
} }

View File

@ -180,7 +180,7 @@ export class DynamicTableModel extends FormWidgetModel {
} }
if (column.type === 'Boolean') { if (column.type === 'Boolean') {
return rowValue ? true : false; return !!rowValue;
} }
if (column.type === 'Date') { if (column.type === 'Date') {

View File

@ -59,8 +59,8 @@ export class WidgetComponent implements AfterViewInit {
constructor(public formService?: FormService) { constructor(public formService?: FormService) {
} }
hasField() { hasField(): boolean {
return this.field ? true : false; return !!this.field;
} }
// Note for developers: // Note for developers:
@ -73,7 +73,7 @@ export class WidgetComponent implements AfterViewInit {
} }
isValid(): boolean { isValid(): boolean {
return this.field.validationSummary ? true : false; return !!this.field.validationSummary;
} }
hasValue(): boolean { hasValue(): boolean {

View File

@ -74,7 +74,6 @@ describe('HeaderLayoutComponent', () => {
const logo = fixture.nativeElement.querySelector('.adf-app-logo'); const logo = fixture.nativeElement.querySelector('.adf-app-logo');
const src = logo.getAttribute('src'); const src = logo.getAttribute('src');
expect(logo === null).toBeFalsy();
expect(src).toEqual('logo.png'); expect(src).toEqual('logo.png');
}); });

View File

@ -71,8 +71,8 @@ export class LicenseModel {
this.remainingDays = obj.remainingDays || null; this.remainingDays = obj.remainingDays || null;
this.holder = obj.holder || null; this.holder = obj.holder || null;
this.mode = obj.mode || null; this.mode = obj.mode || null;
this.isClusterEnabled = obj.isClusterEnabled ? true : false; this.isClusterEnabled = !!obj.isClusterEnabled;
this.isCryptodocEnabled = obj.isCryptodocEnabled ? true : false; this.isCryptodocEnabled = !!obj.isCryptodocEnabled;
} }
} }
} }
@ -85,10 +85,10 @@ export class VersionStatusModel {
constructor(obj?: any) { constructor(obj?: any) {
if (obj) { if (obj) {
this.isReadOnly = obj.isReadOnly ? true : false; this.isReadOnly = !!obj.isReadOnly;
this.isAuditEnabled = obj.isAuditEnabled ? true : false; this.isAuditEnabled = !!obj.isAuditEnabled;
this.isQuickShareEnabled = obj.isQuickShareEnabled ? true : false; this.isQuickShareEnabled = !!obj.isQuickShareEnabled;
this.isThumbnailGenerationEnabled = obj.isThumbnailGenerationEnabled ? true : false; this.isThumbnailGenerationEnabled = !!obj.isThumbnailGenerationEnabled;
} }
} }
} }

View File

@ -28,7 +28,7 @@ export class FileSizePipe implements PipeTransform {
} }
transform(bytes: number, decimals: number = 2): string { transform(bytes: number, decimals: number = 2): string {
if (bytes == null || bytes === undefined) { if (bytes == null) {
return ''; return '';
} }

View File

@ -25,7 +25,7 @@ export class FileTypePipe implements PipeTransform {
transform(value: string) { transform(value: string) {
if ( value == null || value === undefined ) { if ( value == null ) {
return ''; return '';
} else { } else {
const fileInfo = value.substring(value.lastIndexOf('/') + 1).replace(/\.[a-z]+/, ''); const fileInfo = value.substring(value.lastIndexOf('/') + 1).replace(/\.[a-z]+/, '');

View File

@ -157,7 +157,7 @@ export class AuthenticationService {
* @returns True if set, false otherwise * @returns True if set, false otherwise
*/ */
isRememberMeSet(): boolean { isRememberMeSet(): boolean {
return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) === null) ? false : true; return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) !== null);
} }
/** /**

View File

@ -287,10 +287,7 @@ export class IdentityGroupService {
checkGroupHasClientApp(groupId: string, clientId: string): Observable<boolean> { checkGroupHasClientApp(groupId: string, clientId: string): Observable<boolean> {
return this.getClientRoles(groupId, clientId).pipe( return this.getClientRoles(groupId, clientId).pipe(
map((response: any[]) => { map((response: any[]) => {
if (response && response.length > 0) { return response && response.length > 0;
return true;
}
return false;
}), }),
catchError((error) => this.handleError(error)) catchError((error) => this.handleError(error))
); );

View File

@ -201,10 +201,7 @@ export class IdentityUserService {
checkUserHasClientApp(userId: string, clientId: string): Observable<boolean> { checkUserHasClientApp(userId: string, clientId: string): Observable<boolean> {
return this.getClientRoles(userId, clientId).pipe( return this.getClientRoles(userId, clientId).pipe(
map((clientRoles: any[]) => { map((clientRoles: any[]) => {
if (clientRoles.length > 0) { return clientRoles.length > 0;
return true;
}
return false;
}) })
); );
} }

View File

@ -82,7 +82,7 @@ export class UploadService {
* @returns True if a file is uploading, false otherwise * @returns True if a file is uploading, false otherwise
*/ */
isUploading(): boolean { isUploading(): boolean {
return this.activeTask ? true : false; return !!this.activeTask;
} }
/** /**

View File

@ -120,8 +120,8 @@ export class AnalyticsGeneratorComponent implements OnChanges {
return this.showDetails; return this.showDetails;
} }
isCurrent(position: number) { isCurrent(position: number): boolean {
return position === this.currentChartPosition ? true : false; return position === this.currentChartPosition;
} }
selectCurrent(position: number) { selectCurrent(position: number) {

View File

@ -85,10 +85,10 @@ export class AnalyticsReportHeatMapComponent implements OnInit {
}); });
} }
hasMetric() { hasMetric(): boolean {
return (this.report.totalCountsPercentages || return !!(this.report.totalCountsPercentages ||
this.report.totalTimePercentages || this.report.totalTimePercentages ||
this.report.avgTimePercentages) ? true : false; this.report.avgTimePercentages);
} }
} }

View File

@ -171,15 +171,15 @@ export class AnalyticsReportListComponent implements OnInit {
this.selectFirst = false; this.selectFirst = false;
} }
isSelected(report: any) { isSelected(report: any): boolean {
return this.currentReport === report ? true : false; return this.currentReport === report;
} }
isList() { isList(): boolean {
return this.layoutType === AnalyticsReportListComponent.LAYOUT_LIST; return this.layoutType === AnalyticsReportListComponent.LAYOUT_LIST;
} }
isGrid() { isGrid(): boolean {
return this.layoutType === AnalyticsReportListComponent.LAYOUT_GRID; return this.layoutType === AnalyticsReportListComponent.LAYOUT_GRID;
} }
} }

View File

@ -35,8 +35,8 @@ export class WidgetComponent implements OnChanges {
} }
} }
hasField() { hasField(): boolean {
return this.field ? true : false; return !!this.field;
} }
hasValue(): boolean { hasValue(): boolean {

View File

@ -101,7 +101,7 @@ export class BarChart extends Chart {
}; };
}; };
hasDatasets() { hasDatasets(): boolean {
return this.datasets && this.datasets.length > 0 ? true : false; return this.datasets && this.datasets.length > 0;
} }
} }

View File

@ -28,7 +28,7 @@ export class DetailsTableChart extends TableChart {
} }
} }
hasDetailsTable() { hasDetailsTable(): boolean {
return this.detailsTable ? true : false; return !!this.detailsTable;
} }
} }

View File

@ -365,11 +365,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
} }
this.executeOutcome.emit(args); this.executeOutcome.emit(args);
if (args.defaultPrevented) { return !args.defaultPrevented;
return false;
}
return true;
} }
protected storeFormAsMetadata() { protected storeFormAsMetadata() {

View File

@ -46,7 +46,7 @@ export class ContentCloudNodeSelectorService {
actionName: 'Choose', actionName: 'Choose',
currentFolderId: '-my-', currentFolderId: '-my-',
select, select,
isSelectionValid: this.isNodeFile.bind(this), isSelectionValid: (entry: Node) => entry.isFile,
showFilesInResult: true showFilesInResult: true
}; };
@ -61,8 +61,4 @@ export class ContentCloudNodeSelectorService {
close() { close() {
this.dialog.closeAll(); this.dialog.closeAll();
} }
private isNodeFile(entry: Node): boolean {
return entry && entry.isFile;
}
} }

View File

@ -58,7 +58,7 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
@HostListener('click') @HostListener('click')
async onClick() { async onClick() {
try { try {
this.cancelProcess(); await this.cancelProcess();
} catch (error) { } catch (error) {
this.error.emit(error); this.error.emit(error);
} }

View File

@ -74,7 +74,7 @@ export class ClaimTaskCloudDirective implements OnInit {
@HostListener('click') @HostListener('click')
async onClick() { async onClick() {
try { try {
this.claimTask(); await await this.claimTask();
} catch (error) { } catch (error) {
this.error.emit(error); this.error.emit(error);
} }

View File

@ -72,7 +72,7 @@ export class UnClaimTaskCloudDirective implements OnInit {
@HostListener('click') @HostListener('click')
async onClick() { async onClick() {
try { try {
this.unclaimTask(); await this.unclaimTask();
} catch (error) { } catch (error) {
this.error.emit(error); this.error.emit(error);
} }

View File

@ -176,10 +176,7 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy {
* Check if the value of the layoutType property is an allowed value * Check if the value of the layoutType property is an allowed value
*/ */
isValidType(): boolean { isValidType(): boolean {
if (this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID)) { return this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID);
return true;
}
return false;
} }
/** /**

View File

@ -54,7 +54,7 @@ export class AttachFileWidgetDialogService {
selected, selected,
ecmHost, ecmHost,
context, context,
isSelectionValid: this.isNodeFile.bind(this), isSelectionValid: (entry: Node) => entry.isFile,
showFilesInResult: true showFilesInResult: true
}; };
@ -71,10 +71,6 @@ export class AttachFileWidgetDialogService {
this.dialog.closeAll(); this.dialog.closeAll();
} }
private isNodeFile(entry: Node): boolean {
return entry.isFile;
}
private getLoginTitleTranslation(ecmHost: string): string { private getLoginTitleTranslation(ecmHost: string): string {
return this.translation.instant(`ATTACH-FILE.DIALOG.LOGIN`, { ecmHost }); return this.translation.instant(`ATTACH-FILE.DIALOG.LOGIN`, { ecmHost });
} }

View File

@ -392,11 +392,6 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro
} }
this.executeOutcome.emit(args); this.executeOutcome.emit(args);
if (args.defaultPrevented) { return !args.defaultPrevented;
return false;
} }
return true;
}
} }

View File

@ -37,6 +37,6 @@ export class ProcessDefinitionRepresentation {
this.deploymentId = obj && obj.deploymentId || null; this.deploymentId = obj && obj.deploymentId || null;
this.tenantId = obj && obj.tenantId || null; this.tenantId = obj && obj.tenantId || null;
this.metaDataValues = obj && obj.metaDataValues || []; this.metaDataValues = obj && obj.metaDataValues || [];
this.hasStartForm = obj && obj.hasStartForm === true ? true : false; this.hasStartForm = obj && obj.hasStartForm === true;
} }
} }

View File

@ -64,11 +64,7 @@ export class AttachFormComponent implements OnInit, OnChanges {
this.attachFormControl = new FormControl('', Validators.required); this.attachFormControl = new FormControl('', Validators.required);
this.attachFormControl.valueChanges.subscribe( (currentValue) => { this.attachFormControl.valueChanges.subscribe( (currentValue) => {
if (this.attachFormControl.valid) { if (this.attachFormControl.valid) {
if ( this.formId !== currentValue) { this.disableSubmit = this.formId === currentValue;
this.disableSubmit = false;
} else {
this.disableSubmit = true;
}
} }
}); });
} }

View File

@ -59,11 +59,6 @@ export class TaskAuditDirective implements OnChanges {
public audit: any; public audit: any;
/**
*
* @param translateService
* @param taskListService
*/
constructor(private contentService: ContentService, constructor(private contentService: ContentService,
private taskListService: TaskListService) { private taskListService: TaskListService) {
} }
@ -74,11 +69,8 @@ export class TaskAuditDirective implements OnChanges {
} }
} }
isValidType() { isValidType(): boolean {
if (this.format && (this.isJsonFormat() || this.isPdfFormat())) { return this.format && (this.isJsonFormat() || this.isPdfFormat());
return true;
}
return false;
} }
setDefaultFormatType(): void { setDefaultFormatType(): void {

View File

@ -71,7 +71,7 @@ export class ClaimTaskDirective {
@HostListener('click') @HostListener('click')
async onClick() { async onClick() {
try { try {
this.claimTask(); await this.claimTask();
} catch (error) { } catch (error) {
this.error.emit(error); this.error.emit(error);
} }

View File

@ -70,7 +70,7 @@ export class UnclaimTaskDirective {
@HostListener('click') @HostListener('click')
async onClick() { async onClick() {
try { try {
this.unclaimTask(); await this.unclaimTask();
} catch (error) { } catch (error) {
this.error.emit(error); this.error.emit(error);
} }

View File

@ -78,8 +78,8 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
} }
} }
hasFilter() { hasFilter(): boolean {
return this.filter ? true : false; return !!this.filter;
} }
} }

View File

@ -139,10 +139,6 @@ export class PaginationPage {
return totalNumberOfFiles.split('of ')[1]; return totalNumberOfFiles.split('of ')[1];
} }
async getNumberOfAllRows(): Promise<number> {
return +this.getTotalNumberOfFiles();
}
/* /*
* Wait until the total number of items is less then specified value * Wait until the total number of items is less then specified value
*/ */