@open-rlb/ng-app 3.0.3 → 3.0.5
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 = {
|
|
@@ -1359,6 +1359,7 @@ class AuthenticationService {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
get isAuthenticated$() {
|
|
1361
1361
|
return this.oidc.isAuthenticated$.pipe(map((isAuthenticated) => {
|
|
1362
|
+
this.logger.warn(`oidc isAuthenticated$ check, response: ${isAuthenticated}; looking for isAuthenticated of ${this.currentProvider?.configId} configId`);
|
|
1362
1363
|
return isAuthenticated.allConfigsAuthenticated.find(o => o.configId === this.currentProvider?.configId)?.isAuthenticated || false;
|
|
1363
1364
|
}));
|
|
1364
1365
|
}
|
|
@@ -1813,9 +1814,6 @@ class AppTemplateComponent {
|
|
|
1813
1814
|
event?.stopPropagation();
|
|
1814
1815
|
this.store.dispatch(AuthActions.login());
|
|
1815
1816
|
}
|
|
1816
|
-
login() {
|
|
1817
|
-
this.store.dispatch(AuthActions.login());
|
|
1818
|
-
}
|
|
1819
1817
|
onSideBarItemClick(item) {
|
|
1820
1818
|
if (item.externalUrl) {
|
|
1821
1819
|
window.open(item.externalUrl, '_blank')?.focus();
|
|
@@ -2317,76 +2315,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
2317
2315
|
type: Input
|
|
2318
2316
|
}] } });
|
|
2319
2317
|
|
|
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
2318
|
const oauthGuard = (route, state) => {
|
|
2385
2319
|
const authService = inject(AuthenticationService);
|
|
2386
|
-
const logger = inject(RlbLoggerService);
|
|
2387
2320
|
return authService.isAuthenticated$.pipe(take(1), map((isAuthenticated) => {
|
|
2388
2321
|
if (!isAuthenticated) {
|
|
2389
|
-
logger.log('oauthGuard, not authenticated, call authService.login()');
|
|
2390
2322
|
authService.login();
|
|
2391
2323
|
return false;
|
|
2392
2324
|
}
|