mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-622] No implicit returns (#5157)
* enable noImplicitReturns rule * type fixes * fix return types * fix return value * fix tests * fix visibility service * update tests * add missing types * fix test
This commit is contained in:
@@ -62,8 +62,6 @@ export class ContentCloudNodeSelectorService {
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
if (entry) {
|
||||
return entry.isFile;
|
||||
}
|
||||
return entry && entry.isFile;
|
||||
}
|
||||
}
|
||||
|
@@ -221,17 +221,16 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
return this.filterProperties.indexOf(EditProcessFilterCloudComponent.LAST_MODIFIED) >= 0;
|
||||
}
|
||||
|
||||
removeOrderProperty(filteredProperties: ProcessFilterProperties[]) {
|
||||
removeOrderProperty(filteredProperties: ProcessFilterProperties[]): ProcessFilterProperties[] {
|
||||
if (filteredProperties && filteredProperties.length > 0) {
|
||||
const propertiesWithOutOrderProperty = filteredProperties.filter(
|
||||
(property: ProcessFilterProperties) => {
|
||||
return property.key !== EditProcessFilterCloudComponent.ORDER;
|
||||
});
|
||||
return propertiesWithOutOrderProperty;
|
||||
return filteredProperties.filter(
|
||||
property => property.key !== EditProcessFilterCloudComponent.ORDER
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
get createSortProperties(): any {
|
||||
get createSortProperties(): ProcessFilterOptions[] {
|
||||
this.checkMandatorySortProperties();
|
||||
const sortProperties = this.sortProperties.map((property: string) => {
|
||||
return <ProcessFilterOptions> { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
|
||||
@@ -425,6 +424,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
if (action.actionType === EditProcessFilterCloudComponent.ACTION_DELETE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private setLastModifiedToFilter(formValues: ProcessFilterCloudModel) {
|
||||
|
@@ -152,11 +152,14 @@ export class ProcessFilterCloudService {
|
||||
*/
|
||||
deleteFilter(deletedFilter: ProcessFilterCloudModel): Observable<ProcessFilterCloudModel[]> {
|
||||
const key = this.prepareKey(deletedFilter.appName);
|
||||
|
||||
return this.getProcessFiltersByKey(deletedFilter.appName, key).pipe(
|
||||
switchMap((filters: any) => {
|
||||
switchMap(filters => {
|
||||
if (filters && filters.length > 0) {
|
||||
filters = filters.filter((filter: ProcessFilterCloudModel) => filter.id !== deletedFilter.id);
|
||||
filters = filters.filter(filter => filter.id !== deletedFilter.id);
|
||||
return this.updateProcessFilters(deletedFilter.appName, key, filters);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
map((filters: ProcessFilterCloudModel[]) => {
|
||||
|
@@ -57,16 +57,17 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
return throwError('Appname not configured');
|
||||
}
|
||||
}
|
||||
private buildQueryUrl(requestNode: ProcessQueryCloudRequestModel) {
|
||||
|
||||
private buildQueryUrl(requestNode: ProcessQueryCloudRequestModel): string {
|
||||
this.contextRoot = this.appConfigService.get('bpmHost', '');
|
||||
return `${this.getBasePath(requestNode.appName)}/query/v1/process-instances`;
|
||||
}
|
||||
|
||||
private isPropertyValueValid(requestNode, property) {
|
||||
private isPropertyValueValid(requestNode: any, property: string) {
|
||||
return requestNode[property] !== '' && requestNode[property] !== null && requestNode[property] !== undefined;
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: ProcessQueryCloudRequestModel) {
|
||||
private buildQueryParams(requestNode: ProcessQueryCloudRequestModel): Object {
|
||||
const queryParam = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
@@ -78,7 +79,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
return queryParam;
|
||||
}
|
||||
|
||||
private isExcludedField(property) {
|
||||
private isExcludedField(property: string): boolean {
|
||||
return property === 'appName' || property === 'sorting';
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,13 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
if (key || key === '') {
|
||||
return of(this.prepareLocalPreferenceResponse(key));
|
||||
}
|
||||
return of(
|
||||
{
|
||||
'list': {
|
||||
'entries': []
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +77,8 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
updatePreference(_: string, key: string, updatedPreference: any): Observable<any> {
|
||||
if (key) {
|
||||
this.storage.setItem(key, JSON.stringify(updatedPreference));
|
||||
return of(updatedPreference);
|
||||
}
|
||||
return of(updatedPreference);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,8 +91,8 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
deletePreference(key: string, preferences: any): Observable<any> {
|
||||
if (key) {
|
||||
this.storage.setItem(key, JSON.stringify(preferences));
|
||||
return of(preferences);
|
||||
}
|
||||
return of(preferences);
|
||||
}
|
||||
|
||||
prepareLocalPreferenceResponse(key: string): any {
|
||||
|
@@ -242,11 +242,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return this.filterProperties.indexOf(EditTaskFilterCloudComponent.SORT) >= 0;
|
||||
}
|
||||
|
||||
removeOrderProperty(filteredProperties: TaskFilterProperties[]) {
|
||||
removeOrderProperty(filteredProperties: TaskFilterProperties[]): TaskFilterProperties[] {
|
||||
if (filteredProperties && filteredProperties.length > 0) {
|
||||
const propertiesWithOutOrderProperty = filteredProperties.filter((property: TaskFilterProperties) => { return property.key !== EditTaskFilterCloudComponent.ORDER; });
|
||||
return propertiesWithOutOrderProperty;
|
||||
return filteredProperties.filter(property => property.key !== EditTaskFilterCloudComponent.ORDER);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
hasLastModifiedProperty(): boolean {
|
||||
@@ -261,19 +261,19 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return sortProperties;
|
||||
}
|
||||
|
||||
checkMandatorySortProperties() {
|
||||
checkMandatorySortProperties(): void {
|
||||
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
||||
this.sortProperties = EditTaskFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
createAndFilterActions() {
|
||||
createAndFilterActions(): TaskFilterAction[] {
|
||||
this.checkMandatoryActions();
|
||||
const allActions = this.createFilterActions();
|
||||
return allActions.filter((action: TaskFilterAction) => this.isValidAction(this.actions, action));
|
||||
return this.createFilterActions()
|
||||
.filter(action => this.isValidAction(this.actions, action));
|
||||
}
|
||||
|
||||
checkMandatoryActions() {
|
||||
checkMandatoryActions(): void {
|
||||
if (this.actions === undefined || this.actions.length === 0) {
|
||||
this.actions = EditTaskFilterCloudComponent.DEFAULT_ACTIONS;
|
||||
}
|
||||
@@ -316,9 +316,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return JSON.stringify(editedQuery).toLowerCase() === JSON.stringify(currentQuery).toLowerCase();
|
||||
}
|
||||
|
||||
getRunningApplications() {
|
||||
this.appsProcessCloudService.getDeployedApplicationsByStatus(EditTaskFilterCloudComponent.APP_RUNNING_STATUS)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe((applications: ApplicationInstanceModel[]) => {
|
||||
getRunningApplications(): void {
|
||||
this.appsProcessCloudService
|
||||
.getDeployedApplicationsByStatus(EditTaskFilterCloudComponent.APP_RUNNING_STATUS)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
||||
if (applications && applications.length > 0) {
|
||||
applications.map((application) => {
|
||||
this.applicationNames.push({ label: application.name, value: application.name });
|
||||
@@ -337,24 +339,28 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
}
|
||||
}
|
||||
|
||||
save(saveAction: TaskFilterAction) {
|
||||
this.taskFilterCloudService.updateFilter(this.changedTaskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
saveAction.filter = this.changedTaskFilter;
|
||||
this.action.emit(saveAction);
|
||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
||||
});
|
||||
save(saveAction: TaskFilterAction): void {
|
||||
this.taskFilterCloudService
|
||||
.updateFilter(this.changedTaskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
saveAction.filter = this.changedTaskFilter;
|
||||
this.action.emit(saveAction);
|
||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
||||
});
|
||||
}
|
||||
|
||||
delete(deleteAction: TaskFilterAction) {
|
||||
this.taskFilterCloudService.deleteFilter(this.taskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
deleteAction.filter = this.taskFilter;
|
||||
this.action.emit(deleteAction);
|
||||
});
|
||||
delete(deleteAction: TaskFilterAction): void {
|
||||
this.taskFilterCloudService
|
||||
.deleteFilter(this.taskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
deleteAction.filter = this.taskFilter;
|
||||
this.action.emit(deleteAction);
|
||||
});
|
||||
}
|
||||
|
||||
saveAs(saveAsAction: TaskFilterAction) {
|
||||
saveAs(saveAsAction: TaskFilterAction): void {
|
||||
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
|
||||
data: {
|
||||
name: this.translateService.instant(this.taskFilter.name)
|
||||
@@ -404,11 +410,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return this.showFilterActions;
|
||||
}
|
||||
|
||||
onExpand() {
|
||||
onExpand(): void {
|
||||
this.toggleFilterActions = true;
|
||||
}
|
||||
|
||||
onClose() {
|
||||
onClose(): void {
|
||||
this.toggleFilterActions = false;
|
||||
}
|
||||
|
||||
@@ -438,6 +444,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
if (action.actionType === EditTaskFilterCloudComponent.ACTION_DELETE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
createFilterActions(): TaskFilterAction[] {
|
||||
|
@@ -201,13 +201,14 @@ export class TaskFilterCloudService {
|
||||
deleteFilter(deletedFilter: TaskFilterCloudModel): Observable<TaskFilterCloudModel[]> {
|
||||
const key = this.prepareKey(deletedFilter.appName);
|
||||
return this.getTaskFiltersByKey(deletedFilter.appName, key).pipe(
|
||||
switchMap((filters: any) => {
|
||||
switchMap(filters => {
|
||||
if (filters && filters.length > 0) {
|
||||
filters = filters.filter((filter: TaskFilterCloudModel) => filter.id !== deletedFilter.id);
|
||||
filters = filters.filter(filter => filter.id !== deletedFilter.id);
|
||||
return this.updateTaskFilters(deletedFilter.appName, key, filters);
|
||||
}
|
||||
return [];
|
||||
}),
|
||||
map((filters: TaskFilterCloudModel[]) => {
|
||||
map(filters => {
|
||||
this.addFiltersToStream(filters);
|
||||
return filters;
|
||||
}),
|
||||
|
@@ -65,8 +65,8 @@ export class TaskListCloudService extends BaseCloudService {
|
||||
return `${this.getBasePath(requestNode.appName)}/query/v1/tasks`;
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: TaskQueryCloudRequestModel) {
|
||||
const queryParam = {};
|
||||
private buildQueryParams(requestNode: TaskQueryCloudRequestModel): Object {
|
||||
const queryParam: Object = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
!this.isExcludedField(property) &&
|
||||
@@ -77,11 +77,11 @@ export class TaskListCloudService extends BaseCloudService {
|
||||
return queryParam;
|
||||
}
|
||||
|
||||
private isExcludedField(property) {
|
||||
private isExcludedField(property: string): boolean {
|
||||
return property === 'appName' || property === 'sorting';
|
||||
}
|
||||
|
||||
private isPropertyValueValid(requestNode, property) {
|
||||
private isPropertyValueValid(requestNode: any, property: string): boolean {
|
||||
return requestNode[property] !== '' && requestNode[property] !== null && requestNode[property] !== undefined;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user