Bump to angular 11 (#237)

This commit is contained in:
Ildar Galeev 2021-01-19 11:17:15 +03:00 committed by GitHub
parent 9c9b59602f
commit 7338d5c007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 5184 additions and 4195 deletions

102
.eslintrc.json Normal file
View File

@ -0,0 +1,102 @@
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@angular-eslint/template/process-inline-templates",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": ["eslint-plugin-react"],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": ["attribute", "element"],
"prefix": "cc",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": ["attribute", "element"],
"prefix": "cc",
"style": "camelCase"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/member-delimiter-style": [
"off",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variableLike",
"format": ["camelCase", "snake_case", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
}
],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/semi": ["off", null],
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-expressions": "off",
"arrow-parens": ["off", "always"],
"brace-style": ["off", "off"],
"eol-last": "off",
"import/order": "error",
"linebreak-style": "off",
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-duplicate-imports": "error",
"no-extra-semi": "off",
"no-irregular-whitespace": "off",
"no-trailing-spaces": "off",
"quote-props": "off",
"react/jsx-curly-spacing": "off",
"react/jsx-equals-spacing": "off",
"react/jsx-wrap-multilines": "off",
"space-before-function-paren": "off",
"space-in-parens": ["off", "never"],
"prefer-arrow/prefer-arrow-functions": "off",
"no-shadow": "off",
"id-blacklist": "off",
"no-underscore-dangle": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {
"@angular-eslint/template/no-negated-async": "off"
}
}
]
}

View File

@ -49,7 +49,7 @@
{
"input": "src/app/styles/themes/light.scss",
"bundleName": "themes/light",
"lazy": true
"inject": false
}
],
"scripts": ["./node_modules/keycloak-js/dist/keycloak.js"]
@ -65,7 +65,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
@ -115,14 +114,9 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
},
"e2e": {

8720
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,19 +17,19 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~10.0.10",
"@angular/cdk": "^10.1.3",
"@angular/common": "^10.0.10",
"@angular/compiler": "^10.0.10",
"@angular/core": "^10.0.10",
"@angular/flex-layout": "~10.0.0-beta.32",
"@angular/forms": "~10.0.10",
"@angular/material": "~10.1.3",
"@angular/material-moment-adapter": "~10.1.3",
"@angular/platform-browser": "~10.0.10",
"@angular/platform-browser-dynamic": "~10.0.10",
"@angular/platform-server": "~10.0.10",
"@angular/router": "~10.0.10",
"@angular/animations": "~11.0.9",
"@angular/cdk": "^11.0.4",
"@angular/common": "^11.0.9",
"@angular/compiler": "^11.0.9",
"@angular/core": "^11.0.9",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "~11.0.9",
"@angular/material": "~11.0.4",
"@angular/material-moment-adapter": "~11.0.4",
"@angular/platform-browser": "~11.0.9",
"@angular/platform-browser-dynamic": "~11.0.9",
"@angular/platform-server": "~11.0.9",
"@angular/router": "~11.0.9",
"@ngneat/until-destroy": "^8.0.3",
"@rbkmoney/partial-fetcher": "~1.0.4",
"angular-file": "3.0.1",
@ -50,7 +50,7 @@
"moment": "~2.22.2",
"monaco-editor": "^0.21.2",
"pdfmake": "^0.1.64",
"rxjs": "^6.5.5",
"rxjs": "^6.6.3",
"short-uuid": "^4.1.0",
"skipper-proto": "github:rbkmoney/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74",
"thrift-ts": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#a5e3830ad30d5717e5e627ddcefa8f4d8918b174",
@ -62,37 +62,48 @@
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1000.6",
"@angular/cli": "^10.0.6",
"@angular/compiler-cli": "^10.0.10",
"@angular-devkit/build-angular": "^0.1100.7",
"@angular-eslint/builder": "1.1.0",
"@angular-eslint/eslint-plugin": "1.1.0",
"@angular-eslint/eslint-plugin-template": "1.1.0",
"@angular-eslint/schematics": "1.1.0",
"@angular-eslint/template-parser": "1.1.0",
"@angular/cli": "^11.0.7",
"@angular/compiler-cli": "^11.0.9",
"@rbkmoney/angular-templates": "^0.2.2",
"@types/del": "^4.0.0",
"@types/glob": "^7.1.3",
"@types/humanize-duration": "~3.18.0",
"@types/jasmine": "~3.5.0",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/jwt-decode": "~2.2.1",
"@types/lodash-es": "~4.17.3",
"@types/node": "^12.12.34",
"@types/pdfmake": "^0.1.9",
"@types/uuid": "~3.4.3",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"codelyzer": "^6.0.0",
"del": "^5.1.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"eslint-plugin-react": "latest",
"glob": "^7.1.6",
"jasmine-core": "~3.5.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"jwt-decode": "~2.2.0",
"karma": "~5.0.0",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"prettier": "~2.0.4",
"protractor": "~7.0.0",
"ts-mockito": "^2.6.1",
"ts-node": "~8.8.2",
"tslint": "~6.1.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "~3.9.7"
"typescript": "~4.0.5"
}
}

