bug fixed
This commit is contained in:
parent
3a9ae7300f
commit
6935b9a69e
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# compiled output
|
# compiled output
|
||||||
/dist
|
/dist
|
||||||
|
/pack
|
||||||
/tmp
|
/tmp
|
||||||
/out-tsc
|
/out-tsc
|
||||||
# Only exists if Bazel was run
|
# Only exists if Bazel was run
|
||||||
|
|
38
angular.json
38
angular.json
|
@ -3,6 +3,44 @@
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
|
"logger": {
|
||||||
|
"projectType": "library",
|
||||||
|
"root": "projects/logger",
|
||||||
|
"sourceRoot": "projects/logger/src",
|
||||||
|
"prefix": "lib",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-ng-packagr:build",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": "projects/logger/tsconfig.lib.json",
|
||||||
|
"project": "projects/logger/ng-package.json"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"tsConfig": "projects/logger/tsconfig.lib.prod.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "projects/logger/src/test.ts",
|
||||||
|
"tsConfig": "projects/logger/tsconfig.spec.json",
|
||||||
|
"karmaConfig": "projects/logger/karma.conf.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"projects/logger/tsconfig.lib.json",
|
||||||
|
"projects/logger/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"exclude": ["**/node_modules/**"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"root": "projects/core",
|
"root": "projects/core",
|
||||||
|
|
967
package-lock.json
generated
967
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
79
package.json
79
package.json
|
@ -6,8 +6,7 @@
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"clean:all": "rimraf dist/*",
|
"build:all": "npm-run-all -s build:logger build:core build:util:all build:api:all build:protocol:all build:native:all build:store:all build:ui:all build:ui-skin:all",
|
||||||
"build:all": "npm-run-all -s clean:all build:core build:util:all build:api:all build:protocol:all build:native:all build:store:all build:ui:all build:ui-skin:all",
|
|
||||||
"build:api:all": "npm-run-all -s build:api-common build:api-external build:api-message build:api-prompt build:api-public build:pi",
|
"build:api:all": "npm-run-all -s build:api-common build:api-external build:api-message build:api-prompt build:api-public build:pi",
|
||||||
"build:api-common": "node ./scripts/build.js api-common",
|
"build:api-common": "node ./scripts/build.js api-common",
|
||||||
"build:api-external": "node ./scripts/build.js api-external",
|
"build:api-external": "node ./scripts/build.js api-external",
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
"build:api-public": "node ./scripts/build.js api-public",
|
"build:api-public": "node ./scripts/build.js api-public",
|
||||||
"build:pi": "node ./scripts/build.js pi",
|
"build:pi": "node ./scripts/build.js pi",
|
||||||
"build:core": "node ./scripts/build.js core",
|
"build:core": "node ./scripts/build.js core",
|
||||||
|
"build:logger": "node ./scripts/build.js logger",
|
||||||
"build:native:all": "npm-run-all -s build:native build:native-browser",
|
"build:native:all": "npm-run-all -s build:native build:native-browser",
|
||||||
"build:native": "node ./scripts/build.js native",
|
"build:native": "node ./scripts/build.js native",
|
||||||
"build:native-browser": "node ./scripts/build.js native-browser",
|
"build:native-browser": "node ./scripts/build.js native-browser",
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
"build:ui-authentication": "node ./scripts/build.js ui-authentication",
|
"build:ui-authentication": "node ./scripts/build.js ui-authentication",
|
||||||
"build:ui-skin:all": "npm-run-all -s build:ui-skin-default",
|
"build:ui-skin:all": "npm-run-all -s build:ui-skin-default",
|
||||||
"build:ui-skin-default": "node ./scripts/build.js ui-skin-default useScssBundle",
|
"build:ui-skin-default": "node ./scripts/build.js ui-skin-default useScssBundle",
|
||||||
"publish:all": "npm-run-all -s publish:core publish:util:all publish:api:all publish:protocol:all publish:native:all publish:store:all publish:ui:all publish:ui-skin:all",
|
"publish:all": "npm-run-all -s publish:logger publish:core publish:util:all publish:api:all publish:protocol:all publish:native:all publish:store:all publish:ui:all publish:ui-skin:all",
|
||||||
"publish:api:all": "npm-run-all -s publish:api-common publish:api-external publish:api-message publish:api-prompt publish:api-public publish:pi",
|
"publish:api:all": "npm-run-all -s publish:api-common publish:api-external publish:api-message publish:api-prompt publish:api-public publish:pi",
|
||||||
"publish:api-common": "cd ./dist/api-common && npm publish",
|
"publish:api-common": "cd ./dist/api-common && npm publish",
|
||||||
"publish:api-external": "cd ./dist/api-external && npm publish",
|
"publish:api-external": "cd ./dist/api-external && npm publish",
|
||||||
|
@ -59,6 +59,7 @@
|
||||||
"publish:api-public": "cd ./dist/api-public && npm publish",
|
"publish:api-public": "cd ./dist/api-public && npm publish",
|
||||||
"publish:pi": "cd ./dist/pi && npm publish",
|
"publish:pi": "cd ./dist/pi && npm publish",
|
||||||
"publish:core": "cd ./dist/core && npm publish",
|
"publish:core": "cd ./dist/core && npm publish",
|
||||||
|
"publish:logger": "cd ./dist/logger && npm publish",
|
||||||
"publish:native:all": "npm-run-all -s publish:native publish:native-browser",
|
"publish:native:all": "npm-run-all -s publish:native publish:native-browser",
|
||||||
"publish:native": "cd ./dist/native && npm publish",
|
"publish:native": "cd ./dist/native && npm publish",
|
||||||
"publish:native-browser": "cd ./dist/native-browser && npm publish",
|
"publish:native-browser": "cd ./dist/native-browser && npm publish",
|
||||||
|
@ -134,43 +135,45 @@
|
||||||
"@ucap/api-prompt": "~0.0.1",
|
"@ucap/api-prompt": "~0.0.1",
|
||||||
"@ucap/api-public": "~0.0.1",
|
"@ucap/api-public": "~0.0.1",
|
||||||
"@ucap/core": "~0.0.1",
|
"@ucap/core": "~0.0.1",
|
||||||
|
"@ucap/logger": "~0.0.2",
|
||||||
"@ucap/native": "~0.0.1",
|
"@ucap/native": "~0.0.1",
|
||||||
"@ucap/native-browser": "~0.0.1",
|
"@ucap/native-browser": "~0.0.1",
|
||||||
"@ucap/ng-api-common": "file:dist/api-common/ucap-ng-api-common-0.0.1.tgz",
|
"@ucap/ng-api-common": "file:pack/ucap-ng-api-common-0.0.1.tgz",
|
||||||
"@ucap/ng-api-external": "file:dist/api-external/ucap-ng-api-external-0.0.1.tgz",
|
"@ucap/ng-api-external": "file:pack/ucap-ng-api-external-0.0.1.tgz",
|
||||||
"@ucap/ng-api-message": "file:dist/api-message/ucap-ng-api-message-0.0.1.tgz",
|
"@ucap/ng-api-message": "file:pack/ucap-ng-api-message-0.0.1.tgz",
|
||||||
"@ucap/ng-api-prompt": "file:dist/api-prompt/ucap-ng-api-prompt-0.0.1.tgz",
|
"@ucap/ng-api-prompt": "file:pack/ucap-ng-api-prompt-0.0.1.tgz",
|
||||||
"@ucap/ng-api-public": "file:dist/api-public/ucap-ng-api-public-0.0.1.tgz",
|
"@ucap/ng-api-public": "file:pack/ucap-ng-api-public-0.0.1.tgz",
|
||||||
"@ucap/ng-core": "file:dist/core/ucap-ng-core-0.0.1.tgz",
|
"@ucap/ng-core": "file:pack/ucap-ng-core-0.0.1.tgz",
|
||||||
"@ucap/ng-i18n": "file:dist/i18n/ucap-ng-i18n-0.0.1.tgz",
|
"@ucap/ng-i18n": "file:pack/ucap-ng-i18n-0.0.4.tgz",
|
||||||
"@ucap/ng-native": "file:dist/native/ucap-ng-native-0.0.1.tgz",
|
"@ucap/ng-logger": "file:pack/ucap-ng-logger-0.0.1.tgz",
|
||||||
"@ucap/ng-native-browser": "file:dist/native-browser/ucap-ng-native-browser-0.0.1.tgz",
|
"@ucap/ng-native": "file:pack/ucap-ng-native-0.0.1.tgz",
|
||||||
"@ucap/ng-pi": "file:dist/pi/ucap-ng-pi-0.0.1.tgz",
|
"@ucap/ng-native-browser": "file:pack/ucap-ng-native-browser-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol": "file:dist/protocol/ucap-ng-protocol-0.0.1.tgz",
|
"@ucap/ng-pi": "file:pack/ucap-ng-pi-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-authentication": "file:dist/protocol-authentication/ucap-ng-protocol-authentication-0.0.1.tgz",
|
"@ucap/ng-protocol": "file:pack/ucap-ng-protocol-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-buddy": "file:dist/protocol-buddy/ucap-ng-protocol-buddy-0.0.1.tgz",
|
"@ucap/ng-protocol-authentication": "file:pack/ucap-ng-protocol-authentication-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-event": "file:dist/protocol-event/ucap-ng-protocol-event-0.0.1.tgz",
|
"@ucap/ng-protocol-buddy": "file:pack/ucap-ng-protocol-buddy-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-file": "file:dist/protocol-file/ucap-ng-protocol-file-0.0.1.tgz",
|
"@ucap/ng-protocol-event": "file:pack/ucap-ng-protocol-event-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-group": "file:dist/protocol-group/ucap-ng-protocol-group-0.0.1.tgz",
|
"@ucap/ng-protocol-file": "file:pack/ucap-ng-protocol-file-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-info": "file:dist/protocol-info/ucap-ng-protocol-info-0.0.1.tgz",
|
"@ucap/ng-protocol-group": "file:pack/ucap-ng-protocol-group-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-inner": "file:dist/protocol-inner/ucap-ng-protocol-inner-0.0.1.tgz",
|
"@ucap/ng-protocol-info": "file:pack/ucap-ng-protocol-info-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-option": "file:dist/protocol-option/ucap-ng-protocol-option-0.0.1.tgz",
|
"@ucap/ng-protocol-inner": "file:pack/ucap-ng-protocol-inner-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-ping": "file:dist/protocol-ping/ucap-ng-protocol-ping-0.0.1.tgz",
|
"@ucap/ng-protocol-option": "file:pack/ucap-ng-protocol-option-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-query": "file:dist/protocol-query/ucap-ng-protocol-query-0.0.1.tgz",
|
"@ucap/ng-protocol-ping": "file:pack/ucap-ng-protocol-ping-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-room": "file:dist/protocol-room/ucap-ng-protocol-room-0.0.1.tgz",
|
"@ucap/ng-protocol-query": "file:pack/ucap-ng-protocol-query-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-service": "file:dist/protocol-service/ucap-ng-protocol-service-0.0.1.tgz",
|
"@ucap/ng-protocol-room": "file:pack/ucap-ng-protocol-room-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-status": "file:dist/protocol-status/ucap-ng-protocol-status-0.0.1.tgz",
|
"@ucap/ng-protocol-service": "file:pack/ucap-ng-protocol-service-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-sync": "file:dist/protocol-sync/ucap-ng-protocol-sync-0.0.1.tgz",
|
"@ucap/ng-protocol-status": "file:pack/ucap-ng-protocol-status-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-umg": "file:dist/protocol-umg/ucap-ng-protocol-umg-0.0.1.tgz",
|
"@ucap/ng-protocol-sync": "file:pack/ucap-ng-protocol-sync-0.0.1.tgz",
|
||||||
"@ucap/ng-store-authentication": "file:dist/store-authentication/ucap-ng-store-authentication-0.0.2.tgz",
|
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.1.tgz",
|
||||||
"@ucap/ng-store-chat": "file:dist/store-chat/ucap-ng-store-chat-0.0.3.tgz",
|
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.2.tgz",
|
||||||
"@ucap/ng-store-group": "file:dist/store-group/ucap-ng-store-group-0.0.3.tgz",
|
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
|
||||||
"@ucap/ng-store-organization": "file:dist/store-organization/ucap-ng-store-organization-0.0.3.tgz",
|
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.3.tgz",
|
||||||
"@ucap/ng-ui": "file:dist/ui/ucap-ng-ui-0.0.3.tgz",
|
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.3.tgz",
|
||||||
"@ucap/ng-ui-authentication": "file:dist/ui-authentication/ucap-ng-ui-authentication-0.0.1.tgz",
|
"@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.3.tgz",
|
||||||
"@ucap/ng-ui-organization": "file:dist/ui-organization/ucap-ng-ui-organization-0.0.1.tgz",
|
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.5.tgz",
|
||||||
"@ucap/ng-ui-skin-default": "file:dist/ui-skin-default/ucap-ng-ui-skin-default-0.0.1.tgz",
|
"@ucap/ng-ui-organization": "file:pack/ucap-ng-ui-organization-0.0.1.tgz",
|
||||||
"@ucap/ng-web-storage": "file:dist/web-storage/ucap-ng-web-storage-0.0.1.tgz",
|
"@ucap/ng-ui-skin-default": "file:pack/ucap-ng-ui-skin-default-0.0.1.tgz",
|
||||||
|
"@ucap/ng-web-storage": "file:pack/ucap-ng-web-storage-0.0.1.tgz",
|
||||||
"@ucap/pi": "~0.0.1",
|
"@ucap/pi": "~0.0.1",
|
||||||
"@ucap/protocol": "~0.0.1",
|
"@ucap/protocol": "~0.0.1",
|
||||||
"@ucap/protocol-authentication": "~0.0.1",
|
"@ucap/protocol-authentication": "~0.0.1",
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"entryFile": "src/public-api.ts",
|
"entryFile": "src/public-api.ts",
|
||||||
"umdModuleIds": {
|
"umdModuleIds": {
|
||||||
"i18next": "i18next",
|
"i18next": "i18next",
|
||||||
"@ucap/core": "@ucap/core"
|
"@ucap/core": "@ucap/core",
|
||||||
|
"@ucap/ng-logger": "@ucap/ng-logger"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ucap/ng-i18n",
|
"name": "@ucap/ng-i18n",
|
||||||
"version": "0.0.1",
|
"version": "0.0.4",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
import { InjectionToken } from '@angular/core';
|
import { InjectionToken } from '@angular/core';
|
||||||
|
|
||||||
export const _MODULE_CONFIG = new InjectionToken('@ucap/i18n config of module');
|
export const _MODULE_CONFIG = new InjectionToken(
|
||||||
|
'@ucap/ng-i18n config of module'
|
||||||
|
);
|
||||||
|
|
|
@ -12,6 +12,8 @@ import i18next, {
|
||||||
StringMap
|
StringMap
|
||||||
} from 'i18next';
|
} from 'i18next';
|
||||||
|
|
||||||
|
import { LogService } from '@ucap/ng-logger';
|
||||||
|
|
||||||
import { I18nextEvents } from '../types/i18next.event';
|
import { I18nextEvents } from '../types/i18next.event';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -61,7 +63,7 @@ export class I18nService implements OnDestroy {
|
||||||
// tslint:disable-next-line: variable-name
|
// tslint:disable-next-line: variable-name
|
||||||
private _currentLng: string;
|
private _currentLng: string;
|
||||||
|
|
||||||
constructor() {
|
constructor(private logService: LogService) {
|
||||||
this.initialized$ = this.initializedSubject.asObservable().pipe(share());
|
this.initialized$ = this.initializedSubject.asObservable().pipe(share());
|
||||||
this.loaded$ = this.loadedSubject.asObservable().pipe(share());
|
this.loaded$ = this.loadedSubject.asObservable().pipe(share());
|
||||||
this.failedLoading$ = this.failedLoadingSubject
|
this.failedLoading$ = this.failedLoadingSubject
|
||||||
|
@ -110,12 +112,13 @@ export class I18nService implements OnDestroy {
|
||||||
|
|
||||||
this.subscribeEvents();
|
this.subscribeEvents();
|
||||||
|
|
||||||
return i18next.init();
|
return i18next.init(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLanguage(lng: string) {
|
changeLanguage(lng: string) {
|
||||||
|
const self = this;
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
if (lng === this.currentLng) {
|
if (lng === self.currentLng) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +126,7 @@ export class I18nService implements OnDestroy {
|
||||||
i18next
|
i18next
|
||||||
.changeLanguage(lng)
|
.changeLanguage(lng)
|
||||||
.then(v => {
|
.then(v => {
|
||||||
|
self.logService.info('changeLanguage', lng);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(reason => {
|
.catch(reason => {
|
||||||
|
|
24
projects/logger/README.md
Normal file
24
projects/logger/README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Logger
|
||||||
|
|
||||||
|
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.0.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Run `ng generate component component-name --project logger` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project logger`.
|
||||||
|
> Note: Don't forget to add `--project logger` or else it will be added to the default project in your `angular.json` file.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run `ng build logger` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||||
|
|
||||||
|
## Publishing
|
||||||
|
|
||||||
|
After building your library with `ng build logger`, go to the dist folder `cd dist/logger` and run `npm publish`.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `ng test logger` 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 README](https://github.com/angular/angular-cli/blob/master/README.md).
|
32
projects/logger/karma.conf.js
Normal file
32
projects/logger/karma.conf.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// 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-istanbul-reporter'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
coverageIstanbulReporter: {
|
||||||
|
dir: require('path').join(__dirname, '../../coverage/logger'),
|
||||||
|
reports: ['html', 'lcovonly', 'text-summary'],
|
||||||
|
fixWebpackSourcePaths: true
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
10
projects/logger/ng-package.json
Normal file
10
projects/logger/ng-package.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||||
|
"dest": "../../dist/logger",
|
||||||
|
"lib": {
|
||||||
|
"entryFile": "src/public-api.ts",
|
||||||
|
"umdModuleIds": {
|
||||||
|
"@ucap/logger": "@ucap/logger"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
projects/logger/package.json
Normal file
13
projects/logger/package.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "@ucap/ng-logger",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/common": "^9.1.0",
|
||||||
|
"@angular/core": "^9.1.0",
|
||||||
|
"@ucap/logger": "~0.0.1",
|
||||||
|
"tslib": "^1.10.0"
|
||||||
|
}
|
||||||
|
}
|
8
projects/logger/src/lib/config/module-config.ts
Normal file
8
projects/logger/src/lib/config/module-config.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { ModuleConfig as CoreModuleConfig } from '@ucap/core';
|
||||||
|
|
||||||
|
import { LoggerOptions, DestinationStream } from '@ucap/logger';
|
||||||
|
|
||||||
|
// tslint:disable-next-line: no-empty-interface
|
||||||
|
export interface ModuleConfig extends CoreModuleConfig {
|
||||||
|
optionsOrStream?: LoggerOptions | DestinationStream;
|
||||||
|
}
|
5
projects/logger/src/lib/config/token.ts
Normal file
5
projects/logger/src/lib/config/token.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { InjectionToken } from '@angular/core';
|
||||||
|
|
||||||
|
export const _MODULE_CONFIG = new InjectionToken(
|
||||||
|
'@ucap/ng-logger config of module'
|
||||||
|
);
|
30
projects/logger/src/lib/logger.module.ts
Normal file
30
projects/logger/src/lib/logger.module.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { ModuleConfig } from './config/module-config';
|
||||||
|
import { _MODULE_CONFIG } from './config/token';
|
||||||
|
|
||||||
|
import { LogService } from './services/log.service';
|
||||||
|
|
||||||
|
const SERVICES = [LogService];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [],
|
||||||
|
imports: [],
|
||||||
|
exports: []
|
||||||
|
})
|
||||||
|
export class LoggerRootModule {}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [CommonModule]
|
||||||
|
})
|
||||||
|
export class LoggerModule {
|
||||||
|
public static forRoot(
|
||||||
|
config: ModuleConfig
|
||||||
|
): ModuleWithProviders<LoggerRootModule> {
|
||||||
|
return {
|
||||||
|
ngModule: LoggerRootModule,
|
||||||
|
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
16
projects/logger/src/lib/services/log.service.spec.ts
Normal file
16
projects/logger/src/lib/services/log.service.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
|
describe('LogService', () => {
|
||||||
|
let service: LogService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(LogService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
15
projects/logger/src/lib/services/log.service.ts
Normal file
15
projects/logger/src/lib/services/log.service.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { Injectable, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { LogService as UCAPLogService } from '@ucap/logger';
|
||||||
|
|
||||||
|
import { _MODULE_CONFIG } from '../config/token';
|
||||||
|
import { ModuleConfig } from '../config/module-config';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class LogService extends UCAPLogService {
|
||||||
|
constructor(@Inject(_MODULE_CONFIG) moduleConfig: ModuleConfig) {
|
||||||
|
super(moduleConfig.optionsOrStream);
|
||||||
|
}
|
||||||
|
}
|
7
projects/logger/src/public-api.ts
Normal file
7
projects/logger/src/public-api.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* Public API Surface of logger
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './lib/services/log.service';
|
||||||
|
|
||||||
|
export * from './lib/logger.module';
|
26
projects/logger/src/test.ts
Normal file
26
projects/logger/src/test.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
|
import 'zone.js/dist/zone';
|
||||||
|
import 'zone.js/dist/zone-testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting
|
||||||
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
|
declare const require: {
|
||||||
|
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||||
|
keys(): string[];
|
||||||
|
<T>(id: string): T;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// First, initialize the Angular testing environment.
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting()
|
||||||
|
);
|
||||||
|
// Then we find all the tests.
|
||||||
|
const context = require.context('./', true, /\.spec\.ts$/);
|
||||||
|
// And load the modules.
|
||||||
|
context.keys().map(context);
|
23
projects/logger/tsconfig.lib.json
Normal file
23
projects/logger/tsconfig.lib.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../out-tsc/lib",
|
||||||
|
"target": "es2015",
|
||||||
|
"declaration": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"types": [],
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es2018"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"skipTemplateCodegen": true,
|
||||||
|
"strictMetadataEmit": true,
|
||||||
|
"enableResourceInlining": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/test.ts",
|
||||||
|
"**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
6
projects/logger/tsconfig.lib.prod.json
Normal file
6
projects/logger/tsconfig.lib.prod.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.lib.json",
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableIvy": false
|
||||||
|
}
|
||||||
|
}
|
17
projects/logger/tsconfig.spec.json
Normal file
17
projects/logger/tsconfig.spec.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/test.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
17
projects/logger/tslint.json
Normal file
17
projects/logger/tslint.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tslint.json",
|
||||||
|
"rules": {
|
||||||
|
"directive-selector": [
|
||||||
|
true,
|
||||||
|
"attribute",
|
||||||
|
"lib",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"component-selector": [
|
||||||
|
true,
|
||||||
|
"element",
|
||||||
|
"lib",
|
||||||
|
"kebab-case"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ucap/ng-ui-authentication",
|
"name": "@ucap/ng-ui-authentication",
|
||||||
"version": "0.0.1",
|
"version": "0.0.5",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
<div class="login-form">
|
<div class="ucap-login-container">
|
||||||
<div
|
<ng-content select="[ucapAuthenticationLogin='header']"></ng-content>
|
||||||
class="mat-title"
|
|
||||||
style="background-image: url(./assets/images/logo/bg_login_w160.png);"
|
|
||||||
>
|
|
||||||
{{ 'accounts.instructionsOfLogin' | ucapI18n }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form name="loginForm" [formGroup]="loginForm" novalidate>
|
<form name="loginForm" [formGroup]="loginForm" novalidate>
|
||||||
<mat-form-field
|
<mat-form-field
|
||||||
[style.display]="!!curCompanyCode ? 'none' : 'block'"
|
[style.display]="!!curCompanyCode ? 'none' : 'block'"
|
||||||
class="login-company"
|
class="login-company"
|
||||||
>
|
>
|
||||||
<mat-label>{{ 'accounts.fieldCompany' | ucapI18n }}</mat-label>
|
<mat-label>{{ 'login.fields.company' | ucapI18n }}</mat-label>
|
||||||
<mat-select [formControl]="companyCodeFormControl">
|
<mat-select [formControl]="companyCodeFormControl">
|
||||||
<mat-option
|
<mat-option
|
||||||
*ngFor="let company of companyList"
|
*ngFor="let company of companyList"
|
||||||
|
@ -37,7 +32,7 @@
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<mat-form-field class="login-id">
|
<mat-form-field class="login-id">
|
||||||
<mat-label>{{ 'accounts.fieldLoginId' | ucapI18n }}</mat-label>
|
<mat-label>{{ 'login.fields.loginId' | ucapI18n }}</mat-label>
|
||||||
<input matInput [formControl]="loginIdFormControl" />
|
<input matInput [formControl]="loginIdFormControl" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,7 +67,7 @@
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<mat-form-field class="login-pw">
|
<mat-form-field class="login-pw">
|
||||||
<mat-label>{{ 'accounts.fieldLoginPw' | ucapI18n }}</mat-label>
|
<mat-label>{{ 'login.fields.loginPw' | ucapI18n }}</mat-label>
|
||||||
<input
|
<input
|
||||||
matInput
|
matInput
|
||||||
type="password"
|
type="password"
|
||||||
|
@ -89,21 +84,21 @@
|
||||||
companyCodeFormControl.hasError('required')
|
companyCodeFormControl.hasError('required')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ 'accounts.errors.requireCompany' | ucapI18n }}
|
{{ 'login.errors.requireCompany' | ucapI18n }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
<mat-error
|
<mat-error
|
||||||
*ngIf="
|
*ngIf="
|
||||||
loginIdFormControl.dirty && loginIdFormControl.hasError('required')
|
loginIdFormControl.dirty && loginIdFormControl.hasError('required')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ 'accounts.errors.requireLoginId' | ucapI18n }}
|
{{ 'login.errors.requireLoginId' | ucapI18n }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
<mat-error
|
<mat-error
|
||||||
*ngIf="
|
*ngIf="
|
||||||
loginPwFormControl.dirty && loginPwFormControl.hasError('required')
|
loginPwFormControl.dirty && loginPwFormControl.hasError('required')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ 'accounts.errors.requireLoginPw' | ucapI18n }}
|
{{ 'login.errors.requireLoginPw' | ucapI18n }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -129,7 +124,7 @@
|
||||||
formControlName="rememberMe"
|
formControlName="rememberMe"
|
||||||
aria-label="Remember Me"
|
aria-label="Remember Me"
|
||||||
>
|
>
|
||||||
{{ 'accounts.rememberMe' | ucapI18n }}
|
{{ 'login.labels.rememberMe' | ucapI18n }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
|
@ -138,21 +133,10 @@
|
||||||
formControlName="autoLogin"
|
formControlName="autoLogin"
|
||||||
aria-label="Auto Login"
|
aria-label="Auto Login"
|
||||||
>
|
>
|
||||||
{{ 'accounts.autoLogin' | ucapI18n }}
|
{{ 'login.labels.autoLogin' | ucapI18n }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="register" fxLayout="column" fxLayoutAlign="center center">
|
<ng-content select="[ucapAuthenticationLogin='footer']"></ng-content>
|
||||||
<div *ngIf="false">
|
|
||||||
<span class="text">Don't have an account?</span>
|
|
||||||
<a class="link">Forgot Password?</a>
|
|
||||||
<a class="link">Create an account</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="policy" (click)="onClickNoti()">
|
|
||||||
<div class="icon-img"><i class="mid mdi-alarm-light"></i></div>
|
|
||||||
<a class="link">{{ !!notiText ? notiText : '개인정보 처리방침' }}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,7 +24,7 @@ $login-max-height: 800px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form {
|
.ucap-login-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -198,7 +198,7 @@ $login-max-height: 800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include tab {
|
@include tab {
|
||||||
.login-form {
|
.ucap-login-container {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
.mat-title {
|
.mat-title {
|
||||||
background-size: 90% auto;
|
background-size: 90% auto;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"entryFile": "src/public-api.ts",
|
"entryFile": "src/public-api.ts",
|
||||||
"umdModuleIds": {
|
"umdModuleIds": {
|
||||||
"@ucap/ui": "@ucap/ui"
|
"@ucap/ng-ui": "@ucap/ng-ui"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const path = require('path');
|
||||||
const fse = require('fs-extra');
|
const fse = require('fs-extra');
|
||||||
const { Bundler } = require('scss-bundle');
|
const { Bundler } = require('scss-bundle');
|
||||||
|
|
||||||
async function build() {
|
async function buildForProduction() {
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
const projectName = args[0];
|
const projectName = args[0];
|
||||||
const useScssBundle =
|
const useScssBundle =
|
||||||
|
@ -12,13 +12,17 @@ async function build() {
|
||||||
const rootPath = path.join(__dirname, '..');
|
const rootPath = path.join(__dirname, '..');
|
||||||
const projectPath = path.join(rootPath, 'projects', projectName);
|
const projectPath = path.join(rootPath, 'projects', projectName);
|
||||||
const distPath = path.join(rootPath, 'dist', projectName);
|
const distPath = path.join(rootPath, 'dist', projectName);
|
||||||
|
const packPath = path.join(rootPath, 'pack');
|
||||||
|
|
||||||
let projectVersion;
|
let packFileName;
|
||||||
|
|
||||||
const ngBuild = () => {
|
const ngBuild = () => {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
execSync(`ng build ${projectName} --prod`, { stdio: 'inherit' });
|
execSync(`ng build ${projectName} --prod`, { stdio: 'inherit' });
|
||||||
|
const projectVersion = require(path.join(distPath, 'package.json'))
|
||||||
|
.version;
|
||||||
|
packFileName = `ucap-ng-${projectName}-${projectVersion}.tgz`;
|
||||||
resolve();
|
resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
@ -58,55 +62,26 @@ async function build() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const npmPack = () => {
|
const installToLocal = () => {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
process.chdir(distPath);
|
process.chdir(distPath);
|
||||||
|
|
||||||
execSync(`npm pack`, { stdio: 'inherit' });
|
execSync(`npm pack`, { stdio: 'inherit' });
|
||||||
|
|
||||||
projectVersion = require(path.join(distPath, 'package.json')).version;
|
fse.moveSync(
|
||||||
|
path.join(distPath, packFileName),
|
||||||
|
path.join(packPath, packFileName),
|
||||||
|
{
|
||||||
|
overwrite: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
process.chdir(path.join(rootPath));
|
process.chdir(path.join(rootPath));
|
||||||
|
|
||||||
resolve();
|
execSync(`npm install -D ${path.join(packPath, packFileName)}`, {
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const installToLocal = () => {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
try {
|
|
||||||
execSync(
|
|
||||||
`npm install -D ${path.join(
|
|
||||||
distPath,
|
|
||||||
`ucap-ng-${projectName}-${projectVersion}.tgz`
|
|
||||||
)}`,
|
|
||||||
{
|
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
}
|
|
||||||
);
|
|
||||||
resolve();
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
const clean = () => {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
try {
|
|
||||||
execSync(
|
|
||||||
`rimraf ${path.join(
|
|
||||||
distPath,
|
|
||||||
`ucap-ng-${projectName}-${projectVersion}.tgz`
|
|
||||||
)}`,
|
|
||||||
{
|
|
||||||
stdio: 'inherit'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -117,9 +92,7 @@ async function build() {
|
||||||
|
|
||||||
await ngBuild();
|
await ngBuild();
|
||||||
await scssBundle();
|
await scssBundle();
|
||||||
await npmPack();
|
|
||||||
await installToLocal();
|
await installToLocal();
|
||||||
await clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build();
|
buildForProduction();
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
"ui-skin-default": [
|
"ui-skin-default": [
|
||||||
"dist/ui-skin-default/ui-skin-default",
|
"dist/ui-skin-default/ui-skin-default",
|
||||||
"dist/ui-skin-default"
|
"dist/ui-skin-default"
|
||||||
|
],
|
||||||
|
"logger": [
|
||||||
|
"dist/logger/logger",
|
||||||
|
"dist/logger"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user