TD-598: Avoid uppercase. Add CSpell cfg. Move to ng-libs: table, prettier cfg (#221)

This commit is contained in:
Rinat Arsaev 2023-05-11 21:08:44 +04:00 committed by GitHub
parent a97bfd08f1
commit 4decf85956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
102 changed files with 2392 additions and 740 deletions

View File

@ -3,7 +3,7 @@ name: Vality basic linters
on:
pull_request:
branches:
- "*"
- '*'
jobs:
lint:

View File

@ -15,8 +15,8 @@ jobs:
with:
path: ./*
key: ${{ github.sha }}
eslint:
name: ESLint App
lint:
name: Lint check
runs-on: ubuntu-latest
needs: [init]
steps:
@ -28,8 +28,8 @@ jobs:
key: ${{ github.sha }}
- name: Check
run: npm run lint
prettier:
name: Prettier
format:
name: Format check
runs-on: ubuntu-latest
needs: [init]
steps:
@ -40,7 +40,20 @@ jobs:
path: ./*
key: ${{ github.sha }}
- name: Check
run: npm run prettier
run: npm run format
spell:
name: Spell check
runs-on: ubuntu-latest
needs: [init]
steps:
- name: Cache all
uses: actions/cache@v3
id: cache
with:
path: ./*
key: ${{ github.sha }}
- name: Check
run: npm run spell
build:
name: Build
runs-on: ubuntu-latest

View File

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<option name="fix-on-save" value="true" />
</component>
</project>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myConfigurationMode" value="AUTOMATIC" />
<option name="myRunOnSave" value="true" />
<option name="myRunOnReformat" value="true" />
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,json,yaml,yml,html,scss,css,md}" />

View File

@ -4,6 +4,7 @@ node_modules
dist
src/assets/icons/
.angular
.github/settings.*
.github/workflows/basic-*
LICENSE
Dockerfile
*.conf
*.env

View File

@ -1,16 +0,0 @@
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 4,
"attributeSort": "ASC",
"attributeGroups": [
"$ANGULAR_ELEMENT_REF",
"$ANGULAR_STRUCTURAL_DIRECTIVE",
"$ANGULAR_ANIMATION",
"$ANGULAR_ANIMATION_INPUT",
"$ANGULAR_TWO_WAY_BINDING",
"$ANGULAR_INPUT",
"$DEFAULT",
"$ANGULAR_OUTPUT"
]
}

1
.prettierrc.js Normal file
View File

@ -0,0 +1 @@
module.exports = require("@vality/prettier-config");

View File

@ -1,12 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App Dev Server" type="js.build_tools.npm" activateToolWindowBeforeRun="false">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="dev" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -1,12 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App Stage Server" type="js.build_tools.npm" activateToolWindowBeforeRun="false">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="stage" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -1,12 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Libs Dev Server" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="dev-libs" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -1,7 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Stage" type="CompoundRunConfigurationType">
<toRun name="Libs Dev Server" type="js.build_tools.npm" />
<toRun name="App Stage Server" type="js.build_tools.npm" />
<configuration default="false" name="Stage" type="js.build_tools.npm" activateToolWindowBeforeRun="false">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="stage" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -1,7 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Start" type="CompoundRunConfigurationType">
<toRun name="Libs Dev Server" type="js.build_tools.npm" />
<toRun name="App Dev Server" type="js.build_tools.npm" />
<configuration default="false" name="Start" type="js.build_tools.npm" activateToolWindowBeforeRun="false">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="start" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

6
cspell.json Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"import": "node_modules/@vality/cspell-config/cspell.config.js",
"words": ["nspkmir", "applepay", "samsungpay", "googlepay", "submain"]
}

2130
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,13 @@
"build": "ng build --extra-webpack-config webpack.extra.js",
"test": "ng test",
"lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 420",
"lint-fix": "npm run lint -- --fix",
"lint-errors": "npm run lint -- --quiet",
"prettier-preset": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,huskyrc,yml,yaml}\"",
"prettier": "npm run prettier-preset -- --list-different",
"prettier-fix": "npm run prettier-preset -- --write",
"fix": "npm run lint-fix && npm run prettier-fix"
"lint:fix": "npm run lint -- --fix",
"lint:errors": "npm run lint -- --quiet",
"format": "prettier * --list-different",
"format:fix": "prettier * --write --loglevel warn",
"spell": "cspell --no-progress **",
"spell:fix": "cspell --no-progress --show-suggestions --show-context **",
"fix": "npm run lint:fix && npm run format:fix"
},
"dependencies": {
"@angular/animations": "15.0.3",
@ -30,7 +31,7 @@
"@angular/platform-browser-dynamic": "15.0.3",
"@angular/platform-server": "15.0.3",
"@angular/router": "15.0.3",
"@ng-matero/extensions": "15.3.0",
"@ng-matero/extensions": "15.4.2",
"@ngneat/input-mask": "6.0.0",
"@ngneat/until-destroy": "9.2.2",
"@s-libs/js-core": "15.0.0",
@ -42,7 +43,7 @@
"@vality/dominant-cache-proto": "2.0.1-99f38c9.0",
"@vality/fistful-proto": "2.0.1-4ff4ea3.0",
"@vality/magista-proto": "2.0.1-cf0eff8.0",
"@vality/ng-core": "0.3.1-pr-7-478c28d.0",
"@vality/ng-core": "0.4.1-pr-15-225ffc3.0",
"@vality/payout-manager-proto": "2.0.1-b079679.0",
"@vality/repairer-proto": "2.0.1-8f7973d.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
@ -85,7 +86,10 @@
"@types/uuid": "3.4.3",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"@vality/cspell-config": "0.1.1-pr-15-020121f.0",
"@vality/prettier-config": "0.1.1-pr-15-225ffc3.0",
"cross-env": "7.0.3",
"cspell": "6.31.1",
"dotenv": "16.0.0",
"eslint": "8.29.0",
"eslint-config-prettier": "8.5.0",
@ -105,8 +109,7 @@
"karma-jasmine-html-reporter": "2.0.0",
"ng-packagr": "15.0.3",
"ngx-build-plus": "15.0.0",
"prettier": "2.8.1",
"prettier-plugin-organize-attributes": "0.0.5",
"prettier": "2.8.8",
"ts-mockito": "2.6.1",
"ts-node": "10.9.1",
"typescript": "4.8.4",

View File

@ -24,7 +24,7 @@ export const CHARGEBACK_STAGES: (keyof InvoicePaymentChargebackStage)[] = [
'pre_arbitration',
];
// https://github.com/rbkmoney/magista#chargebacks
// https://github.com/valitydev/magista#chargebacks
export interface Chargebacks {
merchant_id?: string;
shop_ids?: string;

View File

@ -91,7 +91,7 @@
<mat-card>
<mat-card-content fxLayout="row" fxLayoutGap="24px">
<button color="primary" mat-button (click)="addModification()">
ADD PARTY MODIFICATION
Add party modification
</button>
<button
[disabled]="(isAllowedChangeStatus$ | async) === false"
@ -99,7 +99,7 @@
mat-button
(click)="changeStatus()"
>
CHANGE STATUS
Change status
</button>
</mat-card-content>
</mat-card>

View File

@ -1,5 +1,5 @@
<v-dialog
[inProgress]="isLoading$ | async"
[progress]="isLoading$ | async"
[title]="isUpdate ? 'Update modification unit' : 'Add party modification unit '"
>
<cc-modification-form
@ -15,7 +15,7 @@
mat-raised-button
(click)="isUpdate ? update() : add()"
>
{{ isUpdate ? 'UPDATE' : 'ADD' }}
{{ isUpdate ? 'Update' : 'Add' }}
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -1,4 +1,4 @@
<v-dialog [inProgress]="inProgress$ | async" title="Change claim status">
<v-dialog [progress]="inProgress$ | async" title="Change claim status">
<div [formGroup]="form" gdColumns="1fr" gdGap="16px">
<mat-form-field>
<mat-select
@ -49,7 +49,7 @@
mat-raised-button
(click)="confirm()"
>
CONFIRM
Confirm
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Claim, ModificationUnit } from '@vality/domain-proto/claim_management';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService, ConfirmDialogComponent } from '@vality/ng-core';
import { coerceBoolean } from 'coerce-property';
import isEmpty from 'lodash-es/isEmpty';
import { BehaviorSubject, switchMap, from } from 'rxjs';
@ -13,7 +13,6 @@ import { getModificationName } from '@cc/app/sections/claim/utils/get-modificati
import { DomainMetadataViewExtensionsService } from '@cc/app/shared/services/domain-metadata-view-extensions';
import { NotificationService } from '@cc/app/shared/services/notification';
import { Color, StatusColor } from '@cc/app/styles';
import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog';
import { inProgressFrom, progressTo } from '@cc/utils';
import { getUnionValue } from '@cc/utils/get-union-key';
@ -83,7 +82,7 @@ export class ModificationUnitTimelineItemComponent {
remove() {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Confirm deletion' })
.open(ConfirmDialogComponent, { title: 'Confirm deletion' })
.afterClosed()
.pipe(
filter(({ status }) => status === DialogResponseStatus.Success),

View File

@ -42,14 +42,14 @@
</div>
</mat-dialog-content>
<mat-dialog-actions fxLayout fxLayoutAlign="space-between">
<button [disabled]="isLoading$ | async" mat-button (click)="closeDialog()">CANCEL</button>
<button [disabled]="isLoading$ | async" mat-button (click)="closeDialog()">Cancel</button>
<button
[disabled]="(isLoading$ | async) || form.invalid"
color="primary"
mat-button
(click)="createRevert()"
>
CREATE
Create
</button>
<mat-progress-bar *ngIf="isLoading$ | async" mode="indeterminate"></mat-progress-bar>
</mat-dialog-actions>

View File

@ -7,7 +7,7 @@
mat-raised-button
(click)="createRevert()"
>
CREATE REVERT
Create revert
</button>
</mat-card-title>
<ng-container *ngIf="reverts$ | async as reverts; else noReverts">
@ -24,7 +24,7 @@
mat-button
(click)="fetchMore()"
>
{{ (doAction$ | async) ? 'LOADING...' : 'SHOW MORE' }}
{{ (doAction$ | async) ? 'Loading...' : 'Show more' }}
</button>
</mat-card-content>
</ng-container>

View File

@ -1,4 +1,4 @@
<v-dialog [inProgress]="isLoading$ | async" title="Create deposit">
<v-dialog [progress]="isLoading$ | async" title="Create deposit">
<form *ngIf="form" [formGroup]="form" fxLayout="column" fxLayoutGap="16px">
<div fxLayout fxLayoutGap="24px">
<mat-form-field fxFlex>
@ -33,7 +33,7 @@
mat-button
(click)="createDeposit()"
>
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -6,7 +6,7 @@
(valueChanges)="searchParamsUpdated($event)"
></cc-search-filters>
<div fxFlexFill fxLayout fxLayoutAlign="end">
<button color="primary" mat-button (click)="createDeposit()">CREATE DEPOSIT</button>
<button color="primary" mat-button (click)="createDeposit()">Create deposit</button>
</div>
<ng-container *ngIf="deposits$ | async as deposits; else noDeposits">
<cc-empty-search-result
@ -24,7 +24,7 @@
mat-button
(click)="fetchMore()"
>
{{ (doAction$ | async) ? 'LOADING...' : 'SHOW MORE' }}
{{ (doAction$ | async) ? 'Loading...' : 'Show more' }}
</button>
</mat-card>
</ng-container>

View File

@ -19,9 +19,9 @@
(changeKind)="kind = $event"
></cc-thrift-viewer>
<v-actions>
<button mat-button (click)="close()">CLOSE</button>
<button color="warn" mat-button (click)="delete()">DELETE</button>
<button color="primary" mat-button (click)="edit()">EDIT</button>
<button mat-button (click)="close()">Close</button>
<button color="warn" mat-button (click)="delete()">Delete</button>
<button color="primary" mat-button (click)="edit()">Edit</button>
</v-actions>
</div>
</mat-sidenav>
@ -33,7 +33,7 @@
</h1>
<div>
<button color="primary" mat-raised-button routerLink="/domain/create">
CREATE OBJECT
Create object
</button>
</div>
</div>

View File

@ -3,7 +3,7 @@ import { MatSidenav } from '@angular/material/sidenav';
import { Router } from '@angular/router';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { DomainObject, Reference } from '@vality/domain-proto/domain';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus, ConfirmDialogComponent } from '@vality/ng-core';
import { from } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators';
@ -11,7 +11,6 @@ import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
import { QueryParamsService } from '@cc/app/shared/services';
import { DomainMetadataViewExtensionsService } from '@cc/app/shared/services/domain-metadata-view-extensions';
import { ConfirmActionDialogComponent } from '../../../../components/confirm-action-dialog';
import { enumHasValue } from '../../../../utils';
import { ViewerKind } from '../../../shared/components/thrift-viewer';
import { NotificationService } from '../../../shared/services/notification';
@ -61,7 +60,7 @@ export class DomainInfoComponent {
delete() {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Delete object' })
.open(ConfirmDialogComponent, { title: 'Delete object' })
.afterClosed()
.pipe(
untilDestroyed(this),

View File

@ -35,7 +35,7 @@
routerLink="/domain"
>
<mat-icon aria-label="Login">keyboard_arrow_left</mat-icon>
BACK TO DOMAIN
Back to domain
</button>
<button
*ngIf="review"
@ -44,7 +44,7 @@
(click)="review = false"
>
<mat-icon aria-label="Login">keyboard_arrow_left</mat-icon>
BACK TO EDIT
Back to edit
</button>
<button
@ -53,7 +53,7 @@
mat-button
(click)="review ? commit() : reviewChanges()"
>
{{ review ? 'COMMIT' : 'REVIEW' }}
{{ review ? 'Commit' : 'Review' }}
<mat-icon aria-label="Login">keyboard_arrow_right</mat-icon>
</button>
</v-actions>

View File

@ -25,7 +25,7 @@
<v-actions>
<button mat-button (click)="backToDomain()">
<mat-icon aria-label="Login">keyboard_arrow_left</mat-icon>
BACK TO DOMAIN
Back to domain
</button>
<button
[disabled]="control.invalid"
@ -33,7 +33,7 @@
mat-button
(click)="reviewChanges()"
>
REVIEW CHANGES
Review changes
<mat-icon aria-label="Login">keyboard_arrow_right</mat-icon>
</button>
</v-actions>

View File

@ -18,7 +18,7 @@
<v-actions>
<button [disabled]="!!(progress$ | async)" mat-button (click)="back()">
<mat-icon>keyboard_arrow_left</mat-icon>
BACK TO EDIT
Back to edit
</button>
<button
[disabled]="!!(progress$ | async)"
@ -26,7 +26,7 @@
mat-button
(click)="commit()"
>
COMMIT
Commit
</button>
</v-actions>
</div>

View File

@ -9,7 +9,7 @@
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-raised-button (click)="create()">
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -25,7 +25,7 @@
<h2 class="cc-headline">Chargebacks</h2>
<v-actions>
<button color="primary" mat-button (click)="createChargeback()">
CREATE CHARGEBACK
Create chargeback
</button>
</v-actions>
</div>

View File

@ -1,6 +1,6 @@
<div fxLayout fxLayoutAlign="start center" fxLayoutGap="8px">
<div>{{ bankCard | toCardNumber }}</div>
<!-- TODO Need migration according to: https://github.com/rbkmoney/damsel/commit/61677b86006d405619bdc5f23d6416a929688180-->
<!-- TODO Need migration according to: https://github.com/valitydev/damsel/commit/61677b86006d405619bdc5f23d6416a929688180 -->
<!-- <mat-icon-->
<!-- *ngIf="bankCard.payment_system_deprecated === legacyPaymentSystems?.visa"-->
<!-- svgIcon="visa"-->

View File

@ -8,7 +8,7 @@
mat-button
(click)="cancel(payout.id)"
>
CANCEL
Cancel
</button>
<button
[disabled]="canBeConfirmed(payout.status | ccUnionKey)"
@ -16,7 +16,7 @@
mat-button
(click)="confirm(payout.id)"
>
CONFIRM
Confirm
</button>
</div>
</div>

View File

@ -6,14 +6,14 @@
</mat-form-field>
</mat-dialog-content>
<mat-dialog-actions fxLayout fxLayoutAlign="space-between">
<button [disabled]="!!(progress$ | async)" [mat-dialog-close]="false" mat-button>CANCEL</button>
<button [disabled]="!!(progress$ | async)" [mat-dialog-close]="false" mat-button>Cancel</button>
<button
[disabled]="detailsControl.invalid || !!(progress$ | async)"
color="primary"
mat-button
(click)="accept()"
>
ACCEPT
Accept
</button>
<mat-progress-bar *ngIf="progress$ | async" mode="indeterminate"></mat-progress-bar>
</mat-dialog-actions>

View File

@ -1,4 +1,4 @@
<v-dialog [inProgress]="!!(progress$ | async)" title="Create payout">
<v-dialog [progress]="!!(progress$ | async)" title="Create payout">
<div [formGroup]="control" gdColumns="1fr" gdGap="16px">
<cc-merchant-field formControlName="partyId" required></cc-merchant-field>
<cc-shop-field
@ -39,7 +39,7 @@
mat-button
(click)="create()"
>
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -2,7 +2,7 @@
<div fxLayout="row" fxLayoutAlign="space-between">
<h1 class="cc-display-1">Payouts</h1>
<v-actions>
<button color="primary" mat-raised-button (click)="create()">CREATE</button>
<button color="primary" mat-raised-button (click)="create()">Create</button>
</v-actions>
</div>
<mat-card>
@ -24,7 +24,7 @@
mat-button
(click)="fetchMore()"
>
{{ (inProgress$ | async) ? 'LOADING...' : 'SHOW MORE' }}
{{ (inProgress$ | async) ? 'Loading...' : 'Show more' }}
</button>
</mat-card>
</ng-container>

View File

@ -1,13 +1,12 @@
import { Injectable } from '@angular/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { PayoutID, PayoutStatus } from '@vality/magista-proto/magista';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService, ConfirmDialogComponent } from '@vality/ng-core';
import { switchMap } from 'rxjs';
import { filter } from 'rxjs/operators';
import { PayoutManagementService } from '@cc/app/api/payout-manager';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog';
import { CancelPayoutDialogComponent } from '../payouts/components/cancel-payout-dialog/cancel-payout-dialog.component';
@ -34,7 +33,7 @@ export class PayoutActionsService {
confirm(id: PayoutID) {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Confirm payout' })
.open(ConfirmDialogComponent, { title: 'Confirm payout' })
.afterClosed()
.pipe(
filter(({ status }) => status === DialogResponseStatus.Success),

View File

@ -66,7 +66,7 @@
mat-button
(click)="repair()"
>
REPAIR
Repair
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -36,27 +36,28 @@
</mat-card-content>
</mat-card>
<cc-simple-table
<v-table
[cellTemplate]="cellTemplate"
[columns]="columns$ | async"
[data]="machines$ | async"
[hasMore]="hasMore$ | async"
[loading]="(inProgress$ | async) && !!(columns$ | async)"
[progress]="(inProgress$ | async) && !!(columns$ | async)"
[rowSelected]="selected$ | async"
[trackBy]="trackById"
rowSelectable
(fetchMore)="fetchMore()"
(more)="fetchMore()"
(rowSelectionChange)="selected$.next($event)"
(size)="update($event)"
(sizeChange)="update($event)"
(update)="update($event.size)"
>
<cc-simple-table-actions>
<v-table-actions>
<button
[disabled]="!(selected$ | async)?.length"
color="primary"
mat-button
(click)="repairByScenario()"
>
REPAIR BY SCENARIO
Repair by scenario
</button>
<button
[disabled]="!(selected$ | async)?.length"
@ -64,12 +65,12 @@
mat-button
(click)="repair()"
>
SIMPLE REPAIR
Simple repair
</button>
</cc-simple-table-actions>
<cc-simple-table-tooltip-cell-template
</v-table-actions>
<v-table-tooltip-cell-template
(template)="cellTemplate.status = cellTemplate.history = $event"
></cc-simple-table-tooltip-cell-template>
</cc-simple-table>
></v-table-tooltip-cell-template>
</v-table>
</div>
</div>

View File

@ -2,7 +2,17 @@ import { Component, OnInit, TemplateRef } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { DateRange } from '@angular/material/datepicker';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { DialogResponseStatus, DialogService, clean, splitIds } from '@vality/ng-core';
import {
DialogResponseStatus,
DialogService,
clean,
splitBySeparators,
createDatetimeFormatterColumn,
createDescriptionFormatterColumn,
createTooltipTemplateGridColumn,
Column,
ConfirmDialogComponent,
} from '@vality/ng-core';
import { repairer } from '@vality/repairer-proto';
import { Namespace, ProviderID, RepairStatus, Machine } from '@vality/repairer-proto/repairer';
import isNil from 'lodash-es/isNil';
@ -12,13 +22,6 @@ import { filter, map, switchMap, shareReplay } from 'rxjs/operators';
import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog';
import {
createGridColumns,
createDatetimeFormattedColumn,
createDescriptionFormattedColumn,
} from '@cc/components/simple-table';
import { createTooltipTemplateGridColumn } from '@cc/components/simple-table/components/simple-table-tooltip-cell-template.component';
import { getEnumKey } from '@cc/utils';
import { RepairManagementService } from '../../api/repairer';
@ -66,22 +69,19 @@ export class RepairingComponent implements OnInit {
selected$ = new BehaviorSubject<Machine[]>([]);
status = repairer.RepairStatus;
columns$ = this.domainStoreService.getObjects('provider').pipe(
map((providers) =>
createGridColumns<Machine>([
map((providers): Column<Machine>[] => [
'id',
{ header: 'Namespace', field: 'ns' },
createDatetimeFormattedColumn('created_at'),
createDescriptionFormattedColumn<Machine>(
createDatetimeFormatterColumn('created_at'),
createDescriptionFormatterColumn<Machine>(
'provider',
(data) => data.provider_id,
(data) =>
providers.find((p) => String(p.ref.id) === data.provider_id)?.data?.name
(data) => providers.find((p) => String(p.ref.id) === data.provider_id)?.data?.name
),
createTooltipTemplateGridColumn(
{
field: 'status',
formatter: (data: Machine) =>
getEnumKey(repairer.RepairStatus, data.status),
formatter: (data: Machine) => getEnumKey(repairer.RepairStatus, data.status),
},
(d) => d.error_message
),
@ -93,11 +93,10 @@ export class RepairingComponent implements OnInit {
},
(d) => d.history
),
])
),
]),
shareReplay({ refCount: true, bufferSize: 1 })
);
cellTemplate: Record<string, TemplateRef<any>> = {};
cellTemplate: Record<string, TemplateRef<unknown>> = {};
constructor(
private machinesService: MachinesService,
@ -121,7 +120,7 @@ export class RepairingComponent implements OnInit {
.pipe(
map(({ ids, ns, timespan, provider_id, status, error_message }) =>
clean({
ids: splitIds(ids),
ids: splitBySeparators(ids),
ns,
provider_id: isNil(provider_id) ? null : String(provider_id),
status,
@ -151,7 +150,7 @@ export class RepairingComponent implements OnInit {
repair() {
this.dialogService
.open(ConfirmActionDialogComponent, {
.open(ConfirmDialogComponent, {
title: `Simple repair ${this.selected$.value.length} machines`,
})
.afterClosed()

View File

@ -13,14 +13,12 @@ import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { ActionsModule, DialogModule } from '@vality/ng-core';
import { ActionsModule, DialogModule, TableModule } from '@vality/ng-core';
import { EnumKeyPipe, EnumKeysPipe, DomainObjectFieldComponent } from '@cc/app/shared';
import { MetadataFormModule } from '@cc/app/shared/components/metadata-form';
import { SimpleTableModule } from '@cc/components/simple-table';
import { EmptySearchResultModule } from '../../../components/empty-search-result';
import { TableModule } from '../../../components/table';
import { DateRangeModule } from '../../shared/components/date-range/date-range.module';
import { RepairByScenarioDialogComponent } from './components/repair-by-scenario-dialog/repair-by-scenario-dialog.component';
import { RepairingRoutingModule } from './repairing-routing.module';
@ -52,7 +50,6 @@ import { RepairingComponent } from './repairing.component';
EnumKeyPipe,
EnumKeysPipe,
DomainObjectFieldComponent,
SimpleTableModule,
],
declarations: [RepairingComponent, RepairByScenarioDialogComponent],
})

View File

@ -10,13 +10,13 @@
</mat-form-field>
<mat-form-field>
<input formControlName="description" matInput placeholder="Deligate description" />
<input formControlName="description" matInput placeholder="Delegate description" />
</mat-form-field>
</div>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="changeRuleset()">
CHANGE RULESET
Change ruleset
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -13,7 +13,7 @@
mat-button
(click)="changeTarget()"
>
CHANGE TARGET
Change target
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -31,7 +31,7 @@
mat-button
(click)="attach()"
>
ATTACH
Attach
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -6,7 +6,7 @@
<div fxLayout fxLayoutAlign="space-between center" fxLayoutGap="8px">
<div class="cc-headline">Party delegate rulesets</div>
<button color="primary" mat-button (click)="attachNewRuleset()">
ATTACH NEW RULESET
Attach new ruleset
</button>
</div>

View File

@ -33,6 +33,6 @@
</div>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="add()">ADD</button>
<button [disabled]="form.invalid" color="primary" mat-button (click)="add()">Add</button>
</v-dialog-actions>
</v-dialog>

View File

@ -24,6 +24,6 @@
</div>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="init()">INIT</button>
<button [disabled]="form.invalid" color="primary" mat-button (click)="init()">Init</button>
</v-dialog-actions>
</v-dialog>

View File

@ -41,7 +41,7 @@
>
<div class="cc-display-1">Routing rules not found</div>
<button class="init" color="primary" mat-raised-button (click)="initialize()">
INITIALIZE
Initialize
</button>
</div>
</ng-template>

View File

@ -10,13 +10,12 @@ import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService, ConfirmDialogComponent } from '@vality/ng-core';
import { combineLatest, defer, ReplaySubject } from 'rxjs';
import { filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { ConfirmActionDialogComponent } from '../../../../components/confirm-action-dialog';
import { handleError } from '../../../../utils/operators/handle-error';
import { ChangeDelegateRulesetDialogComponent } from '../change-delegate-ruleset-dialog';
import { ChangeTargetDialogComponent } from '../change-target-dialog';
@ -107,7 +106,7 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
cloneDelegateRuleset(delegateId: DelegateId) {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Clone delegate ruleset' })
.open(ConfirmDialogComponent, { title: 'Clone delegate ruleset' })
.afterClosed()
.pipe(
filter(({ status }) => status === DialogResponseStatus.Success),
@ -124,7 +123,7 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
delete(delegateId: DelegateId) {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Delete delegate' })
.open(ConfirmDialogComponent, { title: 'Delete delegate' })
.afterClosed()
.pipe(
filter(({ status }) => status === DialogResponseStatus.Success),

View File

@ -4,7 +4,7 @@
<mat-icon *ngIf="backTo" class="back" (click)="navigateBack()">arrow_back</mat-icon>
<div><ng-content></ng-content></div>
</div>
<button mat-button (click)="add.emit($event)">ADD RULE</button>
<button mat-button (click)="add.emit($event)">Add rule</button>
</div>
<div *ngIf="description" class="cc-subheading-2 cc-routing-rules-caption">
{{ description }}

View File

@ -117,7 +117,7 @@
mat-button
(click)="add()"
>
ADD
Add
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -61,7 +61,7 @@
</div>
</div>
<mat-action-row flexLayout fxLayoutAlign="start">
<button color="warn" mat-button (click)="removeShopRule(idx)">REMOVE</button>
<button color="warn" mat-button (click)="removeShopRule(idx)">Remove</button>
</mat-action-row>
</mat-expansion-panel>
</mat-accordion>

View File

@ -47,7 +47,7 @@
<input
formControlName="mainDelegateDescription"
matInput
placeholder="Main deligate description"
placeholder="Main delegate description"
/>
</mat-form-field>
</div>

View File

@ -7,7 +7,7 @@
mat-raised-button
(click)="create()"
>
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -2,7 +2,7 @@
<div fxLayout fxLayoutAlign="space-between">
<h1 class="cc-display-1">Claims</h1>
<v-actions>
<button color="primary" mat-raised-button (click)="create()">CREATE</button>
<button color="primary" mat-raised-button (click)="create()">Create</button>
</v-actions>
</div>
<div fxLayout="column" fxLayoutGap="24px">

View File

@ -8,7 +8,7 @@
type="string"
/>
<mat-hint class="cc-caption">
Email, ID, INN, Registred name, Legal name, Trading name, Russian bank account
Email, ID, INN, Registered name, Legal name, Trading name, Russian bank account
</mat-hint>
</mat-form-field>
</form>

View File

@ -3,7 +3,7 @@ import { Pipe, PipeTransform } from '@angular/core';
import { PartyActions } from './party-actions';
const PARTY_ACTION_NAMES: { [N in PartyActions]: string } = {
[PartyActions.NavigateToParty]: 'Merchant Details',
[PartyActions.NavigateToParty]: 'Merchant details',
};
@Pipe({

View File

@ -33,10 +33,10 @@
</mat-card>
<v-actions *ngIf="shop$ | async as shop">
<button mat-raised-button (click)="toggleSuspension()">
{{ (shop.suspension | ccUnionKey) === 'active' ? 'SUSPEND' : 'ACTIVATE' }}
{{ (shop.suspension | ccUnionKey) === 'active' ? 'Suspend' : 'Activate' }}
</button>
<button color="warn" mat-raised-button (click)="toggleBlocking()">
{{ (shop.blocking | ccUnionKey) === 'unblocked' ? 'BLOCK' : 'UNBLOCK' }}
{{ (shop.blocking | ccUnionKey) === 'unblocked' ? 'Block' : 'Unblock' }}
</button>
</v-actions>
</div>

View File

@ -1,14 +1,13 @@
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UntilDestroy } from '@ngneat/until-destroy';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus, ConfirmDialogComponent } from '@vality/ng-core';
import { combineLatest, switchMap, from } from 'rxjs';
import { pluck, filter, withLatestFrom, first, map } from 'rxjs/operators';
import { DomainMetadataViewExtensionsService } from '@cc/app/shared/services/domain-metadata-view-extensions';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import { ConfirmActionDialogComponent } from '../../../components/confirm-action-dialog';
import { getUnionKey } from '../../../utils';
import { PartyManagementService } from '../../api/payment-processing';
import { NotificationService } from '../../shared/services/notification';
@ -49,7 +48,7 @@ export class ShopDetailsComponent {
first(),
switchMap((shop) =>
this.dialogService
.open(ConfirmActionDialogComponent, {
.open(ConfirmDialogComponent, {
title:
getUnionKey(shop.blocking) === 'unblocked'
? 'Block shop'
@ -83,7 +82,7 @@ export class ShopDetailsComponent {
first(),
switchMap((shop) =>
this.dialogService
.open(ConfirmActionDialogComponent, {
.open(ConfirmDialogComponent, {
title:
getUnionKey(shop.suspension) === 'active'
? 'Suspend shop'

View File

@ -7,7 +7,7 @@
></cc-metadata-form>
<v-dialog-actions>
<button [disabled]="control.invalid" color="primary" mat-raised-button (click)="create()">
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -2,13 +2,12 @@
<div fxLayout fxLayoutAlign="space-between">
<h1 class="cc-display-1">Sources</h1>
<v-actions>
<button color="primary" mat-raised-button (click)="create()">CREATE</button>
<button color="primary" mat-raised-button (click)="create()">Create</button>
</v-actions>
</div>
<cc-simple-table
<v-table
[columns]="columns"
[data]="sources$ | async"
[loading]="!!(progress$ | async)"
noUpdate
></cc-simple-table>
[progress]="!!(progress$ | async)"
></v-table>
</div>

View File

@ -1,11 +1,10 @@
import { Component } from '@angular/core';
import { DialogService } from '@vality/ng-core';
import {
DialogService,
createGridColumns,
createDescriptionFormattedColumn,
createDatetimeFormattedColumn,
} from '@cc/components/simple-table';
createDescriptionFormatterColumn,
createDatetimeFormatterColumn,
} from '@vality/ng-core';
import { CreateSourceComponent } from './create-source/create-source.component';
import { FetchSourcesService } from './fetch-sources.service';
@ -25,10 +24,10 @@ export class SourcesComponent {
sources$ = this.fetchSourcesService.sources$;
progress$ = this.fetchSourcesService.progress$;
columns = createGridColumns([
createDescriptionFormattedColumn('name', 'id'),
createDescriptionFormatterColumn('name', 'id'),
'identity',
'currency_symbolic_code',
createDatetimeFormattedColumn('created_at'),
createDatetimeFormatterColumn('created_at'),
]);
constructor(

View File

@ -6,12 +6,9 @@ import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatTableModule } from '@angular/material/table';
import { ActionsModule, DialogModule } from '@vality/ng-core';
import { SimpleTableModule } from '@cc/components/simple-table';
import { ActionsModule, DialogModule, TableModule } from '@vality/ng-core';
import { EmptySearchResultModule } from '../../../components/empty-search-result';
import { TableModule } from '../../../components/table';
import { MetadataFormModule } from '../../shared/components/metadata-form';
import { CreateSourceComponent } from './create-source/create-source.component';
import { SourcesRoutingModule } from './sources-routing.module';
@ -32,7 +29,6 @@ import { SourcesComponent } from './sources.component';
DialogModule,
MetadataFormModule,
ReactiveFormsModule,
SimpleTableModule,
],
declarations: [SourcesComponent, CreateSourceComponent],
})

View File

@ -20,14 +20,14 @@
</mat-card-content>
</mat-card>
<cc-simple-table
<v-table
[cellTemplate]="{ balance: balanceTpl }"
[columns]="columns"
[data]="wallets$ | async"
[hasMore]="hasMore$ | async"
[loading]="inProgress$ | async"
(fetchMore)="fetchMore()"
(size)="search($event)"
[progress]="inProgress$ | async"
(more)="fetchMore()"
(sizeChange)="search($event)"
(update)="search($event.size)"
>
<ng-template #balanceTpl let-col="colDef" let-index="index" let-row>
@ -50,5 +50,5 @@
</ng-template>
</ng-container>
</ng-template>
</cc-simple-table>
</v-table>
</div>

View File

@ -2,7 +2,13 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { StatWallet } from '@vality/fistful-proto/internal/fistful_stat';
import { clean, splitIds } from '@vality/ng-core';
import {
clean,
splitBySeparators,
Column,
createDatetimeFormatterColumn,
createDescriptionFormatterColumn,
} from '@vality/ng-core';
import { of } from 'rxjs';
import { startWith, map, shareReplay, catchError } from 'rxjs/operators';
import { Memoize } from 'typescript-memoize';
@ -12,11 +18,6 @@ import { WalletParams } from '@cc/app/api/fistful-stat/query-dsl/types/wallet';
import { ManagementService } from '@cc/app/api/wallet';
import { QueryParamsService } from '@cc/app/shared/services';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
import {
createDatetimeFormattedColumn,
createDescriptionFormattedColumn,
createGridColumns,
} from '@cc/components/simple-table';
import { FetchWalletsService } from './fetch-wallets.service';
@ -31,13 +32,13 @@ export class WalletsComponent implements OnInit {
wallets$ = this.fetchWalletsService.searchResult$;
inProgress$ = this.fetchWalletsService.doAction$;
hasMore$ = this.fetchWalletsService.hasMore$;
columns = createGridColumns<StatWallet>([
createDescriptionFormattedColumn('name', 'id'),
columns: Column<StatWallet>[] = [
createDescriptionFormatterColumn('name', 'id'),
'currency_symbolic_code',
'identity_id',
createDatetimeFormattedColumn('created_at'),
createDatetimeFormatterColumn('created_at'),
'balance',
]);
];
filters = this.fb.group<WalletParams>({
party_id: null,
identity_id: null,
@ -46,8 +47,6 @@ export class WalletsComponent implements OnInit {
...this.qp.params,
});
test$ = this.getBalance('294');
constructor(
private fetchWalletsService: FetchWalletsService,
private qp: QueryParamsService<WalletParams>,
@ -61,7 +60,7 @@ export class WalletsComponent implements OnInit {
this.filters.valueChanges
.pipe(
startWith(this.filters.value),
map((v) => ({ ...v, wallet_id: splitIds(v.wallet_id) })),
map((v) => ({ ...v, wallet_id: splitBySeparators(v.wallet_id) })),
map((v) => clean(v)),
untilDestroyed(this)
)
@ -73,7 +72,10 @@ export class WalletsComponent implements OnInit {
search(size?: number) {
const { wallet_id, ...v } = this.filters.value;
this.fetchWalletsService.search(clean({ ...v, wallet_id: splitIds(wallet_id) }), size);
this.fetchWalletsService.search(
clean({ ...v, wallet_id: splitBySeparators(wallet_id) }),
size
);
}
fetchMore() {

View File

@ -9,13 +9,12 @@ import { MatInputModule } from '@angular/material/input';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatTableModule } from '@angular/material/table';
import { MtxButtonModule } from '@ng-matero/extensions/button';
import { TableModule } from '@vality/ng-core';
import { AmountCurrencyPipe } from '@cc/app/shared';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { MetadataFormModule } from '@cc/app/shared/components/metadata-form';
import { EmptySearchResultModule } from '@cc/components/empty-search-result';
import { SimpleTableModule } from '@cc/components/simple-table';
import { TableModule } from '@cc/components/table';
import { WalletsRoutingModule } from './wallets-routing.module';
import { WalletsComponent } from './wallets.component';
@ -35,7 +34,6 @@ import { WalletsComponent } from './wallets.component';
MatInputModule,
MerchantFieldModule,
GridModule,
SimpleTableModule,
MatButtonModule,
MatIconModule,
MtxButtonModule,

View File

@ -30,7 +30,7 @@
mat-button
(click)="createAdjustment()"
>
CREATE
Create
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -44,7 +44,7 @@
mat-button
(click)="adjustment()"
>
CREATE ADJUSTMENT
Create adjustment
</button>
</div>

View File

@ -25,7 +25,7 @@
mat-raised-button
(click)="confirm()"
>
{{ (actionControl.value | enumKey : typeEnum) || 'CHANGE' | uppercase }}
{{ (actionControl.value | enumKey : typeEnum) || 'Change' }}
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -70,7 +70,5 @@
</ng-template>
</mat-expansion-panel>
</mat-accordion>
<button mat-button (click)="add()">
ADD {{ data.type.valueType | valueTypeTitle | uppercase }}
</button>
<button mat-button (click)="add()">Add {{ data.type.valueType | valueTypeTitle }}</button>
</div>

View File

@ -32,7 +32,7 @@
</mat-dialog-content>
<mat-dialog-actions *ngIf="initialized">
<button [disabled]="isLoading || !valid" color="primary" mat-button (click)="apply()">
APPLY
Apply
</button>
<button [disabled]="isLoading" [mat-dialog-close]="false" mat-button>CANCEL</button>
<button [disabled]="isLoading" [mat-dialog-close]="false" mat-button>Cancel</button>
</mat-dialog-actions>

View File

@ -2,5 +2,5 @@
<mat-form-field>
<input formControlName="unitID" matInput placeholder="Unit ID" />
</mat-form-field>
<div><button mat-stroked-button (click)="generate()">GENERATE NEW VALUE</button></div>
<div><button mat-stroked-button (click)="generate()">Generate new value</button></div>
</form>

View File

@ -36,7 +36,7 @@ export class TargetTableService {
return result;
}),
catchError(() => {
this.snackBar.open('An error occured while fetching party', 'OK');
this.snackBar.open('An error occurred while fetching party', 'OK');
this.hasError$.next(true);
return of('error');
}),

View File

@ -2,7 +2,7 @@
<mat-form-field fxFlex>
<input formControlName="adjustment_id" matInput placeholder="Adjustment ID" required />
</mat-form-field>
<div><button mat-stroked-button (click)="generate()">GENERATE NEW VALUE</button></div>
<div><button mat-stroked-button (click)="generate()">Generate new value</button></div>
<cc-adjustment-modification
[form]="form.get('modification')"
[initialValue]="initialValue?.modification"

View File

@ -8,7 +8,7 @@
required
/>
</mat-form-field>
<div><button mat-stroked-button (click)="generate()">GENERATE NEW VALUE</button></div>
<div><button mat-stroked-button (click)="generate()">Generate new value</button></div>
</div>
<cc-contract-payout-tool-modification
[form]="form.get('modification')"

View File

@ -73,6 +73,6 @@
</div>
</div>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="save()">SAVE</button>
<button [disabled]="form.invalid" color="primary" mat-button (click)="save()">Save</button>
</v-dialog-actions>
</v-dialog>

View File

@ -6,5 +6,5 @@
matBadgePosition="after"
(click)="openOtherFiltersDialog()"
>
OTHER FILTERS
Other filters
</button>

View File

@ -16,7 +16,7 @@
mat-raised-button
(click)="closeAndSelectWithAnError()"
>
CLOSE AND SELECT WITH AN ERROR
Close and select with an error
</button>
<button
[disabled]="control.invalid || !!(progress$ | async)"
@ -24,7 +24,7 @@
mat-raised-button
(click)="create()"
>
{{ this.withError.length ? 'REPEAT FOR ' + this.withError.length : 'CREATE' }}
{{ this.withError.length ? 'Repeat for ' + this.withError.length : 'Create' }}
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { StatPayment } from '@vality/magista-proto/magista';
import { cleanPrimitiveProps, clean, splitIds } from '@vality/ng-core';
import { cleanPrimitiveProps, clean, splitBySeparators } from '@vality/ng-core';
import * as moment from 'moment';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@ -54,7 +54,7 @@ export class FetchPaymentsService extends PartialFetcher<StatPayment, SearchFilt
party_id: partyID,
shop_ids: shopIDs,
}),
invoice_ids: clean(splitIds(invoiceIDs), true),
invoice_ids: clean(splitBySeparators(invoiceIDs), true),
payment_params: clean({
payment_status: paymentStatus,
payment_tool: paymentMethod,

View File

@ -11,7 +11,7 @@
</mat-card-footer>
</mat-card>
<v-actions>
<button mat-button (click)="searchParamsChanges()">UPDATE</button>
<button mat-button (click)="searchParamsChanges()">Update</button>
<cc-payments-other-search-filters
[initParams]="initSearchParams"
(valueChanges)="searchParamsChanges($event)"
@ -22,7 +22,7 @@
mat-button
(click)="createPaymentAdjustment()"
>
CREATE PAYMENT ADJUSTMENT{{
Create payment adjustment{{
selectedPayments?.length ? ' (' + selectedPayments?.length + ')' : ''
}}
</button>
@ -45,7 +45,7 @@
mat-button
(click)="fetchMore()"
>
{{ (doAction$ | async) ? 'LOADING...' : 'SHOW MORE' }}
{{ (doAction$ | async) ? 'Loading...' : 'Show more' }}
</button>
</mat-card>
</div>

View File

@ -6,10 +6,10 @@
(valueChange)="change($event)"
>
<mat-select-trigger>
{{ isAllSelected ? 'ALL SELECTED' : currentLabel }}
{{ isAllSelected ? 'All selected' : currentLabel }}
</mat-select-trigger>
<mat-option [value]="selectAllSymbol" (click)="toggle()">
{{ isAllSelected ? 'DESELECT ALL' : 'SELECT ALL' }}
<b>{{ isAllSelected ? 'Deselect all' : 'Select all' }}</b>
</mat-option>
<mat-option *ngFor="let option of options" [value]="option.value">
{{ option.label }}

View File

@ -1,12 +1,11 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { ValidationErrors } from '@angular/forms';
import { ThriftAstMetadata } from '@vality/domain-proto';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus, ConfirmDialogComponent } from '@vality/ng-core';
import { merge, defer, of, Subject } from 'rxjs';
import { map, filter, shareReplay } from 'rxjs/operators';
import { toMonacoFile } from '@cc/app/sections/domain/utils';
import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog';
import { MonacoFile, CodeLensProvider, CompletionProvider } from '@cc/components/monaco-editor';
import { ValidatedFormControlSuperclass, createControlProviders } from '@cc/utils';
import { objectToJSON } from '@cc/utils/thrift-instance';
@ -90,7 +89,7 @@ export class ThriftEditorComponent<T> extends ValidatedFormControlSuperclass<T>
reset() {
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Reset changes' })
.open(ConfirmDialogComponent, { title: 'Reset changes' })
.afterClosed()
.pipe(filter(({ status }) => status === DialogResponseStatus.Success))
.subscribe(() => {

View File

@ -7,7 +7,7 @@ export class UserInfoBasedIdGeneratorService {
constructor(private keycloakService: KeycloakService) {}
getUsernameBasedId(): string {
// TODO: replace it by @rbkmoney/id-generator after fix
// TODO: replace it by id-generator after fix
return `${this.getUsernameForId()}-${short().new()}`;
}

View File

@ -1,15 +0,0 @@
<v-dialog
[noContent]="!(dialogData && dialogData.hasReason)"
[title]="dialogData?.['title'] ?? 'Confirm this action'"
>
<mat-form-field *ngIf="dialogData && dialogData.hasReason" style="width: 100%">
<mat-label>Reason</mat-label>
<input [formControl]="control" matInput />
</mat-form-field>
<v-dialog-actions>
<button mat-button (click)="cancel()">CANCEL</button>
<button color="primary" mat-raised-button (click)="confirm()">
{{ dialogData?.['confirmLabel'] || 'CONFIRM' }}
</button>
</v-dialog-actions>
</v-dialog>

View File

@ -1,30 +0,0 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
@Component({
selector: 'cc-confirm-action-dialog',
templateUrl: 'confirm-action-dialog.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ConfirmActionDialogComponent extends DialogSuperclass<
ConfirmActionDialogComponent,
{ title?: string; confirmLabel?: string; hasReason?: boolean } | void,
{ reason?: string }
> {
control = new FormControl<string>('');
cancel() {
this.dialogRef.close({ status: DialogResponseStatus.Cancelled });
}
confirm() {
this.dialogRef.close({
status: DialogResponseStatus.Success,
data:
this.dialogData && this.dialogData.hasReason
? { reason: this.control.value }
: null,
});
}
}

View File

@ -1,27 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { DialogModule } from '@vality/ng-core';
import { ConfirmActionDialogComponent } from './confirm-action-dialog.component';
@NgModule({
imports: [
MatDialogModule,
MatButtonModule,
FlexLayoutModule,
DialogModule,
MatFormFieldModule,
CommonModule,
MatInputModule,
ReactiveFormsModule,
],
declarations: [ConfirmActionDialogComponent],
exports: [ConfirmActionDialogComponent],
})
export class ConfirmActionDialogModule {}

View File

@ -1,2 +0,0 @@
export * from './confirm-action-dialog.module';
export * from './confirm-action-dialog.component';

View File

@ -61,10 +61,10 @@ export abstract class AbstractMonacoDirective implements OnInit, OnChanges, OnDe
this.monacoEditorService.fileChange.subscribe((file) => this.fileChange.emit(file));
this.monacoEditorService
.codeLensProviderRegistered()
.subscribe((disposible) => this.codeLensProviderRegistered.emit(disposible));
.subscribe((disposable) => this.codeLensProviderRegistered.emit(disposable));
this.monacoEditorService
.completionProviderRegistered()
.subscribe((disposible) => this.completionProviderRegistered.emit(disposible));
.subscribe((disposable) => this.completionProviderRegistered.emit(disposable));
}
ngOnDestroy() {

View File

@ -1,6 +1,6 @@
import { Directive, ElementRef, Input, SimpleChanges } from '@angular/core';
import { AbstractMonacoDirective } from './abstarct-monaco.directive';
import { AbstractMonacoDirective } from './abstract-monaco.directive';
import { MonacoFile } from './model';
import { MonacoDiffEditorService } from './monaco-diff-editor.service';

View File

@ -1,7 +1,7 @@
import { Directive, ElementRef, Input } from '@angular/core';
import { ComponentChanges } from '../../app/shared';
import { AbstractMonacoDirective } from './abstarct-monaco.directive';
import { AbstractMonacoDirective } from './abstract-monaco.directive';
import { MonacoFile } from './model';
import { MonacoEditorService } from './monaco-editor.service';

View File

@ -1,11 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'cc-simple-table-actions',
template: `
<div fxLayout fxLayoutGap="16px">
<ng-content></ng-content>
</div>
`,
})
export class SimpleTableActionsComponent {}

View File

@ -1,39 +0,0 @@
import { Component, ViewChild, TemplateRef, Output, EventEmitter } from '@angular/core';
import { createGridColumn, GridColumn } from '@cc/components/simple-table';
@Component({
selector: 'cc-simple-table-tooltip-cell-template',
template: `
<ng-template #tpl let-col="colDef" let-index="index" let-row>
<div
*ngIf="col.formatter ? col.formatter(row, col) : row[col.field] as val"
[matTooltip]="col._data?.tooltip && (col._data.tooltip(row) | json)"
[ngClass]="{ dashed: !!col._data?.tooltip?.(row) }"
matTooltipPosition="right"
>
{{ val }}
</div>
</ng-template>
`,
styles: [
`
.dashed {
text-decoration: underline;
cursor: default;
text-decoration-style: dotted;
}
`,
],
})
export class SimpleTableTooltipCellTemplateComponent {
@Output() template = new EventEmitter<TemplateRef<any>>();
@ViewChild('tpl', { static: true }) set tpl(tpl: TemplateRef<any>) {
this.template.emit(tpl);
}
}
export function createTooltipTemplateGridColumn<T>(col: GridColumn<T>, tooltip: (data: T) => any) {
return { ...createGridColumn(col), _data: { tooltip } };
}

View File

@ -1,3 +0,0 @@
export * from './simple-table.component';
export * from './simple-table.module';
export * from './utils/create-grid-columns';

View File

@ -1,45 +0,0 @@
<div fxLayout="column" fxLayoutGap="32px">
<div *ngIf="!noUpdate || actions" fxLayout fxLayoutAlign="space-between" fxLayoutGap="8px">
<div *ngIf="!noUpdate" fxLayout fxLayoutGap="16px">
<button
[disabled]="loading"
mat-stroked-button
(click)="update.emit(this.size$.value ? { size: this.size$.value } : {})"
>
UPDATE
</button>
<button [disabled]="loading" [matMenuTriggerFor]="menu" mat-button>
{{ size$ | async }} <mat-icon>table_rows_narrow</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="size$.next(25)">25</button>
<button mat-menu-item (click)="size$.next(100)">100</button>
<button mat-menu-item (click)="size$.next(1000)">1000</button>
</mat-menu>
</div>
<ng-content select="cc-simple-table-actions"></ng-content>
</div>
<mat-card class="table-card">
<mtx-grid
[cellSelectable]="false"
[cellTemplate]="cellTemplate"
[columns]="columns"
[data]="data"
[loading]="loading || !columns"
[paginationTemplate]="footerTpl"
[rowSelectable]="rowSelectable"
[trackBy]="trackBy"
(rowSelectionChange)="rowSelectionChange.emit($event)"
></mtx-grid>
<ng-template #footerTpl>
<cc-show-more-button
*ngIf="hasMore && columns"
[inProgress]="loading"
class="show-more"
style="width: 100%"
(fetchMore)="fetchMore.emit(this.size$.value ? { size: this.size$.value } : {})"
></cc-show-more-button>
</ng-template>
</mat-card>
</div>

View File

@ -1,12 +0,0 @@
.table-card {
width: 100%;
overflow: hidden;
& > * {
border: none;
}
}
.show-more {
padding: 16px;
}

View File

@ -1,39 +0,0 @@
import { Component, Input, Output, EventEmitter, OnInit, ContentChild } from '@angular/core';
import { MtxGridColumn } from '@ng-matero/extensions/grid';
import { MtxGrid } from '@ng-matero/extensions/grid/grid';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { coerceBoolean } from 'coerce-property';
import { BehaviorSubject } from 'rxjs';
import { SimpleTableActionsComponent } from './components/simple-table-actions.component';
@UntilDestroy()
@Component({
selector: 'cc-simple-table',
templateUrl: './simple-table.component.html',
styleUrls: ['./simple-table.component.scss'],
})
export class SimpleTableComponent<T> implements OnInit {
@Input() data: T[];
@Input() columns: MtxGridColumn[];
@Input() cellTemplate?: MtxGrid['cellTemplate'];
@Input() trackBy?: MtxGrid['trackBy'];
@Input() @coerceBoolean loading = false;
@Input() @coerceBoolean rowSelectable = false;
@Output() rowSelectionChange = new EventEmitter<T[]>();
@Input() @coerceBoolean hasMore = false;
@Input() @coerceBoolean noUpdate = false;
@Output() size = new EventEmitter<number>();
@Output() update = new EventEmitter<{ size?: number }>();
@Output() fetchMore = new EventEmitter<{ size?: number }>();
@ContentChild(SimpleTableActionsComponent) actions: SimpleTableActionsComponent;
size$ = new BehaviorSubject<undefined | number>(25);
ngOnInit() {
this.size$.pipe(untilDestroyed(this)).subscribe((v) => this.size.emit(v));
}
}

View File

@ -1,52 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MtxGridModule } from '@ng-matero/extensions/grid';
import { ActionsModule } from '@vality/ng-core';
import { TableModule } from '@cc/components/table';
import { EmptySearchResultModule } from '../empty-search-result';
import { SimpleTableActionsComponent } from './components/simple-table-actions.component';
import { SimpleTableTooltipCellTemplateComponent } from './components/simple-table-tooltip-cell-template.component';
import { SimpleTableComponent } from './simple-table.component';
@NgModule({
imports: [
CommonModule,
MatTableModule,
MatCardModule,
TableModule,
EmptySearchResultModule,
MatProgressSpinnerModule,
FlexModule,
MatInputModule,
MatSelectModule,
MatIconModule,
MatMenuModule,
MatButtonModule,
ActionsModule,
MatTooltipModule,
MtxGridModule,
],
declarations: [
SimpleTableComponent,
SimpleTableActionsComponent,
SimpleTableTooltipCellTemplateComponent,
],
exports: [
SimpleTableComponent,
SimpleTableActionsComponent,
SimpleTableTooltipCellTemplateComponent,
],
})
export class SimpleTableModule {}

View File

@ -1,57 +0,0 @@
import { formatDate } from '@angular/common';
import { MtxGridColumn } from '@ng-matero/extensions/grid';
import isObject from 'lodash-es/isObject';
import startCase from 'lodash-es/startCase';
import { Overwrite } from 'utility-types';
export type GridColumn<T> =
| (Overwrite<
MtxGridColumn,
{
formatter?: (rowData: T, colDef?: MtxGridColumn) => string;
}
> & {
_data?: any;
})
| keyof T
| string;
export function createGridColumn<T>(col: GridColumn<T>) {
if (!isObject(col))
col = {
field: col as string,
};
if (!col.header) col.header = startCase(String(col.field).toLowerCase());
return {
...col,
};
}
export function createGridColumns<T>(columns: GridColumn<T>[]): MtxGridColumn[] {
return columns.map((col) => createGridColumn(col));
}
export function createDescriptionFormattedColumn<T>(
field: string,
getDescriptionOrDescriptionField: ((data: T) => string) | string,
getValue?: (data: T) => string
): MtxGridColumn {
return {
field,
formatter: (data: T) => {
const desc =
typeof getDescriptionOrDescriptionField === 'function'
? getDescriptionOrDescriptionField(data)
: String(data[getDescriptionOrDescriptionField]);
const value = getValue ? getValue(data) : String(data[field]);
return value + (desc ? `<div class="mat-caption cc-secondary-text">${desc}</div>` : '');
},
};
}
export function createDatetimeFormattedColumn<T>(field: string): MtxGridColumn {
return {
field,
formatter: (data: T) => formatDate(data[field], 'dd.MM.yyyy HH:mm:ss', 'en'),
};
}

View File

@ -1,3 +1,3 @@
<button [disabled]="inProgress" fxFlex="100" mat-button (click)="fetchMore.emit()">
{{ inProgress ? 'LOADING...' : 'SHOW MORE' }}
{{ inProgress ? 'Loading...' : 'Show more' }}
</button>