@open-rlb/ng-app 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -148,7 +148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
148
148
|
}]
|
|
149
149
|
}], ctorParameters: () => [{ type: AppStorageService }] });
|
|
150
150
|
|
|
151
|
-
const LEVEL_PRIORITIES
|
|
151
|
+
const LEVEL_PRIORITIES = {
|
|
152
152
|
off: 0,
|
|
153
153
|
error: 1,
|
|
154
154
|
warn: 2,
|
|
@@ -163,7 +163,7 @@ class AppLoggerService extends AbstractLoggerService {
|
|
|
163
163
|
this.timestamps = true;
|
|
164
164
|
}
|
|
165
165
|
setLogLevel(level) {
|
|
166
|
-
if (!(level in LEVEL_PRIORITIES
|
|
166
|
+
if (!(level in LEVEL_PRIORITIES)) {
|
|
167
167
|
throw new Error(`Unknown log level: ${level}`);
|
|
168
168
|
}
|
|
169
169
|
this.currentLevel = level;
|
|
@@ -202,7 +202,7 @@ class AppLoggerService extends AbstractLoggerService {
|
|
|
202
202
|
this.print('log', contextOrMessage, args);
|
|
203
203
|
}
|
|
204
204
|
print(level, contextOrMessage, args) {
|
|
205
|
-
if (LEVEL_PRIORITIES
|
|
205
|
+
if (LEVEL_PRIORITIES[level] > LEVEL_PRIORITIES[this.currentLevel]) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
const colors = {
|
|
@@ -304,6 +304,7 @@ class AuthFeatureService {
|
|
|
304
304
|
this.store = store;
|
|
305
305
|
}
|
|
306
306
|
login() {
|
|
307
|
+
console.log("AuthFeatureService, dispatch login call");
|
|
307
308
|
this.store.dispatch(AuthActions.login());
|
|
308
309
|
}
|
|
309
310
|
logout() {
|
|
@@ -1811,9 +1812,11 @@ class AppTemplateComponent {
|
|
|
1811
1812
|
loginNav(event) {
|
|
1812
1813
|
event?.preventDefault();
|
|
1813
1814
|
event?.stopPropagation();
|
|
1815
|
+
console.log("AppTemplateComponent -> loginNav() called, dispatch login call");
|
|
1814
1816
|
this.store.dispatch(AuthActions.login());
|
|
1815
1817
|
}
|
|
1816
1818
|
login() {
|
|
1819
|
+
console.log("AppTemplateComponent -> login() called, dispatch login call");
|
|
1817
1820
|
this.store.dispatch(AuthActions.login());
|
|
1818
1821
|
}
|
|
1819
1822
|
onSideBarItemClick(item) {
|
|
@@ -2317,76 +2320,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
2317
2320
|
type: Input
|
|
2318
2321
|
}] } });
|
|
2319
2322
|
|
|
2320
|
-
const LEVEL_PRIORITIES = {
|
|
2321
|
-
off: 0,
|
|
2322
|
-
error: 1,
|
|
2323
|
-
warn: 2,
|
|
2324
|
-
info: 3,
|
|
2325
|
-
debug: 4,
|
|
2326
|
-
all: 5,
|
|
2327
|
-
};
|
|
2328
|
-
class RlbLoggerService {
|
|
2329
|
-
constructor() {
|
|
2330
|
-
this.currentLevel = 'warn';
|
|
2331
|
-
this.timestamps = true;
|
|
2332
|
-
}
|
|
2333
|
-
setLogLevel(level) {
|
|
2334
|
-
if (!Object.prototype.hasOwnProperty.call(LEVEL_PRIORITIES, level)) {
|
|
2335
|
-
throw new Error(`Unknown log level: ${String(level)}`);
|
|
2336
|
-
}
|
|
2337
|
-
this.currentLevel = level;
|
|
2338
|
-
}
|
|
2339
|
-
getLogLevel() {
|
|
2340
|
-
return this.currentLevel;
|
|
2341
|
-
}
|
|
2342
|
-
enableTimestamps(enabled) {
|
|
2343
|
-
this.timestamps = enabled;
|
|
2344
|
-
}
|
|
2345
|
-
logError(message, ...args) {
|
|
2346
|
-
if (this.shouldLog('error')) {
|
|
2347
|
-
console.error(this.prefix('error'), message, ...args);
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
logWarning(message, ...args) {
|
|
2351
|
-
if (this.shouldLog('warn')) {
|
|
2352
|
-
console.warn(this.prefix('warn'), message, ...args);
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
logDebug(message, ...args) {
|
|
2356
|
-
if (this.shouldLog('debug')) {
|
|
2357
|
-
console.debug(this.prefix('debug'), message, ...args);
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
logInfo(message, ...args) {
|
|
2361
|
-
if (this.shouldLog('info')) {
|
|
2362
|
-
console.info(this.prefix('info'), message, ...args);
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
log(message, ...args) {
|
|
2366
|
-
if (this.shouldLog('info')) {
|
|
2367
|
-
console.log(this.prefix('log'), message, ...args);
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
prefix(level) {
|
|
2371
|
-
return this.timestamps ? `[${level.toUpperCase()}] ${new Date().toISOString()} -` : `[${level.toUpperCase()}]`;
|
|
2372
|
-
}
|
|
2373
|
-
shouldLog(messageLevel) {
|
|
2374
|
-
return (LEVEL_PRIORITIES[messageLevel] ?? 0) <= (LEVEL_PRIORITIES[this.currentLevel] ?? 0);
|
|
2375
|
-
}
|
|
2376
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RlbLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2377
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RlbLoggerService, providedIn: 'root' }); }
|
|
2378
|
-
}
|
|
2379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RlbLoggerService, decorators: [{
|
|
2380
|
-
type: Injectable,
|
|
2381
|
-
args: [{ providedIn: 'root' }]
|
|
2382
|
-
}] });
|
|
2383
|
-
|
|
2384
2323
|
const oauthGuard = (route, state) => {
|
|
2385
2324
|
const authService = inject(AuthenticationService);
|
|
2386
|
-
const logger = inject(RlbLoggerService);
|
|
2387
2325
|
return authService.isAuthenticated$.pipe(take(1), map((isAuthenticated) => {
|
|
2388
2326
|
if (!isAuthenticated) {
|
|
2389
|
-
|
|
2327
|
+
console.warn("Attention! Guard navigates to login!!!");
|
|
2390
2328
|
authService.login();
|
|
2391
2329
|
return false;
|
|
2392
2330
|
}
|