@bitblit/ngx-acute-common 5.1.118 → 5.1.122-alpha
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.
- package/lib/acute-common-type-guards.d.ts +4 -0
- package/lib/acute-common-type-guards.js +9 -0
- package/lib/acute-common-type-guards.js.map +1 -0
- package/lib/components/dynamic-404-helper/dynamic-404-helper.component.js +14 -14
- package/lib/components/dynamic-404-helper/dynamic-404-helper.component.js.map +1 -1
- package/lib/components/log-display/log-display.component.js +4 -5
- package/lib/components/log-display/log-display.component.js.map +1 -1
- package/lib/components/process-monitor-simple-display/process-monitor-simple-display.component.d.ts +9 -0
- package/lib/components/process-monitor-simple-display/process-monitor-simple-display.component.js +90 -0
- package/lib/components/process-monitor-simple-display/process-monitor-simple-display.component.js.map +1 -0
- package/lib/components/process-monitor-simple-modal-display/process-monitor-simple-modal-display.component.d.ts +9 -0
- package/lib/components/process-monitor-simple-modal-display/process-monitor-simple-modal-display.component.js +98 -0
- package/lib/components/process-monitor-simple-modal-display/process-monitor-simple-modal-display.component.js.map +1 -0
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +13 -1
- package/lib/index.js +13 -1
- package/lib/index.js.map +1 -1
- package/lib/pipes/duration-ms-formatted.pipe.d.ts +7 -0
- package/lib/pipes/duration-ms-formatted.pipe.js +30 -0
- package/lib/pipes/duration-ms-formatted.pipe.js.map +1 -0
- package/lib/services/css-theme.service.d.ts +11 -0
- package/lib/services/css-theme.service.js +50 -0
- package/lib/services/css-theme.service.js.map +1 -0
- package/lib/services/graphql-query-execution-display-style.d.ts +5 -0
- package/lib/services/graphql-query-execution-display-style.js +7 -0
- package/lib/services/graphql-query-execution-display-style.js.map +1 -0
- package/lib/services/graphql-query-execution-options.d.ts +9 -0
- package/lib/services/graphql-query-execution-options.js +2 -0
- package/lib/services/graphql-query-execution-options.js.map +1 -0
- package/lib/services/graphql-query.service.d.ts +8 -12
- package/lib/services/graphql-query.service.js +59 -61
- package/lib/services/graphql-query.service.js.map +1 -1
- package/lib/services/local-storage.service.d.ts +17 -6
- package/lib/services/local-storage.service.js +61 -12
- package/lib/services/local-storage.service.js.map +1 -1
- package/lib/services/process-monitor/monitored-processes.d.ts +4 -0
- package/lib/services/process-monitor/monitored-processes.js +2 -0
- package/lib/services/process-monitor/monitored-processes.js.map +1 -0
- package/lib/services/process-monitor/process-holder.d.ts +9 -0
- package/lib/services/process-monitor/process-holder.js +2 -0
- package/lib/services/process-monitor/process-holder.js.map +1 -0
- package/lib/services/process-monitor/process-monitor-display-mode.d.ts +4 -0
- package/lib/services/process-monitor/process-monitor-display-mode.js +6 -0
- package/lib/services/process-monitor/process-monitor-display-mode.js.map +1 -0
- package/lib/services/process-monitor/process-monitor-service.d.ts +33 -0
- package/lib/services/process-monitor/process-monitor-service.js +148 -0
- package/lib/services/process-monitor/process-monitor-service.js.map +1 -0
- package/lib/services/process-monitor/process-monitor-state.d.ts +5 -0
- package/lib/services/process-monitor/process-monitor-state.js +2 -0
- package/lib/services/process-monitor/process-monitor-state.js.map +1 -0
- package/lib/services/window-ref.service.d.ts +2 -0
- package/lib/services/window-ref.service.js +6 -0
- package/lib/services/window-ref.service.js.map +1 -1
- package/package.json +33 -33
- package/lib/components/dialogs/block-ui/block-ui.component.d.ts +0 -12
- package/lib/components/dialogs/block-ui/block-ui.component.js +0 -79
- package/lib/components/dialogs/block-ui/block-ui.component.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AuthorizationStyle } from "@bitblit/ratchet-graphql/graphql/authorization-style";
|
|
2
|
+
import { ErrorHandlingApproach } from "@bitblit/ratchet-common/lang/error-handling-approach";
|
|
3
|
+
import { GraphqlQueryExecutionDisplayStyle } from "./graphql-query-execution-display-style";
|
|
4
|
+
export interface GraphqlQueryExecutionOptions {
|
|
5
|
+
blockMessage?: string;
|
|
6
|
+
authStyle: AuthorizationStyle;
|
|
7
|
+
errorHandling: ErrorHandlingApproach;
|
|
8
|
+
displayStyle: GraphqlQueryExecutionDisplayStyle;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-query-execution-options.js","sourceRoot":"","sources":["../../src/services/graphql-query-execution-options.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AuthorizationStyle } from '@bitblit/ratchet-graphql/graphql/authorization-style';
|
|
5
|
-
import { ErrorHandlingApproach } from '@bitblit/ratchet-common/lang/error-handling-approach';
|
|
1
|
+
import { GraphqlRatchet } from "@bitblit/ratchet-graphql/graphql/graphql-ratchet";
|
|
2
|
+
import { ProcessMonitorService } from "./process-monitor/process-monitor-service";
|
|
3
|
+
import { GraphqlQueryExecutionOptions } from "./graphql-query-execution-options.ts";
|
|
6
4
|
import * as i0 from "@angular/core";
|
|
7
5
|
export declare class GraphqlQueryService {
|
|
8
6
|
private graphqlRatchet;
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
executeQuery<T>(queryName: string, variables: any,
|
|
13
|
-
|
|
14
|
-
executeMutate<T>(queryName: string, variables: any, authStyle?: AuthorizationStyle, errorHandling?: ErrorHandlingApproach): Promise<T | null>;
|
|
15
|
-
executeMutateWithBlock<T>(blockMessage: string, queryName: string, variables: any, authStyle?: AuthorizationStyle, errorHandling?: ErrorHandlingApproach): Promise<T | null>;
|
|
7
|
+
private processMonitorService;
|
|
8
|
+
constructor(graphqlRatchet: GraphqlRatchet, processMonitorService: ProcessMonitorService);
|
|
9
|
+
fullOptions(input?: Partial<GraphqlQueryExecutionOptions>): GraphqlQueryExecutionOptions;
|
|
10
|
+
executeQuery<T>(queryName: string, variables: any, inOptions?: Partial<GraphqlQueryExecutionOptions>): Promise<T | null>;
|
|
11
|
+
executeMutate<T>(queryName: string, variables: any, inOptions?: Partial<GraphqlQueryExecutionOptions>): Promise<T | null>;
|
|
16
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<GraphqlQueryService, never>;
|
|
17
13
|
static ɵprov: i0.ɵɵInjectableDeclaration<GraphqlQueryService>;
|
|
18
14
|
}
|
|
@@ -1,90 +1,88 @@
|
|
|
1
|
-
import { Injectable } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { Injectable } from "@angular/core";
|
|
2
|
+
import { Logger } from "@bitblit/ratchet-common/logger/logger";
|
|
3
|
+
import { GraphqlRatchet } from "@bitblit/ratchet-graphql/graphql/graphql-ratchet";
|
|
4
|
+
import { AuthorizationStyle } from "@bitblit/ratchet-graphql/graphql/authorization-style";
|
|
5
|
+
import { ErrorHandlingApproach } from "@bitblit/ratchet-common/lang/error-handling-approach";
|
|
6
|
+
import { ErrorRatchet } from "@bitblit/ratchet-common/lang/error-ratchet";
|
|
7
|
+
import { LoggerLevelName } from "@bitblit/ratchet-common/logger/logger-level-name";
|
|
8
|
+
import { ProcessMonitorService } from "./process-monitor/process-monitor-service";
|
|
9
|
+
import { GraphqlQueryExecutionDisplayStyle } from "./graphql-query-execution-display-style.js";
|
|
10
|
+
import { StringRatchet } from "@bitblit/ratchet-common/lang/string-ratchet";
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
12
|
import * as i1 from "@bitblit/ratchet-graphql/graphql/graphql-ratchet";
|
|
13
|
-
import * as i2 from "
|
|
14
|
-
import * as i3 from "primeng/api";
|
|
13
|
+
import * as i2 from "./process-monitor/process-monitor-service";
|
|
15
14
|
export class GraphqlQueryService {
|
|
16
15
|
graphqlRatchet;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
constructor(graphqlRatchet, dialogService, messageService) {
|
|
16
|
+
processMonitorService;
|
|
17
|
+
constructor(graphqlRatchet, processMonitorService) {
|
|
20
18
|
this.graphqlRatchet = graphqlRatchet;
|
|
21
|
-
this.
|
|
22
|
-
this.messageService = messageService;
|
|
19
|
+
this.processMonitorService = processMonitorService;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ErrorRatchet.
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
this.messageService.clear();
|
|
21
|
+
fullOptions(input) {
|
|
22
|
+
const rval = Object.assign({
|
|
23
|
+
blockMessage: null,
|
|
24
|
+
authStyle: AuthorizationStyle.TokenRequired,
|
|
25
|
+
errorHandling: ErrorHandlingApproach.LogAndPassThru,
|
|
26
|
+
displayStyle: GraphqlQueryExecutionDisplayStyle.Monitored
|
|
27
|
+
}, input ?? {});
|
|
28
|
+
if (StringRatchet.trimToNull(rval.blockMessage) && rval.displayStyle !== GraphqlQueryExecutionDisplayStyle.Modal) {
|
|
29
|
+
throw ErrorRatchet.fErr('Block message specified but display style is not modal');
|
|
36
30
|
}
|
|
37
31
|
return rval;
|
|
38
32
|
}
|
|
39
|
-
async
|
|
33
|
+
async executeQuery(queryName, variables, inOptions) {
|
|
40
34
|
let rval = null;
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
Logger.debug('eq: %j -: %s --: %s ---: %j', queryName, variables);
|
|
36
|
+
const opts = this.fullOptions(inOptions);
|
|
43
37
|
try {
|
|
44
|
-
|
|
38
|
+
switch (opts.displayStyle) {
|
|
39
|
+
case GraphqlQueryExecutionDisplayStyle.Silent:
|
|
40
|
+
rval = await this.graphqlRatchet.executeQuery(queryName, variables, opts.authStyle);
|
|
41
|
+
break;
|
|
42
|
+
case GraphqlQueryExecutionDisplayStyle.Monitored:
|
|
43
|
+
rval = await this.processMonitorService.monitorProcessSimple(this.graphqlRatchet.executeQuery(queryName, variables, opts.authStyle), 'Running query', false);
|
|
44
|
+
break;
|
|
45
|
+
case GraphqlQueryExecutionDisplayStyle.Modal:
|
|
46
|
+
rval = await this.processMonitorService.monitorProcessSimple(this.graphqlRatchet.executeQuery(queryName, variables, opts.authStyle), opts.blockMessage ?? 'Running query...', true);
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
throw ErrorRatchet.fErr('Cannot happen - no such display style as %s', opts.displayStyle);
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
catch (err) {
|
|
47
|
-
ErrorRatchet.handleErrorByApproach(err, errorHandling, LoggerLevelName.error, 'GraphQL Error : %s');
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
this.messageService.clear();
|
|
53
|
+
ErrorRatchet.handleErrorByApproach(err, opts.errorHandling, LoggerLevelName.error, 'GraphQL Error : %s');
|
|
51
54
|
}
|
|
52
55
|
return rval;
|
|
53
56
|
}
|
|
54
|
-
async executeMutate(queryName, variables,
|
|
57
|
+
async executeMutate(queryName, variables, inOptions) {
|
|
55
58
|
let rval = null;
|
|
56
|
-
this.
|
|
57
|
-
Logger.
|
|
59
|
+
const opts = this.fullOptions(inOptions);
|
|
60
|
+
Logger.debug('em: %j -: %s --: %s ---: %j', queryName, variables);
|
|
58
61
|
try {
|
|
59
|
-
|
|
62
|
+
switch (opts.displayStyle) {
|
|
63
|
+
case GraphqlQueryExecutionDisplayStyle.Silent:
|
|
64
|
+
rval = await this.graphqlRatchet.executeMutate(queryName, variables, opts.authStyle);
|
|
65
|
+
break;
|
|
66
|
+
case GraphqlQueryExecutionDisplayStyle.Monitored:
|
|
67
|
+
rval = await this.processMonitorService.monitorProcessSimple(this.graphqlRatchet.executeMutate(queryName, variables, opts.authStyle), 'Running query', false);
|
|
68
|
+
break;
|
|
69
|
+
case GraphqlQueryExecutionDisplayStyle.Modal:
|
|
70
|
+
rval = await this.processMonitorService.monitorProcessSimple(this.graphqlRatchet.executeMutate(queryName, variables, opts.authStyle), opts.blockMessage ?? 'Running change...', true);
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
throw ErrorRatchet.fErr('Cannot happen - no such display style as %s', opts.displayStyle);
|
|
74
|
+
}
|
|
60
75
|
}
|
|
61
76
|
catch (err) {
|
|
62
|
-
ErrorRatchet.handleErrorByApproach(err, errorHandling, LoggerLevelName.error, 'GraphQL Error : %s');
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
this.messageService.clear();
|
|
66
|
-
}
|
|
67
|
-
return rval;
|
|
68
|
-
}
|
|
69
|
-
async executeMutateWithBlock(blockMessage, queryName, variables, authStyle = AuthorizationStyle.TokenRequired, errorHandling = ErrorHandlingApproach.LogAndPassThru) {
|
|
70
|
-
let rval = null;
|
|
71
|
-
this.messageService.add({ severity: 'info', summary: 'Running query', detail: queryName, life: 3000 });
|
|
72
|
-
try {
|
|
73
|
-
rval = await BlockUiComponent.runPromiseWithUiBlock(this.dialogService, this.graphqlRatchet.executeMutate(queryName, variables, authStyle), blockMessage);
|
|
74
|
-
}
|
|
75
|
-
catch (err) {
|
|
76
|
-
ErrorRatchet.handleErrorByApproach(err, errorHandling, LoggerLevelName.error, 'GraphQL Error : %s');
|
|
77
|
-
}
|
|
78
|
-
finally {
|
|
79
|
-
this.messageService.clear();
|
|
77
|
+
ErrorRatchet.handleErrorByApproach(err, opts.errorHandling, LoggerLevelName.error, 'GraphQL Error : %s');
|
|
80
78
|
}
|
|
81
79
|
return rval;
|
|
82
80
|
}
|
|
83
|
-
static ɵfac = function GraphqlQueryService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || GraphqlQueryService)(i0.ɵɵinject(i1.GraphqlRatchet), i0.ɵɵinject(i2.
|
|
81
|
+
static ɵfac = function GraphqlQueryService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || GraphqlQueryService)(i0.ɵɵinject(i1.GraphqlRatchet), i0.ɵɵinject(i2.ProcessMonitorService)); };
|
|
84
82
|
static ɵprov = i0.ɵɵdefineInjectable({ token: GraphqlQueryService, factory: GraphqlQueryService.ɵfac, providedIn: 'root' });
|
|
85
83
|
}
|
|
86
84
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(GraphqlQueryService, [{
|
|
87
85
|
type: Injectable,
|
|
88
86
|
args: [{ providedIn: 'root' }]
|
|
89
|
-
}], () => [{ type: i1.GraphqlRatchet }, { type: i2.
|
|
87
|
+
}], () => [{ type: i1.GraphqlRatchet }, { type: i2.ProcessMonitorService }], null); })();
|
|
90
88
|
//# sourceMappingURL=graphql-query.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-query.service.js","sourceRoot":"","sources":["../../src/services/graphql-query.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"graphql-query.service.js","sourceRoot":"","sources":["../../src/services/graphql-query.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAElF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;;;;AAG5E,MAAM,OAAO,mBAAmB;IAEpB;IACA;IAFV,YACU,cAA8B,EAC9B,qBAA4C;QAD5C,mBAAc,GAAd,cAAc,CAAgB;QAC9B,0BAAqB,GAArB,qBAA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A,MAAM;gBACzN,KAAK,iCAAiC,CAAC,KAAK;oBAAE,IAAI,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CACxG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAI,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,EAC1E,IAAI,CAAC,YAAY,IAAI,mBAAmB,EAAC,IAAI,CAAC,CAAC;oBAAC,MAAM;gBACxD;oBACE,MAAM,YAAY,CAAC,IAAI,CAAC,6CAA6C,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAY,CAAC,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;6GArEU,mBAAmB;kDAAnB,mBAAmB,WAAnB,mBAAmB,mBADN,MAAM;;iFACnB,mBAAmB;cAD/B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
export declare function storageFinder(): Storage | null;
|
|
3
|
-
export declare
|
|
4
|
-
|
|
3
|
+
export declare function sessionStorageFinder(): Storage | null;
|
|
4
|
+
export declare class LocalStorageService<LocalType, SessionType> {
|
|
5
|
+
private appName;
|
|
6
|
+
constructor(appName: string);
|
|
5
7
|
get storageReady(): boolean;
|
|
8
|
+
get sessionStorageReady(): boolean;
|
|
9
|
+
private get storageName();
|
|
6
10
|
clear(): void;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
clearSession(): void;
|
|
12
|
+
update(value: LocalType): LocalType;
|
|
13
|
+
updatePartial(value: Partial<LocalType>): LocalType;
|
|
14
|
+
fetch(): LocalType;
|
|
15
|
+
updateSession(value: SessionType): SessionType;
|
|
16
|
+
updateSessionPartial(value: Partial<SessionType>): SessionType;
|
|
17
|
+
fetchSession(): SessionType;
|
|
18
|
+
private updateInternal;
|
|
19
|
+
fetchInternal<T>(storageLabel: string, storage: Storage, ready: boolean): T;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService<any, any>, never>;
|
|
21
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService<any, any>>;
|
|
11
22
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Injectable } from
|
|
1
|
+
import { Inject, Injectable } from "@angular/core";
|
|
2
2
|
import { Logger } from '@bitblit/ratchet-common/logger/logger';
|
|
3
|
+
import { ACUTE_APPLICATION_NAME } from "../constants.js";
|
|
4
|
+
import { RequireRatchet } from "@bitblit/ratchet-common/lang/require-ratchet";
|
|
3
5
|
import * as i0 from "@angular/core";
|
|
4
6
|
export function storageFinder() {
|
|
5
7
|
if (typeof window !== 'undefined') {
|
|
@@ -9,43 +11,90 @@ export function storageFinder() {
|
|
|
9
11
|
}
|
|
10
12
|
return null;
|
|
11
13
|
}
|
|
14
|
+
export function sessionStorageFinder() {
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
if (typeof window.sessionStorage !== 'undefined') {
|
|
17
|
+
return window.sessionStorage;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
12
22
|
export class LocalStorageService {
|
|
13
|
-
|
|
23
|
+
appName;
|
|
24
|
+
constructor(appName) {
|
|
25
|
+
this.appName = appName;
|
|
26
|
+
RequireRatchet.notNullUndefinedOrOnlyWhitespaceString(appName);
|
|
27
|
+
Logger.debug('Starting local storage service with application name %s', this.appName);
|
|
28
|
+
}
|
|
14
29
|
get storageReady() {
|
|
15
30
|
return !!storageFinder();
|
|
16
31
|
}
|
|
32
|
+
get sessionStorageReady() {
|
|
33
|
+
return !!sessionStorageFinder();
|
|
34
|
+
}
|
|
35
|
+
get storageName() {
|
|
36
|
+
return this.appName + 'AcuteLocalStorage';
|
|
37
|
+
}
|
|
17
38
|
clear() {
|
|
18
39
|
this.update({});
|
|
19
40
|
}
|
|
41
|
+
clearSession() {
|
|
42
|
+
this.updateSession({});
|
|
43
|
+
}
|
|
20
44
|
update(value) {
|
|
21
|
-
|
|
45
|
+
return this.updateInternal(value, 'local', storageFinder(), this.storageReady);
|
|
46
|
+
}
|
|
47
|
+
updatePartial(value) {
|
|
48
|
+
const oldValue = this.fetch();
|
|
49
|
+
const newValue = Object.assign({}, oldValue, value);
|
|
50
|
+
return this.update(newValue);
|
|
51
|
+
}
|
|
52
|
+
fetch() {
|
|
53
|
+
return this.fetchInternal('local', storageFinder(), this.storageReady);
|
|
54
|
+
}
|
|
55
|
+
updateSession(value) {
|
|
56
|
+
return this.updateInternal(value, 'session', sessionStorageFinder(), this.sessionStorageReady);
|
|
57
|
+
}
|
|
58
|
+
updateSessionPartial(value) {
|
|
59
|
+
const oldValue = this.fetchSession();
|
|
60
|
+
const newValue = Object.assign({}, oldValue, value);
|
|
61
|
+
return this.updateSession(newValue);
|
|
62
|
+
}
|
|
63
|
+
fetchSession() {
|
|
64
|
+
return this.fetchInternal('session', sessionStorageFinder(), this.sessionStorageReady);
|
|
65
|
+
}
|
|
66
|
+
updateInternal(value, storageLabel, storage, ready) {
|
|
67
|
+
if (ready) {
|
|
22
68
|
const toSave = value || {};
|
|
23
69
|
const saveString = JSON.stringify(toSave);
|
|
24
|
-
Logger.info('Updating
|
|
25
|
-
|
|
70
|
+
Logger.info('Updating %s to %s', storageLabel, saveString);
|
|
71
|
+
storage.setItem(this.storageName, saveString);
|
|
26
72
|
return toSave;
|
|
27
73
|
}
|
|
28
74
|
else {
|
|
29
|
-
Logger.info('Skipping update - storage not ready : %j', value);
|
|
75
|
+
Logger.info('Skipping update - %s storage not ready : %j', storageLabel, value);
|
|
30
76
|
return {};
|
|
31
77
|
}
|
|
32
78
|
}
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
const loadString =
|
|
79
|
+
fetchInternal(storageLabel, storage, ready) {
|
|
80
|
+
if (ready) {
|
|
81
|
+
const loadString = storage.getItem(this.storageName) || '{}';
|
|
36
82
|
const rval = JSON.parse(loadString);
|
|
37
83
|
return rval;
|
|
38
84
|
}
|
|
39
85
|
else {
|
|
40
|
-
Logger.info('Skipping fetch - storage not ready');
|
|
86
|
+
Logger.info('Skipping %s fetch - storage not ready', storageLabel);
|
|
41
87
|
return {};
|
|
42
88
|
}
|
|
43
89
|
}
|
|
44
|
-
static ɵfac = function LocalStorageService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalStorageService)(); };
|
|
90
|
+
static ɵfac = function LocalStorageService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalStorageService)(i0.ɵɵinject(ACUTE_APPLICATION_NAME)); };
|
|
45
91
|
static ɵprov = i0.ɵɵdefineInjectable({ token: LocalStorageService, factory: LocalStorageService.ɵfac, providedIn: 'root' });
|
|
46
92
|
}
|
|
47
93
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LocalStorageService, [{
|
|
48
94
|
type: Injectable,
|
|
49
95
|
args: [{ providedIn: 'root' }]
|
|
50
|
-
}],
|
|
96
|
+
}], () => [{ type: undefined, decorators: [{
|
|
97
|
+
type: Inject,
|
|
98
|
+
args: [ACUTE_APPLICATION_NAME]
|
|
99
|
+
}] }], null); })();
|
|
51
100
|
//# sourceMappingURL=local-storage.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.service.js","sourceRoot":"","sources":["../../src/services/local-storage.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"local-storage.service.js","sourceRoot":"","sources":["../../src/services/local-storage.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACn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IAAI,CAAC,mBAAmB,EAAC,YAAY,EAAC,UAAU,CAAC,CAAC;YACzD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,6CAA6C,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;YAChF,OAAO,EAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAEM,aAAa,CAAI,YAAoB,EAAE,OAAgB,EAAE,KAAc;QAC5E,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,UAAU,GAAW,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC;YACrE,MAAM,IAAI,GAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAM,CAAC;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE,YAAY,CAAC,CAAC;YACnE,OAAO,EAAO,CAAC;QACjB,CAAC;IACH,CAAC;6GA7EU,mBAAmB,cAEV,sBAAsB;kDAF/B,mBAAmB,WAAnB,mBAAmB,mBADN,MAAM;;iFACnB,mBAAmB;cAD/B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;sBAGnB,MAAM;uBAAC,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitored-processes.js","sourceRoot":"","sources":["../../../src/services/process-monitor/monitored-processes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProcessMonitorState } from "./process-monitor-state";
|
|
2
|
+
import { WritableSignal } from "@angular/core";
|
|
3
|
+
export interface ProcessHolder<T> {
|
|
4
|
+
guid: string;
|
|
5
|
+
proc: Promise<T>;
|
|
6
|
+
input: WritableSignal<ProcessMonitorState>;
|
|
7
|
+
group: string;
|
|
8
|
+
modal: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-holder.js","sourceRoot":"","sources":["../../../src/services/process-monitor/process-holder.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var ProcessMonitorDisplayMode;
|
|
2
|
+
(function (ProcessMonitorDisplayMode) {
|
|
3
|
+
ProcessMonitorDisplayMode["Standard"] = "Standard";
|
|
4
|
+
ProcessMonitorDisplayMode["Modal"] = "Modal";
|
|
5
|
+
})(ProcessMonitorDisplayMode || (ProcessMonitorDisplayMode = {}));
|
|
6
|
+
//# sourceMappingURL=process-monitor-display-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-monitor-display-mode.js","sourceRoot":"","sources":["../../../src/services/process-monitor/process-monitor-display-mode.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,kDAAqB,CAAA;IACrB,4CAAe,CAAA;AACjB,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,QAGpC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Signal, WritableSignal } from "@angular/core";
|
|
2
|
+
import { ProcessMonitorState } from './process-monitor-state';
|
|
3
|
+
import { ProcessHolder } from "./process-holder";
|
|
4
|
+
import { MonitoredProcesses } from "./monitored-processes.ts";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class ProcessMonitorService {
|
|
7
|
+
static readonly DEFAULT_GROUP: string;
|
|
8
|
+
private _defaultLabel;
|
|
9
|
+
private processes;
|
|
10
|
+
hasModalProcesses(): Signal<boolean>;
|
|
11
|
+
hasStandardProcesses(): Signal<boolean>;
|
|
12
|
+
modalProcesses(): Signal<MonitoredProcesses>;
|
|
13
|
+
standardProcesses(): Signal<MonitoredProcesses>;
|
|
14
|
+
get defaultLabel(): string;
|
|
15
|
+
set defaultLabel(val: string);
|
|
16
|
+
fafMonitorProcessDefaultLabel<T>(promise: Promise<T>, modal?: boolean): void;
|
|
17
|
+
fafMonitorProcessSimple<T>(promise: Promise<T>, label: string, modal?: boolean): void;
|
|
18
|
+
fafMonitorProcess<T>(promise: Promise<T>, descriptor: ProcessMonitorState | WritableSignal<ProcessMonitorState>, modal?: boolean): void;
|
|
19
|
+
monitorProcessDefaultLabel<T>(promise: Promise<T>, modal?: boolean): Promise<T>;
|
|
20
|
+
monitorProcessSimple<T>(promise: Promise<T>, label: string, modal?: boolean): Promise<T>;
|
|
21
|
+
monitorProcess<T>(promise: Promise<T>, descriptor: ProcessMonitorState | WritableSignal<ProcessMonitorState>, modal?: boolean): Promise<T>;
|
|
22
|
+
monitorProcessWithUpdate<T>(promise: Promise<T>, descriptor: ProcessMonitorState | WritableSignal<ProcessMonitorState>, modal?: boolean): ProcessHolder<T>;
|
|
23
|
+
updatePercentCompleteByGuid(guid: string, pct: number): void;
|
|
24
|
+
updateLabelByGuid(guid: string, newLabel: string): void;
|
|
25
|
+
updateDetailByGuid(guid: string, newDetail: string): void;
|
|
26
|
+
static updateSignalPercent(inp: WritableSignal<ProcessMonitorState>, pct: number): void;
|
|
27
|
+
static updateSignalLabel(inp: WritableSignal<ProcessMonitorState>, newLabel: string): void;
|
|
28
|
+
static updateSignalDetail(inp: WritableSignal<ProcessMonitorState>, newDetail: string): void;
|
|
29
|
+
private innerMonitorProcess;
|
|
30
|
+
static labelToProcessInput(label: string): ProcessMonitorState;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ProcessMonitorService, never>;
|
|
32
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ProcessMonitorService>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { computed, Injectable, signal } from "@angular/core";
|
|
2
|
+
import { RequireRatchet } from "@bitblit/ratchet-common/lang/require-ratchet";
|
|
3
|
+
import { StringRatchet } from "@bitblit/ratchet-common/lang/string-ratchet";
|
|
4
|
+
import { No } from "@bitblit/ratchet-common/lang/no";
|
|
5
|
+
import { Logger } from "@bitblit/ratchet-common/logger/logger";
|
|
6
|
+
import { AcuteCommonTypeGuards } from "../../acute-common-type-guards.js";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export class ProcessMonitorService {
|
|
9
|
+
static DEFAULT_GROUP = 'Long-Running Process';
|
|
10
|
+
_defaultLabel = 'Processing...';
|
|
11
|
+
processes = signal({ processes: [] }, ...(ngDevMode ? [{ debugName: "processes" }] : []));
|
|
12
|
+
hasModalProcesses() {
|
|
13
|
+
return computed(() => {
|
|
14
|
+
const rval = this.modalProcesses()().processes.length > 0;
|
|
15
|
+
return rval;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
hasStandardProcesses() {
|
|
19
|
+
return computed(() => {
|
|
20
|
+
const rval = this.standardProcesses()().processes.length > 0;
|
|
21
|
+
return rval;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
modalProcesses() {
|
|
25
|
+
const rval = computed(() => {
|
|
26
|
+
const r = this.processes().processes;
|
|
27
|
+
const modalOnly = r.filter(s => s.modal);
|
|
28
|
+
return { processes: modalOnly };
|
|
29
|
+
}, ...(ngDevMode ? [{ debugName: "rval" }] : []));
|
|
30
|
+
return rval;
|
|
31
|
+
}
|
|
32
|
+
standardProcesses() {
|
|
33
|
+
return computed(() => {
|
|
34
|
+
const r = this.processes().processes;
|
|
35
|
+
const modalOnly = r.filter(s => !s.modal);
|
|
36
|
+
return { processes: modalOnly };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
get defaultLabel() {
|
|
40
|
+
return this._defaultLabel;
|
|
41
|
+
}
|
|
42
|
+
set defaultLabel(val) {
|
|
43
|
+
this._defaultLabel = val;
|
|
44
|
+
}
|
|
45
|
+
fafMonitorProcessDefaultLabel(promise, modal) {
|
|
46
|
+
this.monitorProcessSimple(promise, this.defaultLabel, modal).then(No.op);
|
|
47
|
+
}
|
|
48
|
+
fafMonitorProcessSimple(promise, label, modal) {
|
|
49
|
+
this.monitorProcessSimple(promise, label, modal).then(No.op);
|
|
50
|
+
}
|
|
51
|
+
fafMonitorProcess(promise, descriptor, modal) {
|
|
52
|
+
this.monitorProcess(promise, descriptor, modal).then(No.op);
|
|
53
|
+
}
|
|
54
|
+
monitorProcessDefaultLabel(promise, modal) {
|
|
55
|
+
return this.monitorProcessSimple(promise, this.defaultLabel, modal);
|
|
56
|
+
}
|
|
57
|
+
monitorProcessSimple(promise, label, modal) {
|
|
58
|
+
return this.monitorProcess(promise, ProcessMonitorService.labelToProcessInput(label), modal);
|
|
59
|
+
}
|
|
60
|
+
monitorProcess(promise, descriptor, modal) {
|
|
61
|
+
const val = this.innerMonitorProcess(promise, descriptor, modal);
|
|
62
|
+
return val.proc;
|
|
63
|
+
}
|
|
64
|
+
monitorProcessWithUpdate(promise, descriptor, modal) {
|
|
65
|
+
return this.innerMonitorProcess(promise, descriptor, modal);
|
|
66
|
+
}
|
|
67
|
+
updatePercentCompleteByGuid(guid, pct) {
|
|
68
|
+
const old = this.processes();
|
|
69
|
+
const tgt = old.processes.find(s => s.guid === guid);
|
|
70
|
+
if (tgt) {
|
|
71
|
+
ProcessMonitorService.updateSignalPercent(tgt.input, pct);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
Logger.warn('Could not find process with guid %s to update', guid);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
updateLabelByGuid(guid, newLabel) {
|
|
78
|
+
const old = this.processes();
|
|
79
|
+
const tgt = old.processes.find(s => s.guid === guid);
|
|
80
|
+
if (tgt) {
|
|
81
|
+
ProcessMonitorService.updateSignalLabel(tgt.input, newLabel);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
Logger.warn('Could not find process with guid %s to update', guid);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
updateDetailByGuid(guid, newDetail) {
|
|
88
|
+
const old = this.processes();
|
|
89
|
+
const tgt = old.processes.find(s => s.guid === guid);
|
|
90
|
+
if (tgt) {
|
|
91
|
+
ProcessMonitorService.updateSignalDetail(tgt.input, newDetail);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
Logger.warn('Could not find process with guid %s to update', guid);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static updateSignalPercent(inp, pct) {
|
|
98
|
+
const old = inp();
|
|
99
|
+
old.percentComplete = pct;
|
|
100
|
+
inp.set(old);
|
|
101
|
+
}
|
|
102
|
+
static updateSignalLabel(inp, newLabel) {
|
|
103
|
+
const old = inp();
|
|
104
|
+
old.label = newLabel;
|
|
105
|
+
inp.set(old);
|
|
106
|
+
}
|
|
107
|
+
static updateSignalDetail(inp, newDetail) {
|
|
108
|
+
const old = inp();
|
|
109
|
+
old.detail = newDetail;
|
|
110
|
+
inp.set(old);
|
|
111
|
+
}
|
|
112
|
+
innerMonitorProcess(promise, descriptor, modal = false) {
|
|
113
|
+
RequireRatchet.notNullOrUndefined(promise, 'promise');
|
|
114
|
+
RequireRatchet.notNullOrUndefined(descriptor, 'descriptor');
|
|
115
|
+
const guid = StringRatchet.createRandomHexString(10);
|
|
116
|
+
const descSig = AcuteCommonTypeGuards.isProcessMonitorState(descriptor) ? signal(descriptor) : descriptor;
|
|
117
|
+
const wrapped = promise.finally(() => {
|
|
118
|
+
Logger.info('Process %s finished - removing', holder.guid);
|
|
119
|
+
const newProc = this.processes().processes.filter(s => s.guid !== guid);
|
|
120
|
+
this.processes.set({ processes: newProc });
|
|
121
|
+
});
|
|
122
|
+
const holder = {
|
|
123
|
+
guid: guid,
|
|
124
|
+
proc: wrapped,
|
|
125
|
+
input: descSig,
|
|
126
|
+
group: ProcessMonitorService.DEFAULT_GROUP,
|
|
127
|
+
modal: modal
|
|
128
|
+
};
|
|
129
|
+
const oldProc = this.processes().processes;
|
|
130
|
+
oldProc.push(holder);
|
|
131
|
+
this.processes.set({ processes: oldProc });
|
|
132
|
+
return holder;
|
|
133
|
+
}
|
|
134
|
+
static labelToProcessInput(label) {
|
|
135
|
+
return {
|
|
136
|
+
label: label,
|
|
137
|
+
detail: null,
|
|
138
|
+
percentComplete: null
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static ɵfac = function ProcessMonitorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ProcessMonitorService)(); };
|
|
142
|
+
static ɵprov = i0.ɵɵdefineInjectable({ token: ProcessMonitorService, factory: ProcessMonitorService.ɵfac, providedIn: 'root' });
|
|
143
|
+
}
|
|
144
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProcessMonitorService, [{
|
|
145
|
+
type: Injectable,
|
|
146
|
+
args: [{ providedIn: 'root' }]
|
|
147
|
+
}], null, null); })();
|
|
148
|
+
//# sourceMappingURL=process-monitor-service.js.map
|