IMP-58: Move to Ng Core Lib (#214)

This commit is contained in:
Rinat Arsaev 2023-04-21 16:49:05 +04:00 committed by GitHub
parent 3d60afc0ea
commit 910baa9fd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
132 changed files with 322 additions and 1118 deletions

View File

@ -9,8 +9,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Building libraries
run: npm run build-libs
- name: Cache all
uses: actions/cache@v3
id: cache
@ -30,19 +28,6 @@ jobs:
key: ${{ github.sha }}
- name: Check
run: npm run lint
eslint-libs:
name: ESLint Libs
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 lint-libs
prettier:
name: Prettier
runs-on: ubuntu-latest
@ -68,4 +53,4 @@ jobs:
path: ./*
key: ${{ github.sha }}
- name: Build
run: npm run build-app
run: npm run build

24
.vscode/settings.json vendored
View File

@ -1,24 +0,0 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#ab307e",
"activityBar.activeBorder": "#25320e",
"activityBar.background": "#ab307e",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#25320e",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#ab307e",
"statusBar.background": "#832561",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#ab307e",
"statusBarItem.remoteBackground": "#832561",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#832561",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#83256199",
"titleBar.inactiveForeground": "#e7e7e799",
"commandCenter.border": "#e7e7e799"
},
"peacock.color": "#832561",
"tasksStatusbar.taskLabelFilter": "Start"
}

41
.vscode/tasks.json vendored
View File

@ -1,41 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Libs",
"type": "shell",
"command": "npm run dev-libs",
"presentation": {
"group": "stage"
}
},
{
"label": "Stage",
"type": "shell",
"command": "sleep 0.5 && npm run stage",
"presentation": {
"group": "stage"
}
},
{
"label": "Dev",
"type": "shell",
"command": "sleep 0.5 && npm run dev",
"presentation": {
"group": "stage"
}
},
{
"label": "Start stage & libs",
"dependsOn": ["Libs", "Stage"],
"problemMatcher": []
},
{
"label": "Start dev & libs",
"dependsOn": ["Libs", "Dev"],
"problemMatcher": []
}
]
}

View File

@ -155,37 +155,6 @@
}
}
}
},
"ng-core": {
"projectType": "library",
"root": "projects/ng-core",
"sourceRoot": "projects/ng-core/src",
"prefix": "v",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/ng-core/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ng-core/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/ng-core/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ng-core/src/test.ts",
"tsConfig": "projects/ng-core/tsconfig.spec.json",
"karmaConfig": "projects/ng-core/karma.conf.js"
}
}
}
}
},
"cli": {

155
package-lock.json generated
View File

@ -34,12 +34,13 @@
"@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/payout-manager-proto": "2.0.1-b079679.0",
"@vality/repairer-proto": "2.0.1-8f7973d.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
"@vality/woody": "0.1.1",
"angular2-prettyjson": "3.0.1",
"coerce-property": "0.3.2",
"coerce-property": "15.0.1",
"css-element-queries": "1.2.3",
"element-resize-detector": "1.2.4",
"humanize-duration": "3.21.0",
@ -76,7 +77,6 @@
"@types/uuid": "3.4.3",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"concurrently": "7.3.0",
"cross-env": "7.0.3",
"dotenv": "16.0.0",
"eslint": "8.29.0",
@ -5221,6 +5221,23 @@
"resolved": "https://registry.npmjs.org/@vality/magista-proto/-/magista-proto-2.0.1-cf0eff8.0.tgz",
"integrity": "sha512-59ncaJpt7tXFLOq9KrDu4OgrDQr9vTQ3j30T0hjN+ZIsPBsE+lld/pGKASWLLQfwvTtvp9laAuKgQGX9GuvIiQ=="
},
"node_modules/@vality/ng-core": {
"version": "0.3.1-pr-7-478c28d.0",
"resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-0.3.1-pr-7-478c28d.0.tgz",
"integrity": "sha512-p5E6pw14mj7pwxmXX3AbYPdWYbMlPMiZklE1zDRFGoSSQMYLI7knUT4/ap1btgKXC2xdf7RARBcBdujg7ugWgA==",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/cdk": ">=15.0.0",
"@angular/common": ">=15.0.0",
"@angular/core": ">=15.0.0",
"@angular/material": ">=15.0.0",
"coerce-property": ">=0.3.2",
"lodash-es": "^4.0.0",
"utility-types": ">=3.0.0"
}
},
"node_modules/@vality/payout-manager-proto": {
"version": "2.0.1-b079679.0",
"resolved": "https://registry.npmjs.org/@vality/payout-manager-proto/-/payout-manager-proto-2.0.1-b079679.0.tgz",
@ -8191,10 +8208,16 @@
}
},
"node_modules/coerce-property": {
"version": "0.3.2",
"license": "MIT",
"version": "15.0.1",
"resolved": "https://registry.npmjs.org/coerce-property/-/coerce-property-15.0.1.tgz",
"integrity": "sha512-BFuCajc/anzod6ExgyfEm2jaAE0OhSHEIBsmFj0bB7rQIrhgBiLPxpo3XWi7AyE5VVlFsLpkgIEGrDIWzJWc1Q==",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/cdk": ">=7.3.0"
"@angular/cdk": ">=15.0.0",
"@angular/common": ">=15.0.0",
"@angular/core": ">=15.0.0"
}
},
"node_modules/collection-visit": {
@ -8314,50 +8337,6 @@
"typedarray": "^0.0.6"
}
},
"node_modules/concurrently": {
"version": "7.3.0",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^4.1.0",
"date-fns": "^2.16.1",
"lodash": "^4.17.21",
"rxjs": "^7.0.0",
"shell-quote": "^1.7.3",
"spawn-command": "^0.0.2-1",
"supports-color": "^8.1.0",
"tree-kill": "^1.2.2",
"yargs": "^17.3.1"
},
"bin": {
"concurrently": "dist/bin/concurrently.js"
},
"engines": {
"node": "^12.20.0 || ^14.13.0 || >=16.0.0"
}
},
"node_modules/concurrently/node_modules/has-flag": {
"version": "4.0.0",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/concurrently/node_modules/supports-color": {
"version": "8.1.1",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/connect": {
"version": "3.7.0",
"dev": true,
@ -8874,18 +8853,6 @@
"version": "1.0.1",
"license": "MIT"
},
"node_modules/date-fns": {
"version": "2.29.1",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.11"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/date-fns"
}
},
"node_modules/date-format": {
"version": "4.0.11",
"dev": true,
@ -17090,11 +17057,6 @@
"node": ">=0.10.0"
}
},
"node_modules/shell-quote": {
"version": "1.7.3",
"dev": true,
"license": "MIT"
},
"node_modules/short-uuid": {
"version": "4.1.0",
"license": "MIT",
@ -17483,11 +17445,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/spawn-command": {
"version": "0.0.2-1",
"dev": true,
"license": "MIT"
},
"node_modules/spdx-correct": {
"version": "3.1.1",
"dev": true,
@ -22975,6 +22932,14 @@
"resolved": "https://registry.npmjs.org/@vality/magista-proto/-/magista-proto-2.0.1-cf0eff8.0.tgz",
"integrity": "sha512-59ncaJpt7tXFLOq9KrDu4OgrDQr9vTQ3j30T0hjN+ZIsPBsE+lld/pGKASWLLQfwvTtvp9laAuKgQGX9GuvIiQ=="
},
"@vality/ng-core": {
"version": "0.3.1-pr-7-478c28d.0",
"resolved": "https://registry.npmjs.org/@vality/ng-core/-/ng-core-0.3.1-pr-7-478c28d.0.tgz",
"integrity": "sha512-p5E6pw14mj7pwxmXX3AbYPdWYbMlPMiZklE1zDRFGoSSQMYLI7knUT4/ap1btgKXC2xdf7RARBcBdujg7ugWgA==",
"requires": {
"tslib": "^2.3.0"
}
},
"@vality/payout-manager-proto": {
"version": "2.0.1-b079679.0",
"resolved": "https://registry.npmjs.org/@vality/payout-manager-proto/-/payout-manager-proto-2.0.1-b079679.0.tgz",
@ -25094,8 +25059,12 @@
"version": "1.1.0"
},
"coerce-property": {
"version": "0.3.2",
"requires": {}
"version": "15.0.1",
"resolved": "https://registry.npmjs.org/coerce-property/-/coerce-property-15.0.1.tgz",
"integrity": "sha512-BFuCajc/anzod6ExgyfEm2jaAE0OhSHEIBsmFj0bB7rQIrhgBiLPxpo3XWi7AyE5VVlFsLpkgIEGrDIWzJWc1Q==",
"requires": {
"tslib": "^2.3.0"
}
},
"collection-visit": {
"version": "1.0.0",
@ -25177,34 +25146,6 @@
"typedarray": "^0.0.6"
}
},
"concurrently": {
"version": "7.3.0",
"dev": true,
"requires": {
"chalk": "^4.1.0",
"date-fns": "^2.16.1",
"lodash": "^4.17.21",
"rxjs": "^7.0.0",
"shell-quote": "^1.7.3",
"spawn-command": "^0.0.2-1",
"supports-color": "^8.1.0",
"tree-kill": "^1.2.2",
"yargs": "^17.3.1"
},
"dependencies": {
"has-flag": {
"version": "4.0.0",
"dev": true
},
"supports-color": {
"version": "8.1.1",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"connect": {
"version": "3.7.0",
"dev": true,
@ -25544,10 +25485,6 @@
"cyclist": {
"version": "1.0.1"
},
"date-fns": {
"version": "2.29.1",
"dev": true
},
"date-format": {
"version": "4.0.11",
"dev": true
@ -30817,10 +30754,6 @@
"shebang-regex": {
"version": "1.0.0"
},
"shell-quote": {
"version": "1.7.3",
"dev": true
},
"short-uuid": {
"version": "4.1.0",
"requires": {
@ -31082,10 +31015,6 @@
"version": "1.4.8",
"dev": true
},
"spawn-command": {
"version": "0.0.2-1",
"dev": true
},
"spdx-correct": {
"version": "3.1.1",
"dev": true,

View File

@ -4,23 +4,17 @@
"private": true,
"scripts": {
"postinstall": "ngcc",
"start": "concurrently -n LIB,APP -c magenta,cyan npm:dev-libs \"sleep 0.5 && npm run dev\"",
"dev": "ng serve --proxy-config proxy.conf.js --port 4200",
"start": "ng serve --proxy-config proxy.conf.js --port 4200",
"stage": "cross-env NODE_ENV=stage ng serve --proxy-config proxy.conf.js --port 4201 --configuration=stage",
"dev-libs": "ng build ng-core --watch",
"build-app": "ng build --extra-webpack-config webpack.extra.js",
"build-libs": "ng build ng-core",
"build": "npm run build-libs && npm run build-app",
"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",
"lint-libs": "eslint \"projects/**/*.{ts,js,html}\" --max-warnings 0",
"lint-libs-fix": "npm run lint-libs -- --fix",
"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": "concurrently -n LIB,APP -c magenta,cyan npm:lint-libs-fix npm:lint-fix && npm run prettier-fix"
"fix": "npm:lint-fix && npm run prettier-fix"
},
"dependencies": {
"@angular/animations": "15.0.3",
@ -48,12 +42,13 @@
"@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/payout-manager-proto": "2.0.1-b079679.0",
"@vality/repairer-proto": "2.0.1-8f7973d.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
"@vality/woody": "0.1.1",
"angular2-prettyjson": "3.0.1",
"coerce-property": "0.3.2",
"coerce-property": "15.0.1",
"css-element-queries": "1.2.3",
"element-resize-detector": "1.2.4",
"humanize-duration": "3.21.0",
@ -90,7 +85,6 @@
"@types/uuid": "3.4.3",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"concurrently": "7.3.0",
"cross-env": "7.0.3",
"dotenv": "16.0.0",
"eslint": "8.29.0",

View File

@ -1 +0,0 @@
package.json

View File

@ -1,25 +0,0 @@
# NgCore
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.0.0.
## Code scaffolding
Run `ng generate component component-name --project ng-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-core`.
> Note: Don't forget to add `--project ng-core` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build ng-core` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build ng-core`, go to the dist folder `cd dist/ng-core` and run `npm publish`.
## Running unit tests
Run `ng test ng-core` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

View File

@ -1,41 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/ng-core'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true,
});
};