View File

@ -13,7 +13,7 @@ import { AppAuthGuardService } from '@cc/app/shared/services';
pathMatch: 'full',
},
],
{ paramsInheritanceStrategy: 'always' }
{ paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' }
),
],
providers: [AppAuthGuardService],

View File

@ -1,30 +1,43 @@
import { async, TestBed } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { AppComponent } from './app.component';
xdescribe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
imports: [MatIconModule, MatMenuModule],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'control-center'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('control-center');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to control-center!');
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
imports: [MatIconModule, MatMenuModule],
}).compileComponents();
})
);
it(
'should create the app',
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
})
);
it(
`should have as title 'control-center'`,
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('control-center');
})
);
it(
'should render title in a h1 tag',
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain(
'Welcome to control-center!'
);
})
);
});

View File

@ -10,13 +10,14 @@ export const addCommentsToTimelineInfos = (
return {
...info,
data: conversations
? conversations.find((conversation) => {
return !!info.modifications.find(
(m) =>
m.claim_modification.comment_modification.id ===
conversation.conversation_id
);
})
? conversations.find(
(conversation) =>
!!info.modifications.find(
(m) =>
m.claim_modification.comment_modification.id ===
conversation.conversation_id
)
)
: null,
};
} else {

View File

@ -73,9 +73,7 @@ export class StatusChangerService {
this.isLoading$.connect();
this.form.valueChanges
.pipe(
distinctUntilChanged((p, c) => {
return p.type === c.type && p.reason === c.reason;
}),
distinctUntilChanged((p, c) => p.type === c.type && p.reason === c.reason),
pairwise(),
filter(([prev, curr]) => prev.reason === curr.reason),
pluck(1, 'type')

View File

@ -1,23 +1,31 @@
import { async, TestBed } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { ClaimInfoDetailsComponent } from './claim-info-details.component';
describe('ClaimInfoDetailsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ClaimInfoDetailsComponent],
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ClaimInfoDetailsComponent],
})
.compileComponents()
.then();
})
.compileComponents()
.then();
}));
it('should create component', async(() => {
const fixture = TestBed.createComponent(ClaimInfoDetailsComponent);
const component = fixture.debugElement.componentInstance;
expect(component).toBeTruthy();
}));
it('should render reason', async(() => {
const fixture = TestBed.createComponent(ClaimInfoDetailsComponent);
const rendered = fixture.debugElement.componentInstance;
expect(rendered).toBeTruthy();
}));
);
it(
'should create component',
waitForAsync(() => {
const fixture = TestBed.createComponent(ClaimInfoDetailsComponent);
const component = fixture.debugElement.componentInstance;
expect(component).toBeTruthy();
})
);
it(
'should render reason',
waitForAsync(() => {
const fixture = TestBed.createComponent(ClaimInfoDetailsComponent);
const rendered = fixture.debugElement.componentInstance;
expect(rendered).toBeTruthy();
})
);
});

View File

