diff --git a/.gitignore b/.gitignore index 5bb015f3..14ee9585 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ Thumbs.db # Env and configs .env* -/src/assets/*Config*.json +/src/assets/appConfig*.json +/src/assets/authConfig*.json diff --git a/README.md b/README.md index 618b548f..7f36a1d5 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,16 @@ # Control Center -## Installation +Admin Dashboard + +## ⚙️ Installation 1. Add environment and configurations: - - `.env` - ```env - PROXY_TARGET="https://" - ``` - - `src/assets/appConfig.json`: - ```json - { - "fileStorageEndpoint": "https://", - "constants": { - "currencies": [{ "source": "", "currency": "USD" }] - } - } - ``` - - `src/assets/authConfig.json`: - ```json - { - "realm": "internal", - "auth-server-url": "https://", - "ssl-required": "external", - "resource": "control-center", - "public-client": true - } - ``` + - [`.env`](./_.env) + - [`src/assets/appConfig.json`](./src/assets/_appConfig.json) + - [`src/assets/authConfig.json`](./src/assets/_authConfig.json) + +You can copy from examples like this one: [`_appConfig.json`](./src/assets/_appConfig.json) 2. Install packages ```sh @@ -37,11 +21,11 @@ Running in stage mode needs files: -- `env.stage` +- `.env.stage` - `src/assets/appConfig.stage.json` - `src/assets/authConfig.stage.json` -## Usage +## 🚀 Launch 1. Start ```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-libs ``` + +## 👩‍💻 Development + +### Console Utilities + +- `ccSwitchLogging()` - Enable/disable logging requests to the console +- `ccGetMyRoles()` - Display your roles from the token diff --git a/_.env b/_.env new file mode 100644 index 00000000..34868f40 --- /dev/null +++ b/_.env @@ -0,0 +1 @@ +PROXY_TARGET="https://control-center.sample.vality.dev" diff --git a/package.json b/package.json index 4db63900..af298cce 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "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", - "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", "build-app": "ng build --extra-webpack-config webpack.extra.js", "build-libs": "ng build ng-core", diff --git a/src/app/shared/components/json-viewer/json-viewer.component.html b/src/app/shared/components/json-viewer/json-viewer.component.html index f2657fd3..ad118b4a 100644 --- a/src/app/shared/components/json-viewer/json-viewer.component.html +++ b/src/app/shared/components/json-viewer/json-viewer.component.html @@ -14,7 +14,7 @@
).ast.items.find( - (i) => i.value === value + (i, idx) => { + if ('value' in i) return i.value === value; + return idx === value; + } ).name ?? value ); if (data?.objectType === 'union' && isEmpty(getEntries(value)?.[0]?.[1])) @@ -41,6 +44,7 @@ export class MetadataViewItem { return value; }) ); + isEmpty$ = this.renderValue$.pipe(map((value) => isEmpty(value))); items$: Observable = this.createItems().pipe( shareReplay({ refCount: true, bufferSize: 1 }) diff --git a/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts b/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts index 1a135771..897217ce 100644 --- a/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts +++ b/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts @@ -62,7 +62,7 @@ export class DomainMetadataFormExtensionsService { currency: { symbolic_code: cash.currencyCode }, } : null, - outputToInternal: (cash: Cash) => + outputToInternal: (cash: Cash): CashField => cash ? { amount: toMajor( @@ -73,7 +73,7 @@ export class DomainMetadataFormExtensionsService { cash.currency.symbolic_code )?.data?.exponent ), - currency: cash.currency.symbolic_code, + currencyCode: cash.currency.symbolic_code, } : null, }, diff --git a/src/assets/_appConfig.json b/src/assets/_appConfig.json new file mode 100644 index 00000000..6fd9ae61 --- /dev/null +++ b/src/assets/_appConfig.json @@ -0,0 +1,9 @@ +{ + "fileStorageEndpoint": "https://files.sample.vality.dev", + "constants": { + "currencies": [ + { "source": "RUB_ID", "currency": "RUB" }, + { "source": "USD_ID", "currency": "USD" } + ] + } +} diff --git a/src/assets/_authConfig.json b/src/assets/_authConfig.json new file mode 100644 index 00000000..47f8948e --- /dev/null +++ b/src/assets/_authConfig.json @@ -0,0 +1,7 @@ +{ + "realm": "internal", + "auth-server-url": "https://auth.vality.dev/auth/", + "ssl-required": "external", + "resource": "control-center", + "public-client": true +} diff --git a/src/components/cash-field/cash-field.component.ts b/src/components/cash-field/cash-field.component.ts index ed3830ec..7b48e46b 100644 --- a/src/components/cash-field/cash-field.component.ts +++ b/src/components/cash-field/cash-field.component.ts @@ -1,6 +1,6 @@ import { getCurrencySymbol } from '@angular/common'; 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 { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy'; import { FormComponentSuperclass } from '@s-libs/ng-core'; @@ -67,8 +67,7 @@ export class CashFieldComponent extends FormComponentSuperclass implements constructor( injector: Injector, @Inject(LOCALE_ID) private _locale: string, - private domainStoreService: DomainStoreService, - private fb: FormBuilder + private domainStoreService: DomainStoreService ) { super(injector); }