[AAE-7100] migrate ADF projects to eslint (#7483)

* migrate content services to eslint

* migrate insights to eslint

* migrate extensions to eslint

* migrate testing lib to eslint

* migrate CLI to eslint

* migrate process-services to eslint

* migrate process-services-cloud to eslint

* remove cli analytics [ci:force]
This commit is contained in:
Denys Vuika
2022-02-03 11:01:54 +00:00
committed by GitHub
parent b8bb234410
commit 8dc736e8f0
233 changed files with 1496 additions and 725 deletions

View File

@@ -0,0 +1,101 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"lib/process-services-cloud/tsconfig.lib.json",
"lib/process-services-cloud/tsconfig.spec.json"
],
"createDefaultProgram": true
},
"plugins": [
"eslint-plugin-unicorn",
"eslint-plugin-rxjs"
],
"rules": {
"jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"no-underscore-dangle": "warn",
"no-shadow": "warn",
"quote-props": "warn",
"object-shorthand": "warn",
"prefer-const": "warn",
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "warn",
"space-before-function-paren": "warn",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "adf-cloud",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "adf-cloud",
"style": "camelCase"
}
],
"@angular-eslint/no-host-metadata-property": "off",
"@angular-eslint/no-input-prefix": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "error",
"brace-style": [
"error",
"1tbs"
],
"comma-dangle": "error",
"default-case": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-bitwise": "off",
"no-duplicate-imports": "error",
"no-multiple-empty-lines": "error",
"no-redeclare": "error",
"no-return-await": "error",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"unicorn/filename-case": "error"
}
},
{
"files": [
"*.html"
],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error"
}
}
]
}

View File

