mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
TD-455: Fix cash field (#164)
This commit is contained in:
parent
7136470378
commit
de37cc1054
3
.gitignore
vendored
3
.gitignore
vendored
@ -48,4 +48,5 @@ Thumbs.db
|
|||||||
|
|
||||||
# Env and configs
|
# Env and configs
|
||||||
.env*
|
.env*
|
||||||
/src/assets/*Config*.json
|
/src/assets/appConfig*.json
|
||||||
|
/src/assets/authConfig*.json
|
||||||
|
43
README.md
43
README.md
@ -1,32 +1,16 @@
|
|||||||
# Control Center
|
# Control Center
|
||||||
|
|
||||||
## Installation
|
Admin Dashboard
|
||||||
|
|
||||||
|
## ⚙️ Installation
|
||||||
|
|
||||||
1. Add environment and configurations:
|
1. Add environment and configurations:
|
||||||
|
|
||||||
- `.env`
|
- [`.env`](./_.env)
|
||||||
```env
|
- [`src/assets/appConfig.json`](./src/assets/_appConfig.json)
|
||||||
PROXY_TARGET="https://<URL>"
|
- [`src/assets/authConfig.json`](./src/assets/_authConfig.json)
|
||||||
```
|
|
||||||
- `src/assets/appConfig.json`:
|
You can copy from examples like this one: [`_appConfig.json`](./src/assets/_appConfig.json)
|
||||||
```json
|
|
||||||
{
|
|
||||||
"fileStorageEndpoint": "https://<URL>",
|
|
||||||
"constants": {
|
|
||||||
"currencies": [{ "source": "<ID>", "currency": "USD" }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
- `src/assets/authConfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"realm": "internal",
|
|
||||||
"auth-server-url": "https://<URL>",
|
|
||||||
"ssl-required": "external",
|
|
||||||
"resource": "control-center",
|
|
||||||
"public-client": true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install packages
|
2. Install packages
|
||||||
```sh
|
```sh
|
||||||
@ -37,11 +21,11 @@
|
|||||||
|
|
||||||
Running in stage mode needs files:
|
Running in stage mode needs files:
|
||||||
|
|
||||||
- `env.stage`
|
- `.env.stage`
|
||||||
- `src/assets/appConfig.stage.json`
|
- `src/assets/appConfig.stage.json`
|
||||||
- `src/assets/authConfig.stage.json`
|
- `src/assets/authConfig.stage.json`
|
||||||
|
|
||||||
## Usage
|
## 🚀 Launch
|
||||||
|
|
||||||
1. Start
|
1. Start
|
||||||
```sh
|
```sh
|
||||||
@ -55,3 +39,10 @@ If you want to develop a library, then it's better to start building library sep
|
|||||||
npm run dev
|
npm run dev
|
||||||
npm run dev-libs
|
npm run dev-libs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 👩💻 Development
|
||||||
|
|
||||||
|
### Console Utilities
|
||||||
|
|
||||||
|
- `ccSwitchLogging()` - Enable/disable logging requests to the console
|
||||||
|
- `ccGetMyRoles()` - Display your roles from the token
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"postinstall": "ngcc",
|
"postinstall": "ngcc",
|
||||||
"start": "concurrently -n LIB,APP -c magenta,cyan npm:dev-libs \"sleep 0.5 && npm run dev\"",
|
"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",
|
"dev": "ng serve --proxy-config proxy.conf.js --port 4200",
|
||||||
"stage": "cross-env NODE_ENV=stage npm run dev -- --configuration=stage",
|
"stage": "cross-env NODE_ENV=stage ng serve --proxy-config proxy.conf.js --port 4201 --configuration=stage",
|
||||||
"dev-libs": "ng build ng-core --watch",
|
"dev-libs": "ng build ng-core --watch",
|
||||||
"build-app": "ng build --extra-webpack-config webpack.extra.js",
|
"build-app": "ng build --extra-webpack-config webpack.extra.js",
|
||||||
"build-libs": "ng build ng-core",
|
"build-libs": "ng build ng-core",
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<div *ngIf="item.current$ | async as current" class="cc-body-1">
|
<div *ngIf="item.current$ | async as current" class="cc-body-1">
|
||||||
<cc-json-viewer
|
<cc-json-viewer
|
||||||
*ngIf="current.value$ | async; else empty"
|
*ngIf="!(current.isEmpty$ | async); else empty"
|
||||||
[data]="current.data$ | async"
|
[data]="current.data$ | async"
|
||||||
[extension]="current.extension$ | async"
|
[extension]="current.extension$ | async"
|
||||||
[extensions]="extensions"
|
[extensions]="extensions"
|
||||||
|
@ -33,7 +33,10 @@ export class MetadataViewItem {
|
|||||||
if (data?.trueTypeNode?.data?.objectType === 'enum')
|
if (data?.trueTypeNode?.data?.objectType === 'enum')
|
||||||
return (
|
return (
|
||||||
(data.trueTypeNode.data as MetadataFormData<ValueType, 'enum'>).ast.items.find(
|
(data.trueTypeNode.data as MetadataFormData<ValueType, 'enum'>).ast.items.find(
|
||||||
(i) => i.value === value
|
(i, idx) => {
|
||||||
|
if ('value' in i) return i.value === value;
|
||||||
|
return idx === value;
|
||||||
|
}
|
||||||
).name ?? value
|
).name ?? value
|
||||||
);
|
);
|
||||||
if (data?.objectType === 'union' && isEmpty(getEntries(value)?.[0]?.[1]))
|
if (data?.objectType === 'union' && isEmpty(getEntries(value)?.[0]?.[1]))
|
||||||
@ -41,6 +44,7 @@ export class MetadataViewItem {
|
|||||||
return value;
|
return value;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
isEmpty$ = this.renderValue$.pipe(map((value) => isEmpty(value)));
|
||||||
|
|
||||||
items$: Observable<MetadataViewItem[]> = this.createItems().pipe(
|
items$: Observable<MetadataViewItem[]> = this.createItems().pipe(
|
||||||
shareReplay({ refCount: true, bufferSize: 1 })
|
shareReplay({ refCount: true, bufferSize: 1 })
|
||||||
|
@ -62,7 +62,7 @@ export class DomainMetadataFormExtensionsService {
|
|||||||
currency: { symbolic_code: cash.currencyCode },
|
currency: { symbolic_code: cash.currencyCode },
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
outputToInternal: (cash: Cash) =>
|
outputToInternal: (cash: Cash): CashField =>
|
||||||
cash
|
cash
|
||||||
? {
|
? {
|
||||||
amount: toMajor(
|
amount: toMajor(
|
||||||
@ -73,7 +73,7 @@ export class DomainMetadataFormExtensionsService {
|
|||||||
cash.currency.symbolic_code
|
cash.currency.symbolic_code
|
||||||
)?.data?.exponent
|
)?.data?.exponent
|
||||||
),
|
),
|
||||||
currency: cash.currency.symbolic_code,
|
currencyCode: cash.currency.symbolic_code,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
},
|
},
|
||||||
|
9
src/assets/_appConfig.json
Normal file
9
src/assets/_appConfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"fileStorageEndpoint": "https://files.sample.vality.dev",
|
||||||
|
"constants": {
|
||||||
|
"currencies": [
|
||||||
|
{ "source": "RUB_ID", "currency": "RUB" },
|
||||||
|
{ "source": "USD_ID", "currency": "USD" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
7
src/assets/_authConfig.json
Normal file
7
src/assets/_authConfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"realm": "internal",
|
||||||
|
"auth-server-url": "https://auth.vality.dev/auth/",
|
||||||
|
"ssl-required": "external",
|
||||||
|
"resource": "control-center",
|
||||||
|
"public-client": true
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { getCurrencySymbol } from '@angular/common';
|
import { getCurrencySymbol } from '@angular/common';
|
||||||
import { Component, Input, Injector, Inject, LOCALE_ID, OnInit } from '@angular/core';
|
import { Component, Input, Injector, Inject, LOCALE_ID, OnInit } from '@angular/core';
|
||||||
import { Validator, ValidationErrors, FormControl, FormBuilder } from '@angular/forms';
|
import { Validator, ValidationErrors, FormControl } from '@angular/forms';
|
||||||
import { createMask } from '@ngneat/input-mask';
|
import { createMask } from '@ngneat/input-mask';
|
||||||
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
|
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
|
||||||
import { FormComponentSuperclass } from '@s-libs/ng-core';
|
import { FormComponentSuperclass } from '@s-libs/ng-core';
|
||||||
@ -67,8 +67,7 @@ export class CashFieldComponent extends FormComponentSuperclass<Cash> implements
|
|||||||
constructor(
|
constructor(
|
||||||
injector: Injector,
|
injector: Injector,
|
||||||
@Inject(LOCALE_ID) private _locale: string,
|
@Inject(LOCALE_ID) private _locale: string,
|
||||||
private domainStoreService: DomainStoreService,
|
private domainStoreService: DomainStoreService
|
||||||
private fb: FormBuilder
|
|
||||||
) {
|
) {
|
||||||
super(injector);
|
super(injector);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user