From 4d171ef8ea1d5e88a20ad36a6b71ca7de17a28cd Mon Sep 17 00:00:00 2001
From: Rinat Arsaev <11846445+A77AY@users.noreply.github.com>
Date: Fri, 20 Oct 2023 15:28:35 +0700
Subject: [PATCH] IMP-82: Terminals page (#275)
---
.prettierignore | 20 +-
.prettierrc.js | 2 +-
package-lock.json | 41 +--
package.json | 13 +-
src/app/api/deprecated-damsel/index.ts | 1 -
src/app/api/domain-config/index.ts | 1 +
.../stores}/domain-store.service.ts | 15 +-
src/app/app.component.html | 10 +-
src/app/app.component.ts | 17 +-
...te-chargebacks-by-file-dialog.component.ts | 12 +-
src/app/sections/claim/claim.component.ts | 8 +-
...dification-unit-timeline-item.component.ts | 4 +-
.../allowed-claim-statuses.service.ts | 3 +-
.../domain-group/domain-group.component.ts | 2 +-
.../domain-group/utils/sort-table-data.ts | 4 +-
.../domain-info/domain-info.component.ts | 2 +-
.../domain-obj-creation.component.ts | 2 +-
.../domain-obj-modification.component.ts | 6 +-
.../domain-obj-review.component.ts | 2 +-
.../domain-obj-modification.service.ts | 3 +-
.../party-shops/party-shops.component.html | 10 +-
.../party-shops/party-shops.component.ts | 8 +-
.../party-shops/party-shops.service.ts | 8 +-
.../payment-details.component.ts | 4 +-
.../fetch-provider.service.ts | 2 +-
.../fetch-terminal.service.ts | 2 +-
.../create-payment-adjustment.component.ts | 4 +-
.../sections/repairing/repairing.component.ts | 2 +-
.../party-delegate-rulesets.component.ts | 2 +-
.../party-delegate-rulesets.service.ts | 2 +-
.../party-routing-ruleset.component.ts | 2 +-
.../routing-ruleset.component.html | 4 +-
.../routing-ruleset.component.ts | 11 +-
.../routing-rules/routing-rules.service.ts | 2 +-
.../target-ruleset-form.component.ts | 2 +-
src/app/sections/sections-routing.module.ts | 4 +
src/app/sections/terminals/index.ts | 2 +
src/app/sections/terminals/routing-config.ts | 5 +
.../terminals/terminals-routing.module.ts | 22 ++
.../terminals/terminals.component.html | 33 +++
.../sections/terminals/terminals.component.ts | 240 ++++++++++++++++++
.../sections/terminals/terminals.module.ts | 28 ++
.../components/datetime/datetime.component.ts | 7 +-
.../components/key/key.component.ts | 20 +-
.../json-viewer/utils/get-entries.ts | 4 +-
.../json-viewer/utils/metadata-view.ts | 19 +-
.../merchant-field.component.ts | 4 +-
.../complex-form/complex-form.component.ts | 12 +-
.../extension-field.component.ts | 4 +-
.../primitive-field.component.ts | 8 +-
.../struct-form/struct-form.component.ts | 23 +-
.../metadata-form/types/metadata-form-data.ts | 4 +-
.../domain-object-field.component.ts | 2 +-
...domain-metadata-view-extensions.service.ts | 2 +-
.../utils/get-object-label.ts | 8 +-
.../thrift-viewer.component.scss | 1 +
src/app/shared/pipes/amount-currency.pipe.ts | 13 +-
.../services/amount-currency.service.ts | 2 +-
.../app-auth-guard/app-auth-guard.service.ts | 3 +-
...domain-metadata-form-extensions.service.ts | 2 +-
.../utils/domains-objects-to-options.ts | 8 +-
src/app/shared/utils/clean-thrift.ts | 4 +-
src/app/tokens.ts | 8 +-
.../cash-field/cash-field.component.ts | 5 +-
.../monaco-editor/abstract-monaco.service.ts | 8 +-
src/utils/csv/utils/unify-csv-items.ts | 4 +-
.../validated-control-superclass.directive.ts | 7 +-
.../create-full-text-search.ts | 12 +
src/utils/full-text-search/index.ts | 1 +
src/utils/get-enum-keys.ts | 8 +-
src/utils/index.ts | 1 +
src/utils/thrift-instance/namespace-type.ts | 6 +-
src/utils/to-major.ts | 4 +-
73 files changed, 633 insertions(+), 148 deletions(-)
delete mode 100644 src/app/api/deprecated-damsel/index.ts
rename src/app/api/{deprecated-damsel => domain-config/stores}/domain-store.service.ts (83%)
create mode 100644 src/app/sections/terminals/index.ts
create mode 100644 src/app/sections/terminals/routing-config.ts
create mode 100644 src/app/sections/terminals/terminals-routing.module.ts
create mode 100644 src/app/sections/terminals/terminals.component.html
create mode 100644 src/app/sections/terminals/terminals.component.ts
create mode 100644 src/app/sections/terminals/terminals.module.ts
create mode 100644 src/utils/full-text-search/create-full-text-search.ts
create mode 100644 src/utils/full-text-search/index.ts
diff --git a/.prettierignore b/.prettierignore
index c995ccf6..efda5d86 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,10 +1,24 @@
+LICENSE
+
+.idea
+.vscode
+
package.json
package-lock.json
node_modules
-dist
-src/assets/icons/
+.npmrc
+
.angular
-LICENSE
+.run
+dist
+
Dockerfile
*.conf
+
+.*ignore
*.env
+
+*.ico
+*.ttf
+
+src/assets/icons/
diff --git a/.prettierrc.js b/.prettierrc.js
index 3cee9524..9f81c84c 100644
--- a/.prettierrc.js
+++ b/.prettierrc.js
@@ -1 +1 @@
-module.exports = require("@vality/prettier-config");
+module.exports = require('@vality/prettier-config');
diff --git a/package-lock.json b/package-lock.json
index fa164eb4..382932c7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,7 +29,7 @@
"@vality/dominant-cache-proto": "2.0.0",
"@vality/fistful-proto": "2.0.1-ed97a0e.0",
"@vality/magista-proto": "2.0.2-37b81e6.0",
- "@vality/ng-core": "16.2.1-pr-40-bdc62db.0",
+ "@vality/ng-core": "16.2.1-pr-40-c4e5174.0",
"@vality/payout-manager-proto": "2.0.0",
"@vality/repairer-proto": "2.0.2-f5e3b7a.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
@@ -37,6 +37,7 @@
"coerce-property": "15.0.1",
"css-element-queries": "1.2.3",
"date-fns": "2.30.0",
+ "fuse.js": "6.6.2",
"humanize-duration": "3.21.0",
"inputmask": "5.0.7",
"keycloak-angular": "14.0.0",
@@ -66,8 +67,8 @@
"@types/lodash-es": "4.17.6",
"@types/papaparse": "5.3.7",
"@vality/cspell-config": "7.0.1-pr-33-8e9a771.0",
- "@vality/eslint-config": "8.0.1-pr-33-541079b.0",
- "@vality/prettier-config": "3.0.1-pr-33-1086ab7.0",
+ "@vality/eslint-config": "8.1.1-pr-40-c4e5174.0",
+ "@vality/prettier-config": "3.0.1-pr-40-c4e5174.0",
"cross-env": "7.0.3",
"cspell": "^7.0.0",
"eslint": "^8.39.0",
@@ -79,7 +80,7 @@
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
- "prettier": "3.0.1",
+ "prettier": "3.0.3",
"typescript": "~5.0.4",
"typescript-memoize": "1.1.1"
}
@@ -5783,9 +5784,9 @@
"integrity": "sha512-Jxo7n8/2xo8D/y7g0v1iFjr5MijOYmJ0hiHNTqoj/D0elzRhHAeRBur9F8h4RDf6sd2/+FmtVlprc7+q0/AGig=="
},
"node_modules/@vality/eslint-config": {
- "version": "8.0.1-pr-33-541079b.0",
- "resolved": "https://registry.npmjs.org/@vality/eslint-config/-/eslint-config-8.0.1-pr-33-541079b.0.tgz",
- "integrity": "sha512-FvkI4bhsfWjJYmpw0lFPqajxlA4cNNDvoIRaelkJcr70iEq1xIol+vYHqvqV8jEc8z0W3xrApseSFOxjTMzMnw==",
+ "version": "8.1.1-pr-40-c4e5174.0",
+ "resolved": "https://registry.npmjs.org/@vality/eslint-config/-/eslint-config-8.1.1-pr-40-c4e5174.0.tgz",
+ "integrity": "sha512-nKOHesoVfatRqdmZUk7S6qm3zs41BxDQam768QAiS81k6rQ52sQwdOZgJYFGm36r2fvokb1KxEnSrIRfqY8U+g==",
"dev": true,
"dependencies": {
"@angular-eslint/eslint-plugin": "^16.1.0",
@@ -6000,9 +6001,9 @@
"integrity": "sha512-gJizpTWuB74L+XuJ+dUaxAwJDkycdnuVwrXWIl/NKcS7++/zgrgTpw+tM5/Te3rWqkkCnSxC1SK0C4aPbbtifg=="
},
"node_modules/@vality/ng-core": {
- "version": "16.2.1-pr-40-bdc62db.0",
- "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-16.2.1-pr-40-bdc62db.0.tgz",
- "integrity": "sha512-hw7ljBUP1X1WYt6ZEQZ2E+y0Udy7G5pUNWL1wUIMmexaXr5H21NTuRZRgy9u3zfxrYfNnLmmI1XZgLfZry/gkA==",
+ "version": "16.2.1-pr-40-c4e5174.0",
+ "resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-16.2.1-pr-40-c4e5174.0.tgz",
+ "integrity": "sha512-gIJrzmrS+vxSdo+0F66imWNZdf7hC5tA74Le3glQSsbr9ZhmldYaBE5559a3VWCwF4VITrADCGBV3tt2nxjM/Q==",
"dependencies": {
"@ng-matero/extensions": "^16.0.0",
"@s-libs/js-core": "^16.0.0",
@@ -6032,9 +6033,9 @@
"integrity": "sha512-eBR/QJQObjfRQPOSR29vafvvfYVaAvrKJGYVxGo7j4ZWWf9KWDlR4cipixNnZyZ/esLNX2fdqebWbfogrOBdSA=="
},
"node_modules/@vality/prettier-config": {
- "version": "3.0.1-pr-33-1086ab7.0",
- "resolved": "https://registry.npmjs.org/@vality/prettier-config/-/prettier-config-3.0.1-pr-33-1086ab7.0.tgz",
- "integrity": "sha512-TurfC2o3w8owbXTC9KTTZef0dlr4EX7l3pfcA8Ubht9lf4YmPiTs86sicMcwQaeyfTKWQExfnsSw99JG90DAAQ==",
+ "version": "3.0.1-pr-40-c4e5174.0",
+ "resolved": "https://registry.npmjs.org/@vality/prettier-config/-/prettier-config-3.0.1-pr-40-c4e5174.0.tgz",
+ "integrity": "sha512-1w5LgPbZxc4j3tam7RIA6NKLNabCI/BWsrx3gSiWVTZfEWSOl43e7UBLv+Mq+Bc/8gdvl1eNNRRjvGkJU82Brw==",
"dev": true,
"dependencies": {
"prettier-plugin-organize-attributes": "^1.0.0"
@@ -13360,6 +13361,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/fuse.js": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz",
+ "integrity": "sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA==",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/gauge": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
@@ -18549,9 +18558,9 @@
}
},
"node_modules/prettier": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz",
- "integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
+ "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
"dev": true,
"bin": {
"prettier": "bin/prettier.cjs"
diff --git a/package.json b/package.json
index 5fec82bb..d6dd923d 100644
--- a/package.json
+++ b/package.json
@@ -9,8 +9,8 @@
"test": "ng test",
"lint": "ng lint --max-warnings=0",
"lint:fix": "ng lint --fix",
- "format": "prettier * --list-different",
- "format:fix": "prettier * --write --loglevel warn",
+ "format": "prettier ** --list-different",
+ "format:fix": "prettier ** --write --log-level=warn",
"spell": "cspell --no-progress **",
"spell:fix": "cspell --no-progress --show-suggestions --show-context **",
"fix": "npm run lint:fix && npm run format:fix"
@@ -37,7 +37,7 @@
"@vality/dominant-cache-proto": "2.0.0",
"@vality/fistful-proto": "2.0.1-ed97a0e.0",
"@vality/magista-proto": "2.0.2-37b81e6.0",
- "@vality/ng-core": "16.2.1-pr-40-bdc62db.0",
+ "@vality/ng-core": "16.2.1-pr-40-c4e5174.0",
"@vality/payout-manager-proto": "2.0.0",
"@vality/repairer-proto": "2.0.2-f5e3b7a.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
@@ -45,6 +45,7 @@
"coerce-property": "15.0.1",
"css-element-queries": "1.2.3",
"date-fns": "2.30.0",
+ "fuse.js": "6.6.2",
"humanize-duration": "3.21.0",
"inputmask": "5.0.7",
"keycloak-angular": "14.0.0",
@@ -74,8 +75,8 @@
"@types/lodash-es": "4.17.6",
"@types/papaparse": "5.3.7",
"@vality/cspell-config": "7.0.1-pr-33-8e9a771.0",
- "@vality/eslint-config": "8.0.1-pr-33-541079b.0",
- "@vality/prettier-config": "3.0.1-pr-33-1086ab7.0",
+ "@vality/eslint-config": "8.1.1-pr-40-c4e5174.0",
+ "@vality/prettier-config": "3.0.1-pr-40-c4e5174.0",
"cross-env": "7.0.3",
"cspell": "^7.0.0",
"eslint": "^8.39.0",
@@ -87,7 +88,7 @@
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
- "prettier": "3.0.1",
+ "prettier": "3.0.3",
"typescript": "~5.0.4",
"typescript-memoize": "1.1.1"
}
diff --git a/src/app/api/deprecated-damsel/index.ts b/src/app/api/deprecated-damsel/index.ts
deleted file mode 100644
index 1f35a68a..00000000
--- a/src/app/api/deprecated-damsel/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './domain-store.service';
diff --git a/src/app/api/domain-config/index.ts b/src/app/api/domain-config/index.ts
index 0cadf132..d7e13642 100644
--- a/src/app/api/domain-config/index.ts
+++ b/src/app/api/domain-config/index.ts
@@ -1 +1,2 @@
export * from './repository.service';
+export * from './stores/domain-store.service';
diff --git a/src/app/api/deprecated-damsel/domain-store.service.ts b/src/app/api/domain-config/stores/domain-store.service.ts
similarity index 83%
rename from src/app/api/deprecated-damsel/domain-store.service.ts
rename to src/app/api/domain-config/stores/domain-store.service.ts
index 91f62f44..012ef835 100644
--- a/src/app/api/deprecated-damsel/domain-store.service.ts
+++ b/src/app/api/domain-config/stores/domain-store.service.ts
@@ -5,12 +5,11 @@ import { Commit, Snapshot, Version } from '@vality/domain-proto/domain_config';
import { BehaviorSubject, defer, Observable, of, ReplaySubject } from 'rxjs';
import { map, pluck, shareReplay, startWith, switchMap, take, tap } from 'rxjs/operators';
-import { RepositoryService } from '@cc/app/api/domain-config';
-import { DomainSecretService } from '@cc/app/shared/services/domain-secret-service';
-import { inProgressFrom, progressTo } from '@cc/utils';
-import { getUnionKey } from '@cc/utils/get-union-key';
-
-import { handleError, NotificationErrorService } from '../../shared/services/notification-error';
+import { inProgressFrom, progressTo } from '../../../../utils';
+import { getUnionKey } from '../../../../utils/get-union-key';
+import { DomainSecretService } from '../../../shared/services/domain-secret-service';
+import { handleError, NotificationErrorService } from '../../../shared/services/notification-error';
+import { RepositoryService } from '../index';
@UntilDestroy()
@Injectable({
@@ -68,7 +67,9 @@ export class DomainStoreService {
return version$.pipe(
switchMap((v) => this.repositoryService.Commit(v, commit)),
tap(() => {
- if (reload) this.forceReload();
+ if (reload) {
+ this.forceReload();
+ }
}),
);
}
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 0ffb8d82..73740d31 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,5 +1,4 @@
-
Control Center {{ username }}
@@ -7,14 +6,7 @@
-
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 03d94c23..169331bb 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -12,11 +12,10 @@ import { ROUTING_CONFIG as PAYOUTS_ROUTING_CONFIG } from './sections/payouts/pay
import { ROUTING_CONFIG as REPAIRING_ROUTING_CONFIG } from './sections/repairing/routing-config';
import { ROUTING_CONFIG as PARTIES_ROUTING_CONFIG } from './sections/search-parties/routing-config';
import { ROUTING_CONFIG as SOURCES_ROUTING_CONFIG } from './sections/sources/routing-config';
+import { ROUTING_CONFIG as TERMINALS_ROUTING_CONFIG } from './sections/terminals';
import { ROUTING_CONFIG as WALLETS_ROUTING_CONFIG } from './sections/wallets/routing-config';
import { ROUTING_CONFIG as WITHDRAWALS_ROUTING_CONFIG } from './sections/withdrawals/routing-config';
-import { SidenavInfoService } from './shared/components/sidenav-info/sidenav-info.service';
-
-const SIDENAV_OPENED_KEY = 'sidenav-opened';
+import { SidenavInfoService } from './shared/components/sidenav-info';
@Component({
selector: 'cc-root',
@@ -27,13 +26,6 @@ export class AppComponent implements OnInit {
username: string;
menuItems: { name: string; route: string }[][] = [];
- get opened(): boolean {
- return localStorage.getItem(SIDENAV_OPENED_KEY) === String(true);
- }
- set opened(opened: boolean) {
- localStorage.setItem(SIDENAV_OPENED_KEY, String(opened));
- }
-
constructor(
private keycloakService: KeycloakService,
private appAuthGuardService: AppAuthGuardService,
@@ -59,6 +51,11 @@ export class AppComponent implements OnInit {
route: '/domain',
services: DOMAIN_ROUTING_CONFIG.services,
},
+ {
+ name: 'Terminals',
+ route: '/terminals',
+ services: TERMINALS_ROUTING_CONFIG.services,
+ },
{
name: 'Repairing',
route: '/repairing',
diff --git a/src/app/sections/chargebacks/components/create-chargebacks-by-file-dialog/create-chargebacks-by-file-dialog.component.ts b/src/app/sections/chargebacks/components/create-chargebacks-by-file-dialog/create-chargebacks-by-file-dialog.component.ts
index dd39783e..2d35ff0e 100644
--- a/src/app/sections/chargebacks/components/create-chargebacks-by-file-dialog/create-chargebacks-by-file-dialog.component.ts
+++ b/src/app/sections/chargebacks/components/create-chargebacks-by-file-dialog/create-chargebacks-by-file-dialog.component.ts
@@ -108,13 +108,19 @@ export class CreateChargebacksByFileDialogComponent
parseCsv(content, { header: this.hasHeaderControl.value || false, delimiter: ';' }),
),
tap((d) => {
- if (!d.errors.length) return;
- if (d.errors.length === 1) this.log.error(d.errors[0]);
+ if (!d.errors.length) {
+ return;
+ }
+ if (d.errors.length === 1) {
+ this.log.error(d.errors[0]);
+ }
this.log.error(new Error(d.errors.map((e) => e.message).join('. ')));
}),
map((d) => {
const chargebacks = unifyCsvItems(d?.data, CSV_CHARGEBACK_PROPS);
- if (chargebacks[0].invoice_id) return chargebacks;
+ if (chargebacks[0].invoice_id) {
+ return chargebacks;
+ }
this.log.error(
'Perhaps you incorrectly checked the checkbox to have or not a header (the first element does not have at least an invoice ID)',
);
diff --git a/src/app/sections/claim/claim.component.ts b/src/app/sections/claim/claim.component.ts
index cffef07e..805e811b 100644
--- a/src/app/sections/claim/claim.component.ts
+++ b/src/app/sections/claim/claim.component.ts
@@ -84,7 +84,9 @@ export class ClaimComponent {
untilDestroyed(this),
)
.subscribe((result) => {
- if (result.status === DialogResponseStatus.Success) this.reloadClaim();
+ if (result.status === DialogResponseStatus.Success) {
+ this.reloadClaim();
+ }
});
}
@@ -100,7 +102,9 @@ export class ClaimComponent {
untilDestroyed(this),
)
.subscribe((result) => {
- if (result.status === DialogResponseStatus.Success) this.reloadClaim();
+ if (result.status === DialogResponseStatus.Success) {
+ this.reloadClaim();
+ }
});
}
}
diff --git a/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts b/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts
index 30a825cf..1627047a 100644
--- a/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts
+++ b/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts
@@ -76,7 +76,9 @@ export class ModificationUnitTimelineItemComponent {
untilDestroyed(this),
)
.subscribe((result) => {
- if (result.status === DialogResponseStatus.Success) this.claimChanged.emit();
+ if (result.status === DialogResponseStatus.Success) {
+ this.claimChanged.emit();
+ }
});
}
diff --git a/src/app/sections/claim/services/allowed-claim-statuses.service.ts b/src/app/sections/claim/services/allowed-claim-statuses.service.ts
index 3797a97d..2f3969d6 100644
--- a/src/app/sections/claim/services/allowed-claim-statuses.service.ts
+++ b/src/app/sections/claim/services/allowed-claim-statuses.service.ts
@@ -28,8 +28,9 @@ export class AllowedClaimStatusesService {
if (
excludedStatuses.includes(status) ||
!includedCurrentStatuses.includes(currentClaimStatus)
- )
+ ) {
return false;
+ }
return this.appAuthGuardService.userHasRoles(CLAIM_STATUS_ROLES[status]);
}
}
diff --git a/src/app/sections/domain/domain-info/domain-group/domain-group.component.ts b/src/app/sections/domain/domain-info/domain-group/domain-group.component.ts
index 3982a4bb..17110909 100644
--- a/src/app/sections/domain/domain-info/domain-group/domain-group.component.ts
+++ b/src/app/sections/domain/domain-info/domain-group/domain-group.component.ts
@@ -12,7 +12,7 @@ import startCase from 'lodash-es/startCase';
import { combineLatest, Observable, ReplaySubject, defer } from 'rxjs';
import { map, switchMap, startWith, shareReplay, withLatestFrom, filter } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { objectToJSON } from '@cc/utils/thrift-instance';
import { Columns } from '../../../../../components/table';
diff --git a/src/app/sections/domain/domain-info/domain-group/utils/sort-table-data.ts b/src/app/sections/domain/domain-info/domain-group/utils/sort-table-data.ts
index 9c4f7461..113ee02a 100644
--- a/src/app/sections/domain/domain-info/domain-group/utils/sort-table-data.ts
+++ b/src/app/sections/domain/domain-info/domain-group/utils/sort-table-data.ts
@@ -26,6 +26,8 @@ export function sortData(data: DataSourceItem[], sort: MatSort): DataSourceItem[
break;
}
}
- if (sort.direction === 'desc') return data.reverse();
+ if (sort.direction === 'desc') {
+ return data.reverse();
+ }
return data;
}
diff --git a/src/app/sections/domain/domain-info/domain-info.component.ts b/src/app/sections/domain/domain-info/domain-info.component.ts
index 0b97d1d0..1cf8dc59 100644
--- a/src/app/sections/domain/domain-info/domain-info.component.ts
+++ b/src/app/sections/domain/domain-info/domain-info.component.ts
@@ -12,7 +12,7 @@ import {
import { from } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { DomainMetadataViewExtensionsService } from '@cc/app/shared/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions';
import { enumHasValue } from '../../../../utils';
diff --git a/src/app/sections/domain/domain-obj-creation/domain-obj-creation.component.ts b/src/app/sections/domain/domain-obj-creation/domain-obj-creation.component.ts
index dcb248ae..29199710 100644
--- a/src/app/sections/domain/domain-obj-creation/domain-obj-creation.component.ts
+++ b/src/app/sections/domain/domain-obj-creation/domain-obj-creation.component.ts
@@ -5,7 +5,7 @@ import { DomainObject } from '@vality/domain-proto/domain';
import { BehaviorSubject } from 'rxjs';
import { withLatestFrom } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { DomainMetadataViewExtensionsService } from '@cc/app/shared/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions';
import { progressTo, getUnionKey, enumHasValue } from '../../../../utils';
diff --git a/src/app/sections/domain/domain-obj-modification/domain-obj-modification.component.ts b/src/app/sections/domain/domain-obj-modification/domain-obj-modification.component.ts
index e48edb12..0f17c0c6 100644
--- a/src/app/sections/domain/domain-obj-modification/domain-obj-modification.component.ts
+++ b/src/app/sections/domain/domain-obj-modification/domain-obj-modification.component.ts
@@ -62,9 +62,11 @@ export class DomainObjModificationComponent implements OnInit {
if (
this.modifiedDomainObjectService.domainObject &&
this.route.snapshot.params.ref === this.modifiedDomainObjectService.ref
- )
+ ) {
this.control.setValue(this.modifiedDomainObjectService.domainObject);
- else this.control.setValue(object);
+ } else {
+ this.control.setValue(object);
+ }
});
}
diff --git a/src/app/sections/domain/domain-obj-review/domain-obj-review.component.ts b/src/app/sections/domain/domain-obj-review/domain-obj-review.component.ts
index 47ff74c8..1db0ce83 100644
--- a/src/app/sections/domain/domain-obj-review/domain-obj-review.component.ts
+++ b/src/app/sections/domain/domain-obj-review/domain-obj-review.component.ts
@@ -4,7 +4,7 @@ import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { switchMap } from 'rxjs';
import { first, withLatestFrom } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { DomainSecretService } from '@cc/app/shared/services/domain-secret-service';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
diff --git a/src/app/sections/domain/services/domain-obj-modification.service.ts b/src/app/sections/domain/services/domain-obj-modification.service.ts
index 68dca77f..a9382da1 100644
--- a/src/app/sections/domain/services/domain-obj-modification.service.ts
+++ b/src/app/sections/domain/services/domain-obj-modification.service.ts
@@ -4,10 +4,11 @@ import { DomainObject, Reference } from '@vality/domain-proto/domain';
import { Observable, switchMap, BehaviorSubject, defer } from 'rxjs';
import { map, shareReplay, first } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel/domain-store.service';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { toJson, getUnionValue, progressTo } from '@cc/utils';
+import { DomainStoreService } from '../../../api/domain-config/stores/domain-store.service';
+
import { MetadataService } from './metadata.service';
@Injectable()
diff --git a/src/app/sections/party-shops/party-shops.component.html b/src/app/sections/party-shops/party-shops.component.html
index 93df1d2e..82e8a72b 100644
--- a/src/app/sections/party-shops/party-shops.component.html
+++ b/src/app/sections/party-shops/party-shops.component.html
@@ -10,7 +10,15 @@
>
-
+
diff --git a/src/app/sections/party-shops/party-shops.component.ts b/src/app/sections/party-shops/party-shops.component.ts
index f53902fe..3656e2de 100644
--- a/src/app/sections/party-shops/party-shops.component.ts
+++ b/src/app/sections/party-shops/party-shops.component.ts
@@ -40,7 +40,11 @@ export class PartyShopsComponent {
),
]).pipe(
map(([shops, searchStr]) =>
- shops.filter((s) => JSON.stringify(s).toLowerCase().includes(searchStr.toLowerCase())),
+ searchStr
+ ? shops.filter((s) =>
+ JSON.stringify(s).toLowerCase().includes(searchStr.toLowerCase()),
+ )
+ : shops,
),
shareReplay({ refCount: true, bufferSize: 1 }),
);
@@ -54,6 +58,7 @@ export class PartyShopsComponent {
this.selectedShop = d;
this.sidenavInfoService.toggle(this.shopTpl, d.details.name || `Shop #${d.id}`, d);
},
+ sortable: true,
},
{
field: 'contract_id',
@@ -114,6 +119,7 @@ export class PartyShopsComponent {
]),
];
progress$ = new BehaviorSubject(0);
+ shopsProgress$ = this.partyShopsService.progress$;
constructor(
private partyShopsService: PartyShopsService,
diff --git a/src/app/sections/party-shops/party-shops.service.ts b/src/app/sections/party-shops/party-shops.service.ts
index d41ac330..6a007733 100644
--- a/src/app/sections/party-shops/party-shops.service.ts
+++ b/src/app/sections/party-shops/party-shops.service.ts
@@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Party } from '@vality/domain-proto/domain';
-import { defer, merge, Observable, Subject } from 'rxjs';
+import { progressTo } from '@vality/ng-core';
+import { defer, merge, Observable, Subject, BehaviorSubject } from 'rxjs';
import { map, shareReplay, switchMap } from 'rxjs/operators';
import { PartyManagementService } from '@cc/app/api/payment-processing';
@@ -12,6 +13,7 @@ export class PartyShopsService {
map((p) => p.shops),
map((shops) => Array.from(shops.values())),
);
+ progress$ = new BehaviorSubject(0);
private reload$ = new Subject();
@@ -20,7 +22,9 @@ export class PartyShopsService {
this.reload$.pipe(map(() => this.route.snapshot.params)),
).pipe(
map((p) => p.partyID),
- switchMap((partyID) => this.partyManagementService.Get(partyID)),
+ switchMap((partyID) =>
+ this.partyManagementService.Get(partyID).pipe(progressTo(this.progress$)),
+ ),
shareReplay(1),
);
diff --git a/src/app/sections/payment-details/payment-details.component.ts b/src/app/sections/payment-details/payment-details.component.ts
index 22839f60..bca16633 100644
--- a/src/app/sections/payment-details/payment-details.component.ts
+++ b/src/app/sections/payment-details/payment-details.component.ts
@@ -56,7 +56,9 @@ export class PaymentDetailsComponent {
.afterClosed()
.pipe(untilDestroyed(this))
.subscribe(({ status }) => {
- if (status === DialogResponseStatus.Success) this.updateChargebacks$.next();
+ if (status === DialogResponseStatus.Success) {
+ this.updateChargebacks$.next();
+ }
});
}
}
diff --git a/src/app/sections/payment-details/payment-main-info/payment-provider/fetch-provider.service.ts b/src/app/sections/payment-details/payment-main-info/payment-provider/fetch-provider.service.ts
index 5aa1562b..bb34c690 100644
--- a/src/app/sections/payment-details/payment-main-info/payment-provider/fetch-provider.service.ts
+++ b/src/app/sections/payment-details/payment-main-info/payment-provider/fetch-provider.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { merge, of, Subject } from 'rxjs';
import { catchError, filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { progress } from '@cc/app/shared/custom-operators';
@Injectable()
diff --git a/src/app/sections/payment-details/payment-main-info/payment-terminal/fetch-terminal.service.ts b/src/app/sections/payment-details/payment-main-info/payment-terminal/fetch-terminal.service.ts
index fa23c06d..ad1dedec 100644
--- a/src/app/sections/payment-details/payment-main-info/payment-terminal/fetch-terminal.service.ts
+++ b/src/app/sections/payment-details/payment-main-info/payment-terminal/fetch-terminal.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { merge, of, Subject } from 'rxjs';
import { catchError, filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { progress } from '@cc/app/shared/custom-operators';
@Injectable()
diff --git a/src/app/sections/payments/components/create-payment-adjustment/create-payment-adjustment.component.ts b/src/app/sections/payments/components/create-payment-adjustment/create-payment-adjustment.component.ts
index 260939c9..ac696598 100644
--- a/src/app/sections/payments/components/create-payment-adjustment/create-payment-adjustment.component.ts
+++ b/src/app/sections/payments/components/create-payment-adjustment/create-payment-adjustment.component.ts
@@ -75,7 +75,9 @@ export class CreatePaymentAdjustmentComponent extends DialogSuperclass<
.map((w) => {
const error: string =
w.error?.['name'] || w.error?.['message'] || '';
- if (error) return `${w.payment.id}: ${error}`;
+ if (error) {
+ return `${w.payment.id}: ${error}`;
+ }
return null;
})
.filter(Boolean)
diff --git a/src/app/sections/repairing/repairing.component.ts b/src/app/sections/repairing/repairing.component.ts
index d3266afa..48e5ab50 100644
--- a/src/app/sections/repairing/repairing.component.ts
+++ b/src/app/sections/repairing/repairing.component.ts
@@ -18,7 +18,7 @@ import { Moment } from 'moment';
import { BehaviorSubject } from 'rxjs';
import { filter, map, switchMap, shareReplay } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { getEnumKey } from '@cc/utils';
diff --git a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts
index 52729424..0cead57c 100644
--- a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts
+++ b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts
@@ -4,7 +4,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { DialogService } from '@vality/ng-core';
import { first, map } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
diff --git a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.service.ts b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.service.ts
index 00b28cc5..88006b47 100644
--- a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.service.ts
+++ b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.service.ts
@@ -9,7 +9,7 @@ import {
import { combineLatest, Observable } from 'rxjs';
import { map, pluck, startWith, switchMap } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesService } from '../services/routing-rules';
import { RoutingRulesType } from '../types/routing-rules-type';
diff --git a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
index 7fd6feb9..e2b6368d 100644
--- a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
+++ b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
@@ -5,7 +5,7 @@ import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { combineLatest, Observable } from 'rxjs';
import { filter, map, pluck, shareReplay, startWith, switchMap, take } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesType } from '../types/routing-rules-type';
diff --git a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.html b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.html
index 417da434..f4c0c4fe 100644
--- a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.html
+++ b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.html
@@ -19,11 +19,9 @@
[columns]="columns"
[data]="(candidates$ | async) || []"
[progress]="isLoading$ | async"
- [sortActive]="sort.active"
- [sortDirection]="sort.direction"
+ [sort]="{ active: 'priority', direction: 'desc' }"
noActions
sortOnFront
- (sortChange)="sort = $event"
>
diff --git a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts
index e05220a7..a5698a3e 100644
--- a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts
+++ b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts
@@ -1,5 +1,4 @@
import { Component, ViewChild, TemplateRef } from '@angular/core';
-import { Sort } from '@angular/material/sort';
import { ActivatedRoute } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { TerminalObject, RoutingCandidate, Predicate } from '@vality/domain-proto/domain';
@@ -13,7 +12,7 @@ import {
import { Observable, combineLatest } from 'rxjs';
import { first, map, switchMap, withLatestFrom } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type';
import { DomainThriftFormDialogComponent } from '@cc/app/shared/components/thrift-api-crud';
@@ -152,10 +151,6 @@ export class RoutingRulesetComponent {
]),
];
openedCandidate?: RoutingCandidate;
- sort: Sort = {
- active: 'priority',
- direction: 'desc',
- };
constructor(
private dialog: DialogService,
@@ -271,7 +266,9 @@ export class RoutingRulesetComponent {
}
private formatPredicate(predicate: Predicate) {
- if (!predicate) return '';
+ if (!predicate) {
+ return '';
+ }
if (getUnionKey(predicate) === 'constant') {
return JSON.stringify(predicate.constant);
}
diff --git a/src/app/sections/routing-rules/services/routing-rules/routing-rules.service.ts b/src/app/sections/routing-rules/services/routing-rules/routing-rules.service.ts
index ff5f04db..c30d36f0 100644
--- a/src/app/sections/routing-rules/services/routing-rules/routing-rules.service.ts
+++ b/src/app/sections/routing-rules/services/routing-rules/routing-rules.service.ts
@@ -5,7 +5,7 @@ import cloneDeep from 'lodash-es/cloneDeep';
import { combineLatest, concat, Observable } from 'rxjs';
import { map, pluck, shareReplay, switchMap, take } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { createNextId } from '@cc/utils/create-next-id';
import { getDelegate } from './utils/get-delegate';
diff --git a/src/app/sections/routing-rules/target-ruleset-form/target-ruleset-form.component.ts b/src/app/sections/routing-rules/target-ruleset-form/target-ruleset-form.component.ts
index d5231e34..7b513240 100644
--- a/src/app/sections/routing-rules/target-ruleset-form/target-ruleset-form.component.ts
+++ b/src/app/sections/routing-rules/target-ruleset-form/target-ruleset-form.component.ts
@@ -13,7 +13,7 @@ import { ComponentChanges } from '@vality/ng-core';
import sortBy from 'lodash-es/sortBy';
import { map, startWith } from 'rxjs/operators';
-import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
+import { DomainStoreService } from '@cc/app/api/domain-config';
import { RoutingRulesService } from '../services/routing-rules';
import { RoutingRulesType } from '../types/routing-rules-type';
diff --git a/src/app/sections/sections-routing.module.ts b/src/app/sections/sections-routing.module.ts
index f0643def..59bb47db 100644
--- a/src/app/sections/sections-routing.module.ts
+++ b/src/app/sections/sections-routing.module.ts
@@ -56,6 +56,10 @@ const ROUTES: Routes = [
path: 'chargebacks',
loadChildren: () => import('./chargebacks').then((m) => m.ChargebacksModule),
},
+ {
+ path: 'terminals',
+ loadChildren: () => import('./terminals').then((m) => m.TerminalsModule),
+ },
{
path: '404',
loadChildren: () => import('./not-found').then((m) => m.NotFoundModule),
diff --git a/src/app/sections/terminals/index.ts b/src/app/sections/terminals/index.ts
new file mode 100644
index 00000000..844928e2
--- /dev/null
+++ b/src/app/sections/terminals/index.ts
@@ -0,0 +1,2 @@
+export * from './terminals.module';
+export * from './routing-config';
diff --git a/src/app/sections/terminals/routing-config.ts b/src/app/sections/terminals/routing-config.ts
new file mode 100644
index 00000000..562aad51
--- /dev/null
+++ b/src/app/sections/terminals/routing-config.ts
@@ -0,0 +1,5 @@
+import { Services, RoutingConfig } from '@cc/app/shared/services';
+
+export const ROUTING_CONFIG: RoutingConfig = {
+ services: [Services.Domain],
+};
diff --git a/src/app/sections/terminals/terminals-routing.module.ts b/src/app/sections/terminals/terminals-routing.module.ts
new file mode 100644
index 00000000..c92617cc
--- /dev/null
+++ b/src/app/sections/terminals/terminals-routing.module.ts
@@ -0,0 +1,22 @@
+import { NgModule } from '@angular/core';
+import { RouterModule } from '@angular/router';
+
+import { AppAuthGuardService } from '@cc/app/shared/services';
+
+import { ROUTING_CONFIG } from './routing-config';
+import { TerminalsComponent } from './terminals.component';
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ {
+ path: '',
+ component: TerminalsComponent,
+ canActivate: [AppAuthGuardService],
+ data: ROUTING_CONFIG,
+ },
+ ]),
+ ],
+ exports: [RouterModule],
+})
+export class TerminalsRoutingModule {}
diff --git a/src/app/sections/terminals/terminals.component.html b/src/app/sections/terminals/terminals.component.html
new file mode 100644
index 00000000..0d01a1a7
--- /dev/null
+++ b/src/app/sections/terminals/terminals.component.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/sections/terminals/terminals.component.ts b/src/app/sections/terminals/terminals.component.ts
new file mode 100644
index 00000000..02cbde0d
--- /dev/null
+++ b/src/app/sections/terminals/terminals.component.ts
@@ -0,0 +1,240 @@
+import { Component, ViewChild, TemplateRef } from '@angular/core';
+import { FormControl } from '@angular/forms';
+import { Sort } from '@angular/material/sort';
+import { Router } from '@angular/router';
+import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
+import {
+ TerminalObject,
+ ProviderObject,
+ RoutingRulesObject,
+ RoutingDelegate,
+} from '@vality/domain-proto/domain';
+import { Column } from '@vality/ng-core';
+import startCase from 'lodash-es/startCase';
+import { combineLatest } from 'rxjs';
+import { startWith, map, debounceTime, tap, take } from 'rxjs/operators';
+
+import { objectToJSON, createFullTextSearch, getUnionValue, getUnionKey } from '../../../utils';
+import { DomainStoreService } from '../../api/domain-config';
+import { PartiesStoreService } from '../../api/payment-processing';
+import { SidenavInfoService } from '../../shared/components/sidenav-info';
+
+@UntilDestroy()
+@Component({
+ selector: 'cc-terminals',
+ templateUrl: './terminals.component.html',
+})
+export class TerminalsComponent {
+ searchControl = new FormControl('');
+ columns: Column[] = [
+ { field: 'ref.id', sortable: true },
+ {
+ field: 'data.name',
+ description: 'data.description',
+ sortable: true,
+ click: (d) => {
+ this.openedTerminal = d;
+ this.sidenavInfoService.toggle(
+ this.terminalTpl,
+ d.data.name || d.data.description || `Terminal #${d.ref.id}`,
+ d,
+ );
+ },
+ },
+ {
+ field: 'data.provider_ref.id',
+ description: 'data.provider_ref.id',
+ header: 'Provider',
+ formatter: (d) => this.getProvider(d).pipe(map((p) => p?.data?.name || '')),
+ sortable: true,
+ click: (d) => {
+ this.getProvider(d)
+ .pipe(take(1), untilDestroyed(this))
+ .subscribe((provider) => {
+ if (!provider) {
+ return;
+ }
+ this.openedProvider = provider;
+ this.sidenavInfoService.toggle(
+ this.providerTpl,
+ provider.data.name ||
+ provider.data.description ||
+ `Provider #${provider.ref.id}`,
+ provider,
+ );
+ });
+ },
+ },
+ {
+ field: 'delegates',
+ formatter: (d) =>
+ this.getTerminalShopWalletDelegates(d).pipe(map((r) => r.length || '')),
+ click: (d) => {
+ this.getTerminalShopWalletDelegates(d)
+ .pipe(take(1), untilDestroyed(this))
+ .subscribe((rules) => {
+ this.openedRoutingRules = rules;
+ this.sidenavInfoService.toggle(
+ this.routingRulesTpl,
+ `Terminal #${d.ref.id} delegates`,
+ d,
+ );
+ });
+ },
+ },
+ ];
+ data$ = combineLatest([
+ this.domainStoreService.getObjects('terminal').pipe(
+ map((objects) =>
+ createFullTextSearch(
+ objects,
+ objects.map((o) => ({
+ ref: o.ref.id,
+ data: JSON.stringify(objectToJSON(o.data)),
+ name: o.data.name,
+ description: o.data.description,
+ })),
+ ),
+ ),
+ ),
+ this.searchControl.valueChanges.pipe(
+ startWith(this.searchControl.value),
+ debounceTime(100),
+ ),
+ ]).pipe(
+ tap(([, search]) => {
+ if (search) {
+ this.sort = { active: '', direction: '' };
+ }
+ }),
+ map(([fts, search]) => fts.search(search)),
+ );
+ progress$ = this.domainStoreService.isLoading$;
+ sort: Sort = { active: 'data.name', direction: 'asc' };
+ openedTerminal?: TerminalObject;
+ @ViewChild('terminalTpl') terminalTpl: TemplateRef;
+ openedProvider?: ProviderObject;
+ @ViewChild('providerTpl') providerTpl: TemplateRef;
+ openedRoutingRules?: {
+ delegate: RoutingDelegate;
+ rule: RoutingRulesObject;
+ terminalRule: RoutingRulesObject;
+ }[];
+ @ViewChild('routingRulesTpl') routingRulesTpl: TemplateRef;
+
+ routingRulesColumns: Column<{
+ delegate: RoutingDelegate;
+ rule: RoutingRulesObject;
+ terminalRule: RoutingRulesObject;
+ }>[] = [
+ {
+ header: 'Routing Rule',
+ field: 'terminalRule.data.name',
+ description: 'terminalRule.ref.id',
+ },
+ {
+ header: 'Ruleset',
+ field: 'rule.data.name',
+ description: 'rule.ref.id',
+ },
+ {
+ field: 'party',
+ formatter: (d) =>
+ this.partiesStoreService
+ .get(d.delegate.allowed.condition?.party?.id)
+ .pipe(map((p) => p.contact_info.email)),
+ description: (d) => d.delegate.allowed.condition?.party?.id,
+ link: (d) => `/party/${d.delegate.allowed.condition.party.id}`,
+ },
+ {
+ field: 'type',
+ formatter: (d) =>
+ startCase(
+ getUnionKey(d.delegate.allowed.condition?.party?.definition).slice(0, -3),
+ ),
+ },
+ {
+ field: 'definition',
+ formatter: (d) =>
+ this.partiesStoreService
+ .get(d.delegate.allowed.condition?.party?.id)
+ .pipe(
+ map((p) =>
+ getUnionKey(d.delegate.allowed.condition?.party?.definition) ===
+ 'shop_is'
+ ? p.shops.get(
+ getUnionValue(
+ d.delegate.allowed.condition?.party?.definition,
+ ),
+ ).details.name
+ : p.wallets.get(
+ getUnionValue(
+ d.delegate.allowed.condition?.party?.definition,
+ ),
+ ).name,
+ ),
+ ),
+ description: (d) => getUnionValue(d.delegate.allowed.condition?.party?.definition),
+ link: (d) =>
+ `/party/${d.delegate.allowed.condition.party.id}/routing-rules/${
+ getUnionKey(d.delegate.allowed.condition?.party?.definition) === 'shop_is'
+ ? 'payment'
+ : 'withdrawal'
+ }/${d.rule.ref.id}/delegate/${d.delegate.ruleset.id}`,
+ },
+ ];
+
+ constructor(
+ private domainStoreService: DomainStoreService,
+ private router: Router,
+ private sidenavInfoService: SidenavInfoService,
+ private partiesStoreService: PartiesStoreService,
+ ) {}
+
+ update() {
+ this.domainStoreService.forceReload();
+ }
+
+ create() {
+ void this.router.navigate(['/domain/create']);
+ }
+
+ private getProvider(terminalObj: TerminalObject) {
+ return this.domainStoreService
+ .getObjects('provider')
+ .pipe(
+ map((providers) =>
+ providers.find((p) => p.ref.id === terminalObj.data.provider_ref.id),
+ ),
+ );
+ }
+
+ private getTerminalShopWalletDelegates(terminalObj: TerminalObject) {
+ return this.domainStoreService.getObjects('routing_rules').pipe(
+ map((rules) => {
+ const terminalRules = rules.filter(
+ (r) =>
+ r.data?.decisions?.candidates?.some?.(
+ (c) => c.terminal.id === terminalObj.ref.id,
+ ),
+ );
+ return terminalRules
+ .map((terminalRule) =>
+ rules.map((rule) =>
+ (
+ rule?.data?.decisions?.delegates?.filter?.(
+ (d) =>
+ d?.ruleset?.id === terminalRule.ref.id &&
+ d?.allowed?.condition?.party &&
+ ['wallet_is', 'shop_is'].includes(
+ getUnionKey(d?.allowed?.condition?.party?.definition),
+ ),
+ ) || []
+ ).map((delegate) => ({ delegate, rule, terminalRule })),
+ ),
+ )
+ .flat(2);
+ }),
+ );
+ }
+}
diff --git a/src/app/sections/terminals/terminals.module.ts b/src/app/sections/terminals/terminals.module.ts
new file mode 100644
index 00000000..57bb6a71
--- /dev/null
+++ b/src/app/sections/terminals/terminals.module.ts
@@ -0,0 +1,28 @@
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { ReactiveFormsModule } from '@angular/forms';
+import { MatButtonModule } from '@angular/material/button';
+import { MatExpansionModule } from '@angular/material/expansion';
+import { TableModule, InputFieldModule } from '@vality/ng-core';
+
+import { PageLayoutModule } from '../../shared';
+import { DomainThriftViewerComponent } from '../../shared/components/thrift-api-crud';
+
+import { TerminalsRoutingModule } from './terminals-routing.module';
+import { TerminalsComponent } from './terminals.component';
+
+@NgModule({
+ declarations: [TerminalsComponent],
+ imports: [
+ CommonModule,
+ TerminalsRoutingModule,
+ TableModule,
+ MatButtonModule,
+ PageLayoutModule,
+ InputFieldModule,
+ ReactiveFormsModule,
+ DomainThriftViewerComponent,
+ MatExpansionModule,
+ ],
+})
+export class TerminalsModule {}
diff --git a/src/app/shared/components/datetime/datetime.component.ts b/src/app/shared/components/datetime/datetime.component.ts
index 00a88a8d..10eb065f 100644
--- a/src/app/shared/components/datetime/datetime.component.ts
+++ b/src/app/shared/components/datetime/datetime.component.ts
@@ -41,8 +41,11 @@ export class DatetimeComponent extends FormComponentSuperclass {
dateChanged(date: MatDatepickerInputEvent) {
const v = date.target.value;
- if (!this.datetime) this.datetime = date.target.value;
- else this.datetime.set({ date: v.date(), month: v.month(), year: v.year() });
+ if (!this.datetime) {
+ this.datetime = date.target.value;
+ } else {
+ this.datetime.set({ date: v.date(), month: v.month(), year: v.year() });
+ }
this.emitOutgoingValue(this.datetime.toISOString());
}
diff --git a/src/app/shared/components/json-viewer/components/key/key.component.ts b/src/app/shared/components/json-viewer/components/key/key.component.ts
index f48134e2..c9ee3922 100644
--- a/src/app/shared/components/json-viewer/components/key/key.component.ts
+++ b/src/app/shared/components/json-viewer/components/key/key.component.ts
@@ -15,11 +15,15 @@ export class KeyComponent implements OnChanges {
keys$ = new ReplaySubject(1);
numberKey$ = this.keys$.pipe(
switchMap((keys) => {
- if (keys.length !== 1) return of(null);
+ if (keys.length !== 1) {
+ return of(null);
+ }
return this.keys[0].key$.pipe(
switchMap((key) => key.renderValue$),
map((value) => {
- if (typeof value === 'number') return `${value + 1}`;
+ if (typeof value === 'number') {
+ return `${value + 1}`;
+ }
return null;
}),
);
@@ -27,16 +31,22 @@ export class KeyComponent implements OnChanges {
);
ngOnChanges(changes: ComponentChanges) {
- if (changes.keys) this.keys$.next(this.keys);
+ if (changes.keys) {
+ this.keys$.next(this.keys);
+ }
}
parentIsUnion(pathItem: MetadataViewItem) {
- if (!pathItem?.data$) return of(false);
+ if (!pathItem?.data$) {
+ return of(false);
+ }
return pathItem.data$.pipe(map((data) => data?.trueParent?.objectType === 'union'));
}
isUnion(pathItem: MetadataViewItem) {
- if (!pathItem?.data$) return of(false);
+ if (!pathItem?.data$) {
+ return of(false);
+ }
return pathItem.data$.pipe(map((data) => data?.trueTypeNode?.data?.objectType === 'union'));
}
}
diff --git a/src/app/shared/components/json-viewer/utils/get-entries.ts b/src/app/shared/components/json-viewer/utils/get-entries.ts
index e8e6e1a2..530fa4d6 100644
--- a/src/app/shared/components/json-viewer/utils/get-entries.ts
+++ b/src/app/shared/components/json-viewer/utils/get-entries.ts
@@ -1,5 +1,7 @@
export function getEntries(obj: unknown): [number | string, unknown][] {
- if (!obj) return [];
+ if (!obj) {
+ return [];
+ }
return Array.isArray(obj) || obj instanceof Set
? Array.from(obj).map((v, idx) => [idx, v])
: obj instanceof Map
diff --git a/src/app/shared/components/json-viewer/utils/metadata-view.ts b/src/app/shared/components/json-viewer/utils/metadata-view.ts
index 554cb400..82df886d 100644
--- a/src/app/shared/components/json-viewer/utils/metadata-view.ts
+++ b/src/app/shared/components/json-viewer/utils/metadata-view.ts
@@ -31,17 +31,21 @@ export class MetadataViewItem {
);
renderValue$ = combineLatest([this.value$, this.data$]).pipe(
map(([value, data]) => {
- if (data?.trueTypeNode?.data?.objectType === 'enum')
+ if (data?.trueTypeNode?.data?.objectType === 'enum') {
return (
(data.trueTypeNode.data as MetadataFormData).ast.items.find(
(i, idx) => {
- if ('value' in i) return i.value === value;
+ if ('value' in i) {
+ return i.value === value;
+ }
return idx === value;
},
).name ?? value
);
- if (data?.objectType === 'union' && isEmpty(getEntries(value)?.[0]?.[1]))
+ }
+ if (data?.objectType === 'union' && isEmpty(getEntries(value)?.[0]?.[1])) {
return getEntries(value)?.[0]?.[0];
+ }
return value;
}),
);
@@ -64,8 +68,9 @@ export class MetadataViewItem {
key?.data ||
(data?.trueTypeNode?.data as MetadataFormData)?.type
?.name
- )
+ ) {
return of([]);
+ }
const [item] = items;
return combineLatest([
item.key$.pipe(switchMap((key) => key.value$)),
@@ -75,12 +80,14 @@ export class MetadataViewItem {
if (
typeof childKey === 'number' ||
(data?.objectType === 'union' && isEmpty(childValue))
- )
+ ) {
return of([]);
+ }
return item.data$.pipe(
switchMap((itemData) => {
- if (data?.objectType === 'union' && itemData?.objectType !== 'union')
+ if (data?.objectType === 'union' && itemData?.objectType !== 'union') {
return of([item]);
+ }
return item.inline$.pipe(map((childInline) => [item, ...childInline]));
}),
);
diff --git a/src/app/shared/components/merchant-field/merchant-field.component.ts b/src/app/shared/components/merchant-field/merchant-field.component.ts
index bc626092..d60e1e80 100644
--- a/src/app/shared/components/merchant-field/merchant-field.component.ts
+++ b/src/app/shared/components/merchant-field/merchant-field.component.ts
@@ -56,7 +56,9 @@ export class MerchantFieldComponent
}
private searchOptions(str: string): Observable