View File

@ -1,7 +0,0 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ng-core",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@vality/ng-core",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^14.0.0",
"@angular/core": "^14.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
}
}

View File

@ -1,10 +0,0 @@
<div
class="cc-actions"
fxFlex="grow"
fxLayout="column"
fxLayout.gt-sm="row"
fxLayoutAlign="space-between center"
fxLayoutGap="24px"
>
<ng-content></ng-content>
</div>

View File

@ -1,14 +0,0 @@
::ng-deep .cc-actions {
& > *:first-child:not(:last-child) {
margin-right: auto !important;
@media screen and (max-width: 959px) {
margin-right: initial !important;
}
}
& > *:first-child:last-child {
margin-left: auto !important;
@media screen and (max-width: 959px) {
margin-left: initial !important;
}
}
}

View File

@ -1,9 +0,0 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'cc-actions',
templateUrl: 'actions.component.html',
styleUrls: ['actions.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ActionsComponent {}

View File

@ -1,11 +0,0 @@
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ActionsComponent } from './actions.component';
@NgModule({
imports: [FlexLayoutModule],
declarations: [ActionsComponent],
exports: [ActionsComponent],
})
export class ActionsModule {}

View File

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

View File

@ -1,32 +0,0 @@
<div class="base-dialog" fxFlex="grow" fxLayout="column">
<div class="base-dialog-title" fxLayout="row" fxLayoutAlign="space-between center">
<div class="cc-headline">{{ title }}</div>
<mat-icon
[matDialogClose]="cancelData"
class="base-dialog-title-close"
inline
(click)="cancelDialog()"
>clear</mat-icon
>
</div>
<ng-container *ngIf="!noContent">
<mat-divider *ngIf="hasDivider"></mat-divider>
<div class="base-dialog-content">
<ng-content></ng-content>
</div>
</ng-container>
<ng-container *ngIf="!noActions">
<mat-divider *ngIf="hasDivider"></mat-divider>
<div class="base-dialog-actions">
<ng-content select="cc-base-dialog-actions"></ng-content>
</div>
</ng-container>
<mat-progress-bar
*ngIf="inProgress || progress"
[mode]="inProgress ? 'indeterminate' : 'determinate'"
[value]="progress"
></mat-progress-bar>
</div>

View File

@ -1,43 +0,0 @@
$base-padding: 24px;
$max-height-mobile: 100vh;
$max-height-desktop: 90vh;
:host {
display: flex;
flex-direction: column;
flex-grow: 1;
height: 100%;
}
.base-dialog {
max-height: calc(#{$max-height-desktop} - #{$base-padding * 2}) !important;
@media screen and (max-width: 959px) {
max-height: calc(#{$max-height-mobile} - #{$base-padding * 2}) !important;
}
&-title {
padding: $base-padding;
&-close {
cursor: pointer;
font-size: 24px;
&:hover {
opacity: 0.5;
}
}
}
&-content {
// instead of flex="grow". Don't need wrong rule "max-height": 100% to support scroll content
flex: 1 1 100%;
box-sizing: border-box;
padding: $base-padding;
overflow: auto;
}
&-actions {
padding: $base-padding;
}
}

View File

@ -1,32 +0,0 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { coerceBoolean } from 'coerce-property';
import { BaseDialogResponseStatus } from './types/base-dialog-response-status';
@Component({
selector: 'cc-base-dialog',
templateUrl: 'base-dialog.component.html',
styleUrls: ['base-dialog.component.scss'],
})
export class BaseDialogComponent {
@Input() title!: string;
@coerceBoolean @Input() disabled = false;
@coerceBoolean @Input() inProgress = false;
@Input() progress?: number;
@coerceBoolean @Input() hasDivider = true;
@coerceBoolean @Input() noContent = false;
@coerceBoolean @Input() noActions = false;
@Output() cancel = new EventEmitter<void>();
cancelData = {
status: BaseDialogResponseStatus.Cancelled,
};
cancelDialog(): void {
this.cancel.emit();
}
}

View File

@ -1,30 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { ActionsModule } from '../actions';
import { BaseDialogComponent } from './base-dialog.component';
import { BaseDialogActionsComponent } from './components/base-dialog-actions/base-dialog-actions.component';
const SHARED_DECLARATIONS = [BaseDialogComponent, BaseDialogActionsComponent];
@NgModule({
imports: [
CommonModule,
FlexLayoutModule,
MatDividerModule,
MatButtonModule,
ActionsModule,
MatIconModule,
MatProgressBarModule,
MatDialogModule,
],
declarations: SHARED_DECLARATIONS,
exports: SHARED_DECLARATIONS,
})
export class BaseDialogModule {}

View File

@ -1 +0,0 @@
<cc-actions><ng-content></ng-content></cc-actions>

View File

@ -1,7 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'cc-base-dialog-actions',
templateUrl: './base-dialog-actions.component.html',
})
export class BaseDialogActionsComponent {}

