[DEV] start to work
This commit is contained in:
parent
475035388f
commit
948816b0f7
@ -2,6 +2,6 @@
|
||||
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "./dist/kar-cw",
|
||||
"lib": {
|
||||
"entryFile": "src/**/index.ts"
|
||||
"entryFile": "src/index.ts"
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ import { PopInComponent } from './popin/popin';
|
||||
import { RenderFormComponent } from './render-settings/render-form';
|
||||
import { RenderSettingsComponent } from './render-settings/render-settings';
|
||||
import { SpinnerComponent } from './spinner/spinner';
|
||||
import { TopMenuComponent } from './top-menu/top-menu';
|
||||
import { EventOnMenu, TopMenuComponent } from './top-menu/top-menu';
|
||||
import { UploadFileComponent } from './upload-file/upload-file';
|
||||
|
||||
export { BurgerPropertyComponent, EntryNumberComponent, CheckboxComponent, RenderFormComponent, RenderSettingsComponent, ErrorMessageStateComponent, AsyncActionState, AsyncActionStatusComponent, EntryValidatorComponent, PopInComponent, TopMenuComponent, UploadFileComponent, ErrorComponent, SpinnerComponent, PasswordEntryComponent, EntryComponent };
|
||||
export { EventOnMenu, BurgerPropertyComponent, EntryNumberComponent, CheckboxComponent, RenderFormComponent, RenderSettingsComponent, ErrorMessageStateComponent, AsyncActionState, AsyncActionStatusComponent, EntryValidatorComponent, PopInComponent, TopMenuComponent, UploadFileComponent, ErrorComponent, SpinnerComponent, PasswordEntryComponent, EntryComponent };
|
||||
|
2
src/component/public_api.ts
Normal file
2
src/component/public_api.ts
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
export * from '.'
|
@ -1,4 +1,3 @@
|
||||
import { KarCWModule } from './kar-cw.module';
|
||||
|
||||
export * from './kar-cw.service';
|
||||
export * from './kar-cw.module';
|
||||
@ -11,5 +10,3 @@ export * from './scene';
|
||||
export * from './popin';
|
||||
export * from './model';
|
||||
export * from './component';
|
||||
|
||||
export default KarCWModule;
|
@ -1,4 +1,3 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { PopInComponent, TopMenuComponent, UploadFileComponent, ErrorComponent, PasswordEntryComponent, EntryComponent, EntryValidatorComponent, SpinnerComponent, AsyncActionStatusComponent, ErrorMessageStateComponent, CheckboxComponent, BurgerPropertyComponent, RenderSettingsComponent, RenderFormComponent, EntryNumberComponent } from './component';
|
||||
import { PopInUploadProgress, PopInDeleteConfirm } from './popin';
|
||||
|
||||
|
@ -11,9 +11,6 @@ import { ALL_COMPONENTS } from "./kar-cw.component";
|
||||
import { ALL_SCENES } from "./kar-cw.scene";
|
||||
import { ALL_SERVICES } from "./kar-cw.service";
|
||||
import { ALL_GUARDS } from "./kar-cw.guard";
|
||||
import { DataStore, DataTools } from "./utils";
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -21,13 +18,13 @@ import { DataStore, DataTools } from "./utils";
|
||||
...ALL_SCENES,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
CommonModule,
|
||||
],
|
||||
providers: [
|
||||
...ALL_SERVICES,
|
||||
...ALL_GUARDS,
|
||||
//...ALL_SERVICES,
|
||||
//...ALL_GUARDS,
|
||||
],
|
||||
exports: [
|
||||
...ALL_COMPONENTS,
|
||||
@ -35,6 +32,6 @@ import { DataStore, DataTools } from "./utils";
|
||||
//...ALL_SERVICES,
|
||||
//...ALL_GUARDS,
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
||||
//schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
||||
})
|
||||
export class KarCWModule { }
|
||||
|
@ -14,7 +14,7 @@ export const ALL_SERVICES = [
|
||||
StorageService,
|
||||
PopInService,
|
||||
SessionService,
|
||||
UserService,
|
||||
SSOService,
|
||||
UserService,
|
||||
NotificationService,
|
||||
];
|
@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
|
||||
export interface Environment {
|
||||
@ -13,4 +14,18 @@ export interface Environment {
|
||||
ssoSignUp: string,
|
||||
ssoSignOut: string,
|
||||
tokenStoredInPermanentStorage: boolean,
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class EnvironmentService {
|
||||
public production: boolean;
|
||||
// URL of development API
|
||||
public applName: string;
|
||||
public defaultServer: string;
|
||||
public server: any;
|
||||
public ssoSite: string;
|
||||
public ssoSignIn: string;
|
||||
public ssoSignUp: string;
|
||||
public ssoSignOut: string;
|
||||
public tokenStoredInPermanentStorage: boolean;
|
||||
};
|
@ -1,3 +1,4 @@
|
||||
import { Environment, EnvironmentService } from './environment';
|
||||
import { isMenuItem, isMenuPosition, MenuItem, MenuPosition } from './menu-item';
|
||||
|
||||
export { MenuPosition, isMenuPosition, MenuItem, isMenuItem };
|
||||
export { MenuPosition, isMenuPosition, MenuItem, isMenuItem, Environment, EnvironmentService };
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PopInDeleteConfirm } from './delete-confirm/delete-confirm';
|
||||
import { PopInUploadProgress } from './upload-progress/upload-progress';
|
||||
import { PopInUploadProgress, UploadProgress } from './upload-progress/upload-progress';
|
||||
|
||||
export { PopInDeleteConfirm, PopInUploadProgress };
|
||||
export { PopInDeleteConfirm, PopInUploadProgress, UploadProgress };
|
||||
|
@ -1,5 +0,0 @@
|
||||
/*
|
||||
* Public API Surface of kar-cw
|
||||
*/
|
||||
|
||||
export * from '.';
|
@ -6,9 +6,11 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CookiesService {
|
||||
constructor() {}
|
||||
constructor() { }
|
||||
|
||||
set(cname: string, cvalue: string, exdays: number): void {
|
||||
if (this.get(cname) !== '') {
|
||||
|
@ -10,7 +10,7 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
||||
|
||||
import { SessionService } from './session';
|
||||
import { isArrayOfs, isBoolean, isNullOrUndefined, isNumber, isString } from '../utils';
|
||||
import { Environment } from '../model/environment';
|
||||
import { EnvironmentService } from '../model/environment';
|
||||
|
||||
export enum HTTPRequestModel {
|
||||
POST = 'POST',
|
||||
@ -53,12 +53,14 @@ export interface ModelResponseHttp {
|
||||
/**
|
||||
* This service permit to add some data like token and authorization.. ir automatically get the token if needed and retake it if expired...
|
||||
*/
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class HttpWrapperService {
|
||||
private displayReturn: boolean = false;
|
||||
constructor(
|
||||
// https://stackoverflow.com/questions/56883120/angular-service-provide-with-a-default-value
|
||||
@Inject('ENVIRONMENT') private environment: Environment,
|
||||
@Inject('ENVIRONMENT') private environment: EnvironmentService,
|
||||
private http: HttpClient,
|
||||
private session: SessionService) { }
|
||||
|
||||
|
@ -8,11 +8,13 @@ import {
|
||||
OnlyUsersGuard,
|
||||
OnlyUsersGuardHome,
|
||||
SessionService,
|
||||
UserRoles222,
|
||||
} from './session';
|
||||
import { SSOService } from './sso';
|
||||
import { UserService } from './user';
|
||||
|
||||
export {
|
||||
UserRoles222,
|
||||
CookiesService,
|
||||
StorageService,
|
||||
PopInService,
|
||||
|
@ -5,14 +5,16 @@
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { Environment } from '../model/environment';
|
||||
import { EnvironmentService } from '../model/environment';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class StorageService {
|
||||
private baseLocalStorageName: string;
|
||||
|
||||
constructor(
|
||||
@Inject('ENVIRONMENT') environment: Environment,
|
||||
@Inject('ENVIRONMENT') environment: EnvironmentService,
|
||||
) {
|
||||
this.baseLocalStorageName = environment.applName + '_';
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NotificationService {
|
||||
|
||||
constructor() {
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PopInService {
|
||||
private popinList: any[] = [];
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import { Injectable, Output, EventEmitter, Inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Environment } from '../model/environment';
|
||||
import { EnvironmentService } from '../model/environment';
|
||||
import { isNullOrUndefined } from '../utils';
|
||||
|
||||
export enum UserRoles222 {
|
||||
@ -15,7 +15,9 @@ export enum UserRoles222 {
|
||||
guest = 'guest',
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SessionService {
|
||||
private tokenJwt?: string;
|
||||
public userLogin?: string;
|
||||
@ -24,8 +26,9 @@ export class SessionService {
|
||||
|
||||
@Output() change: EventEmitter<boolean> = new EventEmitter();
|
||||
|
||||
private environment;//: EnvironmentService
|
||||
constructor(
|
||||
@Inject('ENVIRONMENT') private environment: Environment,
|
||||
//@Inject('ENVIRONMENT') private environment: EnvironmentService,
|
||||
) { }
|
||||
|
||||
/**
|
||||
@ -123,7 +126,9 @@ export class SessionService {
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OnlyUsersGuard {
|
||||
constructor(private sessionService: SessionService, private router: Router) { }
|
||||
|
||||
@ -138,7 +143,9 @@ export class OnlyUsersGuard {
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OnlyUsersGuardHome {
|
||||
constructor(private sessionService: SessionService, private router: Router) { }
|
||||
|
||||
@ -151,7 +158,9 @@ export class OnlyUsersGuardHome {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OnlyUnregisteredGuardHome {
|
||||
constructor(private sessionService: SessionService, private router: Router) { }
|
||||
|
||||
@ -164,8 +173,9 @@ export class OnlyUnregisteredGuardHome {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OnlyAdminGuard {
|
||||
constructor(private sessionService: SessionService, private router: Router) { }
|
||||
|
||||
|
@ -5,16 +5,18 @@
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { Environment } from '../model/environment';
|
||||
import { EnvironmentService } from '../model/environment';
|
||||
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
|
||||
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SSOService {
|
||||
signUpEnable?: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject('ENVIRONMENT') private environment: Environment,
|
||||
@Inject('ENVIRONMENT') private environment: EnvironmentService,
|
||||
private http: HttpWrapperService,
|
||||
) {
|
||||
console.log('Start SSOService');
|
||||
|
@ -12,7 +12,7 @@ import { SessionService } from './session';
|
||||
import { SSOService } from './sso';
|
||||
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
|
||||
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
||||
import { Environment } from '../model/environment';
|
||||
import { EnvironmentService } from '../model/environment';
|
||||
|
||||
/*
|
||||
interface MessageLogIn {
|
||||
@ -29,15 +29,16 @@ interface MessageAnswer_USER_CONNECT {
|
||||
avatar: string;
|
||||
}
|
||||
*/
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UserService {
|
||||
// 0: Not hide password; 1 hide password;
|
||||
private identificationVersion: number = 1;
|
||||
private cookiesRememberMe = 'remember-me';
|
||||
private cookiesToken = 'token';
|
||||
|
||||
constructor(
|
||||
@Inject('ENVIRONMENT') private environment: Environment,
|
||||
@Inject('ENVIRONMENT') private environment: EnvironmentService,
|
||||
private router: Router,
|
||||
private storageService: StorageService,
|
||||
private http: HttpWrapperService,
|
||||
@ -48,7 +49,7 @@ export class UserService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the user from the current session ==> this remove the curreent Token
|
||||
* Disconnect the user from the current session ==> this remove the current Token
|
||||
*/
|
||||
logOut(): void {
|
||||
this.removeSession();
|
||||
|
Loading…
Reference in New Issue
Block a user