@@ -49,7 +49,7 @@ export interface DescriptorSecurity {
export interface DescriptorVariables {
[key: string]: any;
connectors?: { [key: string]: any; };
connectors?: { [key: string]: any };
}
export interface DescriptorInfrastructure {

View File

@@ -36,6 +36,7 @@ export class AppsProcessCloudService {
/**
* Gets a list of deployed apps for this user by status.
*
* @param status Required status value
* @param role to filter the apps
* @returns The list of deployed apps
@@ -63,16 +64,18 @@ export class AppsProcessCloudService {
}
const api: Oauth2Auth = this.apiService.getInstance().oauth2Auth;
const path = this.getApplicationUrl();
const pathParams = {}, queryParams = { status: status, roles : role, sort: 'name' },
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = { status, roles : role, sort: 'name' };
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
return from(api.callCustomApi(path, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts))
.pipe(
map((applications: any) => {
return applications.list.entries.map((application) => application.entry);
}),
map((applications: any) => applications.list.entries.map((application) => application.entry)),
catchError((err) => this.handleError(err))
);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, EventEmitter, Output } from '@angular/core';
import { Component, Input, EventEmitter, Output, OnInit } from '@angular/core';
import { MatSelectChange } from '@angular/material/select';
import { ProcessFilterProperties, ProcessFilterOptions } from '../../process/process-filters/models/process-filter-cloud.model';
import { FormGroup, FormControl } from '@angular/forms';
@@ -27,7 +27,7 @@ import moment from 'moment-es6';
styleUrls: ['./date-range-filter.component.scss'],
templateUrl: './date-range-filter.component.html'
})
export class DateRangeFilterComponent {
export class DateRangeFilterComponent implements OnInit {
@Input()
processFilterProperty: ProcessFilterProperties;

View File

@@ -74,6 +74,7 @@ describe('FormCloudComponent', () => {
selector: 'adf-cloud-custom-widget',
template: '<div></div>'
})
// eslint-disable-next-line @angular-eslint/component-class-suffix
class CustomWidget {
typeId = 'CustomWidget';
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { LocalizedDatePipe, ThumbnailService } from '@alfresco/adf-core';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';

View File

@@ -31,7 +31,7 @@ import { FormCloudService } from '../../../services/form-cloud.service';
import { BehaviorSubject, combineLatest, Observable, of, Subject } from 'rxjs';
import { filter, map, takeUntil } from 'rxjs/operators';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'dropdown-cloud-widget',
@@ -135,7 +135,11 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
private parentValueChanged(value: string) {
if (value && !this.isDefaultValue(value)) {
this.isValidRestType() ? this.persistFieldOptionsFromRestApi() : this.persistFieldOptionsFromManualList(value);
if (this.isValidRestType()) {
this.persistFieldOptionsFromRestApi();
} else {
this.persistFieldOptionsFromManualList(value);
}
} else if (this.isDefaultValue(value)) {
this.resetRestApiErrorMessage();
this.addDefaultOption();

View File

@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { WidgetComponent, IdentityGroupModel, FormService } from '@alfresco/adf-core';
import { FormControl } from '@angular/forms';
import { filter, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ComponentSelectionMode } from '../../../../types';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'group-cloud-widget',
@@ -40,7 +40,7 @@ import { ComponentSelectionMode } from '../../../../types';
},
encapsulation: ViewEncapsulation.None
})
export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit {
export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
private onDestroy$ = new Subject<boolean>();
@@ -62,13 +62,12 @@ export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit
this.title = this.field.placeholder;
this.preSelectGroup = this.field.value ? this.field.value : [];
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.search = new FormControl({value: '', disabled: this.field.readOnly}, []),
this.search.statusChanges
.pipe(
filter((value: string) => {
return value === 'INVALID';
}),
filter((value: string) => value === 'INVALID'),
takeUntil(this.onDestroy$)
)
.subscribe(() => {
@@ -78,9 +77,7 @@ export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit
this.search.statusChanges
.pipe(
filter((value: string) => {
return value === 'VALID';
}),
filter((value: string) => value === 'VALID'),
takeUntil(this.onDestroy$)
)
.subscribe(() => {

View File

@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { WidgetComponent, IdentityUserModel, FormService, IdentityUserService } from '@alfresco/adf-core';
import { FormControl } from '@angular/forms';
import { filter, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ComponentSelectionMode } from '../../../../types';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'people-cloud-widget',
@@ -40,7 +40,7 @@ import { ComponentSelectionMode } from '../../../../types';
},
encapsulation: ViewEncapsulation.None
})
export class PeopleCloudWidgetComponent extends WidgetComponent implements OnInit {
export class PeopleCloudWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
private onDestroy$ = new Subject<boolean>();
@@ -63,13 +63,12 @@ export class PeopleCloudWidgetComponent extends WidgetComponent implements OnIni
this.title = this.field.placeholder;
this.preSelectUsers = this.field.value ? this.field.value : [];
}
this.search = new FormControl({value: '', disabled: this.field.readOnly}, []),
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.search = new FormControl({value: '', disabled: this.field.readOnly}, []),
this.search.statusChanges
.pipe(
filter((value: string) => {
return value === 'INVALID';
}),
filter((value: string) => value === 'INVALID'),
takeUntil(this.onDestroy$)
)
.subscribe(() => {
@@ -79,9 +78,7 @@ export class PeopleCloudWidgetComponent extends WidgetComponent implements OnIni
this.search.statusChanges
.pipe(
filter((value: string) => {
return value === 'VALID';
}),
filter((value: string) => value === 'VALID'),
takeUntil(this.onDestroy$)
)
.subscribe(() => {

View File

@@ -20,7 +20,7 @@ import { NodesApiService } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';
import { PresetConfig } from '@alfresco/adf-content-services';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'adf-properties-viewer-wrapper',

View File

@@ -19,7 +19,7 @@ import { Component, EventEmitter, Output, ViewEncapsulation } from '@angular/cor
import { FormService, WidgetComponent } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'adf-properties-viewer-widget',

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { WidgetComponent, FormService, LogService, FormFieldOption } from '@alfresco/adf-core';

View File

@@ -97,7 +97,7 @@ export class FormCloudServiceMock implements FormCloudServiceInterface {
throw new Error('Method not implemented.');
}
getRestWidgetData(_formName: string, _widgetId: string, _body: Map<String, String>): Observable<FormFieldOption[]> {
getRestWidgetData(_formName: string, _widgetId: string, _body: Map<string, string>): Observable<FormFieldOption[]> {
throw new Error('Method not implemented.');
}
}

View File

@@ -34,5 +34,5 @@ export interface FormCloudServiceInterface {
getTaskVariables(appName: string, taskId: string): Observable<TaskVariableCloud[]>;
getForm(appName: string, formKey: string, version?: number): Observable<FormContent>;
parseForm(json: any, data?: TaskVariableCloud[], readOnly?: boolean): FormModel;
getRestWidgetData(formName: string, widgetId: string, body: Map<String, String>): Observable<FormFieldOption[]>;
getRestWidgetData(formName: string, widgetId: string, body: Map<string, string>): Observable<FormFieldOption[]>;
}

View File

@@ -318,8 +318,8 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
filterGroupsByRoles(group: IdentityGroupModel): Observable<IdentityGroupModel> {
return this.identityGroupService.checkGroupHasRole(group.id, this.roles).pipe(
map((hasRole: boolean) => ({ hasRole: hasRole, group: group })),
filter((filteredGroup: { hasRole: boolean, group: IdentityGroupModel }) => filteredGroup.hasRole),
map((filteredGroup: { hasRole: boolean, group: IdentityGroupModel }) => filteredGroup.group));
filter((filteredGroup: { hasRole: boolean; group: IdentityGroupModel }) => filteredGroup.hasRole),
map((filteredGroup: { hasRole: boolean; group: IdentityGroupModel }) => filteredGroup.group));
}
onSelect(group: IdentityGroupModel): void {

View File

@@ -265,8 +265,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
filterUsersByRoles(user: IdentityUserModel): Observable<IdentityUserModel> {
return this.identityUserService.checkUserHasRole(user.id, this.roles).pipe(
map((hasRole: boolean) => ({ hasRole: hasRole, user: user })),
filter((filteredUser: { hasRole: boolean, user: IdentityUserModel }) => filteredUser.hasRole),
map((filteredUser: { hasRole: boolean, user: IdentityUserModel }) => filteredUser.user));
filter((filteredUser: { hasRole: boolean; user: IdentityUserModel }) => filteredUser.hasRole),
map((filteredUser: { hasRole: boolean; user: IdentityUserModel }) => filteredUser.user));
}
private isUserAlreadySelected(searchUser: IdentityUserModel): boolean {

View File

@@ -22,7 +22,7 @@ import { Subject } from 'rxjs';
import { ProcessInstanceCloud } from '../start-process/models/process-instance-cloud.model';
@Directive({
// tslint:disable-next-line: directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[adf-cloud-cancel-process]'
})
export class CancelProcessDirective implements OnInit, OnDestroy {

View File

@@ -98,10 +98,6 @@ export class ProcessFilterCloudModel {
this._completedFrom = completedFrom;
}
set completedTo(completedTo: string) {
this._completedTo = completedTo;
}
get completedFrom() {
if (this.isDateRangeType(this.completedDateType)) {
return this._completedFrom;
@@ -109,6 +105,10 @@ export class ProcessFilterCloudModel {
return this.getStartDate(this.completedDateType);
}
set completedTo(completedTo: string) {
this._completedTo = completedTo;
}
get completedTo() {
if (this.isDateRangeType(this.completedDateType)) {
return this._completedTo;
@@ -120,10 +120,6 @@ export class ProcessFilterCloudModel {
this._startFrom = startFrom;
}
set startTo(startTo: string) {
this._startTo = startTo;
}
get startFrom() {
if (this.isDateRangeType(this.startedDateType)) {
return this._startFrom;
@@ -131,6 +127,10 @@ export class ProcessFilterCloudModel {
return this.getStartDate(this.startedDateType);
}
set startTo(startTo: string) {
this._startTo = startTo;
}
get startTo() {
if (this.isDateRangeType(this.startedDateType)) {
return this._startTo;
@@ -142,10 +142,6 @@ export class ProcessFilterCloudModel {
this._suspendedFrom = suspendedFrom;
}
set suspendedTo(suspendedTo: string) {
this._suspendedTo = suspendedTo;
}
get suspendedFrom(): string {
if (this.isDateRangeType(this.suspendedDateType)) {
return this._suspendedFrom;
@@ -153,6 +149,10 @@ export class ProcessFilterCloudModel {
return this.getStartDate(this.suspendedDateType);
}
set suspendedTo(suspendedTo: string) {
this._suspendedTo = suspendedTo;
}
get suspendedTo(): string {
if (this.isDateRangeType(this.suspendedDateType)) {
return this._suspendedTo;
@@ -182,7 +182,7 @@ export interface ProcessFilterAction {
export interface ProcessFilterOptions {
label?: string;
value?: string | object;
value?: string | any;
}
export interface ProcessFilterProperties {
@@ -190,7 +190,7 @@ export interface ProcessFilterProperties {
type?: string;
value?: any;
key?: string;
attributes?: { [key: string]: string; };
attributes?: { [key: string]: string };
options?: ProcessFilterOptions[];
dateFilterOptions?: DateCloudFilterType[];
selectionMode?: ComponentSelectionMode;
@@ -198,6 +198,6 @@ export interface ProcessFilterProperties {
export interface ProcessSortFilterProperty {
label: string;
value: string | object;
value: string | any;
key: string;
}

View File

@@ -37,7 +37,7 @@ export class ProcessFilterCloudService {
this.filters$ = this.filtersSubject.asObservable();
}
readQueryParams(obj: Object): ProcessFilterCloudModel {
readQueryParams(obj: any): ProcessFilterCloudModel {
const model = Object.assign({}, obj) as ProcessFilterCloudModel;
if (obj.hasOwnProperty('appVersion') && obj['appVersion']) {
@@ -57,7 +57,7 @@ export class ProcessFilterCloudService {
return model;
}
writeQueryParams(value: Object, filterProperties: string[], appName?: string, id?: string): Object {
writeQueryParams(value: any, filterProperties: string[], appName?: string, id?: string): any {
value = value || {};
const result = {
appName: appName || value['appName'],
@@ -255,7 +255,7 @@ export class ProcessFilterCloudService {
* @returns Boolean value if the preference has process instance filters
*/
private hasProcessFilters(preferences: any, key: string): boolean {
const filters = preferences.find((filter: any) => { return filter.entry.key === key; });
const filters = preferences.find((filter: any) => filter.entry.key === key);
return (filters && filters.entry) ? JSON.parse(filters.entry.value).length > 0 : false;
}
@@ -308,7 +308,7 @@ export class ProcessFilterCloudService {
* @param key
*/
private findFiltersByKeyInPreferences(preferences: any, key: string): ProcessFilterCloudModel[] {
const result = preferences.find((filter: any) => { return filter.entry.key === key; });
const result = preferences.find((filter: any) => filter.entry.key === key);
return result && result.entry ? JSON.parse(result.entry.value) : [];
}

View File

@@ -67,7 +67,7 @@ export class ProcessListCloudService extends BaseCloudService {
return requestNode[property] !== '' && requestNode[property] !== null && requestNode[property] !== undefined;
}
protected buildQueryParams(requestNode: ProcessQueryCloudRequestModel): Object {
protected buildQueryParams(requestNode: ProcessQueryCloudRequestModel): any {
const queryParam = {};
for (const property in requestNode) {

View File

@@ -688,7 +688,7 @@ describe('StartProcessCloudComponent', () => {
});
it('should call service to start process with the variables setted', async () => {
const inputProcessVariable: Map<string, object>[] = [];
const inputProcessVariable: Map<string, any>[] = [];
inputProcessVariable['name'] = { value: 'Josh' };
component.variables = inputProcessVariable;

View File

@@ -64,7 +64,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
/** Variables to attach to the payload. */
@Input()
variables: {};
variables: any;
/** Parameter to pass form field values in the start form if one is associated. */
@Input()

View File

@@ -19,7 +19,7 @@ export class ProcessPayloadCloud {
processDefinitionKey: string;
name: string;
businessKey: string;
variables: {};
variables: any;
payloadType: string = 'StartProcessPayload';
constructor(obj?: any) {

View File

@@ -45,7 +45,7 @@ export interface FormDefinition {
tabs: FormTab[];
fields: Container[] | HeaderRepresentation[];
outcomes: FormOutcome[];
metadata: {};
metadata: any;
variables: any[];
}
@@ -56,7 +56,7 @@ export interface Container {
name: string;
numberOfColumns: number;
fields: {
[key: string]: FormFieldRepresentation[]
[key: string]: FormFieldRepresentation[];
};
}
@@ -82,7 +82,7 @@ export interface RestField extends FormField {
export interface HeaderRepresentation extends Container {
numberOfColumns: number;
params: {
[key: string]: any
[key: string]: any;
};
visibilityCondition: VisibilityCondition;
}
@@ -123,7 +123,7 @@ export interface FormField {
readOnly?: boolean;
colspan: number;
params: {
[anyKey: string]: any
[anyKey: string]: any;
};
visibilityCondition: null | VisibilityCondition;
}
@@ -213,6 +213,7 @@ export interface PeopleField extends FormField {
export enum FormFieldType {
text = 'text',
multiline = 'multi-line-text',
// eslint-disable-next-line id-blacklist
number = 'integer',
checkbox = 'boolean',
date = 'date',

View File

@@ -19,7 +19,7 @@ import { IdentityUserService } from '@alfresco/adf-core';
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[adf-cloud-claim-task]'
})
export class ClaimTaskCloudDirective implements OnInit {

View File

@@ -18,7 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[adf-cloud-complete-task]'
})
export class CompleteTaskDirective implements OnInit {

View File

@@ -18,7 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[adf-cloud-unclaim-task]'
})
export class UnClaimTaskCloudDirective implements OnInit {

View File

@@ -20,7 +20,7 @@ import { Observable, Subject } from 'rxjs';
import { FilterParamsModel } from '../models/filter-cloud.model';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class BaseTaskFiltersCloudComponent implements OnDestroy {
/** Display filters available to the current user for the application with the specified name. */
@Input()

View File

@@ -35,7 +35,7 @@ export interface DropdownOption {
}
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnChanges, OnDestroy {
public static ACTION_SAVE = 'save';

View File

@@ -106,10 +106,6 @@ export class TaskFilterCloudModel {
this._dueDateFrom = dueDateFrom;
}
set dueDateTo(dueDateTo: string) {
this._dueDateTo = dueDateTo;
}
get dueDateFrom() {
if (this.isDateRangeType(this.dueDateType)) {
return this._dueDateFrom;
@@ -117,6 +113,10 @@ export class TaskFilterCloudModel {
return this.getStartDate(this.dueDateType);
}
set dueDateTo(dueDateTo: string) {
this._dueDateTo = dueDateTo;
}
get dueDateTo() {
if (this.isDateRangeType(this.dueDateType)) {
return this._dueDateTo;
@@ -128,10 +128,6 @@ export class TaskFilterCloudModel {
this._completedFrom = completedFrom;
}
set completedTo(completedTo: string) {
this._completedTo = completedTo;
}
get completedFrom(): string {
if (this.isDateRangeType(this.completedDateType)) {
return this._completedFrom;
@@ -139,6 +135,10 @@ export class TaskFilterCloudModel {
return this.getStartDate(this.completedDateType);
}
set completedTo(completedTo: string) {
this._completedTo = completedTo;
}
get completedTo(): string {
if (this.isDateRangeType(this.completedDateType)) {
return this._completedTo;
@@ -150,10 +150,6 @@ export class TaskFilterCloudModel {
this._createdFrom = createdFrom;
}
set createdTo(createdTo: string) {
this._createdTo = createdTo;
}
get createdFrom() {
if (this.isDateRangeType(this.createdDateType)) {
return this._createdFrom;
@@ -161,6 +157,10 @@ export class TaskFilterCloudModel {
return this.getStartDate(this.createdDateType);
}
set createdTo(createdTo: string) {
this._createdTo = createdTo;
}
get createdTo() {
if (this.isDateRangeType(this.createdDateType)) {
return this._createdTo;
@@ -237,7 +237,7 @@ export interface TaskFilterProperties {
type?: string;
value?: any;
key?: string;
attributes?: { [key: string]: string; };
attributes?: { [key: string]: string };
options?: FilterOptions[];
dateFilterOptions?: DateCloudFilterType[];
selectionMode?: ComponentSelectionMode;

View File

@@ -77,7 +77,7 @@ export class ServiceTaskFilterCloudService {
* @returns Boolean value if the preference has task filters
*/
private hasTaskFilters(preferences: any, key: string): boolean {
const filters = preferences.find((filter: any) => { return filter.entry.key === key; });
const filters = preferences.find((filter: any) => filter.entry.key === key);
return (filters && filters.entry) ? JSON.parse(filters.entry.value).length > 0 : false;
}
@@ -245,7 +245,7 @@ export class ServiceTaskFilterCloudService {
* @returns Array of TaskFilterCloudModel
*/
private findFiltersByKeyInPreferences(preferences: any, key: string): ServiceTaskFilterCloudModel[] {
const result = preferences.find((filter: any) => { return filter.entry.key === key; });
const result = preferences.find((filter: any) => filter.entry.key === key);
return result && result.entry ? JSON.parse(result.entry.value) : [];
}

View File

@@ -100,7 +100,7 @@ export class TaskFilterCloudService extends BaseCloudService {
* @returns Boolean value if the preference has task filters
*/
private hasTaskFilters(preferences: any, key: string): boolean {
const filters = preferences.find((filter: any) => { return filter.entry.key === key; });
const filters = preferences.find((filter: any) => filter.entry.key === key);
return (filters && filters.entry) ? JSON.parse(filters.entry.value).length > 0 : false;
}
@@ -290,7 +290,7 @@ export class TaskFilterCloudService extends BaseCloudService {
* @returns Array of TaskFilterCloudModel
*/
private findFiltersByKeyInPreferences(preferences: any, key: string): TaskFilterCloudModel[] {
const result = preferences.find((filter: any) => { return filter.entry.key === key; });
const result = preferences.find((filter: any) => filter.entry.key === key);
return result && result.entry ? JSON.parse(result.entry.value) : [];
}

View File

@@ -30,7 +30,7 @@ import { takeUntil } from 'rxjs/operators';
import { TaskCloudService } from '../../services/task-cloud.service';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class BaseTaskListCloudComponent extends DataTableSchema implements OnChanges, AfterContentInit, PaginatedComponent, OnDestroy, OnInit {
@ContentChild(CustomEmptyContentTemplateDirective)

View File

@@ -469,7 +469,7 @@ describe('TaskListCloudComponent', () => {
});
// TODO still not working because of the Loading Spinner
// tslint:disable-next-line: ban
// eslint-disable-next-line
xit('should render the custom template', (done) => {
fixtureEmpty.detectChanges();
fixtureEmpty.whenStable().then(() => {
@@ -534,7 +534,7 @@ describe('TaskListCloudComponent', () => {
});
// TODO: highly unstable test
// tslint:disable-next-line:ban
// eslint-disable-next-line
xit('should show tooltip if config copyContent flag is true', fakeAsync(() => {
taskSpy.and.returnValue(of(fakeGlobalTask));
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
@@ -556,7 +556,7 @@ describe('TaskListCloudComponent', () => {
}));
// TODO: highly unstable test
// tslint:disable-next-line:ban
// eslint-disable-next-line
xit('should replace priority values', (done) => {
taskSpy.and.returnValue(of(fakeGlobalTask));
component.presetColumn = 'fakeCustomSchema';

View File

@@ -34,6 +34,7 @@ export class ServiceTaskListCloudService extends BaseCloudService {
/**
* Finds a task using an object with optional query properties.
*
* @param requestNode Query object
* @returns Task information
*/
@@ -54,6 +55,7 @@ export class ServiceTaskListCloudService extends BaseCloudService {
/**
* Finds a service task integration context using an object with optional query properties.
*
* @param appName string
* @param serviceTaskId string
* @returns Service Task Integration Context information
@@ -70,8 +72,8 @@ export class ServiceTaskListCloudService extends BaseCloudService {
}
}
protected buildQueryParams(requestNode: ServiceTaskQueryCloudRequestModel): Object {
const queryParam: Object = {};
protected buildQueryParams(requestNode: ServiceTaskQueryCloudRequestModel): any {
const queryParam: any = {};
for (const property in requestNode) {
if (requestNode.hasOwnProperty(property) &&
!this.isExcludedField(property) &&

View File

@@ -35,6 +35,7 @@ export class TaskListCloudService extends BaseCloudService {
/**
* Finds a task using an object with optional query properties.
*
* @param requestNode Query object
* @param queryUrl Query url
* @returns Task information
@@ -62,8 +63,8 @@ export class TaskListCloudService extends BaseCloudService {
}
}
protected buildQueryParams(requestNode: TaskQueryCloudRequestModel): Object {
const queryParam: Object = {};
protected buildQueryParams(requestNode: TaskQueryCloudRequestModel): any {
const queryParam: any = {};
for (const property in requestNode) {
if (requestNode.hasOwnProperty(property) &&
!this.isExcludedField(property) &&

View File

@@ -1,17 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"adf-cloud",
"camelCase"
],
"component-selector": [
true,
"element",
"adf-cloud",
"kebab-case"
]
}
}