mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
various code quality fixes (#5792)
* various code quality fixes * reduce duplicated code * add safety check
This commit is contained in:
parent
dc2060fe49
commit
e9350bd297
@ -27,7 +27,7 @@ var server = http.createServer(function (req, res) {
|
||||
req.on('end', function() {
|
||||
if (req.url === '/') {
|
||||
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']);
|
||||
}
|
||||
|
||||
|
@ -582,10 +582,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
isCustomActionDisabled(node: MinimalNodeEntity): boolean {
|
||||
if (node && node.entry && node.entry.name === 'custom') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(node && node.entry && node.entry.name === 'custom');
|
||||
}
|
||||
|
||||
runCustomAction(event: any) {
|
||||
|
@ -394,7 +394,7 @@ To develop the enhancement, edit the `src/app/mydatatable/mydatatable.component.
|
||||
```ts
|
||||
onExecuteRowAction(event: DataRowActionEvent) {
|
||||
|
||||
if (event.value.action.title = "Greetings") {
|
||||
if (event.value.action.title === "Greetings") {
|
||||
|
||||
this.apiService.getInstance().webScript.executeWebScript(
|
||||
'GET',
|
||||
|
@ -101,9 +101,8 @@ describe('Upload component', () => {
|
||||
afterEach(async () => {
|
||||
const nbResults = await contentServicesPage.numberOfResultsDisplayed();
|
||||
if (nbResults > 1) {
|
||||
const nodesPromise = await contentServicesPage.getElementsDisplayedId();
|
||||
for (const node of nodesPromise) {
|
||||
const nodeId = await node;
|
||||
const nodeIds = await contentServicesPage.getElementsDisplayedId();
|
||||
for (const nodeId of nodeIds) {
|
||||
await uploadActions.deleteFileOrFolder(nodeId);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ describe('Comment component for Processes', () => {
|
||||
const taskId = taskQuery.data[0].id;
|
||||
|
||||
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 () => {
|
||||
|
@ -302,13 +302,16 @@ async function checkIfAppIsReleased(absentApps: any []) {
|
||||
async function checkDescriptorExist(name: string) {
|
||||
logger.info(`Check descriptor ${name} exist in the list `);
|
||||
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.deployed === false) {
|
||||
await deleteDescriptor(descriptor.entry.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -316,7 +319,7 @@ async function importProjectAndRelease(app: any) {
|
||||
await getFileFromRemote(app.file_location, app.name);
|
||||
logger.warn('Project imported ' + app.name);
|
||||
const projectRelease = await importAndReleaseProject(`${app.name}.zip`);
|
||||
deleteLocalFile(`${app.name}`);
|
||||
await deleteLocalFile(`${app.name}`);
|
||||
return projectRelease;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
hasPreviousNodes(): boolean {
|
||||
return this.previousNodes ? true : false;
|
||||
return !!this.previousNodes;
|
||||
}
|
||||
|
||||
parseRoute(node: Node): PathElementEntity[] {
|
||||
|
@ -210,7 +210,7 @@ export class ContentNodeDialogService {
|
||||
actionName: action,
|
||||
currentFolderId: contentEntry.id,
|
||||
imageResolver: this.imageResolver.bind(this),
|
||||
isSelectionValid: this.isNodeFile.bind(this),
|
||||
isSelectionValid: (entry: Node) => entry.isFile,
|
||||
select: select,
|
||||
showFilesInResult
|
||||
};
|
||||
@ -234,10 +234,6 @@ export class ContentNodeDialogService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
return entry.isFile;
|
||||
}
|
||||
|
||||
private hasAllowableOperationsOnNodeFolder(entry: Node): boolean {
|
||||
return this.isNodeFolder(entry) && this.contentService.hasAllowableOperations(entry, 'create');
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ describe('NodeSharedDirective', () => {
|
||||
});
|
||||
|
||||
it('should have share button disabled when selection is empty', async () => {
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
expect(shareButtonElement.disabled).toBe(true);
|
||||
});
|
||||
@ -96,7 +96,7 @@ describe('NodeSharedDirective', () => {
|
||||
component.documentList.selection = [selection];
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
expect(shareButtonElement.disabled).toBe(false);
|
||||
});
|
||||
@ -106,7 +106,7 @@ describe('NodeSharedDirective', () => {
|
||||
component.documentList.selection = [selection];
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
expect(shareButtonElement.disabled).toBe(true);
|
||||
});
|
||||
@ -115,7 +115,7 @@ describe('NodeSharedDirective', () => {
|
||||
component.documentList.selection = [selection];
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
expect(shareButtonElement.title).toBe('Not Shared');
|
||||
});
|
||||
@ -124,7 +124,7 @@ describe('NodeSharedDirective', () => {
|
||||
selection.entry.properties['qshare:sharedId'] = 'someId';
|
||||
component.documentList.selection = [selection];
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(shareButtonElement.title).toBe('Shared');
|
||||
@ -135,7 +135,7 @@ describe('NodeSharedDirective', () => {
|
||||
component.documentList.selection = [selection];
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
|
||||
shareButtonElement.click();
|
||||
|
@ -101,7 +101,7 @@ export class SearchControlComponent implements OnDestroy {
|
||||
) {}
|
||||
|
||||
isNoSearchTemplatePresent(): boolean {
|
||||
return this.emptySearchTemplate ? true : false;
|
||||
return !!this.emptySearchTemplate;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
@ -96,7 +96,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
||||
/**
|
||||
* Upload a list of file in the specified path
|
||||
* @param files
|
||||
* @param path
|
||||
*/
|
||||
uploadFiles(files: File[]): void {
|
||||
const filteredFiles: FileModel[] = files
|
||||
@ -152,17 +151,16 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
||||
.split(',')
|
||||
.map((ext) => ext.trim().replace(/^\./, ''));
|
||||
|
||||
if (allowedExtensions.indexOf(file.extension) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return allowedExtensions.indexOf(file.extension) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates FileModel from File
|
||||
*
|
||||
* @param file
|
||||
* @param parentId
|
||||
* @param path
|
||||
* @param id
|
||||
*/
|
||||
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
|
||||
return new FileModel(file, {
|
||||
|
@ -55,7 +55,7 @@ export class VersionUploadComponent {
|
||||
}
|
||||
|
||||
isMajorVersion(): boolean {
|
||||
return this.semanticVersion === 'minor' ? false : true;
|
||||
return this.semanticVersion !== 'minor';
|
||||
}
|
||||
|
||||
cancelUpload() {
|
||||
|
@ -31,11 +31,7 @@ export class ButtonsMenuComponent implements AfterContentInit {
|
||||
isMenuEmpty: boolean;
|
||||
|
||||
ngAfterContentInit() {
|
||||
if (this.buttons.length > 0) {
|
||||
this.isMenuEmpty = false;
|
||||
} else {
|
||||
this.isMenuEmpty = true;
|
||||
}
|
||||
this.isMenuEmpty = this.buttons.length <= 0;
|
||||
}
|
||||
|
||||
isMobile(): boolean {
|
||||
|
@ -175,14 +175,14 @@ export class CommentsComponent implements OnChanges {
|
||||
}
|
||||
|
||||
isATask(): boolean {
|
||||
return this.taskId ? true : false;
|
||||
return !!this.taskId;
|
||||
}
|
||||
|
||||
isANode(): boolean {
|
||||
return this.nodeId ? true : false;
|
||||
return !!this.nodeId;
|
||||
}
|
||||
|
||||
private sanitize(input: string) {
|
||||
private sanitize(input: string): string {
|
||||
return input.replace(/<[^>]+>/g, '')
|
||||
.replace(/^\s+|\s+$|\s+(?=\s)/g, '')
|
||||
.replace(/\r?\n/g, '<br/>');
|
||||
|
@ -285,7 +285,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
|
||||
isPropertyChanged(property: SimpleChange): boolean {
|
||||
return property && property.currentValue ? true : false;
|
||||
return !!(property && property.currentValue);
|
||||
}
|
||||
|
||||
convertToRowsData(rows: any []): ObjectDataRow[] {
|
||||
@ -375,7 +375,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
this.rowMenuCache = {};
|
||||
}
|
||||
|
||||
isTableEmpty() {
|
||||
isTableEmpty(): boolean {
|
||||
return this.data === undefined || this.data === null;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export class EditJsonDialogComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
if (this.settings) {
|
||||
this.editable = this.settings.editable ? true : false;
|
||||
this.editable = this.settings.editable;
|
||||
this.value = this.settings.value || '';
|
||||
this.title = this.settings.title || 'JSON';
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ export abstract class FormBaseComponent {
|
||||
}
|
||||
|
||||
hasForm(): boolean {
|
||||
return this.form ? true : false;
|
||||
return !!this.form;
|
||||
}
|
||||
|
||||
isTitleEnabled(): boolean {
|
||||
|
@ -53,19 +53,19 @@
|
||||
}
|
||||
|
||||
hasPreviewStatus(): boolean {
|
||||
return this.previewStatus === 'supported' ? true : false;
|
||||
return this.previewStatus === 'supported';
|
||||
}
|
||||
|
||||
isTypeImage(): boolean {
|
||||
return this.simpleType === 'image' ? true : false;
|
||||
return this.simpleType === 'image';
|
||||
}
|
||||
|
||||
isTypePdf(): boolean {
|
||||
return this.simpleType === 'pdf' ? true : false;
|
||||
return this.simpleType === 'pdf';
|
||||
}
|
||||
|
||||
isTypeDoc(): boolean {
|
||||
return this.simpleType === 'word' || this.simpleType === 'content' ? true : false;
|
||||
return this.simpleType === 'word' || this.simpleType === 'content';
|
||||
}
|
||||
|
||||
isThumbnailReady(): boolean {
|
||||
|
@ -27,8 +27,8 @@ export class ErrorMessageModel {
|
||||
this.attributes = new Map();
|
||||
}
|
||||
|
||||
isActive() {
|
||||
return this.message ? true : false;
|
||||
isActive(): boolean {
|
||||
return !!this.message;
|
||||
}
|
||||
|
||||
getAttributesAsJsonObj() {
|
||||
|
@ -80,7 +80,7 @@ export class RequiredFieldValidator implements FormFieldValidator {
|
||||
}
|
||||
|
||||
if (field.type === FormFieldTypes.BOOLEAN) {
|
||||
return field.value ? true : false;
|
||||
return !!field.value;
|
||||
}
|
||||
|
||||
if (field.value === null || field.value === undefined || field.value === '') {
|
||||
|
@ -221,7 +221,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
}
|
||||
|
||||
private isTypeaheadFieldType(type: string): boolean {
|
||||
return type === 'typeahead' ? true : false;
|
||||
return type === 'typeahead';
|
||||
}
|
||||
|
||||
private getFieldNameWithLabel(name: string): string {
|
||||
@ -419,11 +419,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
* @param type
|
||||
*/
|
||||
isInvalidFieldType(type: string) {
|
||||
if (type === 'container') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return type === 'container';
|
||||
}
|
||||
|
||||
getOptionName(): string {
|
||||
|
@ -154,7 +154,7 @@ export class FormModel {
|
||||
}
|
||||
}
|
||||
|
||||
this.isValid = errorsField.length > 0 ? false : true;
|
||||
this.isValid = errorsField.length <= 0;
|
||||
|
||||
if (this.formService) {
|
||||
validateFormEvent.isValid = this.isValid;
|
||||
|
@ -110,7 +110,7 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
|
||||
isReadOnlyType(): boolean {
|
||||
return this.field.type === 'readonly' ? true : false;
|
||||
return this.field.type === 'readonly';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ export class DynamicTableModel extends FormWidgetModel {
|
||||
}
|
||||
|
||||
if (column.type === 'Boolean') {
|
||||
return rowValue ? true : false;
|
||||
return !!rowValue;
|
||||
}
|
||||
|
||||
if (column.type === 'Date') {
|
||||
|
@ -59,8 +59,8 @@ export class WidgetComponent implements AfterViewInit {
|
||||
constructor(public formService?: FormService) {
|
||||
}
|
||||
|
||||
hasField() {
|
||||
return this.field ? true : false;
|
||||
hasField(): boolean {
|
||||
return !!this.field;
|
||||
}
|
||||
|
||||
// Note for developers:
|
||||
@ -73,7 +73,7 @@ export class WidgetComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
isValid(): boolean {
|
||||
return this.field.validationSummary ? true : false;
|
||||
return !!this.field.validationSummary;
|
||||
}
|
||||
|
||||
hasValue(): boolean {
|
||||
|
@ -74,7 +74,6 @@ describe('HeaderLayoutComponent', () => {
|
||||
|
||||
const logo = fixture.nativeElement.querySelector('.adf-app-logo');
|
||||
const src = logo.getAttribute('src');
|
||||
expect(logo === null).toBeFalsy();
|
||||
expect(src).toEqual('logo.png');
|
||||
});
|
||||
|
||||
|
@ -71,8 +71,8 @@ export class LicenseModel {
|
||||
this.remainingDays = obj.remainingDays || null;
|
||||
this.holder = obj.holder || null;
|
||||
this.mode = obj.mode || null;
|
||||
this.isClusterEnabled = obj.isClusterEnabled ? true : false;
|
||||
this.isCryptodocEnabled = obj.isCryptodocEnabled ? true : false;
|
||||
this.isClusterEnabled = !!obj.isClusterEnabled;
|
||||
this.isCryptodocEnabled = !!obj.isCryptodocEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,10 +85,10 @@ export class VersionStatusModel {
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.isReadOnly = obj.isReadOnly ? true : false;
|
||||
this.isAuditEnabled = obj.isAuditEnabled ? true : false;
|
||||
this.isQuickShareEnabled = obj.isQuickShareEnabled ? true : false;
|
||||
this.isThumbnailGenerationEnabled = obj.isThumbnailGenerationEnabled ? true : false;
|
||||
this.isReadOnly = !!obj.isReadOnly;
|
||||
this.isAuditEnabled = !!obj.isAuditEnabled;
|
||||
this.isQuickShareEnabled = !!obj.isQuickShareEnabled;
|
||||
this.isThumbnailGenerationEnabled = !!obj.isThumbnailGenerationEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class FileSizePipe implements PipeTransform {
|
||||
}
|
||||
|
||||
transform(bytes: number, decimals: number = 2): string {
|
||||
if (bytes == null || bytes === undefined) {
|
||||
if (bytes == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ export class FileTypePipe implements PipeTransform {
|
||||
|
||||
transform(value: string) {
|
||||
|
||||
if ( value == null || value === undefined ) {
|
||||
if ( value == null ) {
|
||||
return '';
|
||||
} else {
|
||||
const fileInfo = value.substring(value.lastIndexOf('/') + 1).replace(/\.[a-z]+/, '');
|
||||
|
@ -157,7 +157,7 @@ export class AuthenticationService {
|
||||
* @returns True if set, false otherwise
|
||||
*/
|
||||
isRememberMeSet(): boolean {
|
||||
return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) === null) ? false : true;
|
||||
return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,10 +287,7 @@ export class IdentityGroupService {
|
||||
checkGroupHasClientApp(groupId: string, clientId: string): Observable<boolean> {
|
||||
return this.getClientRoles(groupId, clientId).pipe(
|
||||
map((response: any[]) => {
|
||||
if (response && response.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return response && response.length > 0;
|
||||
}),
|
||||
catchError((error) => this.handleError(error))
|
||||
);
|
||||
|
@ -201,10 +201,7 @@ export class IdentityUserService {
|
||||
checkUserHasClientApp(userId: string, clientId: string): Observable<boolean> {
|
||||
return this.getClientRoles(userId, clientId).pipe(
|
||||
map((clientRoles: any[]) => {
|
||||
if (clientRoles.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return clientRoles.length > 0;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ export class UploadService {
|
||||
* @returns True if a file is uploading, false otherwise
|
||||
*/
|
||||
isUploading(): boolean {
|
||||
return this.activeTask ? true : false;
|
||||
return !!this.activeTask;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,8 +120,8 @@ export class AnalyticsGeneratorComponent implements OnChanges {
|
||||
return this.showDetails;
|
||||
}
|
||||
|
||||
isCurrent(position: number) {
|
||||
return position === this.currentChartPosition ? true : false;
|
||||
isCurrent(position: number): boolean {
|
||||
return position === this.currentChartPosition;
|
||||
}
|
||||
|
||||
selectCurrent(position: number) {
|
||||
|
@ -85,10 +85,10 @@ export class AnalyticsReportHeatMapComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
hasMetric() {
|
||||
return (this.report.totalCountsPercentages ||
|
||||
hasMetric(): boolean {
|
||||
return !!(this.report.totalCountsPercentages ||
|
||||
this.report.totalTimePercentages ||
|
||||
this.report.avgTimePercentages) ? true : false;
|
||||
this.report.avgTimePercentages);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -171,15 +171,15 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
this.selectFirst = false;
|
||||
}
|
||||
|
||||
isSelected(report: any) {
|
||||
return this.currentReport === report ? true : false;
|
||||
isSelected(report: any): boolean {
|
||||
return this.currentReport === report;
|
||||
}
|
||||
|
||||
isList() {
|
||||
isList(): boolean {
|
||||
return this.layoutType === AnalyticsReportListComponent.LAYOUT_LIST;
|
||||
}
|
||||
|
||||
isGrid() {
|
||||
isGrid(): boolean {
|
||||
return this.layoutType === AnalyticsReportListComponent.LAYOUT_GRID;
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ export class WidgetComponent implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
hasField() {
|
||||
return this.field ? true : false;
|
||||
hasField(): boolean {
|
||||
return !!this.field;
|
||||
}
|
||||
|
||||
hasValue(): boolean {
|
||||
|
@ -101,7 +101,7 @@ export class BarChart extends Chart {
|
||||
};
|
||||
};
|
||||
|
||||
hasDatasets() {
|
||||
return this.datasets && this.datasets.length > 0 ? true : false;
|
||||
hasDatasets(): boolean {
|
||||
return this.datasets && this.datasets.length > 0;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class DetailsTableChart extends TableChart {
|
||||
}
|
||||
}
|
||||
|
||||
hasDetailsTable() {
|
||||
return this.detailsTable ? true : false;
|
||||
hasDetailsTable(): boolean {
|
||||
return !!this.detailsTable;
|
||||
}
|
||||
}
|
||||
|
@ -365,11 +365,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
}
|
||||
|
||||
this.executeOutcome.emit(args);
|
||||
if (args.defaultPrevented) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !args.defaultPrevented;
|
||||
}
|
||||
|
||||
protected storeFormAsMetadata() {
|
||||
|
@ -46,7 +46,7 @@ export class ContentCloudNodeSelectorService {
|
||||
actionName: 'Choose',
|
||||
currentFolderId: '-my-',
|
||||
select,
|
||||
isSelectionValid: this.isNodeFile.bind(this),
|
||||
isSelectionValid: (entry: Node) => entry.isFile,
|
||||
showFilesInResult: true
|
||||
};
|
||||
|
||||
@ -61,8 +61,4 @@ export class ContentCloudNodeSelectorService {
|
||||
close() {
|
||||
this.dialog.closeAll();
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
return entry && entry.isFile;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.cancelProcess();
|
||||
await this.cancelProcess();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ export class ClaimTaskCloudDirective implements OnInit {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.claimTask();
|
||||
await await this.claimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class UnClaimTaskCloudDirective implements OnInit {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.unclaimTask();
|
||||
await this.unclaimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@ -176,10 +176,7 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
* Check if the value of the layoutType property is an allowed value
|
||||
*/
|
||||
isValidType(): boolean {
|
||||
if (this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ export class AttachFileWidgetDialogService {
|
||||
selected,
|
||||
ecmHost,
|
||||
context,
|
||||
isSelectionValid: this.isNodeFile.bind(this),
|
||||
isSelectionValid: (entry: Node) => entry.isFile,
|
||||
showFilesInResult: true
|
||||
};
|
||||
|
||||
@ -71,10 +71,6 @@ export class AttachFileWidgetDialogService {
|
||||
this.dialog.closeAll();
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
return entry.isFile;
|
||||
}
|
||||
|
||||
private getLoginTitleTranslation(ecmHost: string): string {
|
||||
return this.translation.instant(`ATTACH-FILE.DIALOG.LOGIN`, { ecmHost });
|
||||
}
|
||||
|
@ -392,11 +392,6 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro
|
||||
}
|
||||
|
||||
this.executeOutcome.emit(args);
|
||||
if (args.defaultPrevented) {
|
||||
return false;
|
||||
return !args.defaultPrevented;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,6 @@ export class ProcessDefinitionRepresentation {
|
||||
this.deploymentId = obj && obj.deploymentId || null;
|
||||
this.tenantId = obj && obj.tenantId || null;
|
||||
this.metaDataValues = obj && obj.metaDataValues || [];
|
||||
this.hasStartForm = obj && obj.hasStartForm === true ? true : false;
|
||||
this.hasStartForm = obj && obj.hasStartForm === true;
|
||||
}
|
||||
}
|
||||
|
@ -64,11 +64,7 @@ export class AttachFormComponent implements OnInit, OnChanges {
|
||||
this.attachFormControl = new FormControl('', Validators.required);
|
||||
this.attachFormControl.valueChanges.subscribe( (currentValue) => {
|
||||
if (this.attachFormControl.valid) {
|
||||
if ( this.formId !== currentValue) {
|
||||
this.disableSubmit = false;
|
||||
} else {
|
||||
this.disableSubmit = true;
|
||||
}
|
||||
this.disableSubmit = this.formId === currentValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -59,11 +59,6 @@ export class TaskAuditDirective implements OnChanges {
|
||||
|
||||
public audit: any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param translateService
|
||||
* @param taskListService
|
||||
*/
|
||||
constructor(private contentService: ContentService,
|
||||
private taskListService: TaskListService) {
|
||||
}
|
||||
@ -74,11 +69,8 @@ export class TaskAuditDirective implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
isValidType() {
|
||||
if (this.format && (this.isJsonFormat() || this.isPdfFormat())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
isValidType(): boolean {
|
||||
return this.format && (this.isJsonFormat() || this.isPdfFormat());
|
||||
}
|
||||
|
||||
setDefaultFormatType(): void {
|
||||
|
@ -71,7 +71,7 @@ export class ClaimTaskDirective {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.claimTask();
|
||||
await this.claimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ export class UnclaimTaskDirective {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.unclaimTask();
|
||||
await this.unclaimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
hasFilter() {
|
||||
return this.filter ? true : false;
|
||||
hasFilter(): boolean {
|
||||
return !!this.filter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,10 +139,6 @@ export class PaginationPage {
|
||||
return totalNumberOfFiles.split('of ')[1];
|
||||
}
|
||||
|
||||
async getNumberOfAllRows(): Promise<number> {
|
||||
return +this.getTotalNumberOfFiles();
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait until the total number of items is less then specified value
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user