View File

@ -1,8 +0,0 @@
export * from './base-dialog.module';
export * from './types/base-dialog-response-status';
export * from './types/base-dialog-response';
export * from './utils/base-dialog-superclass';
export * from './tokens';
export * from './base-dialog.component';
export * from './components/base-dialog-actions/base-dialog-actions.component';
export * from './services/base-dialog.service';

View File

@ -1,45 +0,0 @@
import { ComponentType } from '@angular/cdk/overlay';
import { Inject, Injectable, Optional } from '@angular/core';
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
import { DEFAULT_DIALOG_CONFIG, DIALOG_CONFIG, DialogConfig } from '../tokens';
import { BaseDialogResponse } from '../types/base-dialog-response';
import { BaseDialogSuperclass } from '../utils/base-dialog-superclass';
@Injectable({
providedIn: 'root',
})
export class BaseDialogService {
constructor(
private dialog: MatDialog,
@Optional()
@Inject(DIALOG_CONFIG)
private readonly dialogConfig: DialogConfig
) {
if (!dialogConfig) this.dialogConfig = DEFAULT_DIALOG_CONFIG;
}
open<C, D, R, S>(
dialogComponent: ComponentType<BaseDialogSuperclass<C, D, R, S>>,
/**
* Workaround when both conditions for the 'data' argument must be true:
* - typing did not require passing when it is optional (for example: {param: number} | void)
* - typing required to pass when it is required (for example: {param: number})
*/
...[data, configOrConfigName]: D extends void
? []
: [data: D, configOrConfigName?: Omit<MatDialogConfig<D>, 'data'> | keyof DialogConfig]
): MatDialogRef<C, BaseDialogResponse<R, S>> {
let config: Partial<MatDialogConfig<D>>;
if (!configOrConfigName) config = {};
else if (typeof configOrConfigName === 'string')
config = this.dialogConfig[configOrConfigName];
else config = configOrConfigName;
return this.dialog.open(dialogComponent as never, {
data,
...(dialogComponent as typeof BaseDialogSuperclass).defaultDialogConfig,
...config,
});
}
}

View File

@ -1,20 +0,0 @@
import { InjectionToken } from '@angular/core';
import { MatDialogConfig } from '@angular/material/dialog';
import { ValuesType } from 'utility-types';
export type DialogConfig = Record<'small' | 'medium' | 'large', MatDialogConfig<undefined>>;
export const DIALOG_CONFIG = new InjectionToken<DialogConfig>('dialogConfig');
export const BASE_CONFIG: ValuesType<DialogConfig> = {
maxHeight: '90vh',
disableClose: true,
autoFocus: false,
width: '552px',
};
export const DEFAULT_DIALOG_CONFIG: DialogConfig = {
small: { ...BASE_CONFIG, width: '360px' },
medium: BASE_CONFIG,
large: { ...BASE_CONFIG, width: '800px' },
};

View File

@ -1,5 +0,0 @@
export enum BaseDialogResponseStatus {
Success = 'success',
Error = 'error',
Cancelled = 'canceled',
}

View File

@ -1,7 +0,0 @@
import { BaseDialogResponseStatus } from './base-dialog-response-status';
export interface BaseDialogResponse<T = void, S = void> {
status: S | BaseDialogResponseStatus;
data?: T;
error?: unknown;
}

View File

@ -1,43 +0,0 @@
import { Directive, Injector } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { DEFAULT_DIALOG_CONFIG } from '../tokens';
import { BaseDialogResponse } from '../types/base-dialog-response';
import { BaseDialogResponseStatus } from '../types/base-dialog-response-status';
@Directive()
export class BaseDialogSuperclass<
DialogComponent,
DialogData = void,
DialogResponseData = void,
DialogResponseStatus = void,
DialogResponse = BaseDialogResponse<DialogResponseData, DialogResponseStatus>
> {
static defaultDialogConfig = DEFAULT_DIALOG_CONFIG.medium;
dialogData: DialogData = this.injector.get(MAT_DIALOG_DATA) as DialogData;
dialogRef = this.injector.get(MatDialogRef) as MatDialogRef<DialogComponent, DialogResponse>;
constructor(private injector: Injector) {}
closeWithCancellation(data?: DialogResponseData) {
this.dialogRef.close({
status: BaseDialogResponseStatus.Cancelled,
data,
} as never);
}
closeWithSuccess(data?: DialogResponseData) {
this.dialogRef.close({
status: BaseDialogResponseStatus.Success,
data,
} as never);
}
closeWithError(data?: DialogResponseData) {
this.dialogRef.close({
status: BaseDialogResponseStatus.Error,
data,
} as never);
}
}

View File

@ -1,2 +0,0 @@
export * from './actions';
export * from './base-dialog';

View File

@ -1,3 +0,0 @@
export * from './components';
export * from './utils';
export * from './pipes';

View File

@ -1,2 +0,0 @@
export * from './pipes.module';
export * from './inline-json.pipe';

View File

@ -1,12 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { inlineJson } from '../utils';
@Pipe({
name: 'inlineJson',
})
export class InlineJsonPipe implements PipeTransform {
transform(value: unknown, maxReadableLever: number | false = 1): unknown {
return inlineJson(value, maxReadableLever === false ? Infinity : maxReadableLever);
}
}

View File

@ -1,11 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { InlineJsonPipe } from './inline-json.pipe';
@NgModule({
declarations: [InlineJsonPipe],
exports: [InlineJsonPipe],
imports: [CommonModule],
})
export class PipesModule {}

View File