@ -229,15 +229,15 @@ export class ClaimService {
this.papiClaimService
.getClaim(partyId, claimId)
.pipe(
repeatWhen((notifications) => {
return notifications.pipe(
repeatWhen((notifications) =>
notifications.pipe(
delay(delayMs),
takeWhile(
(_, retries) =>
isEqual(newPair, currentPair) && retries <= retryCount
)
);
})
)
)
)
.subscribe((claimInfo) => {
newPair = {

View File

@ -23,12 +23,8 @@ const initializer = (
bearerExcludedUrls: ['/assets', 'https://storage.rbk.money/files'],
bearerPrefix: 'Bearer',
})
.then(() => {
return keycloak.getToken();
})
.then((token) => {
return keycloakTokenInfoService.init(token);
}),
.then(() => keycloak.getToken())
.then((token) => keycloakTokenInfoService.init(token)),
]);
@NgModule({

View File

@ -2,10 +2,10 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { buildInitialMeta, findMeta, MetaEnricher } from '.';
import { DefinitionService } from './definition.service';
import { ErrorObservable, MetaErrorEmitter } from './meta-error-emitter';
import { MetaStruct, MetaUnion } from './model';
import { buildInitialMeta, findMeta, MetaEnricher } from '.';
@Injectable()
export class MetaBuilder implements ErrorObservable {

View File

@ -16,9 +16,9 @@ describe('FontsService', () => {
providers: [FontsService],
});
const injector = getTestBed();
// tslint:disable-next-line: deprecation
// eslint-disable-next-line import/no-deprecated
const service: FontsService = injector.get(FontsService);
// tslint:disable-next-line: deprecation
// eslint-disable-next-line import/no-deprecated
const httpMock: HttpTestingController = injector.get(HttpTestingController);
return { injector, service, httpMock };
}

View File

@ -8,22 +8,20 @@ function shorten(str: string, limit = 150): string {
}
export function toTableGroup(domainGroup: DomainGroup[]): TableGroup[] {
return domainGroup.map(({ name, pairs }) => {
return {
name,
tableItems: pairs.map((p) => {
const pair = toJson(p);
const stringifiedRef = JSON.stringify(pair.object.ref);
const stringifiedData = JSON.stringify(pair.object.data);
const stringified = stringifiedRef + stringifiedData;
const view = {
ref: shorten(stringifiedRef),
data: shorten(stringifiedData),
};
return { stringified, pair, view };
}),
};
});
return domainGroup.map(({ name, pairs }) => ({
name,
tableItems: pairs.map((p) => {
const pair = toJson(p);
const stringifiedRef = JSON.stringify(pair.object.ref);
const stringifiedData = JSON.stringify(pair.object.data);
const stringified = stringifiedRef + stringifiedData;
const view = {
ref: shorten(stringifiedRef),
data: shorten(stringifiedData),
};
return { stringified, pair, view };
}),
}));
}
export function toDataSource(group: TableGroup[], selectedTypes: string[]): TableDataSource[] {

View File

@ -12,7 +12,7 @@ export class DomainObjCodeLensProvider implements CodeLensProvider {
return 'json';
}
provideCodeLenses(model: ITextModel, token: CancellationToken): ProviderResult<CodeLensList> {
provideCodeLenses(model: ITextModel): ProviderResult<CodeLensList> {
const range = monaco.Range.fromPositions(model.getPositionAt(5), model.getPositionAt(8));
return {
lenses: [

View File

@ -445,12 +445,8 @@ export class ArrayASTNode extends ASTNode {
}
if (schema.uniqueItems === true) {
const values = this.items.map((node) => {
return node.getValue();
});
const duplicates = values.some((value, index) => {
return index !== values.lastIndexOf(value);
});
const values = this.items.map((node) => node.getValue());
const duplicates = values.some((value, index) => index !== values.lastIndexOf(value));
if (duplicates) {
validationResult.warnings.push({
location: { start: this.start, end: this.end },
@ -916,6 +912,7 @@ export class JSONDocument {
private validationResult: ValidationResult;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
constructor(config: JSONDocumentConfig) {
this.validationResult = new ValidationResult();
}

View File

@ -19,7 +19,7 @@ export interface LocalizeInfo {
comment: string[];
}
// tslint:disable-next-line: no-namespace
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace LocalizeInfo {
export function is(value: any): value is LocalizeInfo {
const candidate = value as LocalizeInfo;

View File

@ -1,4 +1,4 @@
// tslint:disable-next-line: no-reference
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../../node_modules/monaco-editor/monaco.d.ts" />
export * from './monaco-editor.module';
export * from './model';

View File

@ -6,8 +6,8 @@ import * as moment from 'moment';
import { PayoutSearchParams } from '../../papi/params';
export const formValueToSearchParams = (formValues: any): PayoutSearchParams => {
return reduce(
export const formValueToSearchParams = (formValues: any): PayoutSearchParams =>
reduce(
formValues,
(acc, value, key) => {
if (key === 'fromTime') {
@ -54,4 +54,3 @@ export const formValueToSearchParams = (formValues: any): PayoutSearchParams =>
},
{}
);
};

View File

@ -13,8 +13,8 @@ export class ChargebackDetailsService {
private loadChargeback$ = new Subject<void>();
payment$ = this.route.params.pipe(
switchMap(({ partyID, invoiceID, paymentID }) => {
return this.merchantStatisticsService
switchMap(({ partyID, invoiceID, paymentID }) =>
this.merchantStatisticsService
.getPayments({
dsl: createDSL({
payments: {
@ -24,8 +24,8 @@ export class ChargebackDetailsService {
},
}),
})
.pipe(map(({ data }) => data.payments[0]));
}),
.pipe(map(({ data }) => data.payments[0]))
),
shareReplay(1)
);

View File

@ -1,10 +1,9 @@
import { ChangesetInfo } from './changeset-info';
export const markOutdated = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] => {
return infos.map((info) => {
export const markOutdated = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] =>
infos.map((info) => {
if (info.hash === hash) {
info.outdated = true;
}
return info;
});
};

View File

@ -1,10 +1,9 @@
import { ChangesetInfo } from './changeset-info';
export const markRemoved = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] => {
return infos.map((info) => {
export const markRemoved = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] =>
infos.map((info) => {
if (info.hash === hash) {
info.removed = true;
}
return info;
});
};

View File

@ -7,9 +7,8 @@ import {
import { ChangesetInfo, ChangesetInfoModificationType, ChangesetInfoType } from './changeset-info';
import { markRemoved } from './mark-removed';
const getCommentChangesetInfoHash = (unit: ModificationUnit): string => {
return `${ChangesetInfoType.commentModification}.${unit.modification.claim_modification.comment_modification.id}`;
};
const getCommentChangesetInfoHash = (unit: ModificationUnit): string =>
`${ChangesetInfoType.commentModification}.${unit.modification.claim_modification.comment_modification.id}`;
const commentModificationType = (mod: CommentModification): ChangesetInfoModificationType => {
switch (getUnionKey(mod)) {

View File

@ -2,9 +2,7 @@ import { ModificationUnit } from '../../../../thrift-services/damsel/gen-model/c
import { ChangesetInfo, ChangesetInfoType } from './changeset-info';
import { markOutdated } from './mark-outdated';
const getDocumentChangesetInfoHash = (): string => {
return `${ChangesetInfoType.documentModification}`;
};
const getDocumentChangesetInfoHash = (): string => `${ChangesetInfoType.documentModification}`;
const makeDocumentChangesetInfo = (unit: ModificationUnit): ChangesetInfo =>
({

View File

@ -7,9 +7,8 @@ import {
import { ChangesetInfo, ChangesetInfoModificationType, ChangesetInfoType } from './changeset-info';
import { markRemoved } from './mark-removed';
const getFileChangesetInfoHash = (unit: ModificationUnit): string => {
return `${ChangesetInfoType.fileModification}.${unit.modification.claim_modification.file_modification.id}`;
};
const getFileChangesetInfoHash = (unit: ModificationUnit): string =>
`${ChangesetInfoType.fileModification}.${unit.modification.claim_modification.file_modification.id}`;
const fileModificationType = (mod: FileModification): ChangesetInfoModificationType => {
switch (getUnionKey(mod)) {

View File

@ -44,12 +44,12 @@ export class SendCommentService {
),
]);
}),
tap(([conversationID, _]) =>
tap(([conversationID]) =>
this.unsavedClaimChangesetService.addModification(
this.createModification(conversationID)
)
),
filter(([_, result]) => result !== 'error'),
filter(([, result]) => result !== 'error'),
shareReplay(1)
);

View File

@ -25,5 +25,4 @@ export interface OperationFailedPayload<C = {}, S = {}> {
operationScope: S;
}
export interface OperationError<C, S>
extends AdjustmentOperationEvent<OperationFailedPayload<C, S>> {}
export type OperationError<C, S> = AdjustmentOperationEvent<OperationFailedPayload<C, S>>;

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { PaymentAdjustmentCreationParams } from '.';
import { ExecErrorResult, ExecResultType, ExecSuccessResult } from '../executor.service';
import {
AdjustmentOperationEvent,
@ -12,6 +11,7 @@ import { AdjustmentOperationService } from './adjustment-operation.service';
import { CreatePaymentAdjustmentErrorCodes } from './error-codes';
import { ExecResultGroup } from './exec-result-group';
import { PaymentAdjustmentCreationScope } from './payment-adjustment-creation-scope';
import { PaymentAdjustmentCreationParams } from '.';
@Injectable()
export class CreateAdjustmentService extends AdjustmentOperationService {

View File

@ -16,8 +16,8 @@ export class PaymentDetailsService {
private routeParams$ = this.route.params.pipe(shareReplay(1));
payment$ = this.routeParams$.pipe(
switchMap(({ partyID, invoiceID, paymentID }) => {
return this.merchantStatisticsService
switchMap(({ partyID, invoiceID, paymentID }) =>
this.merchantStatisticsService
.getPayments({
dsl: JSON.stringify({
query: {
@ -36,8 +36,8 @@ export class PaymentDetailsService {
this.snackBar.open('An error occurred when receiving payment', 'OK');
}
})
);
}),
)
),
shareReplay(1)
);

View File

@ -11,6 +11,5 @@ export class ToCardNumberPipe implements PipeTransform {
}
}
export const toCardNumber = (card: BankCard): string => {
return `${card.bin}******${card.masked_pan}`.replace(/(.{4})/g, '$& ');
};
export const toCardNumber = (card: BankCard): string =>
`${card.bin}******${card.masked_pan}`.replace(/(.{4})/g, '$& ');

View File

@ -249,11 +249,10 @@ export class PredicateComponent implements OnChanges {
}
private enumValidator(enumObj: any): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } | null => {
return !control.value || Object.keys(enumObj).includes(control.value)
return (control: AbstractControl): { [key: string]: any } | null =>
!control.value || Object.keys(enumObj).includes(control.value)
? null
: { enumNotIncludeKey: { value: control.value } };
};
}
addChild() {

View File

@ -30,9 +30,9 @@ export class AddTerminalDialogComponent {
categoryID: number;
}
) {
this.addTerminalDecisionService.terminalAdded$.subscribe(() => {
return this.dialogRef.close('added');
});
this.addTerminalDecisionService.terminalAdded$.subscribe(() =>
this.dialogRef.close('added')
);
}
providerIDSelected(id: number) {

View File

@ -47,7 +47,7 @@ export class RemoveTerminalDecisionService {
),
switchMap((commit) =>
this.domainCacheService.commit(commit).pipe(
catchError((e) => {
catchError(() => {
this.error$.next();
return EMPTY;
})

View File

@ -1,10 +1,8 @@
import { SearchFiltersParams } from '../search-filters-params';
import { FormValue } from './form-value';
export const formValueToSearchParams = (value: FormValue): SearchFiltersParams => {
return {
...value,
fromTime: value.fromTime ? value.fromTime.format() : null,
toTime: value.toTime ? value.toTime.format() : null,
};
};
export const formValueToSearchParams = (value: FormValue): SearchFiltersParams => ({
...value,
fromTime: value.fromTime ? value.fromTime.format() : null,
toTime: value.toTime ? value.toTime.format() : null,
});

View File

@ -3,10 +3,9 @@ import moment from 'moment';
import { SearchFiltersParams } from '../search-filters-params';
import { FormValue } from './form-value';
export const searchParamsToFormParams = (value: SearchFiltersParams): FormValue => {
return {
export const searchParamsToFormParams = (value: SearchFiltersParams): FormValue =>
({
...value,
...(value.fromTime ? { fromTime: moment(value.fromTime) } : {}),
...(value.toTime ? { toTime: moment(value.toTime) } : {}),
} as any;
};
} as any);

View File

@ -2,16 +2,12 @@ import { toMinor } from '@cc/utils/to-minor';
import { SearchFiltersParams } from '../search-filters-params';
export const formParamsToSearchParams = (params: SearchFiltersParams): SearchFiltersParams => {
return {
...params,
...(params.paymentAmountFrom
? { paymentAmountFrom: amountToMinor(params.paymentAmountFrom) }
: {}),
...(params.paymentAmountTo
? { paymentAmountTo: amountToMinor(params.paymentAmountTo) }
: {}),
};
};
export const formParamsToSearchParams = (params: SearchFiltersParams): SearchFiltersParams => ({
...params,
...(params.paymentAmountFrom
? { paymentAmountFrom: amountToMinor(params.paymentAmountFrom) }
: {}),
...(params.paymentAmountTo ? { paymentAmountTo: amountToMinor(params.paymentAmountTo) } : {}),
});
const amountToMinor = (amount: string): string => toMinor(Number(amount)).toString();

View File

@ -43,15 +43,15 @@ export class PaymentsOtherSearchFiltersService {
this.openFiltersDialog$
.pipe(
switchMap(() => this.formParams.pipe(shareReplay(1), take(1))),
switchMap((formParams) => {
return this.dialog
switchMap((formParams) =>
this.dialog
.open(OtherFiltersDialogComponent, {
disableClose: true,
width: '552px',
data: formParams,
})
.afterClosed();
}),
.afterClosed()
),
filter((v) => !!v)
)
.subscribe((params) => this.formParams.next(params));

View File

@ -2,16 +2,12 @@ import { toMajor } from '@cc/utils/to-major';
import { SearchFiltersParams } from '../search-filters-params';
export const searchParamsToFormParams = (params: SearchFiltersParams): SearchFiltersParams => {
return {
...params,
...(params.paymentAmountFrom
? { paymentAmountFrom: amountToMajor(params.paymentAmountFrom) }
: {}),
...(params.paymentAmountTo
? { paymentAmountTo: amountToMajor(params.paymentAmountTo) }
: {}),
};
};
export const searchParamsToFormParams = (params: SearchFiltersParams): SearchFiltersParams => ({
...params,
...(params.paymentAmountFrom
? { paymentAmountFrom: amountToMajor(params.paymentAmountFrom) }
: {}),
...(params.paymentAmountTo ? { paymentAmountTo: amountToMajor(params.paymentAmountTo) } : {}),
});
const amountToMajor = (amount: string): string => toMajor(Number(amount)).toString();

View File

@ -26,6 +26,7 @@ import { getIndividualEntityName } from './get-individual-entity-name';
const EMPTY = '';
/* eslint-disable @typescript-eslint/naming-convention */
export function getDocDef(questionary: Questionary): DocDef {
const { data } = toOptional(questionary);
const { contractor, shop_info, contact_info } = toOptional(data);

View File

@ -33,6 +33,7 @@ import { getAuthorityConfirmingDocument } from './get-authority-confirming-docum
const EMPTY = '';
/* eslint-disable @typescript-eslint/naming-convention */
export function getDocDef(questionary: Questionary): DocDef {
const { data } = toOptional(questionary);
const { contractor, shop_info, contact_info } = toOptional(data);

View File

@ -20,7 +20,7 @@ function format(
) {
const exp =
'\\d(?=(\\d{' + (wholeLength || 3) + '})+' + (decimalLength > 0 ? '\\D' : '$') + ')';
// tslint:disable-next-line:no-bitwise
// eslint-disable-next-line no-bitwise
const num = value.toFixed(Math.max(0, ~~decimalLength));
return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(
new RegExp(exp, 'g'),

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router';
import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
import { isRolesAllowed } from './is-roles-allowed';
@ -18,10 +18,7 @@ export class AppAuthGuardService extends KeycloakAuthGuard {
return isRolesAllowed(this.keycloakAngular.getUserRoles(), roles);
}
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Promise<boolean | UrlTree> {
canActivate(route: ActivatedRouteSnapshot): Promise<boolean | UrlTree> {
return new Promise(async (resolve, reject) => {
try {
this.authenticated = await this.keycloakAngular.isLoggedIn();

View File

@ -1,15 +1,8 @@
import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { SettingsService } from '../settings';
import { ThemeName } from './theme-name';
enum Type {
JS = 'js',
CSS = 'css',
}
@Injectable()
export class ThemeManager {
private static readonly KEY = 'theme';
@ -52,9 +45,7 @@ export class ThemeManager {
}
private createElement(name: ThemeName): HTMLLinkElement | HTMLScriptElement {
const fileType: Type = environment.production ? Type.CSS : Type.JS;
const url = `themes/${name}.${fileType}`;
return fileType === Type.JS ? this.createScriptElement(url) : this.createStyleElement(url);
return this.createStyleElement(`themes/${name}.css`);
}
private createStyleElement(url: string): HTMLLinkElement {
@ -63,10 +54,4 @@ export class ThemeManager {
styleElement.rel = 'stylesheet';
return styleElement;
}
private createScriptElement(url: string): HTMLScriptElement {
const scriptElement = document.createElement('script');
scriptElement.src = url;
return scriptElement;
}
}

View File

@ -19,16 +19,16 @@ export class EditTerminalDecisionPropertyForShopService {
switchMap((params) =>
this.providerService.getProviderFromParams<EditTerminalDecisionPropertyParams>(params)
),
switchMap(([params, provider]) => {
return this.domainCacheService
switchMap(([params, provider]) =>
this.domainCacheService
.commit(editTerminalDecisionPropertyForShopCommit(provider, params))
.pipe(
catchError((e) => {
catchError(() => {
this.error$.next();
return EMPTY;
})
);
}),
)
),
shareReplay(1)
);

View File

@ -4,8 +4,8 @@ import { CategoryRef, ProviderObject } from '../damsel/gen-model/domain';
export const filterProvidersByCategories = (
objects: ProviderObject[],
shopCategories: number[]
): ProviderObject[] => {
return objects.filter((obj) => {
): ProviderObject[] =>
objects.filter((obj) => {
const predicate = (category: CategoryRef) =>
!!shopCategories.find((shopCategory) => shopCategory === category.id);
const paymentCats = get(obj, 'data.payment_terms.categories.value');
@ -18,4 +18,3 @@ export const filterProvidersByCategories = (
}
return null;
});
};

View File

@ -5,12 +5,11 @@ import { ProviderObject } from '../damsel/gen-model/domain';
export const filterProvidersByCategoryId = (
objects: ProviderObject[],
categoryId: number
): ProviderObject[] => {
return objects.filter((obj) => {
): ProviderObject[] =>
objects.filter((obj) => {
const paymentCats = get(obj, 'data.payment_terms.categories.value', []);
const recurrentCats = get(obj, 'data.recurrent_paytool_terms.categories.value', []);
return !![...paymentCats, ...recurrentCats]
.map((c) => c.id)
.find((id) => id === categoryId);
});
};

View File

@ -3,8 +3,8 @@ import { ProviderObject } from '../damsel/gen-model/domain';
export const filterProvidersByTerminalSelector = (
objects: ProviderObject[],
filterValue: 'decisions' | 'value'
): ProviderObject[] => {
return objects.filter((object) => {
): ProviderObject[] =>
objects.filter((object) => {
const selector = object.data.terminal;
switch (filterValue) {
case 'decisions':
@ -13,4 +13,3 @@ export const filterProvidersByTerminalSelector = (
return selector?.value;
}
});
};

View File

@ -14,7 +14,6 @@ import {
OnDestroy,
Optional,
Self,
SimpleChanges,
} from '@angular/core';
import {
ControlValueAccessor,
@ -31,9 +30,11 @@ import * as uuid from 'uuid';
import { InputMixinBase } from './input-base';
// eslint-disable-next-line @angular-eslint/directive-selector
@Directive({ selector: 'cc-custom-form-control' })
// tslint:disable-next-line: no-conflicting-lifecycle
// tslint:disable-next-line: directive-class-suffix
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class CustomFormControl<I extends any = any, P extends any = I> extends InputMixinBase
implements
AfterViewInit,
@ -159,7 +160,7 @@ export class CustomFormControl<I extends any = any, P extends any = I> extends I
}
}
ngOnChanges(_changes?: SimpleChanges) {
ngOnChanges() {
this.stateChanges.next();
}

View File

@ -1,4 +1,4 @@
// tslint:disable:ordered-imports
/* eslint-disable import/order */
/**
* This file includes polyfills needed by Angular and is loaded before the app.

View File

@ -1,4 +1,4 @@
// tslint:disable:ordered-imports
/* eslint-disable import/order */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';

View File

@ -8,7 +8,7 @@ export function getUnionKeys<T extends object>(obj: T): (keyof T)[] {
export function getUnionKeyValue<T extends object>(
obj: T
): { [K in keyof T]: [K, T[K]] }[keyof T] | null {
return obj ? (Object.entries(obj).find(([_, v]) => v) as any) : null;
return obj ? (Object.entries(obj).find(([, v]) => v) as any) : null;
}
export function getUnionKey<T extends object>(obj: T): keyof T | null {

View File

@ -2,7 +2,7 @@ export const i64ToNumber = (buffer: object, offset: number, allowImprecise = fal
const b = buffer;
const o = offset;
// Running sum of octets, doing a 2's complement
// tslint:disable-next-line: no-bitwise
// eslint-disable-next-line no-bitwise
const negate = b[o] & 0x80;
let x = 0;
let carry = 1;
@ -10,11 +10,11 @@ export const i64ToNumber = (buffer: object, offset: number, allowImprecise = fal
let v = b[o + i];
// 2's complement for negative numbers
if (negate) {
// tslint:disable-next-line: no-bitwise
// eslint-disable-next-line no-bitwise
v = (v ^ 0xff) + carry;
// tslint:disable-next-line: no-bitwise
// eslint-disable-next-line no-bitwise
carry = v >> 8;
// tslint:disable-next-line: no-bitwise
// eslint-disable-next-line no-bitwise
v = v & 0xff;
}
x += v * m;

View File

@ -1,52 +0,0 @@
{
"extends": "tslint:recommended",
"rules": {
"array-type": false,
"arrow-parens": false,
"deprecation": {
"severity": "warning"
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
"import-blacklist": [true, "rxjs/Rx"],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [true, 140],
"member-access": false,
"member-ordering": [
true,
{
"order": ["static-field", "instance-field", "static-method", "instance-method"]
}
],
"no-consecutive-blank-lines": false,
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
"no-empty": false,
"no-inferrable-types": [true, "ignore-params"],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-var-requires": false,
"object-literal-key-quotes": [true, "as-needed"],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [true, "single"],
"trailing-comma": false,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
},
"rulesDirectory": ["codelyzer"]
}

View File

@ -1,34 +0,0 @@
{
"extends": ["./tslint.angular.json", "tslint-config-prettier"],
"rules": {
"deprecation": {
"severity": "warning"
},
"directive-selector": [true, ["attribute", "element"], "cc", ["camelCase", "kebab-case"]],
"component-selector": [true, ["attribute", "element"], "cc", "kebab-case"],
"template-no-negated-async": false,
"import-blacklist": [true, "rxjs/Rx", "lodash", "lodash-es"],
"no-unused-variable": [true, { "ignore-pattern": "^_" }],
"variable-name": {
"options": [
"allow-leading-underscore",
"ban-keywords",
"check-format",
"allow-pascal-case",
"allow-snake-case"
]
},
"ordered-imports": [
true,
{
"grouped-imports": true,
"groups": [
{ "name": "node_modules", "match": "^(?![.]|@cc/)", "order": 10 },
{ "name": "project", "match": "^@cc/", "order": 20 },
{ "name": "current", "match": "^[.]", "order": 30 }
]
}
],
"no-duplicate-imports": [true, { "allow-namespace-imports": true }]
}
}