Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
81fa9ad31c | |||
3f871e406a | |||
5340a71776 | |||
d3dc53c56d | |||
2cec643728 | |||
f97458bbdd | |||
13f3255c8d | |||
e1673cac97 | |||
7388e167a7 | |||
496b377b57 | |||
2f07af219c | |||
4daf4a6d48 | |||
ec9d5ad77b | |||
2a174b2702 | |||
8c8279c785 | |||
a37bfa16da | |||
60d9ea0a57 | |||
c6860586df | |||
3aa7efac53 | |||
1950162a99 | |||
da0e6ac9ea |
16
.island/release.bash
Executable file
16
.island/release.bash
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
version_file="version.txt"
|
||||||
|
|
||||||
|
new_version=$(cat $version_file)
|
||||||
|
sed -i "s|\"version\":.*\".*\"|\"version\":\"$new_version\"|" package.json
|
||||||
|
|
||||||
|
if grep -q "dev" "$version_file"; then
|
||||||
|
# update all dependency
|
||||||
|
pnpm install
|
||||||
|
pnpm run update_packages
|
||||||
|
else
|
||||||
|
# in case of release ==> can not do it automatically ...
|
||||||
|
echo not implemented
|
||||||
|
fi
|
||||||
|
|
@ -27,6 +27,10 @@ deploy the environment
|
|||||||
cd dist/kar-cw
|
cd dist/kar-cw
|
||||||
pnpm publish --no-git-checks
|
pnpm publish --no-git-checks
|
||||||
```
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
pnpm run deploy
|
||||||
|
```
|
||||||
|
|
||||||
Use development mode for the library:
|
Use development mode for the library:
|
||||||
=====================================
|
=====================================
|
||||||
|
47
package.json
47
package.json
@ -1,46 +1,45 @@
|
|||||||
{
|
{
|
||||||
"name": "@kangaroo-and-rabbit/kar-cw",
|
"name": "@kangaroo-and-rabbit/kar-cw",
|
||||||
"version": "0.1.7",
|
"version": "0.4.1",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ng build kar-cw --watch --configuration development",
|
"dev": "ng build kar-cw --watch --configuration development",
|
||||||
"build": "ng build kar-cw",
|
"build": "ng build kar-cw --configuration production",
|
||||||
"deploy": "cd dist/kar-cw && pnpm publish --no-git-checks",
|
"deploy": "cd dist/kar-cw && pnpm publish --no-git-checks",
|
||||||
"link": "cd dist/kar-cw && pnpm link # TODO this in sudo ...",
|
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"style": "prettier --write .",
|
"style": "prettier --write .",
|
||||||
"update_packages": "ncu --upgrade",
|
"update_packages": "ncu --upgrade",
|
||||||
"install_dependency": "pnpm install"
|
"install_dependency": "pnpm install --force"
|
||||||
},
|
},
|
||||||
"private": true,
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^17.3.0",
|
"@angular/common": "^18.0.0",
|
||||||
"@angular/compiler": "^17.3.0",
|
"@angular/compiler": "^18.0.0",
|
||||||
"@angular/core": "^17.3.0",
|
"@angular/core": "^18.0.0",
|
||||||
"@angular/forms": "^17.3.0",
|
"@angular/forms": "^18.0.0",
|
||||||
"@angular/platform-browser": "^17.3.0",
|
"@angular/platform-browser": "^18.0.0",
|
||||||
"@angular/platform-browser-dynamic": "^17.3.0",
|
"@angular/platform-browser-dynamic": "^18.0.0",
|
||||||
"@angular/router": "^17.3.0",
|
"@angular/router": "^18.0.0",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.1",
|
||||||
"zone.js": "~0.14.3"
|
"zone.js": "~0.14.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^17.3.1",
|
"@angular-devkit/build-angular": "^18.0.1",
|
||||||
"@angular/cli": "^17.3.1",
|
"@angular/cli": "^18.0.1",
|
||||||
"@angular/compiler-cli": "^17.3.0",
|
"@angular/compiler-cli": "^18.0.0",
|
||||||
"@types/jasmine": "~5.1.0",
|
"@types/jasmine": "~5.1.4",
|
||||||
"jasmine-core": "~5.1.0",
|
"jasmine-core": "~5.1.2",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.3",
|
||||||
"karma-chrome-launcher": "~3.2.0",
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.1",
|
||||||
"karma-jasmine": "~5.1.0",
|
"karma-jasmine": "~5.1.0",
|
||||||
"karma-jasmine-html-reporter": "~2.1.0",
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
"ng-packagr": "^17.3.0",
|
"ng-packagr": "^18.0.0",
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.5",
|
||||||
|
"npm-check-updates": "^16.14.20"
|
||||||
},
|
},
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
{
|
{
|
||||||
|
4323
pnpm-lock.yaml
generated
4323
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ export class AsyncActionStatusComponent {
|
|||||||
@Input() value: AsyncActionState = AsyncActionState.IDLE;
|
@Input() value: AsyncActionState = AsyncActionState.IDLE;
|
||||||
|
|
||||||
public getImage(): string {
|
public getImage(): string {
|
||||||
switch(this.value) {
|
switch (this.value) {
|
||||||
case AsyncActionState.IDLE:
|
case AsyncActionState.IDLE:
|
||||||
return '';
|
return '';
|
||||||
case AsyncActionState.LOADING:
|
case AsyncActionState.LOADING:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<div class="elem-checkbox">
|
<div class="elem-checkbox">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
[disabled]="isDisable"
|
||||||
[checked]="value"
|
[checked]="value"
|
||||||
(change)="onChange($event.target.checked)" />
|
(change)="onChange($event.target.checked)" />
|
||||||
{{comment}}
|
{{comment}}
|
||||||
|
@ -11,6 +11,8 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|||||||
styleUrls: ['checkbox.less'],
|
styleUrls: ['checkbox.less'],
|
||||||
})
|
})
|
||||||
export class CheckboxComponent {
|
export class CheckboxComponent {
|
||||||
|
/// Checkbox value
|
||||||
|
@Input() isDisable: boolean = false;
|
||||||
/// Checkbox value
|
/// Checkbox value
|
||||||
@Input() value: boolean = false;
|
@Input() value: boolean = false;
|
||||||
/// Description of the checkbox
|
/// Description of the checkbox
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import { AsyncActionState, AsyncActionStatusComponent } from './async-action-status/async-status-component';
|
export { AsyncActionState, AsyncActionStatusComponent } from './async-action-status/async-status-component';
|
||||||
import { BurgerPropertyComponent } from './burger-property/burger-property';
|
export { BurgerPropertyComponent } from './burger-property/burger-property';
|
||||||
import { CheckboxComponent } from './checkbox/checkbox';
|
export { CheckboxComponent } from './checkbox/checkbox';
|
||||||
import { EntryNumberComponent } from './entry-number/entry-number';
|
export { EntryNumberComponent } from './entry-number/entry-number';
|
||||||
import { EntryValidatorComponent } from './entry-validator/entry-validator';
|
export { EntryValidatorComponent } from './entry-validator/entry-validator';
|
||||||
import { EntryComponent } from './entry/entry';
|
export { EntryComponent } from './entry/entry';
|
||||||
import { ErrorMessageStateComponent } from './error-message-state/error-message-state';
|
export { ErrorMessageStateComponent } from './error-message-state/error-message-state';
|
||||||
import { ErrorComponent } from './error/error';
|
export { ErrorComponent } from './error/error';
|
||||||
import { PasswordEntryComponent } from './password-entry/password-entry';
|
export { PasswordEntryComponent } from './password-entry/password-entry';
|
||||||
import { PopInComponent } from './popin/popin';
|
export { PopInComponent } from './popin/popin';
|
||||||
import { RenderFormComponent } from './render-settings/render-form';
|
export { RenderFormComponent } from './render-settings/render-form';
|
||||||
import { RenderSettingsComponent } from './render-settings/render-settings';
|
export {
|
||||||
import { SpinnerComponent } from './spinner/spinner';
|
RenderSettingsComponent,
|
||||||
import { EventOnMenu, TopMenuComponent } from './top-menu/top-menu';
|
SettingsItem,
|
||||||
import { UploadFileComponent } from './upload-file/upload-file';
|
isSettingsItem,
|
||||||
|
SettingType,
|
||||||
export { EventOnMenu, BurgerPropertyComponent, EntryNumberComponent, CheckboxComponent, RenderFormComponent, RenderSettingsComponent, ErrorMessageStateComponent, AsyncActionState, AsyncActionStatusComponent, EntryValidatorComponent, PopInComponent, TopMenuComponent, UploadFileComponent, ErrorComponent, SpinnerComponent, PasswordEntryComponent, EntryComponent };
|
isSettingType,
|
||||||
|
CheckerParameter,
|
||||||
|
CheckerParameterType,
|
||||||
|
ReturnFunction,
|
||||||
|
} from './render-settings/render-settings';
|
||||||
|
export { SpinnerComponent } from './spinner/spinner';
|
||||||
|
export { EventOnMenu, TopMenuComponent } from './top-menu/top-menu';
|
||||||
|
export { UploadFileComponent } from './upload-file/upload-file';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="element {{popSize}}">
|
<div class="element {{popSize}}">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<label class="unselectable">{{popTitle}}</label>
|
<label class="unselectable">{{popTitle}}</label>
|
||||||
@if(closeTopRight === true) {
|
@if(closeTopRight) {
|
||||||
<div class="close">
|
<div class="close">
|
||||||
<button class="button-close color-shadow-black" (click)="onCloseTop()" type="submit">
|
<button class="button-close color-shadow-black" (click)="onCloseTop()" type="submit">
|
||||||
<label class="unselectable"><i class="material-icons">close</i></label>
|
<label class="unselectable"><i class="material-icons">close</i></label>
|
||||||
@ -15,28 +15,28 @@
|
|||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
@if(validateTitle !== null) {
|
@if(validateTitle) {
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<button class="button color-shadow-black" (click)="onValidate()" type="submit">
|
<button class="button color-shadow-black" (click)="onValidate()" type="submit">
|
||||||
<label class="unselectable"><i class="material-icons">done</i> {{validateTitle}}</label>
|
<label class="unselectable"><i class="material-icons">done</i> {{validateTitle}}</label>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(saveTitle != null) {
|
@if(saveTitle) {
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<button class="button color-shadow-black" (click)="onSave()" type="submit">
|
<button class="button color-shadow-black" (click)="onSave()" type="submit">
|
||||||
<label class="unselectable"><i class="material-icons">save_alt</i> {{saveTitle}}</label>
|
<label class="unselectable"><i class="material-icons">save_alt</i> {{saveTitle}}</label>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(otherTitle != null) {
|
@if(otherTitle) {
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<button class="button color-shadow-black" (click)="onOther()" type="submit">
|
<button class="button color-shadow-black" (click)="onOther()" type="submit">
|
||||||
<label class="unselectable"><i class="material-icons">star</i> {{otherTitle}}</label>
|
<label class="unselectable"><i class="material-icons">star</i> {{otherTitle}}</label>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(closeTitle != null) {
|
@if(closeTitle) {
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<button class="button color-shadow-black" (click)="onClose()" type="submit">
|
<button class="button color-shadow-black" (click)="onClose()" type="submit">
|
||||||
<label class="unselectable"><i class="material-icons">close</i> {{closeTitle}}</label>
|
<label class="unselectable"><i class="material-icons">close</i> {{closeTitle}}</label>
|
||||||
|
@ -21,10 +21,10 @@ export class PopInComponent implements OnInit, OnDestroy {
|
|||||||
@Input() popSize: string = 'medium';
|
@Input() popSize: string = 'medium';
|
||||||
|
|
||||||
@Output() callback: EventEmitter<any> = new EventEmitter();
|
@Output() callback: EventEmitter<any> = new EventEmitter();
|
||||||
@Input() closeTitle: any = null;
|
@Input() closeTitle?: string;
|
||||||
@Input() validateTitle: any = null;
|
@Input() validateTitle?: string;
|
||||||
@Input() saveTitle: any = null;
|
@Input() saveTitle?: string;
|
||||||
@Input() otherTitle: any = null;
|
@Input() otherTitle?: string;
|
||||||
|
|
||||||
public displayPopIn: boolean = false;
|
public displayPopIn: boolean = false;
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ import { ALL_GUARDS } from "./kar-cw.guard";
|
|||||||
exports: [
|
exports: [
|
||||||
...ALL_COMPONENTS,
|
...ALL_COMPONENTS,
|
||||||
...ALL_SCENES,
|
...ALL_SCENES,
|
||||||
//...ALL_SERVICES,
|
|
||||||
//...ALL_GUARDS,
|
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
|
79
src/model/settings-item.ts
Normal file
79
src/model/settings-item.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { CheckerParameter } from "../component/entry-validator/entry-validator";
|
||||||
|
import { isInArray, isNullOrUndefined, isObject, isString, isOptionalOf, isBoolean, isNumber, isUndefined } from "../utils";
|
||||||
|
|
||||||
|
|
||||||
|
export enum SettingType {
|
||||||
|
VALUE = 'VALUE',
|
||||||
|
LINE = 'LINE',
|
||||||
|
BOOLEAN = 'BOOLEAN',
|
||||||
|
NUMBER = 'NUMBER',
|
||||||
|
STRING = 'STRING',
|
||||||
|
PASSWORD = 'PASSWORD',
|
||||||
|
}
|
||||||
|
export function isSettingType(data: any): data is SettingType {
|
||||||
|
return isInArray(data, ['VALUE', 'LINE', 'NUMBER', 'BOOLEAN', 'STRING', 'PASSWORD']);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SettingsItem {
|
||||||
|
// Type of the menu Node
|
||||||
|
type: SettingType;
|
||||||
|
// Unique key reference
|
||||||
|
key?: string;
|
||||||
|
// Displayed Title
|
||||||
|
title?: string;
|
||||||
|
// Description of the parameter
|
||||||
|
description?: string;
|
||||||
|
// placeholder of the parameter
|
||||||
|
placeholder?: string;
|
||||||
|
// Parameter key to SET/GET or the sub-menu
|
||||||
|
value?: boolean | string | Number;
|
||||||
|
// when data is change the value is set here undefined if not correct (must be set @ undefined):
|
||||||
|
newValue?: boolean | string | Number;
|
||||||
|
// checker to validate the data:
|
||||||
|
checker?: CheckerParameter
|
||||||
|
// result of the checker (must be set @ undefined):
|
||||||
|
state?: boolean | string;
|
||||||
|
// The element is require to have a valid form.
|
||||||
|
require?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isSettingsItem(data: any): data is SettingsItem {
|
||||||
|
if (isNullOrUndefined(data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isObject(data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isSettingType(data.type)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isString(data.key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isOptionalOf(data.title, isString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isOptionalOf(data.description, isString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isOptionalOf(data.placeholder, isString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!isOptionalOf(data.value, isBoolean) &&
|
||||||
|
!isOptionalOf(data.value, isString) &&
|
||||||
|
!isOptionalOf(data.value, isNumber)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isUndefined(data.newValue)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isOptionalOf(data.state, isString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isOptionalOf(data.require, isBoolean)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
@ -10,35 +10,33 @@
|
|||||||
<p class="expand">
|
<p class="expand">
|
||||||
<label class="unselectable"><b>{{mediaTitle}}</b></label>
|
<label class="unselectable"><b>{{mediaTitle}}</b></label>
|
||||||
</p>
|
</p>
|
||||||
@if(progress != 100) {
|
@if(error) {
|
||||||
<div class="progress-back">
|
|
||||||
<div class="progress-bar" style="width:{{progress}}%"> {{progress}}%</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="unselectable">Upload:</label><label style="text-align: right">{{uploadDisplay}}</label><br />
|
|
||||||
<label class="unselectable">Size:</label><label style="text-align: right">{{sizeDisplay}}</label>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@else if (error == null && result == null) {
|
|
||||||
<div>
|
|
||||||
<label class="unselectable">Upload done ... waiting server answer</label>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@else {
|
|
||||||
@if(error != null) {
|
|
||||||
<div>
|
<div>
|
||||||
<label class="unselectable"><b>Get an error From the server:</b></label
|
<label class="unselectable"><b>Get an error From the server:</b></label
|
||||||
><br />
|
><br />
|
||||||
<label class="unselectable">{{error}}</label>
|
<label class="unselectable">{{error}}</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(result != null) {
|
@else if(progress != 100) {
|
||||||
|
<div class="progress-back">
|
||||||
|
<div class="progress-bar" style="width:{{progress??0}}%"> {{progress}}%</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="unselectable">Upload:</label><label style="text-align: right">{{uploadDisplay}}</label><br />
|
||||||
|
<label class="unselectable">Size:</label><label style="text-align: right">{{sizeDisplay}}</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@else if(result) {
|
||||||
<div>
|
<div>
|
||||||
<label class="unselectable"><b>Upload finished:</b></label
|
<label class="unselectable"><b>Upload finished:</b></label
|
||||||
><br />
|
><br />
|
||||||
<label class="unselectable">{{result}}</label>
|
<label class="unselectable">{{result}}</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@else {
|
||||||
|
<div>
|
||||||
|
<label class="unselectable">Upload done ... waiting server answer</label>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</app-popin>
|
</app-popin>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,9 +4,28 @@
|
|||||||
* @license PROPRIETARY (see license file)
|
* @license PROPRIETARY (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, Input, SimpleChanges } from '@angular/core';
|
import { Component, OnInit, Input, SimpleChanges, EventEmitter, Output } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { PopInService } from '../../service';
|
import { PopInService } from '../../service';
|
||||||
|
import { isNullOrUndefined } from '../../utils';
|
||||||
|
|
||||||
|
|
||||||
|
export class UploadProgress {
|
||||||
|
labelMediaTitle: string = '';
|
||||||
|
mediaSendSize: number = 0;
|
||||||
|
mediaSize: number = 99999999999999;
|
||||||
|
result?: string;
|
||||||
|
error?: string;
|
||||||
|
clear() {
|
||||||
|
this.labelMediaTitle = '';
|
||||||
|
this.mediaSendSize = 0;
|
||||||
|
this.mediaSize = 99999999999999;
|
||||||
|
this.result = undefined;
|
||||||
|
this.error = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'upload-progress',
|
selector: 'upload-progress',
|
||||||
@ -19,6 +38,7 @@ export class PopInUploadProgress implements OnInit {
|
|||||||
@Input() mediaSize: number = 999999999999;
|
@Input() mediaSize: number = 999999999999;
|
||||||
@Input() result?: string;
|
@Input() result?: string;
|
||||||
@Input() error?: string;
|
@Input() error?: string;
|
||||||
|
@Output() abort: EventEmitter<void> = new EventEmitter();
|
||||||
public closeButtonTitle?: string = 'Abort';
|
public closeButtonTitle?: string = 'Abort';
|
||||||
public otherButtonTitle?: string;
|
public otherButtonTitle?: string;
|
||||||
public validateButtonTitle?: string;
|
public validateButtonTitle?: string;
|
||||||
@ -29,9 +49,15 @@ export class PopInUploadProgress implements OnInit {
|
|||||||
OnDestroy() { }
|
OnDestroy() { }
|
||||||
ngOnInit() { }
|
ngOnInit() { }
|
||||||
eventPopUp(_event: string): void {
|
eventPopUp(_event: string): void {
|
||||||
|
if (_event == "close") {
|
||||||
|
if (this.abort) {
|
||||||
|
this.abort.emit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
console.log(`GET event: ${_event}`);
|
console.log(`GET event: ${_event}`);
|
||||||
this.popInService.close('popin-upload-progress');
|
this.popInService.close('popin-upload-progress');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
updateNeedSend(): void { }
|
updateNeedSend(): void { }
|
||||||
|
|
||||||
limit3(count: number): string {
|
limit3(count: number): string {
|
||||||
@ -80,11 +106,11 @@ export class PopInUploadProgress implements OnInit {
|
|||||||
this.progress = Math.trunc((this.mediaUploaded * 100) / this.mediaSize);
|
this.progress = Math.trunc((this.mediaUploaded * 100) / this.mediaSize);
|
||||||
this.uploadDisplay = this.convertInHuman(this.mediaUploaded);
|
this.uploadDisplay = this.convertInHuman(this.mediaUploaded);
|
||||||
this.sizeDisplay = this.convertInHuman(this.mediaSize);
|
this.sizeDisplay = this.convertInHuman(this.mediaSize);
|
||||||
if (this.error === null && this.result === null) {
|
if (isNullOrUndefined(this.error) && isNullOrUndefined(this.result)) {
|
||||||
this.closeButtonTitle = 'Abort';
|
this.closeButtonTitle = 'Abort';
|
||||||
this.otherButtonTitle = undefined;
|
this.otherButtonTitle = undefined;
|
||||||
this.validateButtonTitle = undefined;
|
this.validateButtonTitle = undefined;
|
||||||
} else if (this.result === null) {
|
} else if (isNullOrUndefined(this.result)) {
|
||||||
this.closeButtonTitle = undefined;
|
this.closeButtonTitle = undefined;
|
||||||
this.otherButtonTitle = 'Close';
|
this.otherButtonTitle = 'Close';
|
||||||
this.validateButtonTitle = undefined;
|
this.validateButtonTitle = undefined;
|
||||||
@ -95,18 +121,3 @@ export class PopInUploadProgress implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UploadProgress {
|
|
||||||
labelMediaTitle: string = '';
|
|
||||||
mediaSendSize: number = 0;
|
|
||||||
mediaSize: number = 99999999999999;
|
|
||||||
result?: string;
|
|
||||||
error?: string;
|
|
||||||
clear() {
|
|
||||||
this.labelMediaTitle = '';
|
|
||||||
this.mediaSendSize = 0;
|
|
||||||
this.mediaSize = 99999999999999;
|
|
||||||
this.result = undefined;
|
|
||||||
this.error = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class CookiesService {
|
export class CookiesService {
|
||||||
constructor() {
|
constructor() {
|
||||||
console.log("Start CookiesService");
|
console.log("Start CookiesService");
|
||||||
|
@ -53,9 +53,7 @@ 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...
|
* 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 {
|
export class HttpWrapperService {
|
||||||
private displayReturn: boolean = false;
|
private displayReturn: boolean = false;
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -7,9 +7,7 @@
|
|||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
import { Environment } from '../model/environment';
|
import { Environment } from '../model/environment';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class StorageService {
|
export class StorageService {
|
||||||
private baseLocalStorageName: string;
|
private baseLocalStorageName: string;
|
||||||
|
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class NotificationService {
|
export class NotificationService {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class PopInService {
|
export class PopInService {
|
||||||
private popinList: any[] = [];
|
private popinList: any[] = [];
|
||||||
|
|
||||||
|
@ -15,21 +15,21 @@ export enum UserRoles222 {
|
|||||||
guest = 'guest',
|
guest = 'guest',
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class SessionService {
|
export class SessionService {
|
||||||
private tokenJwt?: string;
|
private tokenJwt?: string;
|
||||||
public userLogin?: string;
|
public userLogin?: string;
|
||||||
public userId?: string;
|
public userId?: string;
|
||||||
|
public applName?: string;
|
||||||
public right: any = {};
|
public right: any = {};
|
||||||
|
|
||||||
@Output() change: EventEmitter<boolean> = new EventEmitter();
|
@Output() change: EventEmitter<boolean> = new EventEmitter();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('ENVIRONMENT') private environment: Environment,
|
@Inject('ENVIRONMENT') environment: Environment,
|
||||||
) {
|
) {
|
||||||
console.log("Start SessionService");
|
console.log("Start SessionService");
|
||||||
|
this.applName = environment.applName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,10 +69,10 @@ export class SessionService {
|
|||||||
if (isNullOrUndefined(jsonModel.right)) {
|
if (isNullOrUndefined(jsonModel.right)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (isNullOrUndefined(jsonModel.right[this.environment.applName])) {
|
if (isNullOrUndefined(jsonModel.right[this.applName])) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return jsonModel.right[this.environment.applName];
|
return jsonModel.right[this.applName];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief destroy the current session.
|
* @brief destroy the current session.
|
||||||
@ -88,7 +88,7 @@ export class SessionService {
|
|||||||
getToken(): string | undefined {
|
getToken(): string | undefined {
|
||||||
return this.tokenJwt;
|
return this.tokenJwt;
|
||||||
}
|
}
|
||||||
islogged() {
|
isLogged() {
|
||||||
return this.userId !== null;
|
return this.userId !== null;
|
||||||
}
|
}
|
||||||
hasRight(type: UserRoles222): boolean {
|
hasRight(type: UserRoles222): boolean {
|
||||||
@ -127,66 +127,60 @@ export class SessionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class OnlyUsersGuard {
|
export class OnlyUsersGuard {
|
||||||
constructor(private sessionService: SessionService, private router: Router) { }
|
constructor(private sessionService: SessionService, private router: Router) { }
|
||||||
|
|
||||||
canActivate() {
|
canActivate() {
|
||||||
|
console.log(`OnlyUsersGuard : ${this.sessionService}`)
|
||||||
console.log('OnlyLoggedInUsers');
|
console.log('OnlyLoggedInUsers');
|
||||||
if (this.sessionService.hasRight(UserRoles222.user) || this.sessionService.hasRight(UserRoles222.admin)) {
|
if (this.sessionService.hasRight(UserRoles222.user)
|
||||||
|
|| this.sessionService.hasRight(UserRoles222.admin)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
this.router.navigateByUrl('/forbidden');
|
this.router.navigateByUrl('/forbidden');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class OnlyUsersGuardHome {
|
export class OnlyUsersGuardHome {
|
||||||
constructor(private sessionService: SessionService, private router: Router) { }
|
constructor(private sessionService: SessionService, private router: Router) { }
|
||||||
|
|
||||||
canActivate() {
|
canActivate() {
|
||||||
if (this.sessionService.hasRight(UserRoles222.user) || this.sessionService.hasRight(UserRoles222.admin)) {
|
if (!this.sessionService.isLogged()) {
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.router.navigateByUrl('/unregistered');
|
this.router.navigateByUrl('/unregistered');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.sessionService.hasRight(UserRoles222.user)
|
||||||
|
|| this.sessionService.hasRight(UserRoles222.admin)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
this.router.navigateByUrl('/forbidden');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
@Injectable()
|
||||||
})
|
|
||||||
export class OnlyUnregisteredGuardHome {
|
export class OnlyUnregisteredGuardHome {
|
||||||
constructor(private sessionService: SessionService, private router: Router) { }
|
constructor(private sessionService: SessionService, private router: Router) { }
|
||||||
|
|
||||||
canActivate() {
|
canActivate() {
|
||||||
if (!this.sessionService.islogged()) {
|
if (this.sessionService.isLogged()) {
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.router.navigateByUrl('/home');
|
this.router.navigateByUrl('/home');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
@Injectable()
|
||||||
export class OnlyAdminGuard {
|
export class OnlyAdminGuard {
|
||||||
constructor(private sessionService: SessionService, private router: Router) { }
|
constructor(private sessionService: SessionService, private router: Router) { }
|
||||||
|
|
||||||
canActivate() {
|
canActivate() {
|
||||||
if (this.sessionService.hasRight(UserRoles222.user)) {
|
if (!this.sessionService.hasRight(UserRoles222.user)) {
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.router.navigateByUrl('/forbidden');
|
this.router.navigateByUrl('/forbidden');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,7 @@ import { Environment } from '../model/environment';
|
|||||||
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
|
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
|
||||||
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class SSOService {
|
export class SSOService {
|
||||||
signUpEnable?: boolean;
|
signUpEnable?: boolean;
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ export class SSOService {
|
|||||||
) {
|
) {
|
||||||
return this.utf8_to_b64(data);
|
return this.utf8_to_b64(data);
|
||||||
}
|
}
|
||||||
const pathName = getApplicationLocation();
|
const pathName = getApplicationLocation(this.environment);
|
||||||
if (isInArray(pathName, ['sso', '/sso', '/sso/'])) {
|
if (isInArray(pathName, ['sso', '/sso', '/sso/'])) {
|
||||||
return this.utf8_to_b64('home');
|
return this.utf8_to_b64('home');
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,10 @@ import { SSOService } from './sso';
|
|||||||
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
|
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
|
||||||
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
||||||
import { Environment } from '../model/environment';
|
import { Environment } from '../model/environment';
|
||||||
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable()
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class UserService {
|
export class UserService {
|
||||||
// 0: Not hide password; 1 hide password;
|
// 0: Not hide password; 1 hide password;
|
||||||
private identificationVersion: number = 1;
|
private identificationVersion: number = 1;
|
||||||
@ -78,7 +77,7 @@ export class UserService {
|
|||||||
* Check if the system can be connected
|
* Check if the system can be connected
|
||||||
*/
|
*/
|
||||||
checkAutoConnect(): Promise<void> {
|
checkAutoConnect(): Promise<void> {
|
||||||
let locationOrigin = getApplicationLocation();
|
let locationOrigin = getApplicationLocation(this.environment);
|
||||||
const self = this;
|
const self = this;
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
// Need to use the windows global route to prevent the log in cycle ...
|
// Need to use the windows global route to prevent the log in cycle ...
|
||||||
@ -93,7 +92,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
console.log(' ==> Check if need reconnect?');
|
console.log(' ==> Check if need reconnect?');
|
||||||
let rememberMe = self.getRememberMe();
|
let rememberMe = self.getRememberMe();
|
||||||
// TODO: in case of jest reload ==> no need to manage the SSO ==> just keep the token ... it in enought...
|
// TODO: in case of jest reload ==> no need to manage the SSO ==> just keep the token ... it in enough...
|
||||||
let token: undefined | string = undefined;
|
let token: undefined | string = undefined;
|
||||||
if (
|
if (
|
||||||
isNullOrUndefined(this.environment.tokenStoredInPermanentStorage) ||
|
isNullOrUndefined(this.environment.tokenStoredInPermanentStorage) ||
|
||||||
@ -111,7 +110,7 @@ export class UserService {
|
|||||||
self.startSession(token ?? '', rememberMe)
|
self.startSession(token ?? '', rememberMe)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
self.router.navigateByUrl(locationOrigin);
|
self.router.navigateByUrl(locationOrigin);
|
||||||
console.log(`update global URL = ${locationOrigin}`);
|
console.log(`update global URL = ${locationOrigin} APP_BASE_HREF=${APP_BASE_HREF}`);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
//import { environment } from 'environments/environment';
|
//import { environment } from 'environments/environment';
|
||||||
|
|
||||||
export function getApplicationLocation(): string {
|
import { Environment } from "../model";
|
||||||
|
|
||||||
|
export function getApplicationLocation(environment: Environment): string {
|
||||||
let pathName = location.pathname;
|
let pathName = location.pathname;
|
||||||
return pathName;
|
|
||||||
//console.log("start Path-name: '" + pathName + "'");
|
//console.log("start Path-name: '" + pathName + "'");
|
||||||
//console.log("check with: '" + environment.applName + "/sso/" + "'");
|
//console.log("check with: '" + environment.applName + "/sso/" + "'");
|
||||||
/*
|
|
||||||
|
|
||||||
if (pathName.startsWith('/' + environment.applName + '/')) {
|
if (pathName.startsWith('/' + environment.applName + '/')) {
|
||||||
pathName = pathName.substring(environment.applName.length + 2);
|
pathName = pathName.substring(environment.applName.length + 2);
|
||||||
} else if (pathName.startsWith('/' + environment.applName)) {
|
} else if (pathName.startsWith('/' + environment.applName)) {
|
||||||
@ -17,5 +16,4 @@ export function getApplicationLocation(): string {
|
|||||||
pathName = pathName.substring(environment.applName.length);
|
pathName = pathName.substring(environment.applName.length);
|
||||||
}
|
}
|
||||||
return pathName;
|
return pathName;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export class DataStore<TYPE> {
|
|||||||
}
|
}
|
||||||
resolve(self.data);
|
resolve(self.data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(`[E] ${self.constructor.name}: can not get data from remote server:`);
|
console.log(`[E] ${self.constructor.name}: can not get data from remote server: ${JSON.stringify(error, null, 2)}`);
|
||||||
if (self.dataPromise) {
|
if (self.dataPromise) {
|
||||||
for (let iii = 0; iii < self.dataPromise.length; iii++) {
|
for (let iii = 0; iii < self.dataPromise.length; iii++) {
|
||||||
self.dataPromise[iii].reject(error);
|
self.dataPromise[iii].reject(error);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { getApplicationLocation } from './applPath';
|
import { getApplicationLocation } from './applPath';
|
||||||
|
import { arrayUnique } from './arrayTools';
|
||||||
import { DataStore } from './data-store';
|
import { DataStore } from './data-store';
|
||||||
import { DataTools, TypeCheck } from './data-tools';
|
import { DataTools, TypeCheck } from './data-tools';
|
||||||
import { sha512 } from './sha512';
|
import { sha512 } from './sha512';
|
||||||
@ -50,4 +51,5 @@ export {
|
|||||||
isStringNullOrUndefined,
|
isStringNullOrUndefined,
|
||||||
isUndefined,
|
isUndefined,
|
||||||
sha512,
|
sha512,
|
||||||
|
arrayUnique,
|
||||||
};
|
};
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "ES2022",
|
"target": "ES2018",
|
||||||
"module": "ES2022",
|
"module": "ES2015",
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"lib": [
|
"lib": [
|
||||||
"ES2022",
|
"ES2018",
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
|
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.4.1
|
Loading…
x
Reference in New Issue
Block a user