@ -1,46 +0,0 @@
import isEmpty from 'lodash-es/isEmpty';
import isNil from 'lodash-es/isNil';
import isObject from 'lodash-es/isObject';
import { ValuesType } from 'utility-types';
function isEmptyPrimitive(value: unknown): boolean {
return isNil(value) || value === '';
}
function isEmptyObjectOrPrimitive(value: unknown): boolean {
return isObject(value) ? isEmpty(value) : isEmptyPrimitive(value);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function clean<T extends ReadonlyArray<any> | ArrayLike<any> | Record<any, any>>(
value: T,
allowRootRemoval = false,
isNotDeep = false,
filterPredicate: (v: unknown, k?: PropertyKey) => boolean = (v) => !isEmptyObjectOrPrimitive(v)
): T | null {
if (!isObject(value) || (value.constructor !== Object && !Array.isArray(value))) return value;
if (allowRootRemoval && !filterPredicate(value as never)) return null;
let result: unknown;
const cleanChild = (v: unknown) =>
isNotDeep ? v : clean(v as never, allowRootRemoval, isNotDeep, filterPredicate);
if (Array.isArray(value))
result = (value as ValuesType<T>[])
.slice()
.map((v) => cleanChild(v))
.filter((v, idx) => filterPredicate(v, idx));
else
result = Object.fromEntries(
(Object.entries(value) as [keyof T, ValuesType<T>][])
.map(([k, v]) => [k, cleanChild(v)] as const)
.filter(([k, v]) => filterPredicate(v, k))
);
return allowRootRemoval && !filterPredicate(result) ? null : (result as never);
}
export function cleanPrimitiveProps<T extends object>(
obj: T,
allowRootRemoval = false,
isNotDeep = false
) {
return clean(obj, allowRootRemoval, isNotDeep, (v) => !isEmptyPrimitive(v));
}

View File

@ -1,8 +0,0 @@
/**
* Use with sorting (arr.sort(fn))
*/
export function compareDifferentTypes<T>(a: T, b: T): number {
return typeof a === 'number' && typeof b === 'number'
? a - b
: String(a).localeCompare(String(b));
}

View File

@ -1,5 +0,0 @@
export * from './clean';
export * from './inline-json';
export * from './compare-different-types';
export * from './split-ids';
export * from './is-empty';

View File

@ -1,32 +0,0 @@
import { isPrimitive } from 'utility-types';
export function inlineJson(value: unknown, maxReadableLever = 1): string {
if (value === '') {
return "''";
}
if (isPrimitive(value)) {
return String(value);
}
if (Array.isArray(value) || value instanceof Map || value instanceof Set) {
const content =
maxReadableLever > 0
? Array.from(value)
.map((v) => inlineJson(v, maxReadableLever))
.join(', ')
: Array.from(value).length
? '…'
: '';
if (value instanceof Set) return ['Set(', content, ')'].filter(Boolean).join('');
if (value instanceof Map) return ['Map(', content, ')'].filter(Boolean).join('');
return ['[', content, ']'].filter(Boolean).join('');
}
const content =
maxReadableLever > 0
? ' ' +
Object.entries(value as never)
.map(([k, v]) => `${k}: ${inlineJson(v, maxReadableLever - 1)}`)
.join(', ') +
' '
: '';
return ['{', content, '}'].filter(Boolean).join('');
}

View File

@ -1,7 +0,0 @@
import _isEmpty from 'lodash-es/isEmpty';
import isNil from 'lodash-es/isNil';
import isObject from 'lodash-es/isObject';
export function isEmpty(value: unknown): boolean {
return isObject(value) ? _isEmpty(value) : isNil(value) || value === '';
}

View File

@ -1,9 +0,0 @@
const SEPARATORS = ',.;';
export function splitIds(ids: string): string[] {
if (!ids) return [];
return ids
.split(new RegExp(`[${SEPARATORS}\\s]`))
.map((id) => id.trim())
.filter(Boolean);
}

View File

@ -1,5 +0,0 @@
/*
* Public API Surface of ng-core
*/
export * from './lib';

View File

@ -1,12 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

View File

@ -1,21 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": true
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"strictTemplates": true
},
"exclude": ["src/test.ts", "**/*.spec.ts"]
}

View File

@ -1,10 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View File

@ -1,10 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": ["jasmine"]
},
"files": ["src/test.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { BehaviorSubject, combineLatest, defer, merge, Observable, Subject, switchMap } from 'rxjs';
import { first, map, shareReplay } from 'rxjs/operators';
@ -63,7 +63,7 @@ export class ClaimComponent {
private partyManagementService: PartyManagementService,
private notificationService: NotificationService,
private allowedClaimStatusesService: AllowedClaimStatusesService,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private notificationErrorService: NotificationErrorService
) {}
@ -76,14 +76,14 @@ export class ClaimComponent {
.pipe(
first(),
switchMap(([party, claim]) =>
this.baseDialogService
this.dialogService
.open(AddModificationDialogComponent, { party, claim })
.afterClosed()
),
untilDestroyed(this)
)
.subscribe((result) => {
if (result.status === BaseDialogResponseStatus.Success) this.reloadClaim();
if (result.status === DialogResponseStatus.Success) this.reloadClaim();
});
}
@ -92,14 +92,14 @@ export class ClaimComponent {
.pipe(
first(),
switchMap(([party, claim]) =>
this.baseDialogService
this.dialogService
.open(ChangeStatusDialogComponent, { partyID: party.id, claim })
.afterClosed()
),
untilDestroyed(this)
)
.subscribe((result) => {
if (result.status === BaseDialogResponseStatus.Success) this.reloadClaim();
if (result.status === DialogResponseStatus.Success) this.reloadClaim();
});
}
}

View File

@ -15,7 +15,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { RouterModule } from '@angular/router';
import { ActionsModule, BaseDialogModule } from '@vality/ng-core';
import { ActionsModule, DialogModule } from '@vality/ng-core';
import { JsonViewerModule } from '@cc/app/shared/components/json-viewer/json-viewer.module';
import { StatusModule } from '@cc/app/shared/components/status';
@ -70,7 +70,7 @@ import { TimelineItemLoadingComponent } from './components/timeline-item-loading
MatMenuModule,
MatDialogModule,
MatProgressBarModule,
BaseDialogModule,
DialogModule,
ActionsModule,
HumanizeDurationModule,
],

View File

@ -1,4 +1,4 @@
<cc-base-dialog
<v-dialog
[inProgress]="isLoading$ | async"
[title]="isUpdate ? 'Update modification unit' : 'Add party modification unit '"
>
@ -8,7 +8,7 @@
[party]="dialogData.party"
[type]="isUpdate ? 'PartyModificationChange' : 'PartyModification'"
></cc-modification-form>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="control.invalid || (isLoading$ | async)"
color="primary"
@ -17,5 +17,5 @@
>
{{ isUpdate ? 'UPDATE' : 'ADD' }}
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -8,11 +8,7 @@ import {
PartyModificationChange,
} from '@vality/domain-proto/claim_management';
import { Party } from '@vality/domain-proto/domain';
import {
BaseDialogResponseStatus,
BaseDialogSuperclass,
DEFAULT_DIALOG_CONFIG,
} from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass, DEFAULT_DIALOG_CONFIG } from '@vality/ng-core';
import { BehaviorSubject } from 'rxjs';
import { ClaimManagementService } from '@cc/app/api/claim-management';
@ -26,7 +22,7 @@ import { NotificationErrorService } from '../../../../shared/services/notificati
selector: 'cc-add-modification-dialog',
templateUrl: './add-modification-dialog.component.html',
})
export class AddModificationDialogComponent extends BaseDialogSuperclass<
export class AddModificationDialogComponent extends DialogSuperclass<
AddModificationDialogComponent,
{ party: Party; claim: Claim; modificationUnit?: ModificationUnit }
> {
@ -64,7 +60,7 @@ export class AddModificationDialogComponent extends BaseDialogSuperclass<
.subscribe({
next: () => {
this.notificationService.success('Modification added successfully');
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
},
error: this.notificationErrorService.error,
});
@ -84,13 +80,13 @@ export class AddModificationDialogComponent extends BaseDialogSuperclass<
.subscribe({
next: () => {
this.notificationService.success('Modification updated successfully');
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
},
error: this.notificationErrorService.error,
});
}
cancel() {
this.dialogRef.close({ status: BaseDialogResponseStatus.Cancelled });
this.dialogRef.close({ status: DialogResponseStatus.Cancelled });
}
}

View File

@ -1,4 +1,4 @@
<cc-base-dialog [inProgress]="inProgress$ | async" title="Change claim status">
<v-dialog [inProgress]="inProgress$ | async" title="Change claim status">
<div [formGroup]="form" gdColumns="1fr" gdGap="16px">
<mat-form-field>
<mat-select
@ -42,7 +42,7 @@
</mat-select>
</mat-form-field>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="form.invalid || (inProgress$ | async)"
color="primary"
@ -51,5 +51,5 @@
>
CONFIRM
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -2,7 +2,7 @@ import { Component, Injector } from '@angular/core';
import { Validators, FormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Claim, ClaimStatus } from '@vality/domain-proto/claim_management';
import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
import { BehaviorSubject, Observable } from 'rxjs';
import { ClaimManagementService } from '@cc/app/api/claim-management';
@ -17,7 +17,7 @@ import { NotificationErrorService } from '../../../../shared/services/notificati
selector: 'cc-change-status-dialog',
templateUrl: './change-status-dialog.component.html',
})
export class ChangeStatusDialogComponent extends BaseDialogSuperclass<
export class ChangeStatusDialogComponent extends DialogSuperclass<
ChangeStatusDialogComponent,
{ partyID: string; claim: Claim }
> {
@ -68,7 +68,7 @@ export class ChangeStatusDialogComponent extends BaseDialogSuperclass<
}
result$.pipe(progressTo(this.progress$), untilDestroyed(this)).subscribe({
next: () => {
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
this.notificationService.success('Status successfully changed');
},
error: this.notificationErrorService.error,

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 { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { coerceBoolean } from 'coerce-property';
import isEmpty from 'lodash-es/isEmpty';
import { BehaviorSubject, switchMap, from } from 'rxjs';
@ -45,7 +45,7 @@ export class ModificationUnitTimelineItemComponent {
constructor(
private partyManagementService: PartyManagementService,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private claimManagementService: ClaimManagementService,
private notificationService: NotificationService,
private domainMetadataViewExtensionsService: DomainMetadataViewExtensionsService,
@ -66,7 +66,7 @@ export class ModificationUnitTimelineItemComponent {
.pipe(
first(),
switchMap((party) =>
this.baseDialogService
this.dialogService
.open(AddModificationDialogComponent, {
party,
claim: this.claim,
@ -77,16 +77,16 @@ export class ModificationUnitTimelineItemComponent {
untilDestroyed(this)
)
.subscribe((result) => {
if (result.status === BaseDialogResponseStatus.Success) this.claimChanged.emit();
if (result.status === DialogResponseStatus.Success) this.claimChanged.emit();
});
}
remove() {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Confirm deletion' })
.afterClosed()
.pipe(
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() => this.partyManagementService.Get(this.claim.party_id)),
switchMap((party) =>
this.claimManagementService.RemoveModification(

View File

@ -1,4 +1,4 @@
<cc-base-dialog [inProgress]="isLoading$ | async" title="Create deposit">
<v-dialog [inProgress]="isLoading$ | async" title="Create deposit">
<form *ngIf="form" [formGroup]="form" fxLayout="column" fxLayoutGap="16px">
<div fxLayout fxLayoutGap="24px">
<mat-form-field fxFlex>
@ -26,7 +26,7 @@
<div fxFlex></div>
</div>
</form>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="(isLoading$ | async) || form.invalid"
color="primary"
@ -35,5 +35,5 @@
>
CREATE
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -8,7 +8,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSelectModule } from '@angular/material/select';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { UserInfoBasedIdGeneratorModule } from '@cc/app/shared/services/user-info-based-id-generator/user-info-based-id-generator.module';
@ -26,7 +26,7 @@ import { CreateDepositDialogComponent } from './create-deposit-dialog.component'
MatButtonModule,
MatProgressBarModule,
UserInfoBasedIdGeneratorModule,
BaseDialogModule,
DialogModule,
],
declarations: [CreateDepositDialogComponent],
})

View File

@ -18,11 +18,11 @@
type="DomainObject"
(changeKind)="kind = $event"
></cc-thrift-viewer>
<cc-actions>
<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>
</cc-actions>
</v-actions>
</div>
</mat-sidenav>
<mat-sidenav-content>

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 { BaseDialogService, BaseDialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { from } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators';
@ -48,7 +48,7 @@ export class DomainInfoComponent {
constructor(
private router: Router,
private domainStoreService: DomainStoreService,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private notificationService: NotificationService,
private notificationErrorService: NotificationErrorService,
private domainMetadataViewExtensionsService: DomainMetadataViewExtensionsService,
@ -60,12 +60,12 @@ export class DomainInfoComponent {
}
delete() {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Delete object' })
.afterClosed()
.pipe(
untilDestroyed(this),
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() =>
this.domainStoreService.commit({
ops: [{ remove: { object: this.objWithRef.obj } }],

View File

@ -27,7 +27,7 @@
></cc-thrift-viewer>
</mat-card-content>
</mat-card>
<cc-actions>
<v-actions>
<button
*ngIf="!review"
[disabled]="!!(progress$ | async)"
@ -56,6 +56,6 @@
{{ review ? 'COMMIT' : 'REVIEW' }}
<mat-icon aria-label="Login">keyboard_arrow_right</mat-icon>
</button>
</cc-actions>
</v-actions>
</div>
</div>

View File

@ -22,7 +22,7 @@
></cc-thrift-editor>
</mat-card-content>
</mat-card>
<cc-actions>
<v-actions>
<button mat-button (click)="backToDomain()">
<mat-icon aria-label="Login">keyboard_arrow_left</mat-icon>
BACK TO DOMAIN
@ -36,7 +36,7 @@
REVIEW CHANGES
<mat-icon aria-label="Login">keyboard_arrow_right</mat-icon>
</button>
</cc-actions>
</v-actions>
</div>
</ng-template>
</div>

View File

@ -15,7 +15,7 @@
></cc-thrift-viewer>
</mat-card-content>
</mat-card>
<cc-actions>
<v-actions>
<button [disabled]="!!(progress$ | async)" mat-button (click)="back()">
<mat-icon>keyboard_arrow_left</mat-icon>
BACK TO EDIT
@ -28,7 +28,7 @@
>
COMMIT
</button>
</cc-actions>
</v-actions>
</div>
</ng-template>
</div>

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Create chargeback">
<v-dialog title="Create chargeback">
<cc-metadata-form
[extensions]="extensions$ | async"
[formControl]="form"
@ -7,9 +7,9 @@
type="InvoicePaymentChargebackParams"
></cc-metadata-form>
<cc-base-dialog-actions>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-raised-button (click)="create()">
CREATE
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -3,7 +3,7 @@ import { FormControl } from '@angular/forms';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { InvoicePaymentChargeback } from '@vality/domain-proto/domain';
import { InvoicePaymentChargebackParams } from '@vality/domain-proto/payment_processing';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { from } from 'rxjs';
import * as short from 'short-uuid';
@ -17,7 +17,7 @@ import { NotificationErrorService } from '@cc/app/shared/services/notification-e
selector: 'cc-create-chargeback-dialog',
templateUrl: './create-chargeback-dialog.component.html',
})
export class CreateChargebackDialogComponent extends BaseDialogSuperclass<
export class CreateChargebackDialogComponent extends DialogSuperclass<
CreateChargebackDialogComponent,
{ invoiceID: string; paymentID: string },
InvoicePaymentChargeback

View File

@ -23,11 +23,11 @@
<div fxLayout fxLayoutAlign="space-between">
<h2 class="cc-headline">Chargebacks</h2>
<cc-actions>
<v-actions>
<button color="primary" mat-button (click)="createChargeback()">
CREATE CHARGEBACK
</button>
</cc-actions>
</v-actions>
</div>
<mat-card>
<cc-chargebacks

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { BaseDialogService, BaseDialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { Subject, merge, defer } from 'rxjs';
import { pluck, shareReplay, switchMap, map } from 'rxjs/operators';
@ -39,11 +39,11 @@ export class PaymentDetailsComponent {
private paymentDetailsService: PaymentDetailsService,
private route: ActivatedRoute,
private invoicingService: InvoicingService,
private baseDialogService: BaseDialogService
private dialogService: DialogService
) {}
createChargeback() {
this.baseDialogService
this.dialogService
.open(
CreateChargebackDialogComponent,
this.route.snapshot.params as Record<'invoiceID' | 'paymentID', string>
@ -51,7 +51,7 @@ export class PaymentDetailsComponent {
.afterClosed()
.pipe(untilDestroyed(this))
.subscribe(({ status }) => {
if (status === BaseDialogResponseStatus.Success) this.updateChargebacks$.next();
if (status === DialogResponseStatus.Success) this.updateChargebacks$.next();
});
}
}

View File

@ -6,7 +6,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { ActionsModule, BaseDialogModule } from '@vality/ng-core';
import { ActionsModule, DialogModule } from '@vality/ng-core';
import { StatusModule } from '@cc/app/shared/components';
import { DetailsItemModule } from '@cc/components/details-item';
@ -38,7 +38,7 @@ import { PaymentRefundsModule } from './payment-refunds';
PaymentRefundsModule,
ChargebacksComponent,
ActionsModule,
BaseDialogModule,
DialogModule,
MetadataFormModule,
ReactiveFormsModule,
],

View File

@ -1,7 +1,7 @@
import { Component, Injector } from '@angular/core';
import { FormControl } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
import { PayoutID } from '@vality/payout-manager-proto/payout_manager';
import { BehaviorSubject } from 'rxjs';
@ -16,7 +16,7 @@ import { NotificationErrorService } from '../../../../../shared/services/notific
selector: 'cc-cancel-payout-dialog',
templateUrl: './cancel-payout-dialog.component.html',
})
export class CancelPayoutDialogComponent extends BaseDialogSuperclass<
export class CancelPayoutDialogComponent extends DialogSuperclass<
CancelPayoutDialogComponent,
{ id: PayoutID }
> {
@ -38,7 +38,7 @@ export class CancelPayoutDialogComponent extends BaseDialogSuperclass<
.pipe(progressTo(this.progress$), untilDestroyed(this))
.subscribe({
next: () => {
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
this.notificationService.success('Payout canceled successfully');
},
error: this.notificationErrorService.error,

View File

@ -1,4 +1,4 @@
<cc-base-dialog [inProgress]="!!(progress$ | async)" title="Create payout">
<v-dialog [inProgress]="!!(progress$ | async)" title="Create payout">
<div [formGroup]="control" gdColumns="1fr" gdGap="16px">
<cc-merchant-field formControlName="partyId" required></cc-merchant-field>
<cc-shop-field
@ -32,7 +32,7 @@
formControlName="payoutToolId"
></cc-payout-tool-field>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="control.invalid || !!(progress$ | async)"
color="primary"
@ -41,5 +41,5 @@
>
CREATE
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Injector } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
import { PayoutParams } from '@vality/payout-manager-proto/payout_manager';
import isNil from 'lodash-es/isNil';
import omitBy from 'lodash-es/omitBy';
@ -28,7 +28,7 @@ interface CreatePayoutDialogForm {
templateUrl: './create-payout-dialog.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CreatePayoutDialogComponent extends BaseDialogSuperclass<CreatePayoutDialogComponent> {
export class CreatePayoutDialogComponent extends DialogSuperclass<CreatePayoutDialogComponent> {
progress$ = new BehaviorSubject(0);
control = this.fb.group<CreatePayoutDialogForm>({
partyId: null,
@ -71,7 +71,7 @@ export class CreatePayoutDialogComponent extends BaseDialogSuperclass<CreatePayo
.subscribe({
next: () => {
this.notificationService.success('Payout created successfully');
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
},
error: this.notificationErrorService.error,
});

View File

@ -1,9 +1,9 @@
<div fxLayout="column" fxLayoutGap="24px">
<div fxLayout="row" fxLayoutAlign="space-between">
<h1 class="cc-display-1">Payouts</h1>
<cc-actions>
<v-actions>
<button color="primary" mat-raised-button (click)="create()">CREATE</button>
</cc-actions>
</v-actions>
</div>
<mat-card>
<mat-card-content>

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogService } from '@vality/ng-core';
import { DialogService } from '@vality/ng-core';
import omitBy from 'lodash-es/omitBy';
import * as moment from 'moment/moment';
@ -33,7 +33,7 @@ export class PayoutsComponent implements OnInit {
constructor(
private fetchPayoutsService: FetchPayoutsService,
private qp: QueryParamsService<Partial<PayoutsSearchForm>>,
private baseDialogService: BaseDialogService
private dialogService: DialogService
) {}
ngOnInit() {
@ -70,6 +70,6 @@ export class PayoutsComponent implements OnInit {
}
create() {
this.baseDialogService.open(CreatePayoutDialogComponent);
this.dialogService.open(CreatePayoutDialogComponent);
}
}

View File

@ -13,7 +13,7 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
import { BaseDialogModule, ActionsModule } from '@vality/ng-core';
import { DialogModule, ActionsModule } from '@vality/ng-core';
import { PayoutToolFieldModule, ShopFieldModule, StatusModule } from '@cc/app/shared/components';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
@ -61,7 +61,7 @@ import { PayoutsComponent } from './payouts.component';
MatDialogModule,
ShopFieldModule,
PayoutToolFieldModule,
BaseDialogModule,
DialogModule,
ActionsModule,
DateRangeModule,
],

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { PayoutID, PayoutStatus } from '@vality/magista-proto/magista';
import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { switchMap } from 'rxjs';
import { filter } from 'rxjs/operators';
@ -16,7 +16,7 @@ import { CancelPayoutDialogComponent } from '../payouts/components/cancel-payout
export class PayoutActionsService {
constructor(
private payoutManagementService: PayoutManagementService,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private notificationErrorService: NotificationErrorService
) {}
@ -29,15 +29,15 @@ export class PayoutActionsService {
}
cancel(id: PayoutID) {
this.baseDialogService.open(CancelPayoutDialogComponent, { id });
this.dialogService.open(CancelPayoutDialogComponent, { id });
}
confirm(id: PayoutID) {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Confirm payout' })
.afterClosed()
.pipe(
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() => this.payoutManagementService.ConfirmPayout(id)),
untilDestroyed(this)
)

View File

@ -1,4 +1,4 @@
<cc-base-dialog gdColumn="1fr" title="Repair by scenario">
<v-dialog gdColumn="1fr" title="Repair by scenario">
<div gdGap="16px">
<mat-form-field>
<mat-label>Type</mat-label>
@ -55,7 +55,7 @@
<mat-progress-bar *ngIf="progress$ | async"></mat-progress-bar>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="
typeControl.invalid ||
@ -68,5 +68,5 @@
>
REPAIR
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { Component, Injector, OnInit } from '@angular/core';
import { Validators, FormControl } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
import {
RepairInvoicesRequest,
RepairWithdrawalsRequest,
@ -32,7 +32,7 @@ enum Namespace {
templateUrl: './repair-by-scenario-dialog.component.html',
})
export class RepairByScenarioDialogComponent
extends BaseDialogSuperclass<RepairByScenarioDialogComponent, { machines: Machine[] }>
extends DialogSuperclass<RepairByScenarioDialogComponent, { machines: Machine[] }>
implements OnInit
{
nsControl = new FormControl<Namespace>(null, Validators.required);
@ -89,7 +89,7 @@ export class RepairByScenarioDialogComponent
.subscribe({
next: () => {
this.notificationService.success();
this.dialogRef.close({ status: BaseDialogResponseStatus.Success });
this.dialogRef.close({ status: DialogResponseStatus.Success });
},
error: this.notificationErrorService.error,
});

View File

@ -2,7 +2,7 @@ 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 { BaseDialogResponseStatus, BaseDialogService, clean, splitIds } from '@vality/ng-core';
import { DialogResponseStatus, DialogService, clean, splitIds } 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';
@ -103,7 +103,7 @@ export class RepairingComponent implements OnInit {
private machinesService: MachinesService,
private fb: FormBuilder,
private qp: QueryParamsService<Filters>,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private repairManagementService: RepairManagementService,
private notificationService: NotificationService,
private notificationErrorService: NotificationErrorService,
@ -150,13 +150,13 @@ export class RepairingComponent implements OnInit {
}
repair() {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, {
title: `Simple repair ${this.selected$.value.length} machines`,
})
.afterClosed()
.pipe(
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() =>
this.repairManagementService.SimpleRepairAll(
this.selected$.value.map(({ id, ns }) => ({ id, ns }))
@ -173,7 +173,7 @@ export class RepairingComponent implements OnInit {
}
repairByScenario() {
this.baseDialogService
this.dialogService
.open(RepairByScenarioDialogComponent, { machines: this.selected$.value })
.afterClosed()
.pipe(untilDestroyed(this))

View File

@ -13,7 +13,7 @@ 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, BaseDialogModule } from '@vality/ng-core';
import { ActionsModule, DialogModule } from '@vality/ng-core';
import { EnumKeyPipe, EnumKeysPipe, DomainObjectFieldComponent } from '@cc/app/shared';
import { MetadataFormModule } from '@cc/app/shared/components/metadata-form';
@ -45,7 +45,7 @@ import { RepairingComponent } from './repairing.component';
DateRangeModule,
MatSelectModule,
ActionsModule,
BaseDialogModule,
DialogModule,
MetadataFormModule,
MatRadioModule,
MatChipsModule,

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Change Delegate Ruleset">
<v-dialog title="Change Delegate Ruleset">
<div [formGroup]="form" fxLayout="column" fxLayoutGap="24px">
<mat-form-field>
<mat-label>Delegate Ruleset</mat-label>
@ -14,9 +14,9 @@
</mat-form-field>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="changeRuleset()">
CHANGE RULESET
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/core';
import { UntypedFormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { map } from 'rxjs/operators';
import { RoutingRulesService } from '../services/routing-rules';
@ -13,7 +13,7 @@ import { RoutingRulesService } from '../services/routing-rules';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChangeDelegateRulesetDialogComponent
extends BaseDialogSuperclass<
extends DialogSuperclass<
ChangeDelegateRulesetDialogComponent,
{ mainRulesetRefID: number; delegateIdx: number }
>

View File

@ -5,7 +5,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { ChangeDelegateRulesetDialogComponent } from './change-delegate-ruleset-dialog.component';
@ -18,7 +18,7 @@ import { ChangeDelegateRulesetDialogComponent } from './change-delegate-ruleset-
MatInputModule,
MatButtonModule,
MatSelectModule,
BaseDialogModule,
DialogModule,
],
declarations: [ChangeDelegateRulesetDialogComponent],
exports: [ChangeDelegateRulesetDialogComponent],

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Change main ruleset">
<v-dialog title="Change main ruleset">
<cc-target-ruleset-form
[type]="dialogData.type"
[value]="initValue"
@ -6,7 +6,7 @@
(valueChanges)="targetRuleset$.next($event)"
></cc-target-ruleset-form>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="!(targetRulesetValid$ | async)"
color="primary"
@ -15,5 +15,5 @@
>
CHANGE TARGET
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, Injector } from '@angular/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { BehaviorSubject } from 'rxjs';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
@ -14,7 +14,7 @@ import { RoutingRulesType } from '../types/routing-rules-type';
templateUrl: 'change-target-dialog.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChangeTargetDialogComponent extends BaseDialogSuperclass<
export class ChangeTargetDialogComponent extends DialogSuperclass<
ChangeTargetDialogComponent,
{ mainRulesetRefID: number; delegateIdx: number; type: RoutingRulesType }
> {

View File

@ -3,7 +3,7 @@ import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { TargetRulesetFormModule } from '../target-ruleset-form';
import { ChangeTargetDialogComponent } from './change-target-dialog.component';
@ -15,7 +15,7 @@ import { ChangeTargetDialogComponent } from './change-target-dialog.component';
FlexLayoutModule,
MatDialogModule,
MatButtonModule,
BaseDialogModule,
DialogModule,
],
declarations: [ChangeTargetDialogComponent],
exports: [ChangeTargetDialogComponent],

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Attach party delegate ruleset">
<v-dialog title="Attach party delegate ruleset">
<div [formGroup]="form" fxLayout="column" fxLayoutGap="24px">
<cc-target-ruleset-form
[type]="dialogData.type"
@ -24,7 +24,7 @@
</ng-container>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="form.invalid || !(targetRulesetValid$ | async)"
color="primary"
@ -33,5 +33,5 @@
>
ATTACH
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, Injector } from '@angular/core';
import { UntypedFormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { BehaviorSubject } from 'rxjs';
import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type';
@ -15,7 +15,7 @@ import { TargetRuleset } from '../../target-ruleset-form';
templateUrl: 'attach-new-ruleset-dialog.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AttachNewRulesetDialogComponent extends BaseDialogSuperclass<
export class AttachNewRulesetDialogComponent extends DialogSuperclass<
AttachNewRulesetDialogComponent,
{ partyID: string; type: RoutingRulesType }
> {

View File

@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogService } from '@vality/ng-core';
import { DialogService } from '@vality/ng-core';
import { first, map } from 'rxjs/operators';
import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
@ -58,14 +58,14 @@ export class PartyDelegateRulesetsComponent {
private partyDelegateRulesetsService: PartyDelegateRulesetsService,
private routingRulesService: RoutingRulesService,
private router: Router,
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private domainStoreService: DomainStoreService,
private notificationErrorService: NotificationErrorService,
private route: ActivatedRoute
) {}
attachNewRuleset() {
this.baseDialogService
this.dialogService
.open(AttachNewRulesetDialogComponent, {
partyID: this.partyID,
type: this.route.snapshot.params.type,

View File

@ -14,7 +14,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { RouterModule } from '@angular/router';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { DetailsItemModule } from '@cc/components/details-item';
@ -51,7 +51,7 @@ const EXPORTED_DECLARATIONS = [PartyDelegateRulesetsComponent, AttachNewRulesetD
ChangeTargetDialogModule,
TargetRulesetFormModule,
RoutingRulesListModule,
BaseDialogModule,
DialogModule,
],
declarations: EXPORTED_DECLARATIONS,
exports: EXPORTED_DECLARATIONS,

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Party routing rule params">
<v-dialog title="Party routing rule params">
<div [formGroup]="form" fxLayout="column" fxLayoutGap="24px">
<mat-form-field *ngIf="dialogData.type === 'payment'">
<mat-label>Shop</mat-label>
@ -32,7 +32,7 @@
</div>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="add()">ADD</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -3,7 +3,7 @@ import { FormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Shop } from '@vality/domain-proto/domain';
import { StatWallet } from '@vality/fistful-proto/fistful_stat';
import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core';
import { DialogResponseStatus, DialogSuperclass } from '@vality/ng-core';
import { NotificationErrorService } from '@cc/app/shared/services/notification-error';
@ -14,7 +14,7 @@ import { RoutingRulesType } from '../../types/routing-rules-type';
@Component({
templateUrl: 'add-party-routing-rule-dialog.component.html',
})
export class AddPartyRoutingRuleDialogComponent extends BaseDialogSuperclass<
export class AddPartyRoutingRuleDialogComponent extends DialogSuperclass<
AddPartyRoutingRuleDialogComponent,
{ refID: number; partyID: string; shops: Shop[]; wallets: StatWallet[]; type: RoutingRulesType }
> {
@ -54,7 +54,7 @@ export class AddPartyRoutingRuleDialogComponent extends BaseDialogSuperclass<
)
.pipe(untilDestroyed(this))
.subscribe({
next: () => this.dialogRef.close({ status: BaseDialogResponseStatus.Success }),
next: () => this.dialogRef.close({ status: DialogResponseStatus.Success }),
error: this.notificationErrorService.error,
});
}

View File

@ -11,7 +11,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog.component';
@ -29,7 +29,7 @@ import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dia
MatSelectModule,
MatRadioModule,
MatAutocompleteModule,
BaseDialogModule,
DialogModule,
],
declarations: [AddPartyRoutingRuleDialogComponent],
exports: [AddPartyRoutingRuleDialogComponent],

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Routing rules init params">
<v-dialog title="Routing rules init params">
<div [formGroup]="form" fxLayout="column" fxLayoutGap="24px">
<mat-form-field>
<input
@ -23,7 +23,7 @@
</div>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button [disabled]="form.invalid" color="primary" mat-button (click)="init()">INIT</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -1,7 +1,7 @@
import { Component, Injector } from '@angular/core';
import { UntypedFormBuilder } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { NotificationErrorService } from '../../../../shared/services/notification-error';
import { RoutingRulesService } from '../../services/routing-rules';
@ -11,7 +11,7 @@ import { RoutingRulesService } from '../../services/routing-rules';
selector: 'cc-initialize-routing-rules-dialog',
templateUrl: 'initialize-routing-rules-dialog.component.html',
})
export class InitializeRoutingRulesDialogComponent extends BaseDialogSuperclass<
export class InitializeRoutingRulesDialogComponent extends DialogSuperclass<
InitializeRoutingRulesDialogComponent,
{ partyID: string; refID: number }
> {

View File

@ -11,7 +11,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { InitializeRoutingRulesDialogComponent } from './initialize-routing-rules-dialog.component';
@ -29,7 +29,7 @@ import { InitializeRoutingRulesDialogComponent } from './initialize-routing-rule
MatSelectModule,
MatRadioModule,
MatAutocompleteModule,
BaseDialogModule,
DialogModule,
],
declarations: [InitializeRoutingRulesDialogComponent],
exports: [InitializeRoutingRulesDialogComponent],

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BaseDialogService, BaseDialogResponseStatus } from '@vality/ng-core';
import { DialogService, DialogResponseStatus } from '@vality/ng-core';
import { combineLatest, Observable } from 'rxjs';
import { filter, map, pluck, shareReplay, startWith, switchMap, take } from 'rxjs/operators';
@ -89,7 +89,7 @@ export class PartyRoutingRulesetComponent {
);
constructor(
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private partyRoutingRulesetService: PartyRoutingRulesetService,
private router: Router,
private route: ActivatedRoute,
@ -104,7 +104,7 @@ export class PartyRoutingRulesetComponent {
.pipe(
take(1),
switchMap(([partyID, refID]) =>
this.baseDialogService
this.dialogService
.open(InitializeRoutingRulesDialogComponent, { partyID, refID })
.afterClosed()
),
@ -128,7 +128,7 @@ export class PartyRoutingRulesetComponent {
.pipe(
take(1),
switchMap(([refID, shops, wallets, type, partyID]) =>
this.baseDialogService
this.dialogService
.open(AddPartyRoutingRuleDialogComponent, {
refID,
shops,
@ -142,7 +142,7 @@ export class PartyRoutingRulesetComponent {
)
.subscribe({
next: (res) => {
if (res.status === BaseDialogResponseStatus.Success) {
if (res.status === DialogResponseStatus.Success) {
this.partyRoutingRulesetService.reload();
}
},

View File

@ -10,7 +10,7 @@ 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 { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { combineLatest, defer, ReplaySubject } from 'rxjs';
import { filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
@ -76,14 +76,14 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
private paginator$ = new ReplaySubject<MatPaginator>(1);
constructor(
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private notificationErrorService: NotificationErrorService,
private routingRulesService: RoutingRulesService,
private route: ActivatedRoute
) {}
changeDelegateRuleset(delegateId: DelegateId) {
this.baseDialogService
this.dialogService
.open(ChangeDelegateRulesetDialogComponent, {
mainRulesetRefID: delegateId.parentRefId,
delegateIdx: delegateId.delegateIdx,
@ -94,7 +94,7 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
}
changeTarget(delegateId: DelegateId) {
this.baseDialogService
this.dialogService
.open(ChangeTargetDialogComponent, {
mainRulesetRefID: delegateId.parentRefId,
delegateIdx: delegateId.delegateIdx,
@ -106,11 +106,11 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
}
cloneDelegateRuleset(delegateId: DelegateId) {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Clone delegate ruleset' })
.afterClosed()
.pipe(
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() =>
this.routingRulesService.cloneDelegateRuleset({
mainRulesetRefID: delegateId.parentRefId,
@ -123,11 +123,11 @@ export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & D
}
delete(delegateId: DelegateId) {
this.baseDialogService
this.dialogService
.open(ConfirmActionDialogComponent, { title: 'Delete delegate' })
.afterClosed()
.pipe(
filter(({ status }) => status === BaseDialogResponseStatus.Success),
filter(({ status }) => status === DialogResponseStatus.Success),
switchMap(() =>
this.routingRulesService.deleteDelegate({
mainRulesetRefID: delegateId.parentRefId,

View File

@ -1,4 +1,4 @@
<cc-base-dialog title="Routing rule params">
<v-dialog title="Routing rule params">
<div [formGroup]="form" fxLayout="column" fxLayoutGap="24px">
<div fxLayout="column" fxLayoutGap="16px">
<mat-form-field>
@ -110,7 +110,7 @@
</div>
</div>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="form.invalid || predicateControl.invalid"
color="primary"
@ -119,5 +119,5 @@
>
ADD
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -3,7 +3,7 @@ import { Validators, FormBuilder } from '@angular/forms';
import { UntilDestroy } from '@ngneat/until-destroy';
import { domain } from '@vality/domain-proto';
import { Predicate } from '@vality/domain-proto/domain';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
@ -15,7 +15,7 @@ import { AddRoutingRuleDialogService, TerminalType } from './add-routing-rule-di
styleUrls: ['add-routing-rule-dialog.component.scss'],
providers: [AddRoutingRuleDialogService],
})
export class AddRoutingRuleDialogComponent extends BaseDialogSuperclass<
export class AddRoutingRuleDialogComponent extends DialogSuperclass<
AddRoutingRuleDialogComponent,
{ refID: number }
> {

View File

@ -11,7 +11,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { BaseDialogModule } from '@vality/ng-core';
import { DialogModule } from '@vality/ng-core';
import { MetadataFormModule } from '@cc/app/shared/components/metadata-form';
@ -34,7 +34,7 @@ import { PredicateComponent } from './predicate';
MatRadioModule,
MatAutocompleteModule,
MetadataFormModule,
BaseDialogModule,
DialogModule,
],
declarations: [AddRoutingRuleDialogComponent, PredicateComponent, ExpanderComponent],
exports: [AddRoutingRuleDialogComponent],

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { UntypedFormArray, UntypedFormBuilder, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Predicate } from '@vality/domain-proto/domain';
import { BaseDialogResponseStatus } from '@vality/ng-core';
import { DialogResponseStatus } from '@vality/ng-core';
import { of } from 'rxjs';
import { startWith, switchMap, take } from 'rxjs/operators';
@ -86,7 +86,7 @@ export class AddRoutingRuleDialogService {
})
)
)
.subscribe(() => this.dialogRef.close({ status: BaseDialogResponseStatus.Success }));
.subscribe(() => this.dialogRef.close({ status: DialogResponseStatus.Success }));
}
addOption() {

View File

@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Predicate, TerminalObject } from '@vality/domain-proto/domain';
import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core';
import { DialogResponseStatus, DialogService } from '@vality/ng-core';
import { Observable } from 'rxjs';
import { first, map, pluck, shareReplay, switchMap } from 'rxjs/operators';
@ -43,7 +43,7 @@ export class RoutingRulesetComponent {
isLoading$ = this.domainStoreService.isLoading$;
constructor(
private baseDialogService: BaseDialogService,
private dialogService: DialogService,
private routingRulesetService: RoutingRulesetService,
private domainStoreService: DomainStoreService,
private notificationErrorService: NotificationErrorService,
@ -56,15 +56,13 @@ export class RoutingRulesetComponent {
.pipe(
first(),
switchMap((refID) =>
this.baseDialogService
.open(AddRoutingRuleDialogComponent, { refID })
.afterClosed()
this.dialogService.open(AddRoutingRuleDialogComponent, { refID }).afterClosed()
)
)
.pipe(untilDestroyed(this))
.subscribe({
next: (res) => {
if (res.status === BaseDialogResponseStatus.Success) {
if (res.status === DialogResponseStatus.Success) {
this.domainStoreService.forceReload();
this.notificationService.success('Routing rule successfully added');
}

View File

@ -1,6 +1,6 @@
<cc-base-dialog title="Create claim">
<v-dialog title="Create claim">
<cc-merchant-field [formControl]="control"></cc-merchant-field>
<cc-base-dialog-actions>
<v-dialog-actions>
<button
[disabled]="control.invalid || !!(progress$ | async)"
color="primary"
@ -9,5 +9,5 @@
>
CREATE
</button>
</cc-base-dialog-actions>
</cc-base-dialog>
</v-dialog-actions>
</v-dialog>

View File

@ -2,7 +2,7 @@ import { Component, Injector } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { BaseDialogSuperclass } from '@vality/ng-core';
import { DialogSuperclass } from '@vality/ng-core';
import { BehaviorSubject } from 'rxjs';
import { ClaimManagementService } from '@cc/app/api/claim-management';
@ -15,7 +15,7 @@ import { progressTo } from '@cc/utils';
selector: 'cc-create-claim-dialog',
templateUrl: './create-claim-dialog.component.html',
})
export class CreateClaimDialogComponent extends BaseDialogSuperclass<
export class CreateClaimDialogComponent extends DialogSuperclass<
CreateClaimDialogComponent,
{ partyId: string }
> {

View File

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

Some files were not shown because too many files have changed in this diff Show More