From ee88f862a7312c0e4733da4fe09ac86cb73bacb8 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Tue, 31 Mar 2020 18:04:30 +0900 Subject: [PATCH] bug fixed --- package-lock.json | 128 ++++++++++++++++-- package.json | 12 +- src/app/app-provider.module.ts | 61 ++++++++- src/app/app.module.ts | 12 ++ src/app/models/login-session.ts | 5 +- .../components/login.page.component.html | 14 +- .../components/login.page.component.scss | 6 + .../components/login.page.component.ts | 29 +++- .../account/account.section.module.ts | 12 +- .../components/login.section.component.html | 29 +++- .../components/login.section.component.ts | 26 ++++ src/app/store/app/actions.ts | 6 + src/app/store/app/effects.ts | 21 +++ src/app/store/app/reducers.ts | 4 + src/app/store/app/state.ts | 9 ++ src/assets/i18n/en/authentication.json | 19 +++ src/assets/i18n/en/call.json | 1 + src/assets/i18n/en/chat.json | 1 + src/assets/i18n/en/common.json | 1 + src/assets/i18n/en/group.json | 1 + src/assets/i18n/en/message.json | 1 + src/assets/i18n/en/organization.json | 1 + src/assets/i18n/ko/authentication.json | 19 +++ src/assets/i18n/ko/call.json | 1 + src/assets/i18n/ko/chat.json | 1 + src/assets/i18n/ko/common.json | 1 + src/assets/i18n/ko/group.json | 1 + src/assets/i18n/ko/message.json | 1 + src/assets/i18n/ko/organization.json | 1 + 29 files changed, 395 insertions(+), 29 deletions(-) create mode 100644 src/app/store/app/actions.ts create mode 100644 src/app/store/app/effects.ts create mode 100644 src/app/store/app/reducers.ts create mode 100644 src/app/store/app/state.ts create mode 100644 src/assets/i18n/en/authentication.json create mode 100644 src/assets/i18n/en/call.json create mode 100644 src/assets/i18n/en/chat.json create mode 100644 src/assets/i18n/en/common.json create mode 100644 src/assets/i18n/en/group.json create mode 100644 src/assets/i18n/en/message.json create mode 100644 src/assets/i18n/en/organization.json create mode 100644 src/assets/i18n/ko/authentication.json create mode 100644 src/assets/i18n/ko/call.json create mode 100644 src/assets/i18n/ko/chat.json create mode 100644 src/assets/i18n/ko/common.json create mode 100644 src/assets/i18n/ko/group.json create mode 100644 src/assets/i18n/ko/message.json create mode 100644 src/assets/i18n/ko/organization.json diff --git a/package-lock.json b/package-lock.json index 0ab62e8..d6503cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1619,6 +1619,15 @@ "@types/node": "*" } }, + "@types/i18next-node-fs-backend": { + "version": "2.1.0", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@types/i18next-node-fs-backend/-/i18next-node-fs-backend-2.1.0.tgz", + "integrity": "sha512-bOOeT89UO/bYLJoQHdN5S3pggj7mMmFfQMBpDdUQOQIQkENGpnTwhNsIM/kjl1NE2HEihjlRZUNVV60Ze86UZA==", + "dev": true, + "requires": { + "i18next": ">=17.0.11" + } + }, "@types/jasmine": { "version": "3.5.10", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@types/jasmine/-/jasmine-3.5.10.tgz", @@ -1827,6 +1836,15 @@ "file-type": "^14.1.4" } }, + "@ucap/logger": { + "version": "0.0.4", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/logger/-/logger-0.0.4.tgz", + "integrity": "sha512-v1GxTxTac4qmGuObQK50KIO/J6sBV2dz2d9GkV6jR5EKJVMyN/uTb2Ua5gZ6LO254ZEYfhPBK58pcuFueo2Bdg==", + "requires": { + "pino": "^6.0.0", + "rxjs": "^6.5.4" + } + }, "@ucap/native": { "version": "0.0.2", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native/-/native-0.0.2.tgz", @@ -1908,9 +1926,14 @@ "integrity": "sha512-F1q2lIzwn5yUkQI5mdQmRHc8NvOnyH5NJAI3JpTWp+5LWCpCMw9+bWuxYcUST4RFJkawLrNm/Sq2N3pO7c4g6Q==" }, "@ucap/ng-i18n": { + "version": "0.0.5", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-i18n/-/ng-i18n-0.0.5.tgz", + "integrity": "sha512-P+MUurrVyLeRl4l7b4aLMG3/nPpZ54U1U2VQnAGb7OHNvZG/BJVzZqc2Z+YvnNXTe8PhMqkRfRysOZeu1AGj5A==" + }, + "@ucap/ng-logger": { "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-i18n/-/ng-i18n-0.0.1.tgz", - "integrity": "sha512-p/tNZFKTWv79mIWluhYukYbSm8Vh8jjMiCobIAm/8oyfbmOvQVLDvY1Xuy3hHzTikSp2vT4xirHXDd70LBFlXg==" + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-logger/-/ng-logger-0.0.1.tgz", + "integrity": "sha512-fvD4KOnpVZiVxGQg6MT7dSP78nNFy4O2gOJKmpp+aMDFjwXBmlx5+kDqoPXgPBJoYMfP+w67kMLewKInGcqc3Q==" }, "@ucap/ng-native": { "version": "0.0.1", @@ -2033,9 +2056,9 @@ "integrity": "sha512-U/tpzUgXSGrWzetmmqEcLYYzgCUEew3C0CcfYSr+ajkt4AvHqcFijqXARVHXVahfAkMXZU69/8etDhzWmOcvGw==" }, "@ucap/ng-ui-authentication": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-authentication/-/ng-ui-authentication-0.0.1.tgz", - "integrity": "sha512-4F+RLBmU56mUIfBBIB6qD57KnwPHJnoRP83co+y+NQRl5GGHvoXwlWIT3OqQ4XA4WMdSeM2Ks5RlJvqsuz7FBg==" + "version": "0.0.5", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-authentication/-/ng-ui-authentication-0.0.5.tgz", + "integrity": "sha512-NwsISychSVyCxVO3j13jNRtHbZpvKY2pb/WBATGPnkYrhaB4x7a+b4gXhWUCmO5QZoYrb2uBV4K9hXANr2Ergg==" }, "@ucap/ng-ui-skin-default": { "version": "0.0.1", @@ -2812,7 +2835,6 @@ "version": "1.0.10", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -2994,6 +3016,11 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "atomic-sleep": { + "version": "1.0.0", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" + }, "autolinker": { "version": "3.13.0", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/autolinker/-/autolinker-3.13.0.tgz", @@ -5259,8 +5286,7 @@ "esprima": { "version": "4.0.1", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esrecurse": { "version": "4.2.1", @@ -5573,6 +5599,16 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, + "fast-redact": { + "version": "2.0.0", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/fast-redact/-/fast-redact-2.0.0.tgz", + "integrity": "sha512-zxpkULI9W9MNTK2sJ3BpPQrTEXFNESd2X6O1tXMFpK/XM0G5c5Rll2EVYZH2TqI3xRGK/VaJ+eEOt7pnENJpeA==" + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "fastparse": { "version": "1.1.2", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/fastparse/-/fastparse-1.1.2.tgz", @@ -5779,6 +5815,11 @@ "locate-path": "^3.0.0" } }, + "flatstr": { + "version": "1.0.12", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + }, "flatted": { "version": "2.0.1", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/flatted/-/flatted-2.0.1.tgz", @@ -6406,6 +6447,41 @@ "@babel/runtime": "^7.3.1" } }, + "i18next-browser-languagedetector": { + "version": "4.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.0.2.tgz", + "integrity": "sha512-AK4IZ3XST4HIKShgpB2gOFeDPrMOnZx56GLA6dGo/8rvkiczIlq05lV8w77c3ShEZxtTZeUVRI4Q/cBFFVXS/w==", + "requires": { + "@babel/runtime": "^7.5.5" + } + }, + "i18next-node-fs-backend": { + "version": "2.1.3", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/i18next-node-fs-backend/-/i18next-node-fs-backend-2.1.3.tgz", + "integrity": "sha512-CreMFiVl3ChlMc5ys/e0QfuLFOZyFcL40Jj6jaKD6DxZ/GCUMxPI9BpU43QMWUgC7r+PClpxg2cGXAl0CjG04g==", + "requires": { + "js-yaml": "3.13.1", + "json5": "2.0.0" + }, + "dependencies": { + "json5": { + "version": "2.0.0", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/json5/-/json5-2.0.0.tgz", + "integrity": "sha512-0EdQvHuLm7yJ7lyG5dp7Q3X2ku++BG5ZHaJ5FTnaXpKqDrw4pMxel5Bt3oAYMthnrthFBdnZ1FcsXTPyrQlV0w==", + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "i18next-xhr-backend": { + "version": "3.2.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/i18next-xhr-backend/-/i18next-xhr-backend-3.2.2.tgz", + "integrity": "sha512-OtRf2Vo3IqAxsttQbpjYnmMML12IMB5e0fc5B7qKJFLScitYaXa1OhMX0n0X/3vrfFlpHL9Ro/H+ps4Ej2j7QQ==", + "requires": { + "@babel/runtime": "^7.5.5" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -7188,7 +7264,6 @@ "version": "3.13.1", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -9080,6 +9155,24 @@ "pinkie": "^2.0.0" } }, + "pino": { + "version": "6.0.0", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/pino/-/pino-6.0.0.tgz", + "integrity": "sha512-3RfX2L76o7v230FP1fZ3Fo/WX7Su+P1Ld+pvBm2j+MyUjtA/KqDYxMkzBqzcX3R00zbC7Gf/HqIzyuu3tgvi9Q==", + "requires": { + "fast-redact": "^2.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^2.4.2", + "quick-format-unescaped": "^4.0.1", + "sonic-boom": "^1.0.0" + } + }, + "pino-std-serializers": { + "version": "2.4.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/pino-std-serializers/-/pino-std-serializers-2.4.2.tgz", + "integrity": "sha512-WaL504dO8eGs+vrK+j4BuQQq6GLKeCCcHaMB2ItygzVURcL1CycwNEUHTD/lHFHs/NL5qAz2UKrjYWXKSf4aMQ==" + }, "pkg-dir": { "version": "3.0.0", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/pkg-dir/-/pkg-dir-3.0.0.tgz", @@ -10073,6 +10166,11 @@ "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/queueing-subject/-/queueing-subject-0.3.4.tgz", "integrity": "sha512-sdpymi9eq80oZyg74NrIGr1GHKIDRmBLZp+xqOct8Do5KpKalPsSz9NxApZb0S2j+EEDMzDlosBN5NJGFLmS7A==" }, + "quick-format-unescaped": { + "version": "4.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/quick-format-unescaped/-/quick-format-unescaped-4.0.1.tgz", + "integrity": "sha512-RyYpQ6Q5/drsJyOhrWHYMWTedvjTIat+FTwv0K4yoUxzvekw2aRHMQJLlnvt8UantkZg2++bEzD9EdxXqkWf4A==" + }, "randombytes": { "version": "2.1.0", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/randombytes/-/randombytes-2.1.0.tgz", @@ -11274,6 +11372,15 @@ } } }, + "sonic-boom": { + "version": "1.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/sonic-boom/-/sonic-boom-1.0.1.tgz", + "integrity": "sha512-o9tx+bonVEXSaPtptyXQXpP8l6UV9Bi3im2geZskvWw2a/o/hrbWI7EBbbv+rOx6Hubnzun9GgH4WfbgEA3MFQ==", + "requires": { + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" + } + }, "sort-keys": { "version": "1.1.2", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/sort-keys/-/sort-keys-1.1.2.tgz", @@ -11441,8 +11548,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.16.1", diff --git a/package.json b/package.json index d6379c5..a2d8f1b 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@ucap/api-prompt": "~0.0.2", "@ucap/api-public": "~0.0.2", "@ucap/core": "~0.0.2", + "@ucap/logger": "~0.0.4", "@ucap/native": "~0.0.2", "@ucap/native-browser": "~0.0.2", "@ucap/ng-api-common": "~0.0.1", @@ -43,7 +44,8 @@ "@ucap/ng-api-prompt": "~0.0.1", "@ucap/ng-api-public": "~0.0.1", "@ucap/ng-core": "~0.0.1", - "@ucap/ng-i18n": "~0.0.1", + "@ucap/ng-logger": "~0.0.1", + "@ucap/ng-i18n": "~0.0.5", "@ucap/ng-native": "~0.0.1", "@ucap/ng-native-browser": "~0.0.1", "@ucap/ng-pi": "~0.0.1", @@ -69,7 +71,7 @@ "@ucap/ng-store-organization": "~0.0.3", "@ucap/ng-web-storage": "~0.0.1", "@ucap/ng-ui": "~0.0.3", - "@ucap/ng-ui-authentication": "~0.0.1", + "@ucap/ng-ui-authentication": "~0.0.5", "@ucap/ng-ui-skin-default": "~0.0.1", "@ucap/pi": "~0.0.2", "@ucap/protocol": "~0.0.1", @@ -92,6 +94,9 @@ "@ucap/web-storage": "~0.0.1", "autolinker": "^3.13.0", "i18next": "^19.3.3", + "i18next-browser-languagedetector": "^4.0.2", + "i18next-node-fs-backend": "^2.1.3", + "i18next-xhr-backend": "^3.2.2", "libphonenumber-js": "^1.7.47", "moment": "^2.24.0", "moment-timezone": "^0.5.28", @@ -109,9 +114,10 @@ "@angular/language-service": "~9.0.6", "@angularclass/hmr": "^2.1.3", "@ngrx/store-devtools": "^9.0.0", - "@types/node": "^12.11.1", + "@types/i18next-node-fs-backend": "^2.1.0", "@types/jasmine": "~3.5.0", "@types/jasminewd2": "~2.0.3", + "@types/node": "^12.11.1", "codelyzer": "^5.1.2", "fs-extra": "^9.0.0", "jasmine-core": "~3.5.0", diff --git a/src/app/app-provider.module.ts b/src/app/app-provider.module.ts index b5c1430..d3e8117 100644 --- a/src/app/app-provider.module.ts +++ b/src/app/app-provider.module.ts @@ -1,9 +1,11 @@ -import { NgModule } from '@angular/core'; +import { NgModule, APP_INITIALIZER } from '@angular/core'; import axios from 'axios'; -import { AxiosInstance } from 'axios'; + +import { NativeService, NativeType } from '@ucap/native'; import { AXIOS_INSTANCE } from '@ucap/ng-core'; +import { I18nService } from '@ucap/ng-i18n'; import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native'; import { environment } from '@environments'; @@ -19,11 +21,56 @@ const SERVICES = [AppAuthenticationService, AppNativeService]; const axiosFactory = () => { const i = axios.create(); - console.log('axios', i); - return i; }; +const appInit = (nativeService: NativeService, i18nService: I18nService) => { + return () => + new Promise(async (resolve, reject) => { + switch (nativeService.type()) { + case NativeType.Browser: + const xhr = await import('i18next-xhr-backend').then(m => m.default); + const languageDetector = await import( + 'i18next-browser-languagedetector' + ).then(m => m.default); + i18nService.use(xhr).use(languageDetector); + break; + // case NativeType.Electron: + // const nodeFs = await import('i18next-node-fs-backend').then(m => m); + // i18nService.use(nodeFs); + // break; + default: + break; + } + + i18nService + .init({ + whitelist: ['ko', 'en'], + fallbackLng: 'ko', + debug: true, // set debug? + returnEmptyString: false, + ns: [ + 'common', + 'organization', + 'authentication', + 'group', + 'chat', + 'call', + 'message' + ], + backend: { + loadPath: 'assets/i18n/{{lng}}/{{ns}}.json' + } + }) + .then(() => { + resolve(); + }) + .catch(reason => { + reject(reason); + }); + }); +}; + @NgModule({ imports: [], exports: [], @@ -40,6 +87,12 @@ const axiosFactory = () => { deps: [AXIOS_INSTANCE], multi: false }, + { + provide: APP_INITIALIZER, + useFactory: appInit, + deps: [UCAP_NATIVE_SERVICE, I18nService], + multi: true + }, ...GUARDS, ...SERVICES ] diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0f06144..46f010b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -8,6 +8,8 @@ import { EffectsModule } from '@ngrx/effects'; import { StoreRouterConnectingModule, RouterState } from '@ngrx/router-store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; +import { LoggerModule } from '@ucap/ng-logger'; + import { CommonApiModule } from '@ucap/ng-api-common'; import { PublicApiModule } from '@ucap/ng-api-public'; import { ExternalApiModule } from '@ucap/ng-api-external'; @@ -60,6 +62,16 @@ import { environment } from '@environments'; BrowserModule, BrowserAnimationsModule, + LoggerModule.forRoot({ + optionsOrStream: { + browser: { + write: o => { + console.log(o); + } + } + } + }), + CommonApiModule.forRoot(environment.commonApiModuleConfig), PublicApiModule.forRoot(environment.publicApiModuleConfig), ExternalApiModule.forRoot(environment.externalApiModuleConfig), diff --git a/src/app/models/login-session.ts b/src/app/models/login-session.ts index 995080a..1cd0e54 100644 --- a/src/app/models/login-session.ts +++ b/src/app/models/login-session.ts @@ -1,4 +1,4 @@ -import { LocaleCode } from '@ucap/core'; +import { LocaleCode, DesktopType, DeviceType } from '@ucap/core'; export interface LoginSession { loginId?: string; @@ -8,5 +8,6 @@ export interface LoginSession { companyGroupType?: string; localeCode?: LocaleCode; encData?: string; - deviceType?: string; + deviceType?: DeviceType; + desktopType?: DesktopType; } diff --git a/src/app/pages/account/components/login.page.component.html b/src/app/pages/account/components/login.page.component.html index 0c4b32c..f9e57bd 100644 --- a/src/app/pages/account/components/login.page.component.html +++ b/src/app/pages/account/components/login.page.component.html @@ -1,3 +1,11 @@ - +
+
Login
+ +
diff --git a/src/app/pages/account/components/login.page.component.scss b/src/app/pages/account/components/login.page.component.scss index e69de29..f7ed654 100644 --- a/src/app/pages/account/components/login.page.component.scss +++ b/src/app/pages/account/components/login.page.component.scss @@ -0,0 +1,6 @@ +.login-page-container { + .login-section-container { + width: 400px; + margin: 40px; + } +} diff --git a/src/app/pages/account/components/login.page.component.ts b/src/app/pages/account/components/login.page.component.ts index 1527bab..984b200 100644 --- a/src/app/pages/account/components/login.page.component.ts +++ b/src/app/pages/account/components/login.page.component.ts @@ -1,14 +1,37 @@ -import { Component } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; + +import { LocalStorageService } from '@ucap/ng-web-storage'; import { environment } from '@environments'; +import { UserStore } from '@app/models/user-store'; +import { AppKey } from '@app/types/app-key.type'; + @Component({ selector: 'app-pages-account-login', templateUrl: './login.page.component.html', styleUrls: ['./login.page.component.scss'] }) -export class LoginPageComponent { +export class LoginPageComponent implements OnInit, OnDestroy { companyGroupCode = environment.companyConfig.companyGroupCode; + userStore: UserStore; - constructor() {} + readonly useRememberMe = + environment.productConfig.authentication.rememberMe.use; + + readonly useAutoLogin = + environment.productConfig.authentication.autoLogin.use; + + constructor(private localStorageService: LocalStorageService) {} + + ngOnInit(): void { + this.userStore = this.localStorageService.encGet( + AppKey.UserStore, + environment.productConfig.localEncriptionKey + ); + } + + ngOnDestroy(): void { + throw new Error('Method not implemented.'); + } } diff --git a/src/app/sections/account/account.section.module.ts b/src/app/sections/account/account.section.module.ts index dc97db6..ad0bdec 100644 --- a/src/app/sections/account/account.section.module.ts +++ b/src/app/sections/account/account.section.module.ts @@ -3,14 +3,22 @@ import { CommonModule } from '@angular/common'; import { FlexLayoutModule } from '@angular/flex-layout'; +import { I18nModule, UCAP_I18N_NAMESPACE } from '@ucap/ng-i18n'; + import { AuthenticationUiModule } from '@ucap/ng-ui-authentication'; import { COMPONENTS } from './components'; @NgModule({ - imports: [CommonModule, FlexLayoutModule, AuthenticationUiModule], + imports: [CommonModule, FlexLayoutModule, I18nModule, AuthenticationUiModule], exports: [...COMPONENTS], declarations: [...COMPONENTS], - entryComponents: [] + entryComponents: [], + providers: [ + { + provide: UCAP_I18N_NAMESPACE, + useValue: ['authentication'] + } + ] }) export class AppAccountSectionModule {} diff --git a/src/app/sections/account/components/login.section.component.html b/src/app/sections/account/components/login.section.component.html index 7b38e04..ecf3817 100644 --- a/src/app/sections/account/components/login.section.component.html +++ b/src/app/sections/account/components/login.section.component.html @@ -1 +1,28 @@ - + +
+ {{ 'login.labels.instructionsOfLogin' | ucapI18n }} +
+
+
+ +
+ + +
+
diff --git a/src/app/sections/account/components/login.section.component.ts b/src/app/sections/account/components/login.section.component.ts index 7532dcc..8c454c8 100644 --- a/src/app/sections/account/components/login.section.component.ts +++ b/src/app/sections/account/components/login.section.component.ts @@ -7,8 +7,10 @@ import { Store, select } from '@ngrx/store'; import { Company } from '@ucap/api-external'; import { ProtocolService } from '@ucap/ng-protocol'; +import { I18nService } from '@ucap/ng-i18n'; import { CompanyActions, CompanySelector } from '@ucap/ng-store-organization'; +import { UserStore } from '@app/models/user-store'; @Component({ selector: 'app-sections-account-login', @@ -19,14 +21,25 @@ export class LoginSectionComponent implements OnInit, OnDestroy { @Input() companyGroupCode: string; + @Input() + userStore: UserStore; + + @Input() + useRememberMe: boolean; + + @Input() + useAutoLogin: boolean; + companyList: Company[]; private companyListSubscription: Subscription; constructor( private protocolService: ProtocolService, + private i18nService: I18nService, private store: Store ) {} + ngOnInit(): void { this.protocolService.disconnect(); @@ -48,4 +61,17 @@ export class LoginSectionComponent implements OnInit, OnDestroy { this.companyListSubscription.unsubscribe(); } } + + onLogin(event: { + companyCode: string; + loginId: string; + loginPw: string; + rememberMe: boolean; + autoLogin: boolean; + notValid: () => void; + }) {} + + onClickForgotPassword() { + this.i18nService.changeLanguage('ko'); + } } diff --git a/src/app/store/app/actions.ts b/src/app/store/app/actions.ts new file mode 100644 index 0000000..cd55116 --- /dev/null +++ b/src/app/store/app/actions.ts @@ -0,0 +1,6 @@ +import { createAction, props } from '@ngrx/store'; + +/** + * APP_INITIALIZER + */ +export const initializer = createAction('[ucap::app::app] initializer'); diff --git a/src/app/store/app/effects.ts b/src/app/store/app/effects.ts new file mode 100644 index 0000000..dacf263 --- /dev/null +++ b/src/app/store/app/effects.ts @@ -0,0 +1,21 @@ +import { map, exhaustMap } from 'rxjs/operators'; + +import { Injectable } from '@angular/core'; + +import { Actions, createEffect, ofType } from '@ngrx/effects'; + +import { LoginResponse } from '@ucap/protocol-authentication'; + +import { SessionStorageService } from '@ucap/ng-web-storage'; + +import { LoginActions } from '@ucap/ng-store-authentication'; + +import { AppKey } from '@app/types/app-key.type'; + +@Injectable() +export class Effects { + constructor( + private actions$: Actions, + private sessionStorageService: SessionStorageService + ) {} +} diff --git a/src/app/store/app/reducers.ts b/src/app/store/app/reducers.ts new file mode 100644 index 0000000..70e7e20 --- /dev/null +++ b/src/app/store/app/reducers.ts @@ -0,0 +1,4 @@ +import { createReducer, on } from '@ngrx/store'; +import { initialState } from './state'; + +export const reducer = createReducer(initialState); diff --git a/src/app/store/app/state.ts b/src/app/store/app/state.ts new file mode 100644 index 0000000..1e05bd0 --- /dev/null +++ b/src/app/store/app/state.ts @@ -0,0 +1,9 @@ +import { Selector, createSelector } from '@ngrx/store'; + +export interface State {} + +export const initialState: State = {}; + +export function selectors(selector: Selector) { + return {}; +} diff --git a/src/assets/i18n/en/authentication.json b/src/assets/i18n/en/authentication.json new file mode 100644 index 0000000..d80ce2e --- /dev/null +++ b/src/assets/i18n/en/authentication.json @@ -0,0 +1,19 @@ +{ + "login": { + "labels": { + "rememberMe": "", + "autoLogin": "Auto login", + "instructionsOfLogin": "LOGIN TO YOUR ACCOUNT" + }, + "fields": { + "company": "Company", + "loginId": "Login ID", + "loginPw": "Login Password" + }, + "errors": { + "requireCompany": "", + "requireLoginId": "", + "requireLoginPw": "" + } + } +} diff --git a/src/assets/i18n/en/call.json b/src/assets/i18n/en/call.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/call.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/en/chat.json b/src/assets/i18n/en/chat.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/chat.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/en/common.json b/src/assets/i18n/en/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/common.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/en/group.json b/src/assets/i18n/en/group.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/group.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/en/message.json b/src/assets/i18n/en/message.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/message.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/en/organization.json b/src/assets/i18n/en/organization.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/en/organization.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/authentication.json b/src/assets/i18n/ko/authentication.json new file mode 100644 index 0000000..aa5cef9 --- /dev/null +++ b/src/assets/i18n/ko/authentication.json @@ -0,0 +1,19 @@ +{ + "login": { + "labels": { + "rememberMe": "", + "autoLogin": "자동 로그인", + "instructionsOfLogin": "계정에 로그인 하세요." + }, + "fields": { + "company": "회사명", + "loginId": "로그인 아이디", + "loginPw": "로그인 비밀번호" + }, + "errors": { + "requireCompany": "", + "requireLoginId": "", + "requireLoginPw": "" + } + } +} diff --git a/src/assets/i18n/ko/call.json b/src/assets/i18n/ko/call.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/call.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/chat.json b/src/assets/i18n/ko/chat.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/chat.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/common.json b/src/assets/i18n/ko/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/common.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/group.json b/src/assets/i18n/ko/group.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/group.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/message.json b/src/assets/i18n/ko/message.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/message.json @@ -0,0 +1 @@ +{} diff --git a/src/assets/i18n/ko/organization.json b/src/assets/i18n/ko/organization.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/assets/i18n/ko/organization.json @@ -0,0 +1 @@ +{}