@kosdev-code/kos-ddk-models 0.1.0-dev.5882 → 0.1.0-dev.63
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/constants.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3224 -1
- package/index.js.map +1 -0
- package/index.mjs +2313 -1598
- package/index.mjs.map +1 -0
- package/lib/agitation-control/agitation-control-model.d.ts +4 -5
- package/lib/agitation-control/agitation-control-model.d.ts.map +1 -1
- package/lib/agitation-control/agitation-control-registration.d.ts +2 -3
- package/lib/agitation-control/agitation-control-registration.d.ts.map +1 -1
- package/lib/agitation-control/index.d.ts.map +1 -1
- package/lib/agitation-control/types/index.d.ts +1 -3
- package/lib/animation/animation-model.d.ts +1 -2
- package/lib/animation/animation-model.d.ts.map +1 -1
- package/lib/animation/animation-registration.d.ts +1 -2
- package/lib/animation/animation-registration.d.ts.map +1 -1
- package/lib/animation/index.d.ts.map +1 -1
- package/lib/animation/services/animation-services.d.ts +1 -1
- package/lib/animation/services/animation-services.d.ts.map +1 -1
- package/lib/animation/services/index.d.ts.map +1 -1
- package/lib/animation/types/index.d.ts +1 -3
- package/lib/application/application-model.d.ts +5 -6
- package/lib/application/application-model.d.ts.map +1 -1
- package/lib/application/application-registration.d.ts +1 -2
- package/lib/application/application-registration.d.ts.map +1 -1
- package/lib/application/index.d.ts.map +1 -1
- package/lib/application/services/application-services.d.ts +3 -3
- package/lib/application/services/application-services.d.ts.map +1 -1
- package/lib/application/services/index.d.ts.map +1 -1
- package/lib/application/types/index.d.ts +2 -4
- package/lib/auth/auth-model.d.ts +2 -3
- package/lib/auth/auth-model.d.ts.map +1 -1
- package/lib/auth/auth-registration.d.ts +1 -2
- package/lib/auth/auth-registration.d.ts.map +1 -1
- package/lib/auth/index.d.ts.map +1 -1
- package/lib/auth/services/auth-services.d.ts +1 -2
- package/lib/auth/services/auth-services.d.ts.map +1 -1
- package/lib/auth/services/index.d.ts.map +1 -1
- package/lib/auth/types/index.d.ts +1 -3
- package/lib/carb-water/carb-water-model.d.ts +4 -5
- package/lib/carb-water/carb-water-model.d.ts.map +1 -1
- package/lib/carb-water/carb-water-registration.d.ts +2 -3
- package/lib/carb-water/carb-water-registration.d.ts.map +1 -1
- package/lib/carb-water/index.d.ts.map +1 -1
- package/lib/carb-water/services/carb-water-services.d.ts.map +1 -1
- package/lib/carb-water/services/index.d.ts.map +1 -1
- package/lib/copy-logs/copy-logs-model.d.ts +4 -5
- package/lib/copy-logs/copy-logs-model.d.ts.map +1 -1
- package/lib/copy-logs/index.d.ts +1 -1
- package/lib/copy-logs/index.d.ts.map +1 -1
- package/lib/copy-logs/services/copy-logs-services.d.ts +1 -2
- package/lib/copy-logs/services/copy-logs-services.d.ts.map +1 -1
- package/lib/copy-logs/services/index.d.ts.map +1 -1
- package/lib/dashboard-operations/dashboard-operations-model.d.ts +4 -5
- package/lib/dashboard-operations/dashboard-operations-model.d.ts.map +1 -1
- package/lib/dashboard-operations/dashboard-operations-registration.d.ts +1 -2
- package/lib/dashboard-operations/dashboard-operations-registration.d.ts.map +1 -1
- package/lib/dashboard-operations/index.d.ts.map +1 -1
- package/lib/dashboard-operations/services/dashboard-operations-services.d.ts +2 -2
- package/lib/dashboard-operations/services/dashboard-operations-services.d.ts.map +1 -1
- package/lib/dashboard-operations/services/index.d.ts.map +1 -1
- package/lib/dashboard-operations/types/index.d.ts +1 -3
- package/lib/dispenser/dispenser-model.d.ts +1 -2
- package/lib/dispenser/dispenser-model.d.ts.map +1 -1
- package/lib/dispenser/dispenser-registration.d.ts +1 -2
- package/lib/dispenser/dispenser-registration.d.ts.map +1 -1
- package/lib/dispenser/index.d.ts.map +1 -1
- package/lib/dispenser/services/dispenser-services.d.ts +1 -1
- package/lib/dispenser/services/dispenser-services.d.ts.map +1 -1
- package/lib/dispenser/services/index.d.ts.map +1 -1
- package/lib/dispenser/types/index.d.ts +1 -3
- package/lib/dispenser-info/dispenser-info-model.d.ts +1 -2
- package/lib/dispenser-info/dispenser-info-model.d.ts.map +1 -1
- package/lib/dispenser-info/dispenser-info-registration.d.ts +1 -2
- package/lib/dispenser-info/dispenser-info-registration.d.ts.map +1 -1
- package/lib/dispenser-info/index.d.ts.map +1 -1
- package/lib/dispenser-info/services/dispenser-info-services.d.ts +1 -1
- package/lib/dispenser-info/services/dispenser-info-services.d.ts.map +1 -1
- package/lib/dispenser-info/services/index.d.ts.map +1 -1
- package/lib/dispenser-info/types/index.d.ts +1 -3
- package/lib/door/door-model.d.ts +1 -2
- package/lib/door/door-model.d.ts.map +1 -1
- package/lib/door/door-registration.d.ts +2 -3
- package/lib/door/door-registration.d.ts.map +1 -1
- package/lib/door/index.d.ts.map +1 -1
- package/lib/enrollment/enrollment-model.d.ts +1 -2
- package/lib/enrollment/enrollment-model.d.ts.map +1 -1
- package/lib/enrollment/enrollment-registration.d.ts +1 -2
- package/lib/enrollment/enrollment-registration.d.ts.map +1 -1
- package/lib/enrollment/index.d.ts.map +1 -1
- package/lib/enrollment/services/enrollment-services.d.ts +1 -1
- package/lib/enrollment/services/enrollment-services.d.ts.map +1 -1
- package/lib/enrollment/services/index.d.ts.map +1 -1
- package/lib/enrollment/types/index.d.ts +1 -3
- package/lib/extension/index.d.ts.map +1 -1
- package/lib/ingredient-summary/index.d.ts.map +1 -1
- package/lib/ingredient-summary/ingredient-summary-model.d.ts +4 -5
- package/lib/ingredient-summary/ingredient-summary-model.d.ts.map +1 -1
- package/lib/ingredient-summary/ingredient-summary-registration.d.ts +1 -2
- package/lib/ingredient-summary/ingredient-summary-registration.d.ts.map +1 -1
- package/lib/ingredient-summary/types/index.d.ts +2 -4
- package/lib/lockout/index.d.ts.map +1 -1
- package/lib/lockout/lockout-model.d.ts +1 -2
- package/lib/lockout/lockout-model.d.ts.map +1 -1
- package/lib/lockout/lockout-registration.d.ts +2 -3
- package/lib/lockout/lockout-registration.d.ts.map +1 -1
- package/lib/lockout/services/index.d.ts.map +1 -1
- package/lib/lockout/services/lockout-services.d.ts +1 -1
- package/lib/lockout/services/lockout-services.d.ts.map +1 -1
- package/lib/macro-assignment/index.d.ts.map +1 -1
- package/lib/macro-assignment/macro-assignment-model.d.ts +5 -6
- package/lib/macro-assignment/macro-assignment-model.d.ts.map +1 -1
- package/lib/macro-assignment/macro-assignment-registration.d.ts +1 -2
- package/lib/macro-assignment/macro-assignment-registration.d.ts.map +1 -1
- package/lib/macro-assignment/services/index.d.ts.map +1 -1
- package/lib/macro-assignment/services/macro-assignment-services.d.ts +1 -1
- package/lib/macro-assignment/services/macro-assignment-services.d.ts.map +1 -1
- package/lib/macro-assignment/types/index.d.ts +2 -4
- package/lib/mock/ddk-mock.d.ts +60 -0
- package/lib/mock/ddk-mock.d.ts.map +1 -0
- package/lib/mock/index.d.ts +3 -0
- package/lib/mock/index.d.ts.map +1 -0
- package/lib/mock/ncui-mock-data.d.ts +29 -0
- package/lib/mock/ncui-mock-data.d.ts.map +1 -0
- package/lib/network-test/index.d.ts.map +1 -1
- package/lib/network-test/network-test-container-model.d.ts +3 -4
- package/lib/network-test/network-test-container-model.d.ts.map +1 -1
- package/lib/network-test/network-test-container-registration.d.ts +1 -2
- package/lib/network-test/network-test-container-registration.d.ts.map +1 -1
- package/lib/network-test/network-test-model.d.ts +2 -3
- package/lib/network-test/network-test-model.d.ts.map +1 -1
- package/lib/network-test/network-test-registration.d.ts +1 -2
- package/lib/network-test/network-test-registration.d.ts.map +1 -1
- package/lib/network-test/services/index.d.ts.map +1 -1
- package/lib/network-test/services/network-test-services.d.ts +2 -3
- package/lib/network-test/services/network-test-services.d.ts.map +1 -1
- package/lib/network-test/types/index.d.ts +1 -3
- package/lib/nutritive-sweetener/index.d.ts.map +1 -1
- package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts +7 -8
- package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts.map +1 -1
- package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts +2 -3
- package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts.map +1 -1
- package/lib/nutritive-sweetener/services/index.d.ts.map +1 -1
- package/lib/nutritive-sweetener/services/nutritive-sweetener-services.d.ts.map +1 -1
- package/lib/plain-water/index.d.ts.map +1 -1
- package/lib/plain-water/plain-water-model.d.ts +5 -6
- package/lib/plain-water/plain-water-model.d.ts.map +1 -1
- package/lib/plain-water/plain-water-registration.d.ts +2 -3
- package/lib/plain-water/plain-water-registration.d.ts.map +1 -1
- package/lib/plain-water/services/index.d.ts.map +1 -1
- package/lib/plain-water/services/plain-water-services.d.ts.map +1 -1
- package/lib/reboot/index.d.ts.map +1 -1
- package/lib/reboot/reboot-model.d.ts +1 -2
- package/lib/reboot/reboot-model.d.ts.map +1 -1
- package/lib/reboot/reboot-registration.d.ts +1 -2
- package/lib/reboot/reboot-registration.d.ts.map +1 -1
- package/lib/reboot/services/index.d.ts.map +1 -1
- package/lib/reboot/services/reboot-services.d.ts +1 -1
- package/lib/reboot/services/reboot-services.d.ts.map +1 -1
- package/lib/reboot/types/index.d.ts +1 -3
- package/lib/registration.d.ts +1 -2
- package/lib/registration.d.ts.map +1 -1
- package/lib/settings/index.d.ts.map +1 -1
- package/lib/settings/services/index.d.ts.map +1 -1
- package/lib/settings/services/settings-services.d.ts +2 -3
- package/lib/settings/services/settings-services.d.ts.map +1 -1
- package/lib/settings/settings-model.d.ts +1 -2
- package/lib/settings/settings-model.d.ts.map +1 -1
- package/lib/settings/settings-registration.d.ts +1 -2
- package/lib/settings/settings-registration.d.ts.map +1 -1
- package/lib/settings/types/index.d.ts +1 -3
- package/lib/setup-step/index.d.ts.map +1 -1
- package/lib/setup-step/services/index.d.ts.map +1 -1
- package/lib/setup-step/services/setup-step-services.d.ts +2 -2
- package/lib/setup-step/services/setup-step-services.d.ts.map +1 -1
- package/lib/setup-step/setup-step-container-model.d.ts +3 -4
- package/lib/setup-step/setup-step-container-model.d.ts.map +1 -1
- package/lib/setup-step/setup-step-container-registration.d.ts +1 -2
- package/lib/setup-step/setup-step-container-registration.d.ts.map +1 -1
- package/lib/setup-step/setup-step-model.d.ts +1 -2
- package/lib/setup-step/setup-step-model.d.ts.map +1 -1
- package/lib/setup-step/setup-step-registration.d.ts +1 -2
- package/lib/setup-step/setup-step-registration.d.ts.map +1 -1
- package/lib/setup-step/types/index.d.ts +1 -3
- package/lib/trouble-action/index.d.ts.map +1 -1
- package/lib/trouble-action/trouble-action-model.d.ts +5 -5
- package/lib/trouble-action/trouble-action-model.d.ts.map +1 -1
- package/lib/utilities/index.d.ts.map +1 -1
- package/lib/utilities/services/index.d.ts.map +1 -1
- package/lib/utilities/services/utilities-services.d.ts.map +1 -1
- package/lib/utilities/types/index.d.ts +1 -3
- package/lib/utilities/utilities-container-model.d.ts +1 -2
- package/lib/utilities/utilities-container-model.d.ts.map +1 -1
- package/lib/utilities/utilities-container-registration.d.ts +1 -2
- package/lib/utilities/utilities-container-registration.d.ts.map +1 -1
- package/lib/utilities/utilities-model.d.ts +1 -2
- package/lib/utilities/utilities-model.d.ts.map +1 -1
- package/lib/utilities/utilities-registration.d.ts +1 -2
- package/lib/utilities/utilities-registration.d.ts.map +1 -1
- package/lib/utils/assembly-utils.d.ts +2 -3
- package/lib/utils/assembly-utils.d.ts.map +1 -1
- package/lib/utils/holder-view-extension.d.ts +1 -2
- package/lib/utils/holder-view-extension.d.ts.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/time-utils.d.ts.map +1 -1
- package/lib/utils/trouble-visibility-filter.d.ts +1 -2
- package/lib/utils/trouble-visibility-filter.d.ts.map +1 -1
- package/package.json +5 -5
- package/start/index.d.ts.map +1 -1
- package/start/services/index.d.ts.map +1 -1
- package/start/services/start-services.d.ts +1 -1
- package/start/services/start-services.d.ts.map +1 -1
- package/start/start-model.d.ts +1 -2
- package/start/start-model.d.ts.map +1 -1
- package/start/start-registration.d.ts +2 -3
- package/start/start-registration.d.ts.map +1 -1
- package/types/global.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/utils/openapi-index.d.ts.map +1 -1
- package/utils/services/kosdev.ddk/snapshot/service.d.ts +47 -48
- package/utils/services/kosdev.ddk/snapshot/service.d.ts.map +1 -1
- package/utils/services-index.d.ts.map +1 -1
- package/kos-models.json +0 -358
package/index.mjs
CHANGED
|
@@ -1,39 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
basePath: `${
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { resolveServiceUrl, ServiceFactory, KosLog, kosTopicHandler, kosModel, kosAction, Kos, isKosModel, createPropKey, kosStateProp, kosConfigProperty, KosModelRegistrationFactory, kosDependency, KosModelContainer, resolveContainerDeltas, kosChild, Device, kosFuture, kosModelEffect, MultipleFutureHandler, FutureEndState, TroubleServices, Troubles, SingletonKosModelRegistrationFactory, getKosCompanionModel, FetchError, StorageDeviceContainer, kosFutureAware, kosLoggerAware, KosDataContainer, TroubleContainer, FutureHandler, troubleByTypeReducer, registerExtensionPoint, ExtensionManager, kosConfigBean, kosStateBean, ObservableData } from "@kosdev-code/kos-ui-sdk";
|
|
2
|
+
import { AGITATION_REQUIRED_TROUBLE, CartridgeAgitatorEvents, FcmPump, FreestyleHolder } from "@kosdev-code/kos-freestyle-sdk";
|
|
3
|
+
import { Assembly, HolderContainer, IngredientContainer } from "@kosdev-code/kos-dispense-sdk";
|
|
4
|
+
const TROUBLE_TYPE_PURGE$1 = "PurgeTrouble";
|
|
5
|
+
const TROUBLE_TYPE_PRIME$1 = "PrimeTrouble";
|
|
6
|
+
const { URL: URL$d } = resolveServiceUrl("AUTH_SERVICE");
|
|
7
|
+
const { getOne: getOne$4, postModel: postModel$4 } = ServiceFactory.build({
|
|
8
|
+
basePath: `${URL$d}/api/auth`
|
|
9
|
+
});
|
|
10
|
+
const log$f = KosLog.createLogger({ name: "auth-service", group: "Services" });
|
|
11
|
+
const getCurrentRole = async () => {
|
|
12
|
+
log$f.debug("sending GET for auth");
|
|
13
|
+
const response = await getOne$4({
|
|
14
|
+
urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/role`
|
|
15
|
+
});
|
|
16
|
+
return response;
|
|
17
|
+
};
|
|
18
|
+
const sendPinCode = async (pinCode) => {
|
|
19
|
+
log$f.debug("sending POST for auth");
|
|
20
|
+
const response = await postModel$4({
|
|
21
|
+
urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/pincode/${pinCode}`,
|
|
22
|
+
model: {}
|
|
23
|
+
});
|
|
24
|
+
return response;
|
|
25
|
+
};
|
|
26
|
+
const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
15
27
|
__proto__: null,
|
|
16
|
-
getCurrentRole
|
|
17
|
-
sendPinCode
|
|
28
|
+
getCurrentRole,
|
|
29
|
+
sendPinCode
|
|
18
30
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
var __defProp$j = Object.defineProperty;
|
|
32
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
33
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
34
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
35
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36
|
+
if (decorator = decorators[i])
|
|
37
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
38
|
+
if (kind && result) __defProp$j(target, key, result);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
const MODEL_TYPE$p = "auth-model";
|
|
42
|
+
const convertAuthResponse = (response) => response.toLowerCase();
|
|
43
|
+
let AuthModelImpl = class {
|
|
44
|
+
id;
|
|
45
|
+
logger;
|
|
46
|
+
currentRole;
|
|
47
|
+
constructor(modelId, options, context) {
|
|
48
|
+
this.id = modelId;
|
|
49
|
+
this.logger = context.logger;
|
|
50
|
+
this.currentRole = "crew";
|
|
51
|
+
}
|
|
52
|
+
async authorize(pinCode) {
|
|
53
|
+
if (!pinCode) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const response = await sendPinCode(pinCode);
|
|
57
|
+
if (response?.status === 200) {
|
|
58
|
+
return response.data;
|
|
59
|
+
} else {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
37
62
|
}
|
|
38
63
|
// -------------------LIFECYCLE----------------------------
|
|
39
64
|
async init() {
|
|
@@ -41,112 +66,158 @@ let he = class {
|
|
|
41
66
|
}
|
|
42
67
|
async load() {
|
|
43
68
|
this.logger.debug(`loading auth ${this.id}`);
|
|
44
|
-
const
|
|
45
|
-
(
|
|
46
|
-
this.
|
|
47
|
-
|
|
69
|
+
const response = await getCurrentRole();
|
|
70
|
+
if (response?.status === 200) {
|
|
71
|
+
this.logger.debug(`response ${response.data}`);
|
|
72
|
+
kosAction(() => {
|
|
73
|
+
this.currentRole = convertAuthResponse(response.data);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
48
76
|
}
|
|
49
|
-
handleRoleChange(
|
|
50
|
-
this.currentRole =
|
|
77
|
+
handleRoleChange(role) {
|
|
78
|
+
this.currentRole = convertAuthResponse(role);
|
|
51
79
|
}
|
|
52
|
-
forceRole(
|
|
53
|
-
this.currentRole =
|
|
80
|
+
forceRole(role) {
|
|
81
|
+
this.currentRole = role;
|
|
54
82
|
}
|
|
55
83
|
};
|
|
56
|
-
$
|
|
57
|
-
|
|
84
|
+
__decorateClass$p([
|
|
85
|
+
kosTopicHandler({
|
|
58
86
|
topic: "/app/kosdev.ddk/auth/role",
|
|
59
|
-
websocket:
|
|
87
|
+
websocket: true
|
|
60
88
|
})
|
|
61
|
-
],
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
],
|
|
65
|
-
const
|
|
89
|
+
], AuthModelImpl.prototype, "handleRoleChange", 1);
|
|
90
|
+
AuthModelImpl = __decorateClass$p([
|
|
91
|
+
kosModel(MODEL_TYPE$p)
|
|
92
|
+
], AuthModelImpl);
|
|
93
|
+
const Auth = {
|
|
66
94
|
registration: {
|
|
67
|
-
[
|
|
68
|
-
class:
|
|
69
|
-
singleton:
|
|
95
|
+
[MODEL_TYPE$p]: {
|
|
96
|
+
class: AuthModelImpl,
|
|
97
|
+
singleton: false
|
|
70
98
|
}
|
|
71
99
|
},
|
|
72
|
-
type:
|
|
73
|
-
predicate:
|
|
74
|
-
factory:
|
|
75
|
-
};
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
type: MODEL_TYPE$p,
|
|
101
|
+
predicate: isKosModel(MODEL_TYPE$p),
|
|
102
|
+
factory: Kos.Factory.create(MODEL_TYPE$p)
|
|
103
|
+
};
|
|
104
|
+
var __defProp$i = Object.defineProperty;
|
|
105
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
106
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
107
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
108
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
109
|
+
if (decorator = decorators[i])
|
|
110
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
111
|
+
if (kind && result) __defProp$i(target, key, result);
|
|
112
|
+
return result;
|
|
113
|
+
};
|
|
114
|
+
const MODEL_TYPE$o = "door-model";
|
|
115
|
+
const PROP_PATH = createPropKey("doorPath");
|
|
116
|
+
let DoorModelImpl = class {
|
|
117
|
+
id;
|
|
118
|
+
logger;
|
|
119
|
+
doorPath;
|
|
120
|
+
open;
|
|
121
|
+
ignoreDoor;
|
|
122
|
+
constructor(modelId, options, context) {
|
|
123
|
+
this.id = modelId;
|
|
124
|
+
this.logger = context.logger;
|
|
125
|
+
this.doorPath = options.doorPath;
|
|
90
126
|
}
|
|
91
127
|
get currentState() {
|
|
92
|
-
|
|
128
|
+
if (this.open.value === void 0) {
|
|
129
|
+
return "UNKNOWN";
|
|
130
|
+
}
|
|
131
|
+
return this.open.value ? "OPEN" : "CLOSED";
|
|
93
132
|
}
|
|
94
133
|
get isOpen() {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
134
|
+
const value = this.open.value === void 0 ? true : this.open.value;
|
|
135
|
+
const ignore = this.ignoreDoor.value;
|
|
136
|
+
if (ignore) {
|
|
137
|
+
this.logger.debug(
|
|
138
|
+
`Door state is being ignored (treating as closed) due to ignoreDoor config property being true.`
|
|
139
|
+
);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return value;
|
|
99
143
|
}
|
|
100
144
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
|
|
105
|
-
|
|
145
|
+
__decorateClass$o([
|
|
146
|
+
kosStateProp({ path: PROP_PATH, attribute: "state" })
|
|
147
|
+
], DoorModelImpl.prototype, "open", 2);
|
|
148
|
+
__decorateClass$o([
|
|
149
|
+
kosConfigProperty({
|
|
106
150
|
path: "app:kosdev.ddk:app",
|
|
107
151
|
attribute: "ncui.ignoreDoorStateOnExit"
|
|
108
152
|
})
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
],
|
|
113
|
-
const
|
|
114
|
-
class:
|
|
115
|
-
type:
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
153
|
+
], DoorModelImpl.prototype, "ignoreDoor", 2);
|
|
154
|
+
DoorModelImpl = __decorateClass$o([
|
|
155
|
+
kosModel(MODEL_TYPE$o)
|
|
156
|
+
], DoorModelImpl);
|
|
157
|
+
const Door = new KosModelRegistrationFactory({
|
|
158
|
+
class: DoorModelImpl,
|
|
159
|
+
type: MODEL_TYPE$o
|
|
160
|
+
});
|
|
161
|
+
const { URL: URL$c } = resolveServiceUrl("SETUP-STEP_SERVICE");
|
|
162
|
+
const { getAll: getAll$9, postModel: postModel$3 } = ServiceFactory.build({
|
|
163
|
+
basePath: `${URL$c}/api/setup-step`
|
|
164
|
+
});
|
|
165
|
+
const log$e = KosLog.createLogger({
|
|
119
166
|
name: "setup-step-service",
|
|
120
167
|
group: "Services"
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})
|
|
168
|
+
});
|
|
169
|
+
const getSetupSteps = async () => {
|
|
170
|
+
log$e.debug("sending GET for setup-step");
|
|
171
|
+
const response = await getAll$9({
|
|
172
|
+
urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/steps`
|
|
173
|
+
});
|
|
174
|
+
return response;
|
|
175
|
+
};
|
|
176
|
+
const markStepComplete = async (stepId) => {
|
|
177
|
+
log$e.debug("sending POST for setup-step");
|
|
178
|
+
const response = await postModel$3({
|
|
179
|
+
urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/complete/${stepId}`,
|
|
180
|
+
model: {}
|
|
181
|
+
});
|
|
182
|
+
return response;
|
|
183
|
+
};
|
|
184
|
+
const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
127
185
|
__proto__: null,
|
|
128
|
-
getSetupSteps
|
|
129
|
-
markStepComplete
|
|
186
|
+
getSetupSteps,
|
|
187
|
+
markStepComplete
|
|
130
188
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
189
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
190
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
191
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
192
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
193
|
+
if (decorator = decorators[i])
|
|
194
|
+
result = decorator(result) || result;
|
|
195
|
+
return result;
|
|
196
|
+
};
|
|
197
|
+
const MODEL_TYPE$n = "setup-step-model";
|
|
198
|
+
let SetupStepModelImpl = class {
|
|
199
|
+
id;
|
|
200
|
+
idx;
|
|
201
|
+
name;
|
|
202
|
+
complete;
|
|
203
|
+
preStep;
|
|
204
|
+
exclusive;
|
|
205
|
+
logger;
|
|
206
|
+
constructor(modelId, options, context) {
|
|
207
|
+
this.id = modelId;
|
|
208
|
+
this.idx = options.idx;
|
|
209
|
+
this.logger = context.logger;
|
|
210
|
+
this.name = options.name;
|
|
211
|
+
this.complete = options.complete;
|
|
212
|
+
this.preStep = options.preStep;
|
|
213
|
+
this.exclusive = options.exclusive;
|
|
214
|
+
}
|
|
215
|
+
updateModel(options) {
|
|
216
|
+
this.name = options.name;
|
|
217
|
+
this.idx = options.idx;
|
|
218
|
+
this.complete = options.complete;
|
|
219
|
+
this.preStep = options.preStep;
|
|
220
|
+
this.exclusive = options.exclusive;
|
|
150
221
|
}
|
|
151
222
|
get titleKey() {
|
|
152
223
|
return `setup.${this.name}.title`;
|
|
@@ -155,10 +226,12 @@ let Ae = class {
|
|
|
155
226
|
return `setup.${this.name}.body`;
|
|
156
227
|
}
|
|
157
228
|
async completeStep() {
|
|
158
|
-
const
|
|
159
|
-
(
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
const response = await markStepComplete(this.name);
|
|
230
|
+
if (response?.status === 200) {
|
|
231
|
+
kosAction(() => {
|
|
232
|
+
this.complete = true;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
162
235
|
}
|
|
163
236
|
// -------------------LIFECYCLE----------------------------
|
|
164
237
|
async init() {
|
|
@@ -168,88 +241,101 @@ let Ae = class {
|
|
|
168
241
|
this.logger.debug(`loading setup-step ${this.id}`);
|
|
169
242
|
}
|
|
170
243
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
],
|
|
174
|
-
const
|
|
244
|
+
SetupStepModelImpl = __decorateClass$n([
|
|
245
|
+
kosModel(MODEL_TYPE$n)
|
|
246
|
+
], SetupStepModelImpl);
|
|
247
|
+
const SetupStep = {
|
|
175
248
|
registration: {
|
|
176
|
-
[
|
|
177
|
-
class:
|
|
178
|
-
singleton:
|
|
249
|
+
[MODEL_TYPE$n]: {
|
|
250
|
+
class: SetupStepModelImpl,
|
|
251
|
+
singleton: false
|
|
179
252
|
}
|
|
180
253
|
},
|
|
181
|
-
type:
|
|
182
|
-
predicate:
|
|
183
|
-
factory:
|
|
184
|
-
};
|
|
185
|
-
var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
254
|
+
type: MODEL_TYPE$n,
|
|
255
|
+
predicate: isKosModel(MODEL_TYPE$n),
|
|
256
|
+
factory: Kos.Factory.create(MODEL_TYPE$n)
|
|
257
|
+
};
|
|
258
|
+
var __defProp$h = Object.defineProperty;
|
|
259
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
260
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
261
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
262
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
263
|
+
if (decorator = decorators[i])
|
|
264
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
265
|
+
if (kind && result) __defProp$h(target, key, result);
|
|
266
|
+
return result;
|
|
267
|
+
};
|
|
268
|
+
const MODEL_TYPE$m = "setup-step-container-model";
|
|
269
|
+
function addStep(container) {
|
|
270
|
+
return (step) => {
|
|
271
|
+
const model = SetupStep.factory(step.id)(step);
|
|
272
|
+
model.updateModel(step);
|
|
273
|
+
container.addModel(model);
|
|
195
274
|
};
|
|
196
275
|
}
|
|
197
|
-
function
|
|
198
|
-
return (
|
|
199
|
-
|
|
276
|
+
function removeStep(container) {
|
|
277
|
+
return (id) => {
|
|
278
|
+
container.removeModel(id);
|
|
200
279
|
};
|
|
201
280
|
}
|
|
202
|
-
let
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
this.id =
|
|
210
|
-
|
|
281
|
+
let SetupStepContainerModelImpl = class {
|
|
282
|
+
id;
|
|
283
|
+
_currentStep;
|
|
284
|
+
logger;
|
|
285
|
+
models;
|
|
286
|
+
authModel;
|
|
287
|
+
constructor(modelId, options, context) {
|
|
288
|
+
this.id = modelId;
|
|
289
|
+
this.logger = context.logger;
|
|
290
|
+
this._currentStep = void 0;
|
|
291
|
+
this.models = new KosModelContainer({
|
|
292
|
+
parentId: modelId,
|
|
211
293
|
sortKey: "idx"
|
|
212
294
|
});
|
|
213
295
|
}
|
|
214
296
|
get currentStep() {
|
|
215
297
|
return this._currentStep;
|
|
216
298
|
}
|
|
217
|
-
setCurrentStep(
|
|
218
|
-
const
|
|
219
|
-
|
|
299
|
+
setCurrentStep(id) {
|
|
300
|
+
const step = this.models.getModel(id);
|
|
301
|
+
if (step) {
|
|
302
|
+
this._currentStep = step;
|
|
303
|
+
}
|
|
220
304
|
}
|
|
221
305
|
nextStep() {
|
|
222
|
-
if (!this._currentStep)
|
|
306
|
+
if (!this._currentStep) {
|
|
223
307
|
this._currentStep = this.firstIncompleteStep;
|
|
224
|
-
else {
|
|
225
|
-
const
|
|
226
|
-
|
|
308
|
+
} else {
|
|
309
|
+
const currentIdx = this._currentStep.idx;
|
|
310
|
+
const nextStep = this.models.data.find((step) => step.idx > currentIdx);
|
|
311
|
+
if (nextStep) {
|
|
312
|
+
this._currentStep = nextStep;
|
|
313
|
+
}
|
|
227
314
|
}
|
|
228
315
|
}
|
|
229
316
|
get hasIncompletePreSteps() {
|
|
230
|
-
return this.models.data.some((
|
|
317
|
+
return this.models.data.some((step) => step.preStep && !step.complete);
|
|
231
318
|
}
|
|
232
319
|
get setupRequired() {
|
|
233
|
-
return this.models.data.some((
|
|
320
|
+
return this.models.data.some((step) => !step.complete);
|
|
234
321
|
}
|
|
235
322
|
get firstIncompleteStep() {
|
|
236
|
-
return this.models.data.find((
|
|
323
|
+
return this.models.data.find((step) => !step.complete);
|
|
237
324
|
}
|
|
238
325
|
get isLastStep() {
|
|
239
|
-
|
|
240
|
-
return this.models.data[this.models.data.length - 1].id === ((e = this._currentStep) == null ? void 0 : e.id);
|
|
326
|
+
return this.models.data[this.models.data.length - 1].id === this._currentStep?.id;
|
|
241
327
|
}
|
|
242
328
|
get data() {
|
|
243
329
|
return this.models.data;
|
|
244
330
|
}
|
|
245
|
-
getModel(
|
|
246
|
-
return this.models.getModel(
|
|
331
|
+
getModel(id) {
|
|
332
|
+
return this.models.getModel(id);
|
|
247
333
|
}
|
|
248
|
-
addModel(
|
|
249
|
-
this.models.addModel(
|
|
334
|
+
addModel(model) {
|
|
335
|
+
this.models.addModel(model);
|
|
250
336
|
}
|
|
251
|
-
removeModel(
|
|
252
|
-
this.models.removeModel(
|
|
337
|
+
removeModel(id) {
|
|
338
|
+
this.models.removeModel(id);
|
|
253
339
|
}
|
|
254
340
|
// -------------------LIFECYCLE----------------------------
|
|
255
341
|
async init() {
|
|
@@ -257,156 +343,190 @@ let E = class {
|
|
|
257
343
|
}
|
|
258
344
|
async load() {
|
|
259
345
|
this.logger.debug(`loading setup-step-container container ${this.id}`);
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
346
|
+
const response = await getSetupSteps();
|
|
347
|
+
if (response?.data) {
|
|
348
|
+
const identifiableSteps = response.data.map(
|
|
349
|
+
(step, index2) => {
|
|
350
|
+
return {
|
|
351
|
+
...step,
|
|
352
|
+
idx: index2,
|
|
353
|
+
id: `setup-${step.name}`
|
|
354
|
+
};
|
|
355
|
+
}
|
|
268
356
|
);
|
|
269
|
-
|
|
357
|
+
resolveContainerDeltas({
|
|
270
358
|
container: this.models,
|
|
271
|
-
onAddItem:
|
|
272
|
-
onRemoveItem:
|
|
273
|
-
})(
|
|
359
|
+
onAddItem: addStep(this),
|
|
360
|
+
onRemoveItem: removeStep(this)
|
|
361
|
+
})(identifiableSteps);
|
|
274
362
|
}
|
|
275
363
|
this.nextStep();
|
|
276
364
|
}
|
|
277
|
-
handleStepChanges(
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
365
|
+
handleStepChanges(steps) {
|
|
366
|
+
const identifiableSteps = steps.map((step, index2) => {
|
|
367
|
+
return {
|
|
368
|
+
...step,
|
|
369
|
+
idx: index2,
|
|
370
|
+
id: `setup-${step.name}`
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
resolveContainerDeltas({
|
|
284
374
|
container: this.models,
|
|
285
|
-
onAddItem:
|
|
286
|
-
onRemoveItem:
|
|
287
|
-
})(
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
],
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
],
|
|
296
|
-
|
|
297
|
-
|
|
375
|
+
onAddItem: addStep(this),
|
|
376
|
+
onRemoveItem: removeStep(this)
|
|
377
|
+
})(identifiableSteps);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
__decorateClass$m([
|
|
381
|
+
kosChild
|
|
382
|
+
], SetupStepContainerModelImpl.prototype, "models", 2);
|
|
383
|
+
__decorateClass$m([
|
|
384
|
+
kosDependency({ modelType: Auth.type })
|
|
385
|
+
], SetupStepContainerModelImpl.prototype, "authModel", 2);
|
|
386
|
+
__decorateClass$m([
|
|
387
|
+
kosTopicHandler({
|
|
298
388
|
topic: "/app/kosdev.ddk/setup/steps",
|
|
299
|
-
websocket:
|
|
389
|
+
websocket: true
|
|
300
390
|
})
|
|
301
|
-
],
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
],
|
|
305
|
-
const
|
|
391
|
+
], SetupStepContainerModelImpl.prototype, "handleStepChanges", 1);
|
|
392
|
+
SetupStepContainerModelImpl = __decorateClass$m([
|
|
393
|
+
kosModel(MODEL_TYPE$m)
|
|
394
|
+
], SetupStepContainerModelImpl);
|
|
395
|
+
const SetupStepContainer = {
|
|
306
396
|
registration: {
|
|
307
|
-
[
|
|
308
|
-
class:
|
|
309
|
-
singleton:
|
|
397
|
+
[MODEL_TYPE$m]: {
|
|
398
|
+
class: SetupStepContainerModelImpl,
|
|
399
|
+
singleton: true
|
|
310
400
|
},
|
|
311
|
-
...
|
|
401
|
+
...SetupStep.registration
|
|
312
402
|
},
|
|
313
|
-
type:
|
|
314
|
-
predicate:
|
|
315
|
-
factory:
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
403
|
+
type: MODEL_TYPE$m,
|
|
404
|
+
predicate: isKosModel(MODEL_TYPE$m),
|
|
405
|
+
factory: Kos.Singleton.create(MODEL_TYPE$m)
|
|
406
|
+
};
|
|
407
|
+
const { URL: URL$b } = resolveServiceUrl("AUTH_SERVICE");
|
|
408
|
+
const { getOne: getOne$3, getAll: getAll$8 } = ServiceFactory.build({
|
|
409
|
+
basePath: `${URL$b}/api/app/kosdev.ddk/ncui/`
|
|
410
|
+
});
|
|
411
|
+
const log$d = KosLog.createLogger({ name: "auth-service", group: "Services" });
|
|
412
|
+
const getCuis = async () => {
|
|
413
|
+
log$d.debug("sending GET for cuis");
|
|
414
|
+
const response = await getAll$8({
|
|
415
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/cui`
|
|
322
416
|
});
|
|
323
|
-
if (
|
|
417
|
+
if (response?.status !== 200) {
|
|
324
418
|
throw new Error("Failed to retrieve cuis");
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
419
|
+
}
|
|
420
|
+
return response.data;
|
|
421
|
+
};
|
|
422
|
+
const getNavigation = async () => {
|
|
423
|
+
log$d.debug("sending GET for navigation");
|
|
328
424
|
try {
|
|
329
|
-
const
|
|
330
|
-
urlOverride: `${
|
|
425
|
+
const extensionResponse = await getAll$8({
|
|
426
|
+
urlOverride: `${URL$b}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`
|
|
331
427
|
});
|
|
332
|
-
if (
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
urlOverride: `${
|
|
428
|
+
if (extensionResponse?.status !== 200) {
|
|
429
|
+
log$d.info(`no extensions found, using base data`);
|
|
430
|
+
const response = await getAll$8({
|
|
431
|
+
urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
336
432
|
});
|
|
337
|
-
return
|
|
433
|
+
return response?.data ?? [];
|
|
338
434
|
}
|
|
339
|
-
return
|
|
340
|
-
} catch {
|
|
341
|
-
const
|
|
342
|
-
urlOverride: `${
|
|
435
|
+
return extensionResponse?.data ?? [];
|
|
436
|
+
} catch (error) {
|
|
437
|
+
const response = await getAll$8({
|
|
438
|
+
urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
343
439
|
});
|
|
344
|
-
return
|
|
440
|
+
return response?.data ?? [];
|
|
345
441
|
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
442
|
+
};
|
|
443
|
+
const navigateToCui = async () => {
|
|
444
|
+
log$d.debug("navigating to CUI");
|
|
445
|
+
const response = await getOne$3({
|
|
446
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/cui/open`
|
|
447
|
+
});
|
|
448
|
+
return response;
|
|
449
|
+
};
|
|
450
|
+
const navigateToNCui$1 = async () => {
|
|
451
|
+
log$d.debug("navigating to NCUI");
|
|
452
|
+
const response = await getOne$3({
|
|
453
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/ncui/open`
|
|
454
|
+
});
|
|
455
|
+
return response;
|
|
456
|
+
};
|
|
457
|
+
var __defProp$g = Object.defineProperty;
|
|
458
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
459
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
460
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
461
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
462
|
+
if (decorator = decorators[i])
|
|
463
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
464
|
+
if (kind && result) __defProp$g(target, key, result);
|
|
465
|
+
return result;
|
|
466
|
+
};
|
|
467
|
+
const MODEL_TYPE$l = "application-model";
|
|
468
|
+
const flattenNavigationItems = (items, path = "") => items.reduce((acc, item) => {
|
|
469
|
+
const itemPath = path ? `${path}.${item.name}` : item.name;
|
|
470
|
+
acc[itemPath] = { ...item, root: !path };
|
|
471
|
+
if (item.children) {
|
|
472
|
+
const childItems = flattenNavigationItems(item.children, itemPath);
|
|
473
|
+
Object.keys(childItems).forEach((key) => {
|
|
474
|
+
acc[key] = childItems[key];
|
|
362
475
|
});
|
|
363
476
|
}
|
|
364
|
-
return
|
|
477
|
+
return acc;
|
|
365
478
|
}, {});
|
|
366
|
-
let
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
this.id =
|
|
479
|
+
let ApplicationModelImpl = class {
|
|
480
|
+
id;
|
|
481
|
+
device;
|
|
482
|
+
authModel;
|
|
483
|
+
setupStepContainer;
|
|
484
|
+
door;
|
|
485
|
+
ncuiLanguage;
|
|
486
|
+
activeCui;
|
|
487
|
+
fallbackCui;
|
|
488
|
+
_cuis = [];
|
|
489
|
+
_navigationItems = [];
|
|
490
|
+
// @kosConfigProperty({
|
|
491
|
+
// path: 'somewhere.enable.dial.animation',
|
|
492
|
+
// attribute: 'enableDialAnimation',
|
|
493
|
+
// })
|
|
494
|
+
// enableDialAnimation!: KosConfigProperty<boolean>;
|
|
495
|
+
// @kosConfigProperty({
|
|
496
|
+
// path: 'somewhere.enable.modal.animation',
|
|
497
|
+
// attribute: 'enableModalAnimation',
|
|
498
|
+
// })
|
|
499
|
+
// enableModalAnimation!: KosConfigProperty<boolean>;
|
|
500
|
+
// @kosConfigProperty({
|
|
501
|
+
// path: 'somewhere.enable.sidebar.animation',
|
|
502
|
+
// attribute: 'enableSidebarAnimation',
|
|
503
|
+
// })
|
|
504
|
+
// enableSidebarAnimation!: KosConfigProperty<boolean>;
|
|
505
|
+
languages;
|
|
506
|
+
logger;
|
|
507
|
+
constructor(modelId, _options, context) {
|
|
508
|
+
this.id = modelId;
|
|
509
|
+
this.languages = [];
|
|
510
|
+
this._cuis = [];
|
|
511
|
+
this.logger = context.logger;
|
|
512
|
+
this.door = Door.instance("app:kosdev.ddk:service:door:door").options({
|
|
396
513
|
doorPath: "app:kosdev.ddk:service:door:door"
|
|
397
514
|
}).build();
|
|
398
515
|
}
|
|
399
516
|
get setupRequired() {
|
|
400
|
-
return this.authModel.currentRole === "crew" ?
|
|
517
|
+
return this.authModel.currentRole === "crew" ? false : this.setupStepContainer.setupRequired;
|
|
401
518
|
}
|
|
402
519
|
get currentRole() {
|
|
403
520
|
return this.authModel.currentRole;
|
|
404
521
|
}
|
|
405
522
|
get cuis() {
|
|
406
|
-
return this._cuis.reduce((
|
|
523
|
+
return this._cuis.reduce((acc, cui) => {
|
|
524
|
+
acc[cui.appId] = cui;
|
|
525
|
+
return acc;
|
|
526
|
+
}, {});
|
|
407
527
|
}
|
|
408
528
|
get navigationItems() {
|
|
409
|
-
return
|
|
529
|
+
return flattenNavigationItems(this._navigationItems);
|
|
410
530
|
}
|
|
411
531
|
get hasCuiDefined() {
|
|
412
532
|
return !!this.activeCui.value || !!this.fallbackCui.value;
|
|
@@ -415,19 +535,24 @@ let b = class {
|
|
|
415
535
|
return this.door.isOpen;
|
|
416
536
|
}
|
|
417
537
|
async enter() {
|
|
418
|
-
this.logger.info("navigating to NCUI")
|
|
538
|
+
this.logger.info("navigating to NCUI");
|
|
539
|
+
await navigateToNCui$1();
|
|
419
540
|
}
|
|
420
541
|
async exit() {
|
|
421
|
-
this.logger.info("navigating to CUI")
|
|
542
|
+
this.logger.info("navigating to CUI");
|
|
543
|
+
await navigateToCui();
|
|
422
544
|
}
|
|
423
545
|
// -------------------LIFECYCLE----------------------------
|
|
424
546
|
async load() {
|
|
425
|
-
var o, s;
|
|
426
547
|
this.logger.debug(`loading application ${this.id}`);
|
|
427
|
-
const
|
|
428
|
-
this._navigationItems =
|
|
429
|
-
const
|
|
430
|
-
this._cuis =
|
|
548
|
+
const navigationItems = await getNavigation();
|
|
549
|
+
this._navigationItems = navigationItems;
|
|
550
|
+
const cuis = await getCuis();
|
|
551
|
+
this._cuis = cuis;
|
|
552
|
+
if (this.setupStepContainer?.hasIncompletePreSteps) {
|
|
553
|
+
this.authModel?.forceRole("technician");
|
|
554
|
+
}
|
|
555
|
+
this.languages = [
|
|
431
556
|
{
|
|
432
557
|
name: "English",
|
|
433
558
|
locale: "en"
|
|
@@ -435,90 +560,103 @@ let b = class {
|
|
|
435
560
|
];
|
|
436
561
|
}
|
|
437
562
|
};
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
],
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
],
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
],
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
],
|
|
450
|
-
|
|
451
|
-
|
|
563
|
+
__decorateClass$l([
|
|
564
|
+
kosDependency({ modelType: Device.type })
|
|
565
|
+
], ApplicationModelImpl.prototype, "device", 2);
|
|
566
|
+
__decorateClass$l([
|
|
567
|
+
kosDependency({ modelType: Auth.type })
|
|
568
|
+
], ApplicationModelImpl.prototype, "authModel", 2);
|
|
569
|
+
__decorateClass$l([
|
|
570
|
+
kosDependency({ modelType: SetupStepContainer.type })
|
|
571
|
+
], ApplicationModelImpl.prototype, "setupStepContainer", 2);
|
|
572
|
+
__decorateClass$l([
|
|
573
|
+
kosChild
|
|
574
|
+
], ApplicationModelImpl.prototype, "door", 2);
|
|
575
|
+
__decorateClass$l([
|
|
576
|
+
kosConfigProperty({
|
|
452
577
|
path: "app:kosdev.ddk:app",
|
|
453
578
|
attribute: "ncui.ncuiLanguage"
|
|
454
579
|
//updated attribute for language config property
|
|
455
580
|
})
|
|
456
|
-
],
|
|
457
|
-
|
|
458
|
-
|
|
581
|
+
], ApplicationModelImpl.prototype, "ncuiLanguage", 2);
|
|
582
|
+
__decorateClass$l([
|
|
583
|
+
kosConfigProperty({
|
|
459
584
|
path: "app:kosdev.ddk:service:cui",
|
|
460
585
|
attribute: "activeCui"
|
|
461
586
|
})
|
|
462
|
-
],
|
|
463
|
-
|
|
464
|
-
|
|
587
|
+
], ApplicationModelImpl.prototype, "activeCui", 2);
|
|
588
|
+
__decorateClass$l([
|
|
589
|
+
kosConfigProperty({
|
|
465
590
|
path: "app:kosdev.ddk:service:cui",
|
|
466
591
|
attribute: "fallbackCui"
|
|
467
592
|
})
|
|
468
|
-
],
|
|
469
|
-
|
|
470
|
-
l
|
|
471
|
-
],
|
|
472
|
-
const
|
|
593
|
+
], ApplicationModelImpl.prototype, "fallbackCui", 2);
|
|
594
|
+
ApplicationModelImpl = __decorateClass$l([
|
|
595
|
+
kosModel(MODEL_TYPE$l)
|
|
596
|
+
], ApplicationModelImpl);
|
|
597
|
+
const Application = {
|
|
473
598
|
registration: {
|
|
474
|
-
[
|
|
475
|
-
class:
|
|
476
|
-
singleton:
|
|
599
|
+
[MODEL_TYPE$l]: {
|
|
600
|
+
class: ApplicationModelImpl,
|
|
601
|
+
singleton: true
|
|
477
602
|
}
|
|
478
603
|
},
|
|
479
|
-
type:
|
|
480
|
-
predicate:
|
|
481
|
-
factory:
|
|
482
|
-
|
|
604
|
+
type: MODEL_TYPE$l,
|
|
605
|
+
predicate: isKosModel(MODEL_TYPE$l),
|
|
606
|
+
factory: Kos.Singleton.create(
|
|
607
|
+
MODEL_TYPE$l
|
|
483
608
|
)
|
|
484
|
-
}
|
|
609
|
+
};
|
|
610
|
+
const RoleMap = {
|
|
485
611
|
none: 999,
|
|
486
612
|
crew: 0,
|
|
487
613
|
technician: 1,
|
|
488
614
|
manager: 2
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
615
|
+
};
|
|
616
|
+
const troubleVisibilityFilter = (currentRole) => (trouble) => {
|
|
617
|
+
if (trouble.type === AGITATION_REQUIRED_TROUBLE) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
const visibleRole = trouble?.role || "technician";
|
|
621
|
+
if (currentRole && visibleRole) {
|
|
622
|
+
const currentRoleIndex = RoleMap[currentRole.toLowerCase()] ?? RoleMap["crew"];
|
|
623
|
+
const visibleRoleIndex = RoleMap[visibleRole.toLowerCase()] ?? RoleMap["crew"];
|
|
624
|
+
return currentRoleIndex >= visibleRoleIndex;
|
|
625
|
+
}
|
|
626
|
+
return false;
|
|
627
|
+
};
|
|
628
|
+
var __defProp$f = Object.defineProperty;
|
|
629
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
630
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
631
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
632
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
633
|
+
if (decorator = decorators[i])
|
|
634
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
635
|
+
if (kind && result) __defProp$f(target, key, result);
|
|
636
|
+
return result;
|
|
637
|
+
};
|
|
638
|
+
const MODEL_TYPE$k = "agitation-control-model";
|
|
639
|
+
const FUTURE_RESOLVE = "resolve";
|
|
640
|
+
const FUTURE_AGITATE = "agitate";
|
|
641
|
+
let AgitationControlModelImpl = class {
|
|
642
|
+
id;
|
|
643
|
+
futureHandler;
|
|
644
|
+
logger;
|
|
645
|
+
troubleContainer;
|
|
646
|
+
_agitationFutureId;
|
|
647
|
+
_canExit = true;
|
|
648
|
+
_exiting = false;
|
|
649
|
+
_isFailed = false;
|
|
650
|
+
disposer;
|
|
651
|
+
application;
|
|
652
|
+
constructor(modelId, options, context) {
|
|
653
|
+
this.id = modelId;
|
|
654
|
+
this.logger = context.logger;
|
|
655
|
+
this.troubleContainer = options.companionParent;
|
|
656
|
+
this.futureHandler = new MultipleFutureHandler(this, FUTURE_RESOLVE);
|
|
657
|
+
}
|
|
658
|
+
set isFailed(value) {
|
|
659
|
+
this._isFailed = value;
|
|
522
660
|
}
|
|
523
661
|
get isFailed() {
|
|
524
662
|
return this._isFailed;
|
|
@@ -529,188 +667,241 @@ let $ = class {
|
|
|
529
667
|
get isAgitating() {
|
|
530
668
|
return !!this._agitationFutureId;
|
|
531
669
|
}
|
|
532
|
-
set exiting(
|
|
533
|
-
this._exiting =
|
|
670
|
+
set exiting(value) {
|
|
671
|
+
this._exiting = value;
|
|
534
672
|
}
|
|
535
673
|
get exiting() {
|
|
536
674
|
return this._exiting;
|
|
537
675
|
}
|
|
538
676
|
get canExit() {
|
|
539
|
-
|
|
677
|
+
const allDeferredCount = this.queuedTroubles.length;
|
|
678
|
+
return allDeferredCount === 0 && this._canExit;
|
|
540
679
|
}
|
|
541
680
|
clearAll() {
|
|
542
|
-
this.queuedTroubles.forEach((
|
|
543
|
-
|
|
681
|
+
this.queuedTroubles.forEach((trouble) => {
|
|
682
|
+
trouble.clearDefer();
|
|
544
683
|
});
|
|
545
684
|
}
|
|
546
685
|
get readyToResolve() {
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
686
|
+
const allDeferredCount = this.queuedTroubles.length;
|
|
687
|
+
const notResolvable = this.queuedTroubles.filter((t) => t.shouldDefer);
|
|
688
|
+
const _readyToResolve = allDeferredCount > 0 && notResolvable.length === 0;
|
|
689
|
+
return this.isDoorClosed && _readyToResolve && this.exiting;
|
|
690
|
+
}
|
|
691
|
+
onFutureUpdate(future) {
|
|
692
|
+
if (future.endState === FutureEndState.Success) {
|
|
693
|
+
this.logger.debug(
|
|
694
|
+
`Resolve deferred troubles future ${future.id} completed successfully`
|
|
695
|
+
);
|
|
696
|
+
this.queuedTroubles.forEach((trouble) => {
|
|
697
|
+
trouble.clearDefer();
|
|
698
|
+
});
|
|
699
|
+
kosAction(() => {
|
|
700
|
+
this._canExit = true;
|
|
701
|
+
this._isFailed = false;
|
|
702
|
+
});
|
|
703
|
+
} else if (future.endState === FutureEndState.Fail || future.endState === FutureEndState.Canceled || future.endState === FutureEndState.Aborted) {
|
|
704
|
+
this.logger.error(`Resolve deferred troubles future ${future.id} failed`);
|
|
705
|
+
this.clearAll();
|
|
706
|
+
kosAction(() => {
|
|
707
|
+
this._canExit = false;
|
|
708
|
+
this._isFailed = true;
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
inProgress = [];
|
|
713
|
+
async resolveDeferredTroubles(tracker) {
|
|
714
|
+
const toResolve = this.queuedTroubles.filter((t) => !t.shouldDefer).map((trouble) => trouble.rawId).filter((id) => !this.inProgress.includes(id));
|
|
715
|
+
this.inProgress.push(...toResolve);
|
|
716
|
+
if (toResolve.length === 0) {
|
|
717
|
+
return void 0;
|
|
718
|
+
}
|
|
719
|
+
const response = await TroubleServices.bulkResolveTroubles(
|
|
720
|
+
toResolve,
|
|
565
721
|
void 0,
|
|
566
|
-
|
|
722
|
+
tracker
|
|
567
723
|
);
|
|
724
|
+
return response;
|
|
568
725
|
}
|
|
569
726
|
get hasQueuedTroubles() {
|
|
570
727
|
return this.queuedTroubles.length > 0;
|
|
571
728
|
}
|
|
572
729
|
get queuedTroubles() {
|
|
573
730
|
return this.troubleContainer.troubles.getIndexByKey(
|
|
574
|
-
|
|
575
|
-
|
|
731
|
+
Troubles.INDEX_TROUBLES_BY_DEFERRED,
|
|
732
|
+
Troubles.TROUBLES_DEFERRED
|
|
576
733
|
);
|
|
577
734
|
}
|
|
578
735
|
get visibleTroubles() {
|
|
579
|
-
const
|
|
580
|
-
return this.troubleContainer.troubles.data.filter(
|
|
736
|
+
const currentRole = this.application.currentRole;
|
|
737
|
+
return this.troubleContainer.troubles.data.filter(troubleVisibilityFilter(currentRole)).filter((trouble) => trouble.type !== AGITATION_REQUIRED_TROUBLE);
|
|
581
738
|
}
|
|
582
739
|
// -------------------LIFECYCLE----------------------------
|
|
583
740
|
get future() {
|
|
584
741
|
return this.futureHandler.future;
|
|
585
742
|
}
|
|
586
743
|
get resolveFuture() {
|
|
587
|
-
return this.futureHandler.getFuture(
|
|
744
|
+
return this.futureHandler.getFuture(FUTURE_RESOLVE);
|
|
588
745
|
}
|
|
589
746
|
get agitateFuture() {
|
|
590
|
-
return this.futureHandler.getFuture(
|
|
747
|
+
return this.futureHandler.getFuture(FUTURE_AGITATE);
|
|
591
748
|
}
|
|
592
|
-
handleAgitationStarted(
|
|
593
|
-
this.logger.info(`Agitation started for ${
|
|
749
|
+
handleAgitationStarted(event) {
|
|
750
|
+
this.logger.info(`Agitation started for ${event.path}`);
|
|
751
|
+
this._agitationFutureId = String(event.futureId);
|
|
594
752
|
}
|
|
595
|
-
handleAgitationEnded(
|
|
596
|
-
this.logger.info(`Agitation ended for ${
|
|
753
|
+
handleAgitationEnded(event) {
|
|
754
|
+
this.logger.info(`Agitation ended for ${event.path}`);
|
|
755
|
+
this._agitationFutureId = void 0;
|
|
597
756
|
}
|
|
598
757
|
async init() {
|
|
599
758
|
this.logger.debug(`initializing agitation-control ${this.id}`);
|
|
600
759
|
}
|
|
601
760
|
unload() {
|
|
602
|
-
this.logger.debug(`unloading agitation-control ${this.id}`)
|
|
761
|
+
this.logger.debug(`unloading agitation-control ${this.id}`);
|
|
762
|
+
if (this.disposer) {
|
|
763
|
+
this.disposer();
|
|
764
|
+
}
|
|
603
765
|
}
|
|
604
766
|
handleReadyToResolve() {
|
|
605
|
-
|
|
767
|
+
if (this.readyToResolve) {
|
|
768
|
+
this.logger.info(`AgitationControl - Resolving deferred troubles`);
|
|
769
|
+
this.resolveDeferredTroubles();
|
|
770
|
+
}
|
|
771
|
+
if (this._agitationFutureId) {
|
|
772
|
+
this.logger.info(`AgitationControl - Agitation started`);
|
|
773
|
+
}
|
|
606
774
|
}
|
|
607
775
|
async load() {
|
|
608
776
|
this.logger.debug(`loading agitation-control ${this.id}`);
|
|
609
777
|
}
|
|
610
778
|
};
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
],
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
],
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
],
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
],
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
dependencies: (
|
|
779
|
+
__decorateClass$k([
|
|
780
|
+
kosDependency({ modelType: Application.type })
|
|
781
|
+
], AgitationControlModelImpl.prototype, "application", 2);
|
|
782
|
+
__decorateClass$k([
|
|
783
|
+
kosFuture({ alias: FUTURE_RESOLVE })
|
|
784
|
+
], AgitationControlModelImpl.prototype, "resolveDeferredTroubles", 1);
|
|
785
|
+
__decorateClass$k([
|
|
786
|
+
kosTopicHandler({ topic: CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED })
|
|
787
|
+
], AgitationControlModelImpl.prototype, "handleAgitationStarted", 1);
|
|
788
|
+
__decorateClass$k([
|
|
789
|
+
kosTopicHandler({ topic: CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED })
|
|
790
|
+
], AgitationControlModelImpl.prototype, "handleAgitationEnded", 1);
|
|
791
|
+
__decorateClass$k([
|
|
792
|
+
kosModelEffect({
|
|
793
|
+
dependencies: (model) => [model.readyToResolve, model._agitationFutureId]
|
|
626
794
|
})
|
|
627
|
-
],
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
],
|
|
631
|
-
const
|
|
632
|
-
class:
|
|
633
|
-
type:
|
|
795
|
+
], AgitationControlModelImpl.prototype, "handleReadyToResolve", 1);
|
|
796
|
+
AgitationControlModelImpl = __decorateClass$k([
|
|
797
|
+
kosModel(MODEL_TYPE$k)
|
|
798
|
+
], AgitationControlModelImpl);
|
|
799
|
+
const AgitationControl = new SingletonKosModelRegistrationFactory({
|
|
800
|
+
class: AgitationControlModelImpl,
|
|
801
|
+
type: MODEL_TYPE$k
|
|
634
802
|
});
|
|
635
|
-
var
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
803
|
+
var __defProp$e = Object.defineProperty;
|
|
804
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
805
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
806
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
807
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
808
|
+
if (decorator = decorators[i])
|
|
809
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
810
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
811
|
+
return result;
|
|
812
|
+
};
|
|
813
|
+
const MODEL_TYPE$j = "animation-model";
|
|
814
|
+
let AnimationModelImpl = class {
|
|
815
|
+
id;
|
|
816
|
+
logger;
|
|
817
|
+
disableAll;
|
|
818
|
+
enableDial;
|
|
819
|
+
enableModal;
|
|
820
|
+
enableSideBar;
|
|
821
|
+
constructor(modelId, options, context) {
|
|
822
|
+
this.id = modelId;
|
|
823
|
+
this.logger = context.logger;
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
__decorateClass$j([
|
|
827
|
+
kosConfigProperty({
|
|
654
828
|
path: "app:kosdev.ddk:app",
|
|
655
829
|
attribute: "ncui.uiConfig.animations.disableAll"
|
|
656
830
|
})
|
|
657
|
-
],
|
|
658
|
-
|
|
659
|
-
|
|
831
|
+
], AnimationModelImpl.prototype, "disableAll", 2);
|
|
832
|
+
__decorateClass$j([
|
|
833
|
+
kosConfigProperty({
|
|
660
834
|
path: "app:kosdev.ddk:app",
|
|
661
835
|
attribute: "ncui.uiConfig.animations.enableDial"
|
|
662
836
|
})
|
|
663
|
-
],
|
|
664
|
-
|
|
665
|
-
|
|
837
|
+
], AnimationModelImpl.prototype, "enableDial", 2);
|
|
838
|
+
__decorateClass$j([
|
|
839
|
+
kosConfigProperty({
|
|
666
840
|
path: "app:kosdev.ddk:app",
|
|
667
841
|
attribute: "ncui.uiConfig.animations.enableModal"
|
|
668
842
|
})
|
|
669
|
-
],
|
|
670
|
-
|
|
671
|
-
|
|
843
|
+
], AnimationModelImpl.prototype, "enableModal", 2);
|
|
844
|
+
__decorateClass$j([
|
|
845
|
+
kosConfigProperty({
|
|
672
846
|
path: "app:kosdev.ddk:app",
|
|
673
847
|
attribute: "ncui.uiConfig.animations.enableSideBar"
|
|
674
848
|
})
|
|
675
|
-
],
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
],
|
|
679
|
-
const
|
|
849
|
+
], AnimationModelImpl.prototype, "enableSideBar", 2);
|
|
850
|
+
AnimationModelImpl = __decorateClass$j([
|
|
851
|
+
kosModel(MODEL_TYPE$j)
|
|
852
|
+
], AnimationModelImpl);
|
|
853
|
+
const Animation = {
|
|
680
854
|
registration: {
|
|
681
|
-
[
|
|
682
|
-
class:
|
|
683
|
-
singleton:
|
|
855
|
+
[MODEL_TYPE$j]: {
|
|
856
|
+
class: AnimationModelImpl,
|
|
857
|
+
singleton: true
|
|
684
858
|
}
|
|
685
859
|
},
|
|
686
|
-
type:
|
|
687
|
-
predicate:
|
|
688
|
-
factory:
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
}
|
|
860
|
+
type: MODEL_TYPE$j,
|
|
861
|
+
predicate: isKosModel(MODEL_TYPE$j),
|
|
862
|
+
factory: Kos.Singleton.create(MODEL_TYPE$j)
|
|
863
|
+
};
|
|
864
|
+
const { URL: URL$a } = resolveServiceUrl("ANIMATION_SERVICE");
|
|
865
|
+
const { getAll: getAll$7 } = ServiceFactory.build({
|
|
866
|
+
basePath: `${URL$a}/api/animation`
|
|
867
|
+
});
|
|
868
|
+
const log$c = KosLog.createLogger({
|
|
692
869
|
name: "animation-service",
|
|
693
870
|
group: "Services"
|
|
694
|
-
})
|
|
871
|
+
});
|
|
872
|
+
const getAnimations = async () => {
|
|
873
|
+
log$c.debug("sending GET for animation");
|
|
874
|
+
const response = await getAll$7({});
|
|
875
|
+
return response;
|
|
876
|
+
};
|
|
877
|
+
const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
695
878
|
__proto__: null,
|
|
696
|
-
getAnimations
|
|
879
|
+
getAnimations
|
|
697
880
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
698
|
-
var
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
881
|
+
var __defProp$d = Object.defineProperty;
|
|
882
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
883
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
884
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
885
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
886
|
+
if (decorator = decorators[i])
|
|
887
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
888
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
889
|
+
return result;
|
|
890
|
+
};
|
|
891
|
+
const MODEL_TYPE$i = "carb-water-model";
|
|
892
|
+
let CarbWaterModelImpl = class {
|
|
893
|
+
id;
|
|
894
|
+
assemblyModel;
|
|
895
|
+
logger;
|
|
896
|
+
constructor(modelId, _options, context) {
|
|
897
|
+
this.id = modelId;
|
|
898
|
+
this.logger = context.logger;
|
|
710
899
|
}
|
|
711
900
|
getPump() {
|
|
712
|
-
const
|
|
713
|
-
|
|
901
|
+
const carbHolder = this.assemblyModel.getHoldersByGroup("carb")[0];
|
|
902
|
+
const pump = carbHolder.pumps.data[0];
|
|
903
|
+
const model = getKosCompanionModel(pump, FcmPump.type);
|
|
904
|
+
return model ?? carbHolder;
|
|
714
905
|
}
|
|
715
906
|
// -------------------LIFECYCLE----------------------------
|
|
716
907
|
async init() {
|
|
@@ -720,102 +911,128 @@ let ye = class {
|
|
|
720
911
|
this.logger.debug(`loading carb-water ${this.id}`);
|
|
721
912
|
}
|
|
722
913
|
};
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
],
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
],
|
|
729
|
-
const
|
|
914
|
+
__decorateClass$i([
|
|
915
|
+
kosDependency({ modelType: Assembly.type })
|
|
916
|
+
], CarbWaterModelImpl.prototype, "assemblyModel", 2);
|
|
917
|
+
CarbWaterModelImpl = __decorateClass$i([
|
|
918
|
+
kosModel(MODEL_TYPE$i)
|
|
919
|
+
], CarbWaterModelImpl);
|
|
920
|
+
const CarbWater = {
|
|
730
921
|
registration: {
|
|
731
|
-
[
|
|
732
|
-
class:
|
|
733
|
-
singleton:
|
|
922
|
+
[MODEL_TYPE$i]: {
|
|
923
|
+
class: CarbWaterModelImpl,
|
|
924
|
+
singleton: false
|
|
734
925
|
}
|
|
735
926
|
},
|
|
736
|
-
type:
|
|
737
|
-
predicate:
|
|
738
|
-
factory:
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
|
|
927
|
+
type: MODEL_TYPE$i,
|
|
928
|
+
predicate: isKosModel(MODEL_TYPE$i),
|
|
929
|
+
factory: Kos.Factory.create(MODEL_TYPE$i)
|
|
930
|
+
};
|
|
931
|
+
const { URL: URL$9 } = resolveServiceUrl("COPY-LOGS_SERVICE");
|
|
932
|
+
const { getAll: getAll$6, getOne: getOne$2, postModel: postModel$2, deleteModel } = ServiceFactory.build({
|
|
933
|
+
basePath: `${URL$9}/api/copy-logs`
|
|
934
|
+
});
|
|
935
|
+
const log$b = KosLog.createLogger({
|
|
742
936
|
name: "copy-logs-service",
|
|
743
937
|
group: "Services"
|
|
744
|
-
})
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
938
|
+
});
|
|
939
|
+
const eraseVolume = async (volumeId, tracker) => {
|
|
940
|
+
const response = await deleteModel({
|
|
941
|
+
tracker,
|
|
942
|
+
id: volumeId,
|
|
943
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
|
|
749
944
|
});
|
|
750
|
-
if (!
|
|
945
|
+
if (!response?.data) {
|
|
751
946
|
throw new Error("No response from server");
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
947
|
+
}
|
|
948
|
+
return response.data;
|
|
949
|
+
};
|
|
950
|
+
const eraseAndCopyLogsToVolume = async (volumeId, tracker) => {
|
|
951
|
+
const response = await postModel$2({
|
|
755
952
|
model: {},
|
|
756
|
-
tracker
|
|
757
|
-
urlOverride: `${
|
|
953
|
+
tracker,
|
|
954
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${volumeId}`
|
|
758
955
|
});
|
|
759
|
-
if (!
|
|
956
|
+
if (!response?.data) {
|
|
760
957
|
throw new Error("No response from server");
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
958
|
+
}
|
|
959
|
+
return response.data;
|
|
960
|
+
};
|
|
961
|
+
const copyLogFromVolume = async (volumeId, tracker) => {
|
|
962
|
+
const response = await postModel$2({
|
|
764
963
|
model: {},
|
|
765
|
-
tracker
|
|
766
|
-
urlOverride: `${
|
|
964
|
+
tracker,
|
|
965
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
|
|
767
966
|
});
|
|
768
|
-
if (!
|
|
967
|
+
if (!response?.data) {
|
|
769
968
|
throw new Error("No response from server");
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
969
|
+
}
|
|
970
|
+
return response.data;
|
|
971
|
+
};
|
|
972
|
+
const getVolumes = async () => {
|
|
973
|
+
log$b.debug("sending GET for copy-logs");
|
|
773
974
|
try {
|
|
774
|
-
const
|
|
775
|
-
urlOverride: `${
|
|
975
|
+
const response = await getAll$6({
|
|
976
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/volumes/size`
|
|
776
977
|
});
|
|
777
|
-
return [void 0,
|
|
778
|
-
} catch (
|
|
779
|
-
if (
|
|
780
|
-
|
|
978
|
+
return [void 0, response?.data];
|
|
979
|
+
} catch (error) {
|
|
980
|
+
if (error instanceof FetchError) {
|
|
981
|
+
log$b.error(`Error fetching log file size: ${error.payload.error}`);
|
|
982
|
+
return [error.payload.error, void 0];
|
|
983
|
+
}
|
|
781
984
|
}
|
|
782
985
|
return ["unknownError", void 0];
|
|
783
|
-
}
|
|
784
|
-
|
|
986
|
+
};
|
|
987
|
+
const getLogFileSize = async () => {
|
|
988
|
+
log$b.debug("sending GET for log file size");
|
|
785
989
|
try {
|
|
786
|
-
const
|
|
787
|
-
urlOverride: `${
|
|
990
|
+
const response = await getOne$2({
|
|
991
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/files/size`
|
|
788
992
|
});
|
|
789
|
-
return [void 0,
|
|
790
|
-
} catch (
|
|
791
|
-
if (
|
|
792
|
-
|
|
993
|
+
return [void 0, response?.data];
|
|
994
|
+
} catch (error) {
|
|
995
|
+
if (error instanceof FetchError) {
|
|
996
|
+
log$b.error(`Error fetching log file size: ${error.payload.error}`);
|
|
997
|
+
return [error.payload.error, void 0];
|
|
998
|
+
}
|
|
793
999
|
}
|
|
794
1000
|
return ["unknownError", void 0];
|
|
795
|
-
}
|
|
1001
|
+
};
|
|
1002
|
+
const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
796
1003
|
__proto__: null,
|
|
797
|
-
copyLogFromVolume
|
|
798
|
-
eraseAndCopyLogsToVolume
|
|
799
|
-
eraseVolume
|
|
800
|
-
getLogFileSize
|
|
801
|
-
getVolumes
|
|
1004
|
+
copyLogFromVolume,
|
|
1005
|
+
eraseAndCopyLogsToVolume,
|
|
1006
|
+
eraseVolume,
|
|
1007
|
+
getLogFileSize,
|
|
1008
|
+
getVolumes
|
|
802
1009
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
803
|
-
var
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1010
|
+
var __defProp$c = Object.defineProperty;
|
|
1011
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
1012
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1013
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
1014
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
1015
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1016
|
+
if (decorator = decorators[i])
|
|
1017
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1018
|
+
if (kind && result) __defProp$c(target, key, result);
|
|
1019
|
+
return result;
|
|
1020
|
+
};
|
|
1021
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "", value);
|
|
1022
|
+
const MODEL_TYPE$h = "copy-logs-model";
|
|
1023
|
+
let CopyLogsModelImpl = class {
|
|
1024
|
+
id;
|
|
1025
|
+
_volumes;
|
|
1026
|
+
storageDeviceContainer;
|
|
1027
|
+
_activeVolume;
|
|
1028
|
+
_logFileSize = 0;
|
|
1029
|
+
_actionState = "idle";
|
|
1030
|
+
copyProgress;
|
|
1031
|
+
constructor(modelId) {
|
|
1032
|
+
this.id = modelId;
|
|
1033
|
+
this._volumes = new KosDataContainer();
|
|
1034
|
+
this._activeVolume = void 0;
|
|
1035
|
+
this.copyProgress = {
|
|
819
1036
|
bytesCopied: 0,
|
|
820
1037
|
bytesToCopy: 0,
|
|
821
1038
|
filesCopied: 0,
|
|
@@ -833,19 +1050,20 @@ let _ = class {
|
|
|
833
1050
|
return this._logFileSize;
|
|
834
1051
|
}
|
|
835
1052
|
reset() {
|
|
836
|
-
this.clearActiveVolume()
|
|
1053
|
+
this.clearActiveVolume();
|
|
1054
|
+
this.futureHandler.removeFuture();
|
|
837
1055
|
}
|
|
838
1056
|
clearActiveVolume() {
|
|
839
1057
|
this._activeVolume = void 0;
|
|
840
1058
|
}
|
|
841
|
-
updateActiveVolume(
|
|
842
|
-
this._activeVolume =
|
|
1059
|
+
updateActiveVolume(volume) {
|
|
1060
|
+
this._activeVolume = volume;
|
|
843
1061
|
}
|
|
844
1062
|
get inserted() {
|
|
845
1063
|
return this.storageDeviceContainer.isStorageInserted;
|
|
846
1064
|
}
|
|
847
|
-
updateLogFileSize(
|
|
848
|
-
this._logFileSize =
|
|
1065
|
+
updateLogFileSize(size) {
|
|
1066
|
+
this._logFileSize = size;
|
|
849
1067
|
}
|
|
850
1068
|
get canCopyLogs() {
|
|
851
1069
|
return this.inserted && this._activeVolume;
|
|
@@ -854,170 +1072,235 @@ let _ = class {
|
|
|
854
1072
|
return this._actionState;
|
|
855
1073
|
}
|
|
856
1074
|
get diskFull() {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
this.
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1075
|
+
return this.future?.status === FutureEndState.Success && this.copyProgress.filesSkipped > 0;
|
|
1076
|
+
}
|
|
1077
|
+
onFutureUpdate(update) {
|
|
1078
|
+
this.logger.info(`Future update: ${update.status}`);
|
|
1079
|
+
if (update.status === FutureEndState.Success) {
|
|
1080
|
+
this.logger.info(`Future success: ${update.status}`);
|
|
1081
|
+
if (this.diskFull) {
|
|
1082
|
+
kosAction(() => {
|
|
1083
|
+
update.endState = FutureEndState.Fail;
|
|
1084
|
+
update.reason = "errDiskFull";
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (update.status === FutureEndState.Fail) {
|
|
1089
|
+
this.logger.error(`Future failed: ${update.status}`);
|
|
1090
|
+
}
|
|
1091
|
+
if (update.note === "copy") {
|
|
1092
|
+
kosAction(() => {
|
|
1093
|
+
this._actionState = "copying";
|
|
1094
|
+
this.copyProgress = update.clientData || {
|
|
1095
|
+
bytesCopied: 0,
|
|
1096
|
+
bytesToCopy: 0,
|
|
1097
|
+
filesCopied: 0,
|
|
1098
|
+
filesSkipped: 0
|
|
1099
|
+
};
|
|
1100
|
+
});
|
|
1101
|
+
} else {
|
|
1102
|
+
this._actionState = "erasing";
|
|
1103
|
+
kosAction(() => {
|
|
1104
|
+
this.copyProgress = {
|
|
1105
|
+
bytesCopied: 0,
|
|
1106
|
+
bytesToCopy: 0,
|
|
1107
|
+
filesCopied: 0,
|
|
1108
|
+
filesSkipped: 0
|
|
1109
|
+
};
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
878
1112
|
}
|
|
879
|
-
async eraseAndCopyVolume(
|
|
880
|
-
|
|
881
|
-
if (!e)
|
|
1113
|
+
async eraseAndCopyVolume(tracker) {
|
|
1114
|
+
if (!tracker) {
|
|
882
1115
|
throw new Error("No tracker provided");
|
|
883
|
-
|
|
1116
|
+
}
|
|
1117
|
+
kosAction(() => {
|
|
884
1118
|
this._actionState = "erasing";
|
|
885
|
-
})
|
|
886
|
-
|
|
887
|
-
|
|
1119
|
+
});
|
|
1120
|
+
if (!this._activeVolume) {
|
|
1121
|
+
this.logger.error("No active volume selected");
|
|
1122
|
+
throw new Error("No active volume selected");
|
|
1123
|
+
}
|
|
1124
|
+
this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
|
|
1125
|
+
return eraseAndCopyLogsToVolume(this._activeVolume.id, tracker);
|
|
888
1126
|
}
|
|
889
|
-
async eraseVolume(
|
|
890
|
-
|
|
891
|
-
if (!e)
|
|
1127
|
+
async eraseVolume(tracker) {
|
|
1128
|
+
if (!tracker) {
|
|
892
1129
|
throw new Error("No tracker provided");
|
|
893
|
-
|
|
1130
|
+
}
|
|
1131
|
+
kosAction(() => {
|
|
894
1132
|
this._actionState = "erasing";
|
|
895
|
-
})
|
|
896
|
-
|
|
897
|
-
|
|
1133
|
+
});
|
|
1134
|
+
if (!this._activeVolume) {
|
|
1135
|
+
this.logger.error("No active volume selected");
|
|
1136
|
+
throw new Error("No active volume selected");
|
|
1137
|
+
}
|
|
1138
|
+
this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
|
|
1139
|
+
return eraseVolume(this._activeVolume.id, tracker);
|
|
898
1140
|
}
|
|
899
|
-
async copyLogs(
|
|
900
|
-
|
|
901
|
-
if (!e)
|
|
1141
|
+
async copyLogs(tracker) {
|
|
1142
|
+
if (!tracker) {
|
|
902
1143
|
throw new Error("No tracker provided");
|
|
903
|
-
|
|
1144
|
+
}
|
|
1145
|
+
kosAction(() => {
|
|
904
1146
|
this._actionState = "copying";
|
|
905
|
-
})
|
|
906
|
-
|
|
907
|
-
|
|
1147
|
+
});
|
|
1148
|
+
if (!this._activeVolume) {
|
|
1149
|
+
this.logger.error("No active volume selected");
|
|
1150
|
+
throw new Error("No active volume selected");
|
|
1151
|
+
}
|
|
1152
|
+
this.logger.info(`Copying logs to ${this._activeVolume?.name}`);
|
|
1153
|
+
return copyLogFromVolume(this._activeVolume.id, tracker);
|
|
908
1154
|
}
|
|
909
1155
|
handleInsertion() {
|
|
910
|
-
|
|
1156
|
+
if (this.inserted) {
|
|
1157
|
+
this.syncVolumes();
|
|
1158
|
+
} else {
|
|
1159
|
+
this._volumes.clear();
|
|
1160
|
+
this.clearActiveVolume();
|
|
1161
|
+
}
|
|
911
1162
|
}
|
|
912
1163
|
async init() {
|
|
913
1164
|
this.logger.debug(`initializing copy-logs ${this.id}`);
|
|
914
1165
|
}
|
|
915
1166
|
async syncVolumes() {
|
|
916
|
-
const [
|
|
917
|
-
|
|
918
|
-
|
|
1167
|
+
const [volumeError, volumes] = await getVolumes();
|
|
1168
|
+
const [error, logSize] = await getLogFileSize();
|
|
1169
|
+
if (error) {
|
|
1170
|
+
this.logger.error(`Error fetching log file size: ${error}`);
|
|
919
1171
|
return;
|
|
920
1172
|
}
|
|
921
|
-
if (
|
|
922
|
-
this.logger.error(`Error fetching volumes: ${
|
|
1173
|
+
if (volumeError) {
|
|
1174
|
+
this.logger.error(`Error fetching volumes: ${volumeError}`);
|
|
923
1175
|
return;
|
|
924
1176
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1177
|
+
if (volumes) {
|
|
1178
|
+
volumes.forEach((volume) => {
|
|
1179
|
+
const storageVolume = this.storageDeviceContainer.getModel(volume.id);
|
|
1180
|
+
if (storageVolume) {
|
|
1181
|
+
const _volume = {
|
|
1182
|
+
id: volume.id,
|
|
1183
|
+
name: storageVolume.label,
|
|
1184
|
+
freeBytes: volume.info.freeBytes,
|
|
1185
|
+
totalBytes: volume.info.totalBytes
|
|
1186
|
+
};
|
|
1187
|
+
this._volumes.addModel(_volume);
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
if (volumes.length === 1) {
|
|
1191
|
+
this.updateActiveVolume(this._volumes.data[0]);
|
|
1192
|
+
} else {
|
|
1193
|
+
this.clearActiveVolume();
|
|
935
1194
|
}
|
|
936
|
-
}
|
|
1195
|
+
}
|
|
1196
|
+
if (logSize) {
|
|
1197
|
+
this.logger.info(`Log file size: ${logSize}`);
|
|
1198
|
+
this.updateLogFileSize(parseInt(logSize, 10));
|
|
1199
|
+
}
|
|
937
1200
|
}
|
|
938
1201
|
async activate() {
|
|
939
|
-
this.logger.debug(`activating copy-logs ${this.id}`)
|
|
1202
|
+
this.logger.debug(`activating copy-logs ${this.id}`);
|
|
1203
|
+
await this.syncVolumes();
|
|
940
1204
|
}
|
|
941
1205
|
async load() {
|
|
942
1206
|
this.logger.debug(`loading copy-logs ${this.id}`);
|
|
943
1207
|
}
|
|
944
1208
|
};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
],
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
],
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
],
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
],
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
dependencies: (
|
|
1209
|
+
__publicField$1(CopyLogsModelImpl, "Registration");
|
|
1210
|
+
__decorateClass$h([
|
|
1211
|
+
kosDependency({ modelType: StorageDeviceContainer.type })
|
|
1212
|
+
], CopyLogsModelImpl.prototype, "storageDeviceContainer", 2);
|
|
1213
|
+
__decorateClass$h([
|
|
1214
|
+
kosFuture()
|
|
1215
|
+
], CopyLogsModelImpl.prototype, "eraseAndCopyVolume", 1);
|
|
1216
|
+
__decorateClass$h([
|
|
1217
|
+
kosFuture()
|
|
1218
|
+
], CopyLogsModelImpl.prototype, "eraseVolume", 1);
|
|
1219
|
+
__decorateClass$h([
|
|
1220
|
+
kosFuture()
|
|
1221
|
+
], CopyLogsModelImpl.prototype, "copyLogs", 1);
|
|
1222
|
+
__decorateClass$h([
|
|
1223
|
+
kosModelEffect({
|
|
1224
|
+
dependencies: (model) => [model.inserted]
|
|
961
1225
|
})
|
|
962
|
-
],
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
],
|
|
968
|
-
const
|
|
1226
|
+
], CopyLogsModelImpl.prototype, "handleInsertion", 1);
|
|
1227
|
+
CopyLogsModelImpl = __decorateClass$h([
|
|
1228
|
+
kosModel({ modelTypeId: MODEL_TYPE$h, singleton: true }),
|
|
1229
|
+
kosFutureAware(),
|
|
1230
|
+
kosLoggerAware()
|
|
1231
|
+
], CopyLogsModelImpl);
|
|
1232
|
+
const CopyLogs = CopyLogsModelImpl.Registration;
|
|
1233
|
+
const log$a = KosLog.createLogger({
|
|
969
1234
|
name: "dashboard-operations-service",
|
|
970
1235
|
group: "Services"
|
|
971
|
-
})
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1236
|
+
});
|
|
1237
|
+
const resolveAll = async (troubleIds, tracker) => {
|
|
1238
|
+
log$a.debug("resolveAll");
|
|
1239
|
+
const response = await TroubleServices.bulkResolveTroubles(
|
|
1240
|
+
troubleIds,
|
|
1241
|
+
void 0,
|
|
1242
|
+
tracker
|
|
1243
|
+
);
|
|
1244
|
+
return response;
|
|
1245
|
+
};
|
|
1246
|
+
const resolveTrouble = async (troubleId, tracker) => {
|
|
1247
|
+
log$a.debug("resolveTrouble");
|
|
1248
|
+
const response = await TroubleServices.resolveTrouble(
|
|
1249
|
+
troubleId,
|
|
1250
|
+
void 0,
|
|
1251
|
+
tracker
|
|
1252
|
+
);
|
|
1253
|
+
return response;
|
|
1254
|
+
};
|
|
1255
|
+
const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
980
1256
|
__proto__: null,
|
|
981
|
-
resolveAll
|
|
982
|
-
resolveTrouble
|
|
1257
|
+
resolveAll,
|
|
1258
|
+
resolveTrouble
|
|
983
1259
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
984
|
-
var
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1260
|
+
var __defProp$b = Object.defineProperty;
|
|
1261
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
1262
|
+
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
1263
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
1264
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1265
|
+
if (decorator = decorators[i])
|
|
1266
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1267
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
1268
|
+
return result;
|
|
1269
|
+
};
|
|
1270
|
+
const MODEL_TYPE$g = "dashboard-operations-model";
|
|
1271
|
+
function resolvableTroubleFilter(trouble) {
|
|
1272
|
+
return !trouble.deferred;
|
|
992
1273
|
}
|
|
993
|
-
function
|
|
994
|
-
return
|
|
1274
|
+
function deferredTroubleFilter(trouble) {
|
|
1275
|
+
return trouble.deferred;
|
|
995
1276
|
}
|
|
996
|
-
let
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
this.id =
|
|
1277
|
+
let DashboardOperationsModelImpl = class {
|
|
1278
|
+
id;
|
|
1279
|
+
troubles;
|
|
1280
|
+
futureHandler;
|
|
1281
|
+
logger;
|
|
1282
|
+
constructor(modelId, options, context) {
|
|
1283
|
+
this.id = modelId;
|
|
1284
|
+
this.futureHandler = new FutureHandler(this);
|
|
1285
|
+
this.logger = context.logger;
|
|
1003
1286
|
}
|
|
1004
1287
|
get troublesByType() {
|
|
1005
1288
|
return this.troubles.troubles.data.reduce(
|
|
1006
|
-
|
|
1289
|
+
troubleByTypeReducer,
|
|
1007
1290
|
{}
|
|
1008
1291
|
);
|
|
1009
1292
|
}
|
|
1010
1293
|
get queuedPurgeTroubles() {
|
|
1011
|
-
return this.purgeTroubles.filter(
|
|
1294
|
+
return this.purgeTroubles.filter(deferredTroubleFilter);
|
|
1012
1295
|
}
|
|
1013
1296
|
get queuedPrimeTroubles() {
|
|
1014
|
-
return this.primeTroubles.filter(
|
|
1297
|
+
return this.primeTroubles.filter(deferredTroubleFilter);
|
|
1015
1298
|
}
|
|
1016
1299
|
get resolvablePrimeTroubles() {
|
|
1017
|
-
return this.primeTroubles.filter(
|
|
1300
|
+
return this.primeTroubles.filter(resolvableTroubleFilter);
|
|
1018
1301
|
}
|
|
1019
1302
|
get resolvablePurgeTroubles() {
|
|
1020
|
-
return this.purgeTroubles.filter(
|
|
1303
|
+
return this.purgeTroubles.filter(resolvableTroubleFilter);
|
|
1021
1304
|
}
|
|
1022
1305
|
get hasResolvablePurgeTroubles() {
|
|
1023
1306
|
return this.resolvablePurgeTroubles.length > 0;
|
|
@@ -1032,28 +1315,37 @@ let C = class {
|
|
|
1032
1315
|
return this.primeTroubles.length > 0;
|
|
1033
1316
|
}
|
|
1034
1317
|
get purgeTroubles() {
|
|
1035
|
-
return this.troublesByType[
|
|
1318
|
+
return this.troublesByType[TROUBLE_TYPE_PURGE$1] || [];
|
|
1036
1319
|
}
|
|
1037
1320
|
get primeTroubles() {
|
|
1038
|
-
return this.troublesByType[
|
|
1321
|
+
return this.troublesByType[TROUBLE_TYPE_PRIME$1] || [];
|
|
1039
1322
|
}
|
|
1040
1323
|
get future() {
|
|
1041
1324
|
return this.futureHandler.getFuture();
|
|
1042
1325
|
}
|
|
1043
|
-
async resolveAllTroubles(
|
|
1044
|
-
if (!
|
|
1326
|
+
async resolveAllTroubles(type, tracker) {
|
|
1327
|
+
if (!tracker) {
|
|
1045
1328
|
throw new Error("No tracker provided");
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1329
|
+
}
|
|
1330
|
+
const container = type === TROUBLE_TYPE_PURGE$1 ? this.purgeTroubles : this.primeTroubles;
|
|
1331
|
+
const shouldDefer = container.filter((trouble) => trouble.shouldDefer);
|
|
1332
|
+
shouldDefer.forEach((trouble) => {
|
|
1333
|
+
this.logger.info(`Deferring trouble ${trouble.rawId}`);
|
|
1334
|
+
trouble.defer();
|
|
1049
1335
|
});
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1336
|
+
const allTroubles = container.filter((trouble) => !trouble.shouldDefer).map((trouble) => trouble.rawId);
|
|
1337
|
+
if (allTroubles.length === 0) {
|
|
1338
|
+
return void 0;
|
|
1339
|
+
}
|
|
1340
|
+
const response = await resolveAll(allTroubles, tracker);
|
|
1341
|
+
return response;
|
|
1052
1342
|
}
|
|
1053
|
-
async resolveTrouble(
|
|
1054
|
-
if (!
|
|
1343
|
+
async resolveTrouble(troubleId, tracker) {
|
|
1344
|
+
if (!tracker) {
|
|
1055
1345
|
throw new Error("No tracker provided");
|
|
1056
|
-
|
|
1346
|
+
}
|
|
1347
|
+
const response = await resolveTrouble(troubleId, tracker);
|
|
1348
|
+
return response;
|
|
1057
1349
|
}
|
|
1058
1350
|
// -------------------LIFECYCLE----------------------------
|
|
1059
1351
|
async init() {
|
|
@@ -1063,42 +1355,46 @@ let C = class {
|
|
|
1063
1355
|
this.logger.debug(`loading dashboard-operations ${this.id}`);
|
|
1064
1356
|
}
|
|
1065
1357
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
modelType:
|
|
1358
|
+
__decorateClass$g([
|
|
1359
|
+
kosDependency({
|
|
1360
|
+
modelType: TroubleContainer.type
|
|
1069
1361
|
})
|
|
1070
|
-
],
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
],
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
],
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
],
|
|
1080
|
-
const
|
|
1362
|
+
], DashboardOperationsModelImpl.prototype, "troubles", 2);
|
|
1363
|
+
__decorateClass$g([
|
|
1364
|
+
kosFuture()
|
|
1365
|
+
], DashboardOperationsModelImpl.prototype, "resolveAllTroubles", 1);
|
|
1366
|
+
__decorateClass$g([
|
|
1367
|
+
kosFuture()
|
|
1368
|
+
], DashboardOperationsModelImpl.prototype, "resolveTrouble", 1);
|
|
1369
|
+
DashboardOperationsModelImpl = __decorateClass$g([
|
|
1370
|
+
kosModel(MODEL_TYPE$g)
|
|
1371
|
+
], DashboardOperationsModelImpl);
|
|
1372
|
+
const DashboardOperations = {
|
|
1081
1373
|
registration: {
|
|
1082
|
-
[
|
|
1083
|
-
class:
|
|
1084
|
-
singleton:
|
|
1374
|
+
[MODEL_TYPE$g]: {
|
|
1375
|
+
class: DashboardOperationsModelImpl,
|
|
1376
|
+
singleton: true
|
|
1085
1377
|
}
|
|
1086
1378
|
},
|
|
1087
|
-
type:
|
|
1088
|
-
predicate:
|
|
1089
|
-
factory:
|
|
1090
|
-
};
|
|
1091
|
-
var
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1379
|
+
type: MODEL_TYPE$g,
|
|
1380
|
+
predicate: isKosModel(MODEL_TYPE$g),
|
|
1381
|
+
factory: Kos.Singleton.create(MODEL_TYPE$g)
|
|
1382
|
+
};
|
|
1383
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
1384
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
1385
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
1386
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1387
|
+
if (decorator = decorators[i])
|
|
1388
|
+
result = decorator(result) || result;
|
|
1389
|
+
return result;
|
|
1390
|
+
};
|
|
1391
|
+
const MODEL_TYPE$f = "dispenser-model";
|
|
1392
|
+
let DispenserModelImpl = class {
|
|
1393
|
+
id;
|
|
1394
|
+
logger;
|
|
1395
|
+
constructor(modelId, options, context) {
|
|
1396
|
+
this.id = modelId;
|
|
1397
|
+
this.logger = context.logger;
|
|
1102
1398
|
}
|
|
1103
1399
|
updateModel() {
|
|
1104
1400
|
}
|
|
@@ -1110,40 +1406,55 @@ let xe = class {
|
|
|
1110
1406
|
this.logger.debug(`loading dispenser ${this.id}`);
|
|
1111
1407
|
}
|
|
1112
1408
|
};
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
],
|
|
1116
|
-
const
|
|
1409
|
+
DispenserModelImpl = __decorateClass$f([
|
|
1410
|
+
kosModel(MODEL_TYPE$f)
|
|
1411
|
+
], DispenserModelImpl);
|
|
1412
|
+
const Dispenser = {
|
|
1117
1413
|
registration: {
|
|
1118
|
-
[
|
|
1119
|
-
class:
|
|
1120
|
-
singleton:
|
|
1414
|
+
[MODEL_TYPE$f]: {
|
|
1415
|
+
class: DispenserModelImpl,
|
|
1416
|
+
singleton: true
|
|
1121
1417
|
}
|
|
1122
1418
|
},
|
|
1123
|
-
type:
|
|
1124
|
-
predicate:
|
|
1125
|
-
factory:
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1419
|
+
type: MODEL_TYPE$f,
|
|
1420
|
+
predicate: isKosModel(MODEL_TYPE$f),
|
|
1421
|
+
factory: Kos.Singleton.create(MODEL_TYPE$f)
|
|
1422
|
+
};
|
|
1423
|
+
const { URL: URL$8 } = resolveServiceUrl("DISPENSER_SERVICE");
|
|
1424
|
+
const { getAll: getAll$5 } = ServiceFactory.build({
|
|
1425
|
+
basePath: `${URL$8}/api/dispenser`
|
|
1426
|
+
});
|
|
1427
|
+
const log$9 = KosLog.createLogger({
|
|
1129
1428
|
name: "dispenser-service",
|
|
1130
1429
|
group: "Services"
|
|
1131
|
-
})
|
|
1430
|
+
});
|
|
1431
|
+
const getDispensers = async () => {
|
|
1432
|
+
log$9.debug("sending GET for dispenser");
|
|
1433
|
+
const response = await getAll$5({});
|
|
1434
|
+
return response;
|
|
1435
|
+
};
|
|
1436
|
+
const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1132
1437
|
__proto__: null,
|
|
1133
|
-
getDispensers
|
|
1438
|
+
getDispensers
|
|
1134
1439
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1440
|
+
var __defProp$a = Object.defineProperty;
|
|
1441
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
1442
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
1443
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
1444
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1445
|
+
if (decorator = decorators[i])
|
|
1446
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1447
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
1448
|
+
return result;
|
|
1449
|
+
};
|
|
1450
|
+
const MODEL_TYPE$e = "dispenser-info-model";
|
|
1451
|
+
let DispenserInfoModelImpl = class {
|
|
1452
|
+
logger;
|
|
1453
|
+
id;
|
|
1454
|
+
name;
|
|
1455
|
+
constructor(modelId, _options, context) {
|
|
1456
|
+
this.id = modelId;
|
|
1457
|
+
this.logger = context.logger;
|
|
1147
1458
|
}
|
|
1148
1459
|
// -------------------LIFECYCLE----------------------------
|
|
1149
1460
|
async init() {
|
|
@@ -1153,51 +1464,65 @@ let ve = class {
|
|
|
1153
1464
|
this.logger.debug(`loading dispenser-info ${this.id}`);
|
|
1154
1465
|
}
|
|
1155
1466
|
};
|
|
1156
|
-
|
|
1157
|
-
|
|
1467
|
+
__decorateClass$e([
|
|
1468
|
+
kosConfigProperty({
|
|
1158
1469
|
path: "kos:device",
|
|
1159
1470
|
attribute: "name"
|
|
1160
1471
|
})
|
|
1161
|
-
],
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
],
|
|
1165
|
-
const
|
|
1472
|
+
], DispenserInfoModelImpl.prototype, "name", 2);
|
|
1473
|
+
DispenserInfoModelImpl = __decorateClass$e([
|
|
1474
|
+
kosModel(MODEL_TYPE$e)
|
|
1475
|
+
], DispenserInfoModelImpl);
|
|
1476
|
+
const DispenserInfo = {
|
|
1166
1477
|
registration: {
|
|
1167
|
-
[
|
|
1168
|
-
class:
|
|
1169
|
-
singleton:
|
|
1478
|
+
[MODEL_TYPE$e]: {
|
|
1479
|
+
class: DispenserInfoModelImpl,
|
|
1480
|
+
singleton: false
|
|
1170
1481
|
}
|
|
1171
1482
|
},
|
|
1172
|
-
type:
|
|
1173
|
-
predicate:
|
|
1174
|
-
factory:
|
|
1175
|
-
|
|
1483
|
+
type: MODEL_TYPE$e,
|
|
1484
|
+
predicate: isKosModel(MODEL_TYPE$e),
|
|
1485
|
+
factory: Kos.Factory.create(
|
|
1486
|
+
MODEL_TYPE$e
|
|
1176
1487
|
)
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
}
|
|
1488
|
+
};
|
|
1489
|
+
const { URL: URL$7 } = resolveServiceUrl("DISPENSER-INFO_SERVICE");
|
|
1490
|
+
const { getAll: getAll$4 } = ServiceFactory.build({
|
|
1491
|
+
basePath: `${URL$7}/api/dispenser-info`
|
|
1492
|
+
});
|
|
1493
|
+
const log$8 = KosLog.createLogger({
|
|
1180
1494
|
name: "dispenser-info-service",
|
|
1181
1495
|
group: "Services"
|
|
1182
|
-
})
|
|
1496
|
+
});
|
|
1497
|
+
const getDispenserInfos = async () => {
|
|
1498
|
+
log$8.debug("sending GET for dispenser-info");
|
|
1499
|
+
const response = await getAll$4({});
|
|
1500
|
+
return response;
|
|
1501
|
+
};
|
|
1502
|
+
const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1183
1503
|
__proto__: null,
|
|
1184
|
-
getDispenserInfos
|
|
1504
|
+
getDispenserInfos
|
|
1185
1505
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1186
|
-
var
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1506
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
1507
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
1508
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
1509
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1510
|
+
if (decorator = decorators[i])
|
|
1511
|
+
result = decorator(result) || result;
|
|
1512
|
+
return result;
|
|
1513
|
+
};
|
|
1514
|
+
const MODEL_TYPE$d = "enrollment-model";
|
|
1515
|
+
let EnrollmentModelImpl = class {
|
|
1516
|
+
id;
|
|
1517
|
+
logger;
|
|
1518
|
+
enrolled;
|
|
1519
|
+
constructor(modelId, _options, context) {
|
|
1520
|
+
this.id = modelId;
|
|
1521
|
+
this.logger = context.logger;
|
|
1522
|
+
this.enrolled = false;
|
|
1523
|
+
}
|
|
1524
|
+
updateModel(options) {
|
|
1525
|
+
console.log("updateModel:", options);
|
|
1201
1526
|
}
|
|
1202
1527
|
// -------------------LIFECYCLE----------------------------
|
|
1203
1528
|
async init() {
|
|
@@ -1207,100 +1532,159 @@ let Ue = class {
|
|
|
1207
1532
|
this.logger.debug(`loading enrollment ${this.id}`);
|
|
1208
1533
|
}
|
|
1209
1534
|
};
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
],
|
|
1213
|
-
const
|
|
1535
|
+
EnrollmentModelImpl = __decorateClass$d([
|
|
1536
|
+
kosModel(MODEL_TYPE$d)
|
|
1537
|
+
], EnrollmentModelImpl);
|
|
1538
|
+
const Enrollment = {
|
|
1214
1539
|
registration: {
|
|
1215
|
-
[
|
|
1216
|
-
class:
|
|
1217
|
-
singleton:
|
|
1540
|
+
[MODEL_TYPE$d]: {
|
|
1541
|
+
class: EnrollmentModelImpl,
|
|
1542
|
+
singleton: true
|
|
1218
1543
|
}
|
|
1219
1544
|
},
|
|
1220
|
-
type:
|
|
1221
|
-
predicate:
|
|
1222
|
-
factory:
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1545
|
+
type: MODEL_TYPE$d,
|
|
1546
|
+
predicate: isKosModel(MODEL_TYPE$d),
|
|
1547
|
+
factory: Kos.Singleton.create(MODEL_TYPE$d)
|
|
1548
|
+
};
|
|
1549
|
+
const { URL: URL$6 } = resolveServiceUrl("ENROLLMENT_SERVICE");
|
|
1550
|
+
const { getAll: getAll$3 } = ServiceFactory.build({
|
|
1551
|
+
basePath: `${URL$6}/api/enrollment`
|
|
1552
|
+
});
|
|
1553
|
+
const log$7 = KosLog.createLogger({
|
|
1226
1554
|
name: "enrollment-service",
|
|
1227
1555
|
group: "Services"
|
|
1228
|
-
})
|
|
1556
|
+
});
|
|
1557
|
+
const getEnrollments = async () => {
|
|
1558
|
+
log$7.debug("sending GET for enrollment");
|
|
1559
|
+
const response = await getAll$3({});
|
|
1560
|
+
return response;
|
|
1561
|
+
};
|
|
1562
|
+
const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1229
1563
|
__proto__: null,
|
|
1230
|
-
getEnrollments
|
|
1231
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1564
|
+
getEnrollments
|
|
1565
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1566
|
+
const isMicroGroup = (group) => group.toLowerCase().includes("micros");
|
|
1567
|
+
const isMacroGroup = (group) => !group.toLowerCase().includes("micros");
|
|
1568
|
+
const macroHolderMap = (assembly) => (holderName) => {
|
|
1569
|
+
const holderGroup = assembly?.getHoldersByGroup(holderName);
|
|
1570
|
+
if (!holderGroup) {
|
|
1571
|
+
return null;
|
|
1572
|
+
}
|
|
1573
|
+
return holderGroup.map((holder) => {
|
|
1574
|
+
return { id: holder.id, name: holder.ingredientName, path: holder.path };
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
const MACRO_KEYS = ["water", "carb", "ns", "nss"];
|
|
1578
|
+
const EXTENSION_POINT_DASHBOARD_KEY_FACTORY = "dashboardKeyFactory";
|
|
1579
|
+
const dashboardKeyFactories = [];
|
|
1580
|
+
registerExtensionPoint(EXTENSION_POINT_DASHBOARD_KEY_FACTORY, {
|
|
1581
|
+
register: (_id, factory) => {
|
|
1582
|
+
if (dashboardKeyFactories.includes(factory)) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
dashboardKeyFactories.push(factory);
|
|
1238
1586
|
},
|
|
1239
|
-
execute: (
|
|
1240
|
-
const
|
|
1241
|
-
for (const
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
return
|
|
1587
|
+
execute: (_id, holder) => {
|
|
1588
|
+
const factories = dashboardKeyFactories.sort((a, b) => a.rank - b.rank);
|
|
1589
|
+
for (const factory of factories) {
|
|
1590
|
+
const key = factory.factory(holder);
|
|
1591
|
+
if (key) {
|
|
1592
|
+
return key;
|
|
1593
|
+
}
|
|
1245
1594
|
}
|
|
1595
|
+
return void 0;
|
|
1246
1596
|
}
|
|
1247
1597
|
});
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1598
|
+
const registerDashboardKeyFactory = (factory) => {
|
|
1599
|
+
ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].register(
|
|
1600
|
+
EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
1601
|
+
factory
|
|
1252
1602
|
);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1603
|
+
};
|
|
1604
|
+
const executeDashboardKeyFactory = (holder) => ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].execute(
|
|
1605
|
+
EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
1606
|
+
holder
|
|
1256
1607
|
);
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1608
|
+
ExtensionManager.registerDashboardKeyFactory = registerDashboardKeyFactory;
|
|
1609
|
+
ExtensionManager.executeDashboardKeyFactory = executeDashboardKeyFactory;
|
|
1610
|
+
const HOUR = 3600;
|
|
1611
|
+
const MINUTE = 60;
|
|
1612
|
+
const toTimeComponents = (seconds) => {
|
|
1613
|
+
const hours = Math.floor(seconds / HOUR);
|
|
1614
|
+
const minutes = Math.floor(seconds % HOUR / MINUTE);
|
|
1615
|
+
return { hours, minutes };
|
|
1616
|
+
};
|
|
1617
|
+
const toSeconds = (hours, minutes) => {
|
|
1618
|
+
const time = hours * HOUR + minutes * MINUTE;
|
|
1619
|
+
return time;
|
|
1620
|
+
};
|
|
1621
|
+
const calculateTimeDifference = (date) => {
|
|
1622
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
1623
|
+
const timeDifference = currentDate.valueOf() - date.valueOf();
|
|
1624
|
+
const minutes = Math.floor(timeDifference / (1e3 * 60));
|
|
1625
|
+
const hours = Math.floor(minutes / 60);
|
|
1626
|
+
const days = Math.floor(hours / 24);
|
|
1627
|
+
const remainingMinutes = minutes % 60;
|
|
1628
|
+
const remainingHours = hours % 24;
|
|
1629
|
+
let result = "";
|
|
1630
|
+
if (days > 0) {
|
|
1631
|
+
result += `${days} day${days > 1 ? "s" : ""} `;
|
|
1632
|
+
}
|
|
1633
|
+
if (remainingHours > 0) {
|
|
1634
|
+
result += `${remainingHours} hour${remainingHours > 1 ? "s" : ""} `;
|
|
1635
|
+
}
|
|
1636
|
+
if (remainingMinutes > 0 || days === 0 && remainingHours === 0) {
|
|
1637
|
+
result += `${remainingMinutes} minute${remainingMinutes > 1 ? "s" : ""} `;
|
|
1638
|
+
}
|
|
1639
|
+
return result;
|
|
1640
|
+
};
|
|
1641
|
+
var __defProp$9 = Object.defineProperty;
|
|
1642
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
1643
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
1644
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
1645
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1646
|
+
if (decorator = decorators[i])
|
|
1647
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1648
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
1649
|
+
return result;
|
|
1650
|
+
};
|
|
1651
|
+
const MODEL_TYPE$c = "ingredient-summary-model";
|
|
1652
|
+
let IngredientSummaryModelImpl = class {
|
|
1653
|
+
id;
|
|
1654
|
+
assemblyModel;
|
|
1655
|
+
dashboardOperationModel;
|
|
1656
|
+
appModel;
|
|
1657
|
+
logger;
|
|
1658
|
+
constructor(modelId, options, context) {
|
|
1659
|
+
this.id = modelId;
|
|
1660
|
+
this.logger = context.logger;
|
|
1661
|
+
this.dashboardOperationModel = DashboardOperations.factory({});
|
|
1281
1662
|
}
|
|
1282
1663
|
get highPriorityHolders() {
|
|
1283
1664
|
return this.assemblyModel.allHolders.filter(
|
|
1284
|
-
(
|
|
1665
|
+
(holder) => holder.troubles.length > 0 && holder.troubles.find((trouble) => trouble.rank >= 400)
|
|
1285
1666
|
);
|
|
1286
1667
|
}
|
|
1287
1668
|
get actionRequiredHolders() {
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1669
|
+
const currentRole = this.appModel.currentRole;
|
|
1670
|
+
const filter = troubleVisibilityFilter(currentRole);
|
|
1671
|
+
return this.assemblyModel.allHolders.filter((holder) => {
|
|
1672
|
+
const companionModel = getKosCompanionModel(
|
|
1673
|
+
holder,
|
|
1674
|
+
FreestyleHolder.type
|
|
1293
1675
|
);
|
|
1294
|
-
if (
|
|
1295
|
-
return
|
|
1296
|
-
|
|
1297
|
-
|
|
1676
|
+
if (companionModel?.isRemote) {
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
const visibleTroubles = holder.troubles.filter(filter);
|
|
1680
|
+
return visibleTroubles.length > 0 && visibleTroubles.find((trouble) => trouble.resolvable);
|
|
1298
1681
|
});
|
|
1299
1682
|
}
|
|
1300
1683
|
get lowLevelHolders() {
|
|
1301
|
-
return this.assemblyModel.allHolders.filter((
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1684
|
+
return this.assemblyModel.allHolders.filter((holder) => {
|
|
1685
|
+
const fillPercent = holder.fillPercent;
|
|
1686
|
+
const hasFuelGuage = holder.hasFuelGuage;
|
|
1687
|
+
return hasFuelGuage && fillPercent < 20;
|
|
1304
1688
|
});
|
|
1305
1689
|
}
|
|
1306
1690
|
// -------------------LIFECYCLE----------------------------
|
|
@@ -1311,53 +1695,69 @@ let L = class {
|
|
|
1311
1695
|
this.logger.debug(`loading ingredient-summary ${this.id}`);
|
|
1312
1696
|
}
|
|
1313
1697
|
};
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
],
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
],
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
],
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
],
|
|
1326
|
-
const
|
|
1698
|
+
__decorateClass$c([
|
|
1699
|
+
kosDependency({ modelType: Assembly.type })
|
|
1700
|
+
], IngredientSummaryModelImpl.prototype, "assemblyModel", 2);
|
|
1701
|
+
__decorateClass$c([
|
|
1702
|
+
kosDependency({ modelType: DashboardOperations.type })
|
|
1703
|
+
], IngredientSummaryModelImpl.prototype, "dashboardOperationModel", 2);
|
|
1704
|
+
__decorateClass$c([
|
|
1705
|
+
kosDependency({ modelType: Application.type })
|
|
1706
|
+
], IngredientSummaryModelImpl.prototype, "appModel", 2);
|
|
1707
|
+
IngredientSummaryModelImpl = __decorateClass$c([
|
|
1708
|
+
kosModel(MODEL_TYPE$c)
|
|
1709
|
+
], IngredientSummaryModelImpl);
|
|
1710
|
+
const IngredientSummary = {
|
|
1327
1711
|
registration: {
|
|
1328
|
-
[
|
|
1329
|
-
class:
|
|
1330
|
-
singleton:
|
|
1712
|
+
[MODEL_TYPE$c]: {
|
|
1713
|
+
class: IngredientSummaryModelImpl,
|
|
1714
|
+
singleton: false
|
|
1331
1715
|
}
|
|
1332
1716
|
},
|
|
1333
|
-
type:
|
|
1334
|
-
predicate:
|
|
1335
|
-
factory:
|
|
1336
|
-
|
|
1717
|
+
type: MODEL_TYPE$c,
|
|
1718
|
+
predicate: isKosModel(MODEL_TYPE$c),
|
|
1719
|
+
factory: Kos.Factory.create(
|
|
1720
|
+
MODEL_TYPE$c
|
|
1337
1721
|
)
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1722
|
+
};
|
|
1723
|
+
const { URL: URL$5 } = resolveServiceUrl("LOCKOUT_SERVICE");
|
|
1724
|
+
const { postModel: postModel$1 } = ServiceFactory.build({
|
|
1725
|
+
basePath: `${URL$5}/api/app/kosdev.ddk/lockout`
|
|
1726
|
+
});
|
|
1727
|
+
const log$6 = KosLog.createLogger({ name: "lockout-service", group: "Services" });
|
|
1728
|
+
const lock = async () => {
|
|
1729
|
+
log$6.info("lock");
|
|
1730
|
+
const response = await postModel$1({
|
|
1731
|
+
model: {},
|
|
1732
|
+
urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/lockNow`
|
|
1733
|
+
});
|
|
1734
|
+
return response;
|
|
1735
|
+
};
|
|
1736
|
+
const unlock = async (pin) => {
|
|
1737
|
+
log$6.info("unlock");
|
|
1738
|
+
const response = await postModel$1({
|
|
1346
1739
|
model: {},
|
|
1347
|
-
urlOverride: `${
|
|
1740
|
+
urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/unlock/${pin}`
|
|
1348
1741
|
});
|
|
1349
|
-
return
|
|
1350
|
-
}
|
|
1742
|
+
return response?.data;
|
|
1743
|
+
};
|
|
1744
|
+
const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1351
1745
|
__proto__: null,
|
|
1352
|
-
lock
|
|
1353
|
-
unlock
|
|
1746
|
+
lock,
|
|
1747
|
+
unlock
|
|
1354
1748
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1355
|
-
var
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1749
|
+
var __defProp$8 = Object.defineProperty;
|
|
1750
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
1751
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
1752
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
1753
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1754
|
+
if (decorator = decorators[i])
|
|
1755
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1756
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
1757
|
+
return result;
|
|
1359
1758
|
};
|
|
1360
|
-
const
|
|
1759
|
+
const MODEL_TYPE$b = "lockout-model";
|
|
1760
|
+
const scheduleData = [
|
|
1361
1761
|
{ day: "monday", lock: "dayWiseLockConfigMap.Mon.enabled", open: "dayWiseLockConfigMap.Mon.unlockTime", close: "dayWiseLockConfigMap.Mon.lockTime" },
|
|
1362
1762
|
{ day: "tuesday", lock: "dayWiseLockConfigMap.Tue.enabled", open: "dayWiseLockConfigMap.Tue.unlockTime", close: "dayWiseLockConfigMap.Tue.lockTime" },
|
|
1363
1763
|
{ day: "wednesday", lock: "dayWiseLockConfigMap.Wed.enabled", open: "dayWiseLockConfigMap.Wed.unlockTime", close: "dayWiseLockConfigMap.Wed.lockTime" },
|
|
@@ -1366,146 +1766,170 @@ const qt = "lockout-model", Xr = [
|
|
|
1366
1766
|
{ day: "saturday", lock: "dayWiseLockConfigMap.Sat.enabled", open: "dayWiseLockConfigMap.Sat.unlockTime", close: "dayWiseLockConfigMap.Sat.lockTime" },
|
|
1367
1767
|
{ day: "sunday", lock: "dayWiseLockConfigMap.Sun.enabled", open: "dayWiseLockConfigMap.Sun.unlockTime", close: "dayWiseLockConfigMap.Sun.lockTime" }
|
|
1368
1768
|
];
|
|
1369
|
-
let
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
i(this, "cuiLockout");
|
|
1406
|
-
this.id = e, this.logger = o.logger, this.saveMap = /* @__PURE__ */ new Map();
|
|
1407
|
-
}
|
|
1769
|
+
let LockoutModelImpl = class {
|
|
1770
|
+
id;
|
|
1771
|
+
logger;
|
|
1772
|
+
dayEnabledList = [
|
|
1773
|
+
"dayWiseLockConfigMap.Sun.enabled",
|
|
1774
|
+
"dayWiseLockConfigMap.Mon.enabled",
|
|
1775
|
+
"dayWiseLockConfigMap.Tue.enabled",
|
|
1776
|
+
"dayWiseLockConfigMap.Wed.enabled",
|
|
1777
|
+
"dayWiseLockConfigMap.Thu.enabled",
|
|
1778
|
+
"dayWiseLockConfigMap.Fri.enabled",
|
|
1779
|
+
"dayWiseLockConfigMap.Sat.enabled"
|
|
1780
|
+
];
|
|
1781
|
+
dayOpenAtList = [
|
|
1782
|
+
"dayWiseLockConfigMap.Sun.unlockTime",
|
|
1783
|
+
"dayWiseLockConfigMap.Mon.unlockTime",
|
|
1784
|
+
"dayWiseLockConfigMap.Tue.unlockTime",
|
|
1785
|
+
"dayWiseLockConfigMap.Wed.unlockTime",
|
|
1786
|
+
"dayWiseLockConfigMap.Thu.unlockTime",
|
|
1787
|
+
"dayWiseLockConfigMap.Fri.unlockTime",
|
|
1788
|
+
"dayWiseLockConfigMap.Sat.unlockTime"
|
|
1789
|
+
];
|
|
1790
|
+
dayCloseAtList = [
|
|
1791
|
+
"dayWiseLockConfigMap.Sun.lockTime",
|
|
1792
|
+
"dayWiseLockConfigMap.Mon.lockTime",
|
|
1793
|
+
"dayWiseLockConfigMap.Tue.lockTime",
|
|
1794
|
+
"dayWiseLockConfigMap.Wed.lockTime",
|
|
1795
|
+
"dayWiseLockConfigMap.Thu.lockTime",
|
|
1796
|
+
"dayWiseLockConfigMap.Fri.lockTime",
|
|
1797
|
+
"dayWiseLockConfigMap.Sat.lockTime"
|
|
1798
|
+
];
|
|
1799
|
+
saveMap;
|
|
1800
|
+
pin;
|
|
1801
|
+
nextLockSkipped;
|
|
1802
|
+
nextLockTime;
|
|
1803
|
+
nextUnLockTime;
|
|
1804
|
+
cuiLockout;
|
|
1408
1805
|
get enabled() {
|
|
1409
|
-
const
|
|
1806
|
+
const oneTimeLockConfigLockTime = this.getProp(
|
|
1410
1807
|
"oneTimeLockConfig.lockTime"
|
|
1411
|
-
)
|
|
1412
|
-
|
|
1808
|
+
);
|
|
1809
|
+
const oneTimeLockEnabled = oneTimeLockConfigLockTime !== void 0 && oneTimeLockConfigLockTime !== "";
|
|
1810
|
+
const lockScheduleEnabled = this.getProp("lockScheduleEnabled");
|
|
1811
|
+
const enabled = oneTimeLockEnabled || lockScheduleEnabled;
|
|
1812
|
+
return enabled;
|
|
1413
1813
|
}
|
|
1414
1814
|
get schedule() {
|
|
1415
|
-
return
|
|
1815
|
+
return scheduleData;
|
|
1416
1816
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1817
|
+
constructor(modelId, _options, context) {
|
|
1818
|
+
this.id = modelId;
|
|
1819
|
+
this.logger = context.logger;
|
|
1820
|
+
this.saveMap = /* @__PURE__ */ new Map();
|
|
1419
1821
|
}
|
|
1420
|
-
|
|
1421
|
-
this.saveMap.
|
|
1822
|
+
getProp(key) {
|
|
1823
|
+
return this.saveMap.get(key);
|
|
1824
|
+
}
|
|
1825
|
+
setProp(key, value) {
|
|
1826
|
+
this.saveMap.set(key, value);
|
|
1422
1827
|
}
|
|
1423
1828
|
// Skip or resume the next lock...
|
|
1424
1829
|
toggleSkip() {
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1830
|
+
const nextLockSkipped = this.nextLockSkipped.value;
|
|
1831
|
+
if (nextLockSkipped === "0") {
|
|
1832
|
+
const nextLockTime = this.nextLockTime.value;
|
|
1833
|
+
if (nextLockTime !== void 0)
|
|
1834
|
+
this.nextLockSkipped.updateProperty(nextLockTime);
|
|
1835
|
+
} else {
|
|
1429
1836
|
this.nextLockSkipped.updateProperty("0");
|
|
1837
|
+
}
|
|
1430
1838
|
}
|
|
1431
|
-
async unlock(
|
|
1432
|
-
return await
|
|
1839
|
+
async unlock(pin) {
|
|
1840
|
+
return await unlock(pin);
|
|
1433
1841
|
}
|
|
1434
1842
|
async save() {
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1843
|
+
this.saveMap.forEach((value, key) => {
|
|
1844
|
+
if (value !== this.cuiLockout.props[key])
|
|
1845
|
+
this.cuiLockout.props[key] = value;
|
|
1846
|
+
});
|
|
1847
|
+
return this.cuiLockout.updateConfigBean();
|
|
1438
1848
|
}
|
|
1439
1849
|
reset() {
|
|
1440
1850
|
this.cuiLockout.props.entries.forEach(
|
|
1441
|
-
([
|
|
1851
|
+
([key, value]) => this.saveMap.set(key, value)
|
|
1442
1852
|
);
|
|
1443
1853
|
}
|
|
1444
1854
|
// -------------------LIFECYCLE----------------------------
|
|
1445
1855
|
async init() {
|
|
1446
|
-
this.logger.debug(`initializing lockout ${this.id}`)
|
|
1447
|
-
|
|
1856
|
+
this.logger.debug(`initializing lockout ${this.id}`);
|
|
1857
|
+
this.cuiLockout.props.entries.forEach(
|
|
1858
|
+
([key, value]) => this.saveMap.set(key, value)
|
|
1448
1859
|
);
|
|
1449
1860
|
}
|
|
1450
1861
|
async load() {
|
|
1451
1862
|
this.logger.debug(`loading lockout ${this.id}`);
|
|
1452
1863
|
}
|
|
1453
1864
|
};
|
|
1454
|
-
|
|
1455
|
-
|
|
1865
|
+
__decorateClass$b([
|
|
1866
|
+
kosConfigProperty({
|
|
1456
1867
|
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1457
1868
|
attribute: "pin"
|
|
1458
1869
|
})
|
|
1459
|
-
],
|
|
1460
|
-
|
|
1461
|
-
|
|
1870
|
+
], LockoutModelImpl.prototype, "pin", 2);
|
|
1871
|
+
__decorateClass$b([
|
|
1872
|
+
kosConfigProperty({
|
|
1462
1873
|
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1463
1874
|
attribute: "nextLockSkipped"
|
|
1464
1875
|
})
|
|
1465
|
-
],
|
|
1466
|
-
|
|
1467
|
-
|
|
1876
|
+
], LockoutModelImpl.prototype, "nextLockSkipped", 2);
|
|
1877
|
+
__decorateClass$b([
|
|
1878
|
+
kosConfigProperty({
|
|
1468
1879
|
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1469
1880
|
attribute: "nextLockTime"
|
|
1470
1881
|
})
|
|
1471
|
-
],
|
|
1472
|
-
|
|
1473
|
-
|
|
1882
|
+
], LockoutModelImpl.prototype, "nextLockTime", 2);
|
|
1883
|
+
__decorateClass$b([
|
|
1884
|
+
kosConfigProperty({
|
|
1474
1885
|
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1475
1886
|
attribute: "nextUnLockTime"
|
|
1476
1887
|
})
|
|
1477
|
-
],
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
],
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
],
|
|
1484
|
-
const
|
|
1485
|
-
class:
|
|
1486
|
-
type:
|
|
1487
|
-
})
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1888
|
+
], LockoutModelImpl.prototype, "nextUnLockTime", 2);
|
|
1889
|
+
__decorateClass$b([
|
|
1890
|
+
kosConfigBean({ path: "app:kosdev.ddk:service:cuiLockout" })
|
|
1891
|
+
], LockoutModelImpl.prototype, "cuiLockout", 2);
|
|
1892
|
+
LockoutModelImpl = __decorateClass$b([
|
|
1893
|
+
kosModel(MODEL_TYPE$b)
|
|
1894
|
+
], LockoutModelImpl);
|
|
1895
|
+
const Lockout = new SingletonKosModelRegistrationFactory({
|
|
1896
|
+
class: LockoutModelImpl,
|
|
1897
|
+
type: MODEL_TYPE$b
|
|
1898
|
+
});
|
|
1899
|
+
const purgeMacroPumps = async (troubleIds, tracker) => {
|
|
1900
|
+
const response = await TroubleServices.bulkResolveTroubles(
|
|
1901
|
+
troubleIds,
|
|
1902
|
+
void 0,
|
|
1903
|
+
tracker
|
|
1904
|
+
);
|
|
1905
|
+
return response;
|
|
1906
|
+
};
|
|
1907
|
+
var __defProp$7 = Object.defineProperty;
|
|
1908
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
1909
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
1910
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
1911
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1912
|
+
if (decorator = decorators[i])
|
|
1913
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1914
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
1915
|
+
return result;
|
|
1916
|
+
};
|
|
1917
|
+
const MODEL_TYPE$a = "macro-assignment-model";
|
|
1918
|
+
const TROUBLE_TYPE_PURGE = "PurgeTrouble";
|
|
1919
|
+
const TROUBLE_TYPE_PRIME = "PrimeTrouble";
|
|
1920
|
+
let MacroAssignmentModelImpl = class {
|
|
1921
|
+
id;
|
|
1922
|
+
logger;
|
|
1923
|
+
/**
|
|
1924
|
+
* futureHandler is used to handle async operations
|
|
1925
|
+
*/
|
|
1926
|
+
futureHandler;
|
|
1927
|
+
holders;
|
|
1928
|
+
ingredients;
|
|
1929
|
+
constructor(modelId, _options, context) {
|
|
1930
|
+
this.id = modelId;
|
|
1931
|
+
this.futureHandler = new FutureHandler();
|
|
1932
|
+
this.logger = context.logger;
|
|
1509
1933
|
}
|
|
1510
1934
|
/**
|
|
1511
1935
|
* shortcut to the current running future
|
|
@@ -1520,7 +1944,11 @@ let D = class {
|
|
|
1520
1944
|
* by the holders position in the dispenser assembly.
|
|
1521
1945
|
*/
|
|
1522
1946
|
get macroHolders() {
|
|
1523
|
-
return this.holders.holders.getIndexByKey("group", "macros").sort((
|
|
1947
|
+
return this.holders.holders.getIndexByKey("group", "macros").sort((a, b) => {
|
|
1948
|
+
if (a.name < b.name) return -1;
|
|
1949
|
+
if (a.name > b.name) return 1;
|
|
1950
|
+
return 0;
|
|
1951
|
+
});
|
|
1524
1952
|
}
|
|
1525
1953
|
/**
|
|
1526
1954
|
* Returns true if there are any macro holders in the dispenser assembly
|
|
@@ -1534,16 +1962,20 @@ let D = class {
|
|
|
1534
1962
|
* Relying on the indexing of troubles by type to find the purge troubles.
|
|
1535
1963
|
*/
|
|
1536
1964
|
get holderPurgeTroubles() {
|
|
1537
|
-
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1965
|
+
const troubles = this.macroHolders.reduce((acc, curr) => {
|
|
1966
|
+
const purgeTroubles = curr.troublesByType[TROUBLE_TYPE_PURGE] || [];
|
|
1967
|
+
acc = [...acc, ...purgeTroubles];
|
|
1968
|
+
return acc;
|
|
1540
1969
|
}, []);
|
|
1970
|
+
return troubles;
|
|
1541
1971
|
}
|
|
1542
1972
|
get holderPrimeTroubles() {
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1973
|
+
const troubles = this.macroHolders.reduce((acc, curr) => {
|
|
1974
|
+
const primeTroubles = curr.troublesByType[TROUBLE_TYPE_PRIME] || [];
|
|
1975
|
+
acc = [...acc, ...primeTroubles];
|
|
1976
|
+
return acc;
|
|
1546
1977
|
}, []);
|
|
1978
|
+
return troubles;
|
|
1547
1979
|
}
|
|
1548
1980
|
/**
|
|
1549
1981
|
* Returns true if there are any purge troubles for the macro holders.
|
|
@@ -1574,59 +2006,197 @@ let D = class {
|
|
|
1574
2006
|
get hasMacroIngredients() {
|
|
1575
2007
|
return this.macroIngredients.length > 0;
|
|
1576
2008
|
}
|
|
1577
|
-
async resolveAll(
|
|
1578
|
-
if (!
|
|
2009
|
+
async resolveAll(type, tracker) {
|
|
2010
|
+
if (!tracker) {
|
|
1579
2011
|
throw new Error("No tracker provided");
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
],
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
],
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
],
|
|
1596
|
-
|
|
2012
|
+
}
|
|
2013
|
+
const container = type === TROUBLE_TYPE_PURGE ? this.holderPurgeTroubles : this.holderPrimeTroubles;
|
|
2014
|
+
const allTroubles = container.map((trouble) => trouble.rawId);
|
|
2015
|
+
const response = await purgeMacroPumps(allTroubles, tracker);
|
|
2016
|
+
return response;
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
__decorateClass$a([
|
|
2020
|
+
kosDependency({ modelType: HolderContainer.type })
|
|
2021
|
+
], MacroAssignmentModelImpl.prototype, "holders", 2);
|
|
2022
|
+
__decorateClass$a([
|
|
2023
|
+
kosDependency({ modelType: IngredientContainer.type })
|
|
2024
|
+
], MacroAssignmentModelImpl.prototype, "ingredients", 2);
|
|
2025
|
+
__decorateClass$a([
|
|
2026
|
+
kosFuture()
|
|
2027
|
+
], MacroAssignmentModelImpl.prototype, "resolveAll", 1);
|
|
2028
|
+
MacroAssignmentModelImpl = __decorateClass$a([
|
|
2029
|
+
kosModel(MODEL_TYPE$a)
|
|
2030
|
+
], MacroAssignmentModelImpl);
|
|
2031
|
+
const MacroAssignment = {
|
|
1597
2032
|
registration: {
|
|
1598
|
-
[
|
|
1599
|
-
class:
|
|
1600
|
-
singleton:
|
|
2033
|
+
[MODEL_TYPE$a]: {
|
|
2034
|
+
class: MacroAssignmentModelImpl,
|
|
2035
|
+
singleton: true
|
|
1601
2036
|
}
|
|
1602
2037
|
},
|
|
1603
|
-
type:
|
|
1604
|
-
predicate:
|
|
1605
|
-
factory:
|
|
1606
|
-
|
|
2038
|
+
type: MODEL_TYPE$a,
|
|
2039
|
+
predicate: isKosModel(MODEL_TYPE$a),
|
|
2040
|
+
factory: Kos.Singleton.create(
|
|
2041
|
+
MODEL_TYPE$a
|
|
1607
2042
|
)
|
|
1608
2043
|
};
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
2044
|
+
const descriptorValue = (ncui, path) => path.split(".").reduce(
|
|
2045
|
+
(value, key) => value && typeof value === "object" ? value[key] : void 0,
|
|
2046
|
+
{ kondra: { ncui } }
|
|
2047
|
+
);
|
|
2048
|
+
const descriptorSetupSteps = (steps, backend) => steps.map((step) => ({
|
|
2049
|
+
complete: false,
|
|
2050
|
+
preStep: false,
|
|
2051
|
+
exclusive: false,
|
|
2052
|
+
...backend.find((existing) => existing.name === step.name),
|
|
2053
|
+
...step
|
|
2054
|
+
}));
|
|
2055
|
+
const withUtility = (columns, entry, column = columns.length - 1) => columns.length === 0 ? [[entry]] : columns.map((items, i) => i === column ? [...items, entry] : items);
|
|
2056
|
+
const withNavigation = (items, entry, parent) => {
|
|
2057
|
+
if (!parent) return [...items, entry];
|
|
2058
|
+
const [head, ...rest] = parent.split(".");
|
|
2059
|
+
return items.map(
|
|
2060
|
+
(item) => item.name === head ? {
|
|
2061
|
+
...item,
|
|
2062
|
+
children: withNavigation(
|
|
2063
|
+
item.children ?? [],
|
|
2064
|
+
entry,
|
|
2065
|
+
rest.join(".") || void 0
|
|
2066
|
+
)
|
|
2067
|
+
} : item
|
|
2068
|
+
);
|
|
2069
|
+
};
|
|
2070
|
+
const withSetupStep = (steps, entry, before) => {
|
|
2071
|
+
const step = { complete: false, preStep: false, exclusive: false, ...entry };
|
|
2072
|
+
const at = before ? steps.findIndex((s) => s.name === before) : -1;
|
|
2073
|
+
return at < 0 ? [...steps, step] : [...steps.slice(0, at), step, ...steps.slice(at)];
|
|
2074
|
+
};
|
|
2075
|
+
const log$5 = KosLog.createLogger({ name: "ddk-mock" });
|
|
2076
|
+
const NCUI_DESCRIPTOR = "/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor";
|
|
2077
|
+
const ANY_DESCRIPTOR = "/api/kos/descriptor/:descriptor";
|
|
2078
|
+
const SETUP_STEPS = "/api/app/kosdev.ddk/setup/steps";
|
|
2079
|
+
const onData = (change) => (body) => {
|
|
2080
|
+
const envelope = body;
|
|
2081
|
+
if (envelope?.data === void 0) return body;
|
|
2082
|
+
return { ...envelope, data: change(envelope.data) };
|
|
2083
|
+
};
|
|
2084
|
+
const lastSegment = (path) => path.split("/").pop() ?? "";
|
|
2085
|
+
const createDdkMockHelpers = (kosMock) => {
|
|
2086
|
+
const removeAll = (...handles) => () => handles.forEach((handle) => handle.remove());
|
|
2087
|
+
return {
|
|
2088
|
+
useDescriptor(descriptor) {
|
|
2089
|
+
const ncui = "kondra" in descriptor ? descriptor.kondra.ncui : descriptor;
|
|
2090
|
+
const handles = [
|
|
2091
|
+
kosMock.get(
|
|
2092
|
+
`${NCUI_DESCRIPTOR}/:path`,
|
|
2093
|
+
(req) => ({ data: descriptorValue(ncui, lastSegment(req.path)) }),
|
|
2094
|
+
{
|
|
2095
|
+
id: "ddk-ncui-descriptor",
|
|
2096
|
+
description: "DDK: the descriptor project as the installed NCUI descriptor",
|
|
2097
|
+
// Paths the descriptor does not have reach the backend.
|
|
2098
|
+
when: (req) => descriptorValue(ncui, lastSegment(req.path)) !== void 0
|
|
2099
|
+
}
|
|
2100
|
+
)
|
|
2101
|
+
];
|
|
2102
|
+
const steps = ncui.setup?.steps;
|
|
2103
|
+
if (steps) {
|
|
2104
|
+
handles.push(
|
|
2105
|
+
kosMock.transformResponse(
|
|
2106
|
+
"GET",
|
|
2107
|
+
SETUP_STEPS,
|
|
2108
|
+
onData(
|
|
2109
|
+
(backend) => descriptorSetupSteps(steps, backend)
|
|
2110
|
+
),
|
|
2111
|
+
{ description: "DDK: the descriptor project's setup steps" }
|
|
2112
|
+
)
|
|
2113
|
+
);
|
|
2114
|
+
}
|
|
2115
|
+
return removeAll(...handles);
|
|
2116
|
+
},
|
|
2117
|
+
addUtility(entry, { column } = {}) {
|
|
2118
|
+
return removeAll(
|
|
2119
|
+
kosMock.transformResponse(
|
|
2120
|
+
"GET",
|
|
2121
|
+
`${ANY_DESCRIPTOR}/kondra.ncui.utilities`,
|
|
2122
|
+
onData(
|
|
2123
|
+
(columns) => withUtility(columns, entry, column)
|
|
2124
|
+
),
|
|
2125
|
+
{ description: `DDK: utility ${entry.name}` }
|
|
2126
|
+
)
|
|
2127
|
+
);
|
|
2128
|
+
},
|
|
2129
|
+
addNavigation(entry, { parent } = {}) {
|
|
2130
|
+
return removeAll(
|
|
2131
|
+
kosMock.transformResponse(
|
|
2132
|
+
"GET",
|
|
2133
|
+
`${ANY_DESCRIPTOR}/kondra.ncui.navigations`,
|
|
2134
|
+
onData(
|
|
2135
|
+
(items) => withNavigation(items, entry, parent)
|
|
2136
|
+
),
|
|
2137
|
+
{ description: `DDK: navigation ${entry.name}` }
|
|
2138
|
+
)
|
|
2139
|
+
);
|
|
2140
|
+
},
|
|
2141
|
+
addSetupStep(entry, { before } = {}) {
|
|
2142
|
+
return removeAll(
|
|
2143
|
+
kosMock.transformResponse(
|
|
2144
|
+
"GET",
|
|
2145
|
+
SETUP_STEPS,
|
|
2146
|
+
onData(
|
|
2147
|
+
(steps) => withSetupStep(steps, entry, before)
|
|
2148
|
+
),
|
|
2149
|
+
{ description: `DDK: setup step ${entry.name}` }
|
|
2150
|
+
)
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
};
|
|
2154
|
+
};
|
|
2155
|
+
const registerDdkMock = () => {
|
|
2156
|
+
const kosMock = globalThis.KosMock;
|
|
2157
|
+
if (typeof kosMock?.extend !== "function") return;
|
|
2158
|
+
try {
|
|
2159
|
+
kosMock.extend("ddk", createDdkMockHelpers);
|
|
2160
|
+
} catch (error) {
|
|
2161
|
+
log$5.warn("kosMock.ddk not registered", error?.message);
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
2165
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
2166
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
2167
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2168
|
+
if (decorator = decorators[i])
|
|
2169
|
+
result = decorator(result) || result;
|
|
2170
|
+
return result;
|
|
2171
|
+
};
|
|
2172
|
+
const MODEL_TYPE$9 = "network-test-model";
|
|
2173
|
+
let NetworkTestModelImpl = class {
|
|
2174
|
+
id;
|
|
2175
|
+
group;
|
|
2176
|
+
passed;
|
|
2177
|
+
inProgress;
|
|
2178
|
+
failureTime;
|
|
2179
|
+
timestamp;
|
|
2180
|
+
name;
|
|
2181
|
+
results;
|
|
2182
|
+
logger;
|
|
2183
|
+
constructor(modelId, options, context) {
|
|
2184
|
+
this.id = modelId;
|
|
2185
|
+
this.logger = context.logger;
|
|
2186
|
+
this.group = options.group;
|
|
2187
|
+
this.passed = false;
|
|
2188
|
+
this.inProgress = false;
|
|
2189
|
+
this.name = options.name;
|
|
2190
|
+
this.results = [];
|
|
2191
|
+
}
|
|
2192
|
+
updateModel(options) {
|
|
2193
|
+
this.group = options.group;
|
|
2194
|
+
this.name = options.name;
|
|
2195
|
+
this.passed = options.passed;
|
|
2196
|
+
this.failureTime = options.failureTime;
|
|
2197
|
+
this.inProgress = options.inProgress;
|
|
2198
|
+
this.timestamp = options.timestamp;
|
|
2199
|
+
this.results = options.results;
|
|
1630
2200
|
}
|
|
1631
2201
|
// -------------------LIFECYCLE----------------------------
|
|
1632
2202
|
async init() {
|
|
@@ -1636,75 +2206,94 @@ let We = class {
|
|
|
1636
2206
|
this.logger.debug(`loading network-test ${this.id}`);
|
|
1637
2207
|
}
|
|
1638
2208
|
};
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
],
|
|
1642
|
-
const
|
|
2209
|
+
NetworkTestModelImpl = __decorateClass$9([
|
|
2210
|
+
kosModel(MODEL_TYPE$9)
|
|
2211
|
+
], NetworkTestModelImpl);
|
|
2212
|
+
const NetworkTest = {
|
|
1643
2213
|
registration: {
|
|
1644
|
-
[
|
|
1645
|
-
class:
|
|
1646
|
-
singleton:
|
|
2214
|
+
[MODEL_TYPE$9]: {
|
|
2215
|
+
class: NetworkTestModelImpl,
|
|
2216
|
+
singleton: false
|
|
1647
2217
|
}
|
|
1648
2218
|
},
|
|
1649
|
-
type:
|
|
1650
|
-
predicate:
|
|
1651
|
-
factory:
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
|
|
2219
|
+
type: MODEL_TYPE$9,
|
|
2220
|
+
predicate: isKosModel(MODEL_TYPE$9),
|
|
2221
|
+
factory: Kos.Factory.create(MODEL_TYPE$9)
|
|
2222
|
+
};
|
|
2223
|
+
const { URL: URL$4 } = resolveServiceUrl("NETWORK-TEST_SERVICE");
|
|
2224
|
+
const { getAll: getAll$2, getOne: getOne$1 } = ServiceFactory.build({
|
|
2225
|
+
basePath: `${URL$4}/api/app/ncui/network/tests`
|
|
2226
|
+
});
|
|
2227
|
+
const log$4 = KosLog.createLogger({
|
|
1655
2228
|
name: "network-test-service",
|
|
1656
2229
|
group: "Services"
|
|
1657
|
-
})
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
2230
|
+
});
|
|
2231
|
+
const getNetworkTests = async () => {
|
|
2232
|
+
log$4.debug("sending GET for network-test");
|
|
2233
|
+
const response = await getAll$2({
|
|
2234
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests`
|
|
1661
2235
|
});
|
|
1662
|
-
return
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
|
|
2236
|
+
return response?.data;
|
|
2237
|
+
};
|
|
2238
|
+
const getTestsReports = async () => {
|
|
2239
|
+
const response = await getOne$1({
|
|
2240
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/reports`
|
|
2241
|
+
});
|
|
2242
|
+
return response?.data;
|
|
2243
|
+
};
|
|
2244
|
+
const performGroupTest = async (group, tracker) => {
|
|
2245
|
+
const response = await getOne$1({
|
|
2246
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests/run/group/${group}`,
|
|
2247
|
+
tracker
|
|
1666
2248
|
});
|
|
1667
|
-
return
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
tracker: t
|
|
1671
|
-
}), di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2249
|
+
return response;
|
|
2250
|
+
};
|
|
2251
|
+
const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1672
2252
|
__proto__: null,
|
|
1673
|
-
getNetworkTests
|
|
1674
|
-
getTestsReports
|
|
1675
|
-
performGroupTest
|
|
2253
|
+
getNetworkTests,
|
|
2254
|
+
getTestsReports,
|
|
2255
|
+
performGroupTest
|
|
1676
2256
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1677
|
-
var
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
2257
|
+
var __defProp$6 = Object.defineProperty;
|
|
2258
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
2259
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
2260
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
2261
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2262
|
+
if (decorator = decorators[i])
|
|
2263
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2264
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
2265
|
+
return result;
|
|
2266
|
+
};
|
|
2267
|
+
const MODEL_TYPE$8 = "network-test-container-model";
|
|
2268
|
+
let NetworkTestContainerModelImpl = class {
|
|
2269
|
+
id;
|
|
2270
|
+
logger;
|
|
2271
|
+
lastTested;
|
|
2272
|
+
futureHandler;
|
|
2273
|
+
models;
|
|
2274
|
+
constructor(modelId, options, context) {
|
|
2275
|
+
this.id = modelId;
|
|
2276
|
+
this.logger = context.logger;
|
|
2277
|
+
this.futureHandler = new FutureHandler(this);
|
|
2278
|
+
this.models = new KosModelContainer({
|
|
2279
|
+
parentId: modelId,
|
|
1692
2280
|
indexMap: {
|
|
1693
2281
|
group: "group"
|
|
1694
2282
|
}
|
|
1695
|
-
})
|
|
2283
|
+
});
|
|
2284
|
+
this.lastTested = /* @__PURE__ */ new Date("default");
|
|
1696
2285
|
}
|
|
1697
2286
|
get data() {
|
|
1698
2287
|
return this.models.data;
|
|
1699
2288
|
}
|
|
1700
|
-
addModel(
|
|
1701
|
-
this.models.addModel(
|
|
2289
|
+
addModel(model) {
|
|
2290
|
+
this.models.addModel(model);
|
|
1702
2291
|
}
|
|
1703
|
-
removeModel(
|
|
1704
|
-
this.models.removeModel(
|
|
2292
|
+
removeModel(id) {
|
|
2293
|
+
this.models.removeModel(id);
|
|
1705
2294
|
}
|
|
1706
|
-
getModel(
|
|
1707
|
-
return this.models.getModel(
|
|
2295
|
+
getModel(id) {
|
|
2296
|
+
return this.models.getModel(id);
|
|
1708
2297
|
}
|
|
1709
2298
|
// -------------------LIFECYCLE----------------------------
|
|
1710
2299
|
async init() {
|
|
@@ -1712,99 +2301,119 @@ let ne = class {
|
|
|
1712
2301
|
`initializing network-test-container container ${this.id}`
|
|
1713
2302
|
);
|
|
1714
2303
|
}
|
|
1715
|
-
getLastTested(
|
|
1716
|
-
const
|
|
1717
|
-
|
|
2304
|
+
getLastTested(groupName) {
|
|
2305
|
+
const dateArray = this.models.getIndexByKey("group", groupName).map((obj) => obj.timestamp && new Date(obj.timestamp));
|
|
2306
|
+
const latestDate = Math.max(
|
|
2307
|
+
...dateArray.map((date) => date ? date.getTime() : 0)
|
|
1718
2308
|
);
|
|
1719
|
-
return
|
|
2309
|
+
return latestDate ? calculateTimeDifference(new Date(latestDate)) : "";
|
|
1720
2310
|
}
|
|
1721
2311
|
async load() {
|
|
1722
2312
|
this.logger.debug(`loading network-test-container container ${this.id}`);
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
2313
|
+
const testResponse = await getNetworkTests();
|
|
2314
|
+
const testReportResponse = await getTestsReports();
|
|
2315
|
+
if (testResponse) {
|
|
2316
|
+
testResponse.forEach((item) => {
|
|
2317
|
+
const testModel = NetworkTest.factory(item.id)(item);
|
|
2318
|
+
this.addModel(testModel);
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2321
|
+
if (testResponse && testReportResponse) {
|
|
2322
|
+
testResponse.forEach((item) => {
|
|
2323
|
+
const groupReport = testReportResponse?.[item.group];
|
|
2324
|
+
const testReport = groupReport?.[item.id];
|
|
2325
|
+
const testModel = this.getModel(item.id);
|
|
2326
|
+
if (testModel && testReport) {
|
|
2327
|
+
const update = {
|
|
2328
|
+
group: testReport.group,
|
|
2329
|
+
name: testReport.name,
|
|
2330
|
+
passed: testReport.passed,
|
|
2331
|
+
failureTime: testReport.failureTime ? new Date(testReport.failureTime) : void 0,
|
|
2332
|
+
inProgress: testReport.inProgress,
|
|
2333
|
+
timestamp: new Date(testReport.timestamp),
|
|
2334
|
+
results: testReport.results
|
|
2335
|
+
};
|
|
2336
|
+
testModel.updateModel(update);
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
1742
2340
|
}
|
|
1743
|
-
async performTest(
|
|
1744
|
-
if (!
|
|
2341
|
+
async performTest(group, tracker) {
|
|
2342
|
+
if (!tracker) {
|
|
1745
2343
|
throw new Error("No tracker provided");
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
group: o.group,
|
|
1758
|
-
name: o.name,
|
|
1759
|
-
passed: o.passed,
|
|
1760
|
-
failureTime: o.failureTime ? new Date(o.failureTime) : void 0,
|
|
1761
|
-
inProgress: o.inProgress,
|
|
1762
|
-
timestamp: new Date(o.timestamp),
|
|
1763
|
-
results: o.results
|
|
1764
|
-
};
|
|
1765
|
-
v(() => {
|
|
1766
|
-
s.updateModel(r);
|
|
2344
|
+
}
|
|
2345
|
+
const result = await performGroupTest(group, tracker);
|
|
2346
|
+
return result?.data;
|
|
2347
|
+
}
|
|
2348
|
+
onFutureUpdate(future) {
|
|
2349
|
+
const { clientData } = future;
|
|
2350
|
+
if (clientData) {
|
|
2351
|
+
clientData.forEach((item) => {
|
|
2352
|
+
const testModel = this.getModel(item.id);
|
|
2353
|
+
kosAction(() => {
|
|
2354
|
+
this.lastTested = this.lastTested > new Date(item.timestamp) ? this.lastTested : new Date(item.timestamp);
|
|
1767
2355
|
});
|
|
1768
|
-
|
|
1769
|
-
|
|
2356
|
+
if (testModel) {
|
|
2357
|
+
const update = {
|
|
2358
|
+
group: item.group,
|
|
2359
|
+
name: item.name,
|
|
2360
|
+
passed: item.passed,
|
|
2361
|
+
failureTime: item.failureTime ? new Date(item.failureTime) : void 0,
|
|
2362
|
+
inProgress: item.inProgress,
|
|
2363
|
+
timestamp: new Date(item.timestamp),
|
|
2364
|
+
results: item.results
|
|
2365
|
+
};
|
|
2366
|
+
kosAction(() => {
|
|
2367
|
+
testModel.updateModel(update);
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
1770
2372
|
}
|
|
1771
2373
|
};
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
],
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
],
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
],
|
|
1781
|
-
const
|
|
2374
|
+
__decorateClass$8([
|
|
2375
|
+
kosChild
|
|
2376
|
+
], NetworkTestContainerModelImpl.prototype, "models", 2);
|
|
2377
|
+
__decorateClass$8([
|
|
2378
|
+
kosFuture()
|
|
2379
|
+
], NetworkTestContainerModelImpl.prototype, "performTest", 1);
|
|
2380
|
+
NetworkTestContainerModelImpl = __decorateClass$8([
|
|
2381
|
+
kosModel(MODEL_TYPE$8)
|
|
2382
|
+
], NetworkTestContainerModelImpl);
|
|
2383
|
+
const NetworkTestContainer = {
|
|
1782
2384
|
registration: {
|
|
1783
|
-
[
|
|
1784
|
-
class:
|
|
1785
|
-
singleton:
|
|
2385
|
+
[MODEL_TYPE$8]: {
|
|
2386
|
+
class: NetworkTestContainerModelImpl,
|
|
2387
|
+
singleton: true
|
|
1786
2388
|
},
|
|
1787
|
-
...
|
|
2389
|
+
...NetworkTest.registration
|
|
1788
2390
|
},
|
|
1789
|
-
type:
|
|
1790
|
-
predicate:
|
|
1791
|
-
factory:
|
|
1792
|
-
};
|
|
1793
|
-
var
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
2391
|
+
type: MODEL_TYPE$8,
|
|
2392
|
+
predicate: isKosModel(MODEL_TYPE$8),
|
|
2393
|
+
factory: Kos.Singleton.create(MODEL_TYPE$8)
|
|
2394
|
+
};
|
|
2395
|
+
var __defProp$5 = Object.defineProperty;
|
|
2396
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
2397
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
2398
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
2399
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2400
|
+
if (decorator = decorators[i])
|
|
2401
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2402
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
2403
|
+
return result;
|
|
2404
|
+
};
|
|
2405
|
+
const MODEL_TYPE$7 = "nutritive-sweetener-model";
|
|
2406
|
+
const PATH_PUMP_STATE = createPropKey("statePath");
|
|
2407
|
+
let NutritiveSweetenerModelImpl = class {
|
|
2408
|
+
id;
|
|
2409
|
+
assemblyModel;
|
|
2410
|
+
pumpState;
|
|
2411
|
+
constructor(modelId, _options) {
|
|
2412
|
+
this.id = modelId;
|
|
1805
2413
|
}
|
|
1806
2414
|
get holder() {
|
|
1807
|
-
|
|
2415
|
+
const nsHolder = this.assemblyModel.getHoldersByGroup("ns")[0];
|
|
2416
|
+
return nsHolder;
|
|
1808
2417
|
}
|
|
1809
2418
|
getHolder() {
|
|
1810
2419
|
return this.holder;
|
|
@@ -1819,49 +2428,57 @@ let ae = class {
|
|
|
1819
2428
|
return this.pump;
|
|
1820
2429
|
}
|
|
1821
2430
|
};
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
],
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
path:
|
|
2431
|
+
__decorateClass$7([
|
|
2432
|
+
kosDependency({ modelType: Assembly.type })
|
|
2433
|
+
], NutritiveSweetenerModelImpl.prototype, "assemblyModel", 2);
|
|
2434
|
+
__decorateClass$7([
|
|
2435
|
+
kosStateBean({
|
|
2436
|
+
path: PATH_PUMP_STATE
|
|
1828
2437
|
})
|
|
1829
|
-
],
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
],
|
|
1834
|
-
const
|
|
2438
|
+
], NutritiveSweetenerModelImpl.prototype, "pumpState", 2);
|
|
2439
|
+
NutritiveSweetenerModelImpl = __decorateClass$7([
|
|
2440
|
+
kosModel(MODEL_TYPE$7),
|
|
2441
|
+
kosLoggerAware()
|
|
2442
|
+
], NutritiveSweetenerModelImpl);
|
|
2443
|
+
const NutritiveSweetener = {
|
|
1835
2444
|
registration: {
|
|
1836
|
-
[
|
|
1837
|
-
class:
|
|
1838
|
-
singleton:
|
|
2445
|
+
[MODEL_TYPE$7]: {
|
|
2446
|
+
class: NutritiveSweetenerModelImpl,
|
|
2447
|
+
singleton: false
|
|
1839
2448
|
}
|
|
1840
2449
|
},
|
|
1841
|
-
type:
|
|
1842
|
-
predicate:
|
|
1843
|
-
factory:
|
|
1844
|
-
};
|
|
1845
|
-
var
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
2450
|
+
type: MODEL_TYPE$7,
|
|
2451
|
+
predicate: isKosModel(MODEL_TYPE$7),
|
|
2452
|
+
factory: Kos.Factory.create(MODEL_TYPE$7)
|
|
2453
|
+
};
|
|
2454
|
+
var __defProp$4 = Object.defineProperty;
|
|
2455
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
2456
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
2457
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
2458
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2459
|
+
if (decorator = decorators[i])
|
|
2460
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2461
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
2462
|
+
return result;
|
|
2463
|
+
};
|
|
2464
|
+
const MODEL_TYPE$6 = "plain-water-model";
|
|
2465
|
+
let PlainWaterModelImpl = class {
|
|
2466
|
+
id;
|
|
2467
|
+
assemblyModel;
|
|
2468
|
+
logger;
|
|
2469
|
+
constructor(modelId, _options, context) {
|
|
2470
|
+
this.id = modelId;
|
|
2471
|
+
this.logger = context.logger;
|
|
1857
2472
|
}
|
|
1858
2473
|
getHolder() {
|
|
1859
|
-
|
|
2474
|
+
const waterHolder = this.assemblyModel.getHoldersByGroup("water")[0];
|
|
2475
|
+
return waterHolder;
|
|
1860
2476
|
}
|
|
1861
2477
|
getPump() {
|
|
1862
|
-
|
|
1863
|
-
const
|
|
1864
|
-
|
|
2478
|
+
const waterHolder = this.getHolder();
|
|
2479
|
+
const pump = waterHolder?.pumps?.data?.[0];
|
|
2480
|
+
const model = getKosCompanionModel(pump, FcmPump.type);
|
|
2481
|
+
return model ?? waterHolder;
|
|
1865
2482
|
}
|
|
1866
2483
|
// -------------------LIFECYCLE----------------------------
|
|
1867
2484
|
async init() {
|
|
@@ -1871,45 +2488,58 @@ let me = class {
|
|
|
1871
2488
|
this.logger.debug(`loading plain-water ${this.id}`);
|
|
1872
2489
|
}
|
|
1873
2490
|
};
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
],
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
],
|
|
1880
|
-
const
|
|
2491
|
+
__decorateClass$6([
|
|
2492
|
+
kosDependency({ modelType: Assembly.type })
|
|
2493
|
+
], PlainWaterModelImpl.prototype, "assemblyModel", 2);
|
|
2494
|
+
PlainWaterModelImpl = __decorateClass$6([
|
|
2495
|
+
kosModel(MODEL_TYPE$6)
|
|
2496
|
+
], PlainWaterModelImpl);
|
|
2497
|
+
const PlainWater = {
|
|
1881
2498
|
registration: {
|
|
1882
|
-
[
|
|
1883
|
-
class:
|
|
1884
|
-
singleton:
|
|
2499
|
+
[MODEL_TYPE$6]: {
|
|
2500
|
+
class: PlainWaterModelImpl,
|
|
2501
|
+
singleton: false
|
|
1885
2502
|
}
|
|
1886
2503
|
},
|
|
1887
|
-
type:
|
|
1888
|
-
predicate:
|
|
1889
|
-
factory:
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
2504
|
+
type: MODEL_TYPE$6,
|
|
2505
|
+
predicate: isKosModel(MODEL_TYPE$6),
|
|
2506
|
+
factory: Kos.Factory.create(MODEL_TYPE$6)
|
|
2507
|
+
};
|
|
2508
|
+
const { URL: URL$3 } = resolveServiceUrl("REBOOT_SERVICE");
|
|
2509
|
+
const { postModel } = ServiceFactory.build({
|
|
2510
|
+
basePath: `${URL$3}/api/reboot`
|
|
2511
|
+
});
|
|
2512
|
+
const log$3 = KosLog.createLogger({ name: "reboot-service", group: "Services" });
|
|
2513
|
+
const rebootDispenser = async () => {
|
|
2514
|
+
log$3.debug("sending POST call for Reboot Dispenser");
|
|
2515
|
+
const response = await postModel({
|
|
2516
|
+
urlOverride: `${URL$3}/api/app/kosdev.ddk/ncui/reboot`,
|
|
2517
|
+
model: {}
|
|
2518
|
+
});
|
|
2519
|
+
return response;
|
|
2520
|
+
};
|
|
2521
|
+
const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1896
2522
|
__proto__: null,
|
|
1897
|
-
rebootDispenser
|
|
2523
|
+
rebootDispenser
|
|
1898
2524
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1899
|
-
var
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2525
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2526
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
2527
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
2528
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2529
|
+
if (decorator = decorators[i])
|
|
2530
|
+
result = decorator(result) || result;
|
|
2531
|
+
return result;
|
|
2532
|
+
};
|
|
2533
|
+
const MODEL_TYPE$5 = "reboot-model";
|
|
2534
|
+
let RebootModelImpl = class {
|
|
2535
|
+
id;
|
|
2536
|
+
logger;
|
|
2537
|
+
constructor(modelId, options, context) {
|
|
2538
|
+
this.id = modelId;
|
|
2539
|
+
this.logger = context.logger;
|
|
1910
2540
|
}
|
|
1911
2541
|
async completeReboot() {
|
|
1912
|
-
await
|
|
2542
|
+
await rebootDispenser();
|
|
1913
2543
|
}
|
|
1914
2544
|
updateModel() {
|
|
1915
2545
|
}
|
|
@@ -1921,41 +2551,47 @@ let Ne = class {
|
|
|
1921
2551
|
this.logger.debug(`loading reboot ${this.id}`);
|
|
1922
2552
|
}
|
|
1923
2553
|
};
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
],
|
|
1927
|
-
const
|
|
2554
|
+
RebootModelImpl = __decorateClass$5([
|
|
2555
|
+
kosModel(MODEL_TYPE$5)
|
|
2556
|
+
], RebootModelImpl);
|
|
2557
|
+
const Reboot = {
|
|
1928
2558
|
registration: {
|
|
1929
|
-
[
|
|
1930
|
-
class:
|
|
1931
|
-
singleton:
|
|
2559
|
+
[MODEL_TYPE$5]: {
|
|
2560
|
+
class: RebootModelImpl,
|
|
2561
|
+
singleton: false
|
|
1932
2562
|
}
|
|
1933
2563
|
},
|
|
1934
|
-
type:
|
|
1935
|
-
predicate:
|
|
1936
|
-
factory:
|
|
1937
|
-
};
|
|
1938
|
-
var $
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2564
|
+
type: MODEL_TYPE$5,
|
|
2565
|
+
predicate: isKosModel(MODEL_TYPE$5),
|
|
2566
|
+
factory: Kos.Factory.create(MODEL_TYPE$5)
|
|
2567
|
+
};
|
|
2568
|
+
var __defProp$3 = Object.defineProperty;
|
|
2569
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
2570
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
2571
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
2572
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2573
|
+
if (decorator = decorators[i])
|
|
2574
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2575
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
2576
|
+
return result;
|
|
2577
|
+
};
|
|
2578
|
+
const MODEL_TYPE$4 = "settings-model";
|
|
2579
|
+
let SettingsModelImpl = class {
|
|
2580
|
+
id;
|
|
2581
|
+
logger;
|
|
2582
|
+
ncuiLanguageData;
|
|
2583
|
+
resolveDelaysMs;
|
|
2584
|
+
dateFormat;
|
|
2585
|
+
timeFormat;
|
|
2586
|
+
hidePlainWaterBev;
|
|
2587
|
+
hideCarbWaterBev;
|
|
2588
|
+
ncuiLanguage;
|
|
2589
|
+
name;
|
|
2590
|
+
activateAndRebootTime;
|
|
2591
|
+
horizontalMode;
|
|
2592
|
+
constructor(modelId, _options, context) {
|
|
2593
|
+
this.id = modelId;
|
|
2594
|
+
this.logger = context.logger;
|
|
1959
2595
|
}
|
|
1960
2596
|
// -------------------LIFECYCLE----------------------------
|
|
1961
2597
|
async ready() {
|
|
@@ -1975,7 +2611,8 @@ let f = class {
|
|
|
1975
2611
|
};
|
|
1976
2612
|
}
|
|
1977
2613
|
async load() {
|
|
1978
|
-
this.logger.debug(`loading settings ${this.id}`)
|
|
2614
|
+
this.logger.debug(`loading settings ${this.id}`);
|
|
2615
|
+
this.ncuiLanguageData = {
|
|
1979
2616
|
status: 200,
|
|
1980
2617
|
data: {
|
|
1981
2618
|
languages: [
|
|
@@ -1991,114 +2628,141 @@ let f = class {
|
|
|
1991
2628
|
this.updateDisplayMode();
|
|
1992
2629
|
}
|
|
1993
2630
|
updateDisplayMode() {
|
|
1994
|
-
this.horizontalMode.value
|
|
2631
|
+
if (this.horizontalMode.value) {
|
|
2632
|
+
document.body.setAttribute("data-orientation", "landscape");
|
|
2633
|
+
} else {
|
|
2634
|
+
document.body.setAttribute("data-orientation", "portrait");
|
|
2635
|
+
}
|
|
1995
2636
|
}
|
|
1996
2637
|
};
|
|
1997
|
-
|
|
1998
|
-
|
|
2638
|
+
__decorateClass$4([
|
|
2639
|
+
kosConfigProperty({
|
|
1999
2640
|
path: "system:app",
|
|
2000
2641
|
attribute: "resolveDelaysMs"
|
|
2001
2642
|
// optionsExpander: () => [],
|
|
2002
2643
|
})
|
|
2003
|
-
],
|
|
2004
|
-
|
|
2005
|
-
|
|
2644
|
+
], SettingsModelImpl.prototype, "resolveDelaysMs", 2);
|
|
2645
|
+
__decorateClass$4([
|
|
2646
|
+
kosConfigProperty({
|
|
2006
2647
|
path: "system:app",
|
|
2007
2648
|
attribute: "dateFormat"
|
|
2008
2649
|
// optionsExpander: () => [],
|
|
2009
2650
|
})
|
|
2010
|
-
],
|
|
2011
|
-
|
|
2012
|
-
|
|
2651
|
+
], SettingsModelImpl.prototype, "dateFormat", 2);
|
|
2652
|
+
__decorateClass$4([
|
|
2653
|
+
kosConfigProperty({
|
|
2013
2654
|
path: "system:app",
|
|
2014
2655
|
attribute: "timeFormat"
|
|
2015
2656
|
// optionsExpander: () => [],
|
|
2016
2657
|
})
|
|
2017
|
-
],
|
|
2018
|
-
|
|
2019
|
-
|
|
2658
|
+
], SettingsModelImpl.prototype, "timeFormat", 2);
|
|
2659
|
+
__decorateClass$4([
|
|
2660
|
+
kosConfigProperty({
|
|
2020
2661
|
path: "app:kosdev.ddk:app",
|
|
2021
2662
|
attribute: "ncui.hidePlainWaterBev"
|
|
2022
2663
|
})
|
|
2023
|
-
],
|
|
2024
|
-
|
|
2025
|
-
|
|
2664
|
+
], SettingsModelImpl.prototype, "hidePlainWaterBev", 2);
|
|
2665
|
+
__decorateClass$4([
|
|
2666
|
+
kosConfigProperty({
|
|
2026
2667
|
path: "app:kosdev.ddk:app",
|
|
2027
2668
|
attribute: "ncui.hideCarbWaterBev"
|
|
2028
2669
|
})
|
|
2029
|
-
],
|
|
2030
|
-
|
|
2031
|
-
|
|
2670
|
+
], SettingsModelImpl.prototype, "hideCarbWaterBev", 2);
|
|
2671
|
+
__decorateClass$4([
|
|
2672
|
+
kosConfigProperty({
|
|
2032
2673
|
path: "app:kosdev.ddk:app",
|
|
2033
2674
|
attribute: "ncui.ncuiLanguage"
|
|
2034
2675
|
})
|
|
2035
|
-
],
|
|
2036
|
-
|
|
2037
|
-
|
|
2676
|
+
], SettingsModelImpl.prototype, "ncuiLanguage", 2);
|
|
2677
|
+
__decorateClass$4([
|
|
2678
|
+
kosConfigProperty({
|
|
2038
2679
|
path: "kos:device",
|
|
2039
2680
|
attribute: "name"
|
|
2040
2681
|
})
|
|
2041
|
-
],
|
|
2042
|
-
|
|
2043
|
-
|
|
2682
|
+
], SettingsModelImpl.prototype, "name", 2);
|
|
2683
|
+
__decorateClass$4([
|
|
2684
|
+
kosConfigProperty({
|
|
2044
2685
|
path: "kos:service:OTA",
|
|
2045
2686
|
attribute: "activateAndRebootTime"
|
|
2046
2687
|
})
|
|
2047
|
-
],
|
|
2048
|
-
|
|
2049
|
-
|
|
2688
|
+
], SettingsModelImpl.prototype, "activateAndRebootTime", 2);
|
|
2689
|
+
__decorateClass$4([
|
|
2690
|
+
kosConfigProperty({
|
|
2050
2691
|
path: "app:kosdev.ddk:app",
|
|
2051
2692
|
attribute: "ncui.uiConfig.display.horizontalMode"
|
|
2052
2693
|
})
|
|
2053
|
-
],
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
dependencies: (
|
|
2694
|
+
], SettingsModelImpl.prototype, "horizontalMode", 2);
|
|
2695
|
+
__decorateClass$4([
|
|
2696
|
+
kosModelEffect({
|
|
2697
|
+
dependencies: (model) => [model.horizontalMode.value]
|
|
2057
2698
|
})
|
|
2058
|
-
],
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
],
|
|
2062
|
-
const
|
|
2699
|
+
], SettingsModelImpl.prototype, "handleUpdateDisplayMode", 1);
|
|
2700
|
+
SettingsModelImpl = __decorateClass$4([
|
|
2701
|
+
kosModel(MODEL_TYPE$4)
|
|
2702
|
+
], SettingsModelImpl);
|
|
2703
|
+
const Settings = {
|
|
2063
2704
|
registration: {
|
|
2064
|
-
[
|
|
2065
|
-
class:
|
|
2066
|
-
singleton:
|
|
2705
|
+
[MODEL_TYPE$4]: {
|
|
2706
|
+
class: SettingsModelImpl,
|
|
2707
|
+
singleton: true
|
|
2067
2708
|
}
|
|
2068
2709
|
},
|
|
2069
|
-
type:
|
|
2070
|
-
predicate:
|
|
2071
|
-
factory:
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
}
|
|
2710
|
+
type: MODEL_TYPE$4,
|
|
2711
|
+
predicate: isKosModel(MODEL_TYPE$4),
|
|
2712
|
+
factory: Kos.Singleton.create(MODEL_TYPE$4)
|
|
2713
|
+
};
|
|
2714
|
+
const { URL: URL$2 } = resolveServiceUrl("SETTINGS_SERVICE");
|
|
2715
|
+
const { getAll: getAll$1 } = ServiceFactory.build({
|
|
2716
|
+
basePath: `${URL$2}/api/settings`
|
|
2717
|
+
});
|
|
2718
|
+
const log$2 = KosLog.createLogger({
|
|
2075
2719
|
name: "settings-service",
|
|
2076
2720
|
group: "Services"
|
|
2077
|
-
})
|
|
2078
|
-
|
|
2079
|
-
|
|
2721
|
+
});
|
|
2722
|
+
const getSettings = async () => {
|
|
2723
|
+
log$2.debug("sending GET for settings");
|
|
2724
|
+
const response = await getAll$1({});
|
|
2725
|
+
return response;
|
|
2726
|
+
};
|
|
2727
|
+
const getNcuiLanguage = async () => {
|
|
2728
|
+
const response = await getAll$1({
|
|
2729
|
+
urlOverride: `${URL$2}api/app/kosdev.ddk/ncui/languages`
|
|
2730
|
+
});
|
|
2731
|
+
return response;
|
|
2732
|
+
};
|
|
2733
|
+
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2080
2734
|
__proto__: null,
|
|
2081
|
-
getNcuiLanguage
|
|
2082
|
-
getSettings
|
|
2735
|
+
getNcuiLanguage,
|
|
2736
|
+
getSettings
|
|
2083
2737
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2084
|
-
var
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
this.
|
|
2738
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
2739
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
2740
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
2741
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2742
|
+
if (decorator = decorators[i])
|
|
2743
|
+
result = decorator(result) || result;
|
|
2744
|
+
return result;
|
|
2745
|
+
};
|
|
2746
|
+
const MODEL_TYPE$3 = "utilities-model";
|
|
2747
|
+
let UtilitiesModelImpl = class {
|
|
2748
|
+
id;
|
|
2749
|
+
name;
|
|
2750
|
+
options;
|
|
2751
|
+
roles;
|
|
2752
|
+
columnId;
|
|
2753
|
+
logger;
|
|
2754
|
+
constructor(modelId, options, context) {
|
|
2755
|
+
this.id = modelId;
|
|
2756
|
+
this.logger = context.logger;
|
|
2757
|
+
this.name = options.name;
|
|
2758
|
+
this.options = options.options;
|
|
2759
|
+
this.roles = options?.roles;
|
|
2760
|
+
this.columnId = options.columnId;
|
|
2761
|
+
}
|
|
2762
|
+
updateModel(options) {
|
|
2763
|
+
this.name = options.name;
|
|
2764
|
+
this.options = options.options;
|
|
2765
|
+
this.roles = options?.roles;
|
|
2102
2766
|
}
|
|
2103
2767
|
get titleKey() {
|
|
2104
2768
|
return `utility.${this.id}.title`;
|
|
@@ -2114,62 +2778,74 @@ let ze = class {
|
|
|
2114
2778
|
this.logger.debug(`loading utilities ${this.id}`);
|
|
2115
2779
|
}
|
|
2116
2780
|
};
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
],
|
|
2120
|
-
const
|
|
2781
|
+
UtilitiesModelImpl = __decorateClass$3([
|
|
2782
|
+
kosModel(MODEL_TYPE$3)
|
|
2783
|
+
], UtilitiesModelImpl);
|
|
2784
|
+
const Utilities = {
|
|
2121
2785
|
registration: {
|
|
2122
|
-
[
|
|
2123
|
-
class:
|
|
2124
|
-
singleton:
|
|
2786
|
+
[MODEL_TYPE$3]: {
|
|
2787
|
+
class: UtilitiesModelImpl,
|
|
2788
|
+
singleton: false
|
|
2125
2789
|
}
|
|
2126
2790
|
},
|
|
2127
|
-
type:
|
|
2128
|
-
predicate:
|
|
2129
|
-
factory:
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
}
|
|
2791
|
+
type: MODEL_TYPE$3,
|
|
2792
|
+
predicate: isKosModel(MODEL_TYPE$3),
|
|
2793
|
+
factory: Kos.Factory.create(MODEL_TYPE$3)
|
|
2794
|
+
};
|
|
2795
|
+
const { URL: URL$1 } = resolveServiceUrl("UTILITIES_SERVICE");
|
|
2796
|
+
const { getAll } = ServiceFactory.build({
|
|
2797
|
+
basePath: `${URL$1}/api/utilities`
|
|
2798
|
+
});
|
|
2799
|
+
const log$1 = KosLog.createLogger({
|
|
2133
2800
|
name: "utilities-service",
|
|
2134
2801
|
group: "Services"
|
|
2135
|
-
})
|
|
2136
|
-
|
|
2802
|
+
});
|
|
2803
|
+
const getUtilities = async () => {
|
|
2804
|
+
log$1.debug("sending GET for utilities");
|
|
2137
2805
|
try {
|
|
2138
|
-
const
|
|
2139
|
-
urlOverride: `${
|
|
2806
|
+
const extensionResponse = await getAll({
|
|
2807
|
+
urlOverride: `${URL$1}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`
|
|
2140
2808
|
});
|
|
2141
|
-
if (
|
|
2142
|
-
|
|
2143
|
-
const
|
|
2144
|
-
urlOverride: `${
|
|
2809
|
+
if (extensionResponse?.status !== 200) {
|
|
2810
|
+
log$1.info(`no extensions found, using base data`);
|
|
2811
|
+
const response = await getAll({
|
|
2812
|
+
urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2145
2813
|
});
|
|
2146
|
-
return
|
|
2814
|
+
return response?.data ?? [];
|
|
2147
2815
|
}
|
|
2148
|
-
return
|
|
2149
|
-
} catch (
|
|
2150
|
-
|
|
2151
|
-
const
|
|
2152
|
-
urlOverride: `${
|
|
2816
|
+
return extensionResponse?.data ?? [];
|
|
2817
|
+
} catch (error) {
|
|
2818
|
+
log$1.info(`error fetching utilities: ${error}. Using base data`);
|
|
2819
|
+
const response = await getAll({
|
|
2820
|
+
urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2153
2821
|
});
|
|
2154
|
-
return
|
|
2822
|
+
return response?.data ?? [];
|
|
2155
2823
|
}
|
|
2156
|
-
}
|
|
2824
|
+
};
|
|
2825
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2157
2826
|
__proto__: null,
|
|
2158
|
-
getUtilities
|
|
2827
|
+
getUtilities
|
|
2159
2828
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2160
|
-
var
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2829
|
+
var __defProp$2 = Object.defineProperty;
|
|
2830
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2831
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2832
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2833
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2834
|
+
if (decorator = decorators[i])
|
|
2835
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2836
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2837
|
+
return result;
|
|
2838
|
+
};
|
|
2839
|
+
const MODEL_TYPE$2 = "utilities-container-model";
|
|
2840
|
+
let UtilitiesContainerModelImpl = class {
|
|
2841
|
+
id;
|
|
2842
|
+
logger;
|
|
2843
|
+
_models;
|
|
2844
|
+
constructor(modelId, _options, context) {
|
|
2845
|
+
this.id = modelId;
|
|
2846
|
+
this.logger = context.logger;
|
|
2847
|
+
this._models = new KosModelContainer({
|
|
2848
|
+
parentId: modelId,
|
|
2173
2849
|
sortKey: "id",
|
|
2174
2850
|
indexMap: {
|
|
2175
2851
|
byColumn: "columnId"
|
|
@@ -2183,80 +2859,129 @@ let be = class {
|
|
|
2183
2859
|
return this._models;
|
|
2184
2860
|
}
|
|
2185
2861
|
get columns() {
|
|
2186
|
-
return this._models.getIndexKeys("byColumn").sort((
|
|
2862
|
+
return this._models.getIndexKeys("byColumn").sort((a, b) => a.localeCompare(b));
|
|
2187
2863
|
}
|
|
2188
|
-
addModel(
|
|
2189
|
-
this._models.addModel(
|
|
2864
|
+
addModel(model) {
|
|
2865
|
+
this._models.addModel(model);
|
|
2190
2866
|
}
|
|
2191
|
-
removeModel(
|
|
2192
|
-
this._models.removeModel(
|
|
2867
|
+
removeModel(id) {
|
|
2868
|
+
this._models.removeModel(id);
|
|
2193
2869
|
}
|
|
2194
|
-
getModel(
|
|
2195
|
-
return this._models.getModel(
|
|
2870
|
+
getModel(id) {
|
|
2871
|
+
return this._models.getModel(id);
|
|
2196
2872
|
}
|
|
2197
|
-
getUtilitiesByColumn(
|
|
2198
|
-
return this._models.getIndexByKey("byColumn",
|
|
2873
|
+
getUtilitiesByColumn(id) {
|
|
2874
|
+
return this._models.getIndexByKey("byColumn", id);
|
|
2199
2875
|
}
|
|
2200
2876
|
// -------------------LIFECYCLE----------------------------
|
|
2201
2877
|
async load() {
|
|
2202
2878
|
this.logger.debug(`loading utilities-container container ${this.id}`);
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
const
|
|
2207
|
-
...
|
|
2208
|
-
columnId: String(
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2879
|
+
const utilitiesResponse = await getUtilities();
|
|
2880
|
+
utilitiesResponse?.forEach((utilityColumnsResponse, columnId) => {
|
|
2881
|
+
utilityColumnsResponse.forEach((utilityResponse) => {
|
|
2882
|
+
const utilityOptions = {
|
|
2883
|
+
...utilityResponse,
|
|
2884
|
+
columnId: String(columnId)
|
|
2885
|
+
};
|
|
2886
|
+
const utilityModel = Utilities.factory(utilityResponse.name)(
|
|
2887
|
+
utilityOptions
|
|
2211
2888
|
);
|
|
2212
|
-
this.addModel(
|
|
2889
|
+
this.addModel(utilityModel);
|
|
2213
2890
|
});
|
|
2214
2891
|
});
|
|
2215
2892
|
}
|
|
2216
2893
|
};
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
],
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
],
|
|
2223
|
-
const
|
|
2894
|
+
__decorateClass$2([
|
|
2895
|
+
kosChild
|
|
2896
|
+
], UtilitiesContainerModelImpl.prototype, "_models", 2);
|
|
2897
|
+
UtilitiesContainerModelImpl = __decorateClass$2([
|
|
2898
|
+
kosModel(MODEL_TYPE$2)
|
|
2899
|
+
], UtilitiesContainerModelImpl);
|
|
2900
|
+
const UtilitiesContainer = {
|
|
2224
2901
|
registration: {
|
|
2225
|
-
[
|
|
2226
|
-
class:
|
|
2227
|
-
singleton:
|
|
2902
|
+
[MODEL_TYPE$2]: {
|
|
2903
|
+
class: UtilitiesContainerModelImpl,
|
|
2904
|
+
singleton: true
|
|
2228
2905
|
},
|
|
2229
|
-
...
|
|
2906
|
+
...Utilities.registration
|
|
2230
2907
|
},
|
|
2231
|
-
type:
|
|
2232
|
-
predicate:
|
|
2233
|
-
factory:
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
...
|
|
2237
|
-
...
|
|
2238
|
-
...
|
|
2239
|
-
...
|
|
2240
|
-
...
|
|
2241
|
-
...
|
|
2242
|
-
...
|
|
2243
|
-
...
|
|
2244
|
-
...
|
|
2245
|
-
...
|
|
2246
|
-
...
|
|
2247
|
-
...
|
|
2248
|
-
...
|
|
2249
|
-
...
|
|
2250
|
-
...
|
|
2251
|
-
...
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2908
|
+
type: MODEL_TYPE$2,
|
|
2909
|
+
predicate: isKosModel(MODEL_TYPE$2),
|
|
2910
|
+
factory: Kos.Singleton.create(MODEL_TYPE$2)
|
|
2911
|
+
};
|
|
2912
|
+
const DDKModels = {
|
|
2913
|
+
...Animation.registration,
|
|
2914
|
+
...Application.registration,
|
|
2915
|
+
...Auth.registration,
|
|
2916
|
+
...CarbWater.registration,
|
|
2917
|
+
...DashboardOperations.registration,
|
|
2918
|
+
...Dispenser.registration,
|
|
2919
|
+
...DispenserInfo.registration,
|
|
2920
|
+
...Enrollment.registration,
|
|
2921
|
+
...IngredientSummary.registration,
|
|
2922
|
+
...MacroAssignment.registration,
|
|
2923
|
+
...NetworkTestContainer.registration,
|
|
2924
|
+
...NutritiveSweetener.registration,
|
|
2925
|
+
...PlainWater.registration,
|
|
2926
|
+
...Reboot.registration,
|
|
2927
|
+
...Settings.registration,
|
|
2928
|
+
...SetupStepContainer.registration,
|
|
2929
|
+
...UtilitiesContainer.registration
|
|
2930
|
+
};
|
|
2931
|
+
var __defProp$1 = Object.defineProperty;
|
|
2932
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2933
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2934
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
2935
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
2936
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2937
|
+
if (decorator = decorators[i])
|
|
2938
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2939
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
2940
|
+
return result;
|
|
2941
|
+
};
|
|
2942
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
2943
|
+
const MODEL_TYPE$1 = "trouble-action-model";
|
|
2944
|
+
let TroubleActionModelImpl = class {
|
|
2945
|
+
/**
|
|
2946
|
+
* Unique identifier for this model instance.
|
|
2947
|
+
*
|
|
2948
|
+
* Set during construction and used for model lifecycle management
|
|
2949
|
+
* and debugging purposes.
|
|
2950
|
+
*
|
|
2951
|
+
* @category Model Properties
|
|
2952
|
+
*/
|
|
2953
|
+
id;
|
|
2954
|
+
troubleContainer;
|
|
2955
|
+
/**
|
|
2956
|
+
* Observable state object mapping trouble state keys to values.
|
|
2957
|
+
*
|
|
2958
|
+
* This reactive state object is automatically updated when troubles are
|
|
2959
|
+
* added or removed from the system. Keys and values are determined by
|
|
2960
|
+
* the trouble action definitions provided during model initialization.
|
|
2961
|
+
*
|
|
2962
|
+
* State keys that no longer have associated active troubles are set to
|
|
2963
|
+
* undefined.
|
|
2964
|
+
*
|
|
2965
|
+
* @example
|
|
2966
|
+
* ```typescript
|
|
2967
|
+
* // Access state values
|
|
2968
|
+
* const isAgitationRequired = troubleActionModel.state.agitationRequired;
|
|
2969
|
+
*
|
|
2970
|
+
* // State is reactive - updates automatically propagate to React components
|
|
2971
|
+
* ```
|
|
2972
|
+
*
|
|
2973
|
+
* @category Model State
|
|
2974
|
+
*/
|
|
2975
|
+
state;
|
|
2976
|
+
/**
|
|
2977
|
+
* Internal mapping of trouble types to their action definitions.
|
|
2978
|
+
*
|
|
2979
|
+
* Built from the definitions array provided in TroubleActionOptions during
|
|
2980
|
+
* construction. Used for efficient lookup when processing trouble changes.
|
|
2981
|
+
*
|
|
2982
|
+
* @category Internal State
|
|
2983
|
+
*/
|
|
2984
|
+
troubleActionData;
|
|
2260
2985
|
/**
|
|
2261
2986
|
* Creates a new TroubleActionModel instance.
|
|
2262
2987
|
*
|
|
@@ -2270,56 +2995,22 @@ let k = class {
|
|
|
2270
2995
|
*
|
|
2271
2996
|
* @category Lifecycle
|
|
2272
2997
|
*/
|
|
2273
|
-
constructor(
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
* @category Model Properties
|
|
2281
|
-
*/
|
|
2282
|
-
i(this, "id");
|
|
2283
|
-
i(this, "troubleContainer");
|
|
2284
|
-
/**
|
|
2285
|
-
* Observable state object mapping trouble state keys to values.
|
|
2286
|
-
*
|
|
2287
|
-
* This reactive state object is automatically updated when troubles are
|
|
2288
|
-
* added or removed from the system. Keys and values are determined by
|
|
2289
|
-
* the trouble action definitions provided during model initialization.
|
|
2290
|
-
*
|
|
2291
|
-
* State keys that no longer have associated active troubles are set to
|
|
2292
|
-
* undefined.
|
|
2293
|
-
*
|
|
2294
|
-
* @example
|
|
2295
|
-
* ```typescript
|
|
2296
|
-
* // Access state values
|
|
2297
|
-
* const isAgitationRequired = troubleActionModel.state.agitationRequired;
|
|
2298
|
-
*
|
|
2299
|
-
* // State is reactive - updates automatically propagate to React components
|
|
2300
|
-
* ```
|
|
2301
|
-
*
|
|
2302
|
-
* @category Model State
|
|
2303
|
-
*/
|
|
2304
|
-
i(this, "state");
|
|
2305
|
-
/**
|
|
2306
|
-
* Internal mapping of trouble types to their action definitions.
|
|
2307
|
-
*
|
|
2308
|
-
* Built from the definitions array provided in TroubleActionOptions during
|
|
2309
|
-
* construction. Used for efficient lookup when processing trouble changes.
|
|
2310
|
-
*
|
|
2311
|
-
* @category Internal State
|
|
2312
|
-
*/
|
|
2313
|
-
i(this, "troubleActionData");
|
|
2314
|
-
this.id = e, this.state = Eo(), this.troubleActionData = t.definitions.reduce((o, s) => (o[s.troubleType] = s, o), {});
|
|
2998
|
+
constructor(modelId, options) {
|
|
2999
|
+
this.id = modelId;
|
|
3000
|
+
this.state = ObservableData();
|
|
3001
|
+
this.troubleActionData = options.definitions.reduce((acc, curr) => {
|
|
3002
|
+
acc[curr.troubleType] = curr;
|
|
3003
|
+
return acc;
|
|
3004
|
+
}, {});
|
|
2315
3005
|
}
|
|
2316
3006
|
// -------------------LIFECYCLE----------------------------
|
|
2317
3007
|
/**
|
|
2318
3008
|
* Gets the first active trouble that has an associated action definition.
|
|
2319
3009
|
*
|
|
2320
3010
|
* Returns the first trouble found that matches any of the configured trouble
|
|
2321
|
-
* action definitions
|
|
2322
|
-
*
|
|
3011
|
+
* action definitions, checking the trouble types in definition order. If
|
|
3012
|
+
* troubles of several defined types are active, the earliest-defined type wins
|
|
3013
|
+
* (in the DDK hosts, plugin load order).
|
|
2323
3014
|
*
|
|
2324
3015
|
* @returns The active trouble model, or undefined if no matching troubles exist
|
|
2325
3016
|
*
|
|
@@ -2336,14 +3027,14 @@ let k = class {
|
|
|
2336
3027
|
* @see {@link TroubleContainerModel} for trouble data structure
|
|
2337
3028
|
*/
|
|
2338
3029
|
get activeTrouble() {
|
|
2339
|
-
const
|
|
2340
|
-
|
|
2341
|
-
const t = e[0], o = this.troubleContainer.troubles.getIndexByKey(
|
|
3030
|
+
for (const troubleType of Object.keys(this.troubleActionData)) {
|
|
3031
|
+
const [trouble] = this.troubleContainer.troubles.getIndexByKey(
|
|
2342
3032
|
"byType",
|
|
2343
|
-
|
|
3033
|
+
troubleType
|
|
2344
3034
|
);
|
|
2345
|
-
|
|
3035
|
+
if (trouble) return trouble;
|
|
2346
3036
|
}
|
|
3037
|
+
return void 0;
|
|
2347
3038
|
}
|
|
2348
3039
|
/**
|
|
2349
3040
|
* Gets the type of the first active trouble with an associated action definition.
|
|
@@ -2364,59 +3055,75 @@ let k = class {
|
|
|
2364
3055
|
* @category Trouble Access
|
|
2365
3056
|
*/
|
|
2366
3057
|
get activeTroubleType() {
|
|
2367
|
-
|
|
2368
|
-
return (e = this.activeTrouble) == null ? void 0 : e.type;
|
|
3058
|
+
return this.activeTrouble?.type;
|
|
2369
3059
|
}
|
|
2370
3060
|
handleTroubleActions() {
|
|
2371
|
-
const
|
|
2372
|
-
const
|
|
2373
|
-
if (this.troubleActionData[
|
|
2374
|
-
const
|
|
2375
|
-
|
|
3061
|
+
const _state = this.troubleContainer.troubles.data.reduce((acc, curr) => {
|
|
3062
|
+
const _troubleType = curr.type;
|
|
3063
|
+
if (this.troubleActionData[_troubleType]) {
|
|
3064
|
+
const _stateKey = this.troubleActionData[_troubleType].stateKey ?? _troubleType;
|
|
3065
|
+
const _stateValue = this.troubleActionData[_troubleType].stateValue ?? _troubleType;
|
|
3066
|
+
acc[_stateKey] = _stateValue;
|
|
2376
3067
|
}
|
|
2377
|
-
return
|
|
3068
|
+
return acc;
|
|
2378
3069
|
}, {});
|
|
2379
|
-
this.state.setValues(
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
this.
|
|
3070
|
+
this.state.setValues(_state);
|
|
3071
|
+
Object.keys(this.troubleActionData).forEach((key) => {
|
|
3072
|
+
if (this.troubleContainer.troubles.getIndexByKey("byType", key).length === 0) {
|
|
3073
|
+
const _stateKey = this.troubleActionData[key].stateKey ?? key;
|
|
3074
|
+
this.state[_stateKey] = void 0;
|
|
2383
3075
|
}
|
|
2384
3076
|
});
|
|
2385
3077
|
}
|
|
2386
3078
|
};
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
],
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
dependencies: (
|
|
3079
|
+
__publicField(TroubleActionModelImpl, "Registration");
|
|
3080
|
+
__decorateClass$1([
|
|
3081
|
+
kosDependency({ modelType: TroubleContainer.type })
|
|
3082
|
+
], TroubleActionModelImpl.prototype, "troubleContainer", 2);
|
|
3083
|
+
__decorateClass$1([
|
|
3084
|
+
kosModelEffect({
|
|
3085
|
+
dependencies: (model) => [model.troubleContainer.troubles.data]
|
|
2394
3086
|
})
|
|
2395
|
-
],
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
],
|
|
2400
|
-
const
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
})
|
|
3087
|
+
], TroubleActionModelImpl.prototype, "handleTroubleActions", 1);
|
|
3088
|
+
TroubleActionModelImpl = __decorateClass$1([
|
|
3089
|
+
kosModel({ modelTypeId: MODEL_TYPE$1, singleton: true }),
|
|
3090
|
+
kosLoggerAware()
|
|
3091
|
+
], TroubleActionModelImpl);
|
|
3092
|
+
const TroubleAction = TroubleActionModelImpl.Registration;
|
|
3093
|
+
const { URL } = resolveServiceUrl("START_SERVICE");
|
|
3094
|
+
const { getOne } = ServiceFactory.build({
|
|
3095
|
+
basePath: `${URL}/api/start`
|
|
3096
|
+
});
|
|
3097
|
+
const log = KosLog.createLogger({ name: "start-service", group: "Services" });
|
|
3098
|
+
const navigateToNCui = async () => {
|
|
3099
|
+
log.debug("navigating to NCUI");
|
|
3100
|
+
const response = await getOne({
|
|
3101
|
+
urlOverride: `${URL}/api/app/kosdev.ddk/ncui/open`
|
|
3102
|
+
});
|
|
3103
|
+
return response;
|
|
3104
|
+
};
|
|
3105
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2405
3106
|
__proto__: null,
|
|
2406
|
-
navigateToNCui
|
|
3107
|
+
navigateToNCui
|
|
2407
3108
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2408
|
-
var
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
3109
|
+
var __defProp = Object.defineProperty;
|
|
3110
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3111
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
3112
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
3113
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3114
|
+
if (decorator = decorators[i])
|
|
3115
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3116
|
+
if (kind && result) __defProp(target, key, result);
|
|
3117
|
+
return result;
|
|
3118
|
+
};
|
|
3119
|
+
const MODEL_TYPE = "start-model";
|
|
3120
|
+
let StartModelImpl = class {
|
|
3121
|
+
id;
|
|
3122
|
+
logger;
|
|
3123
|
+
troubles;
|
|
3124
|
+
constructor(modelId, options, context) {
|
|
3125
|
+
this.id = modelId;
|
|
3126
|
+
this.logger = context.logger;
|
|
2420
3127
|
}
|
|
2421
3128
|
get firmwareFailed() {
|
|
2422
3129
|
return this.troubles.troubles.getIndexByKey(
|
|
@@ -2431,7 +3138,7 @@ let _e = class {
|
|
|
2431
3138
|
).length > 0;
|
|
2432
3139
|
}
|
|
2433
3140
|
async navigate() {
|
|
2434
|
-
await
|
|
3141
|
+
await navigateToNCui();
|
|
2435
3142
|
}
|
|
2436
3143
|
// -------------------LIFECYCLE----------------------------
|
|
2437
3144
|
async init() {
|
|
@@ -2441,69 +3148,77 @@ let _e = class {
|
|
|
2441
3148
|
this.logger.debug(`loading start ${this.id}`);
|
|
2442
3149
|
}
|
|
2443
3150
|
};
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
],
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
],
|
|
2450
|
-
const
|
|
2451
|
-
class:
|
|
2452
|
-
type:
|
|
3151
|
+
__decorateClass([
|
|
3152
|
+
kosDependency({ modelType: TroubleContainer.type })
|
|
3153
|
+
], StartModelImpl.prototype, "troubles", 2);
|
|
3154
|
+
StartModelImpl = __decorateClass([
|
|
3155
|
+
kosModel(MODEL_TYPE)
|
|
3156
|
+
], StartModelImpl);
|
|
3157
|
+
const Start = new SingletonKosModelRegistrationFactory({
|
|
3158
|
+
class: StartModelImpl,
|
|
3159
|
+
type: MODEL_TYPE
|
|
2453
3160
|
});
|
|
2454
3161
|
export {
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
3162
|
+
AgitationControl,
|
|
3163
|
+
Animation,
|
|
3164
|
+
index$b as AnimationServices,
|
|
3165
|
+
Application,
|
|
3166
|
+
Auth,
|
|
3167
|
+
index$d as AuthServices,
|
|
3168
|
+
CarbWater,
|
|
3169
|
+
CopyLogs,
|
|
3170
|
+
index$a as CopyLogsServices,
|
|
3171
|
+
DDKModels,
|
|
3172
|
+
DashboardOperations,
|
|
3173
|
+
index$9 as DashboardOperationsServices,
|
|
3174
|
+
Dispenser,
|
|
3175
|
+
DispenserInfo,
|
|
3176
|
+
index$7 as DispenserInfoServices,
|
|
3177
|
+
index$8 as DispenserServices,
|
|
3178
|
+
Door,
|
|
3179
|
+
EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
3180
|
+
Enrollment,
|
|
3181
|
+
index$6 as EnrollmentServices,
|
|
3182
|
+
IngredientSummary,
|
|
3183
|
+
Lockout,
|
|
3184
|
+
index$5 as LockoutServices,
|
|
3185
|
+
MACRO_KEYS,
|
|
3186
|
+
MacroAssignment,
|
|
3187
|
+
NetworkTest,
|
|
3188
|
+
NetworkTestContainer,
|
|
3189
|
+
index$4 as NetworkTestServices,
|
|
3190
|
+
NutritiveSweetener,
|
|
3191
|
+
PlainWater,
|
|
3192
|
+
Reboot,
|
|
3193
|
+
index$3 as RebootServices,
|
|
3194
|
+
Settings,
|
|
3195
|
+
index$2 as SettingsServices,
|
|
3196
|
+
SetupStep,
|
|
3197
|
+
SetupStepContainer,
|
|
3198
|
+
index$c as SetupStepServices,
|
|
3199
|
+
Start,
|
|
3200
|
+
index as StartServices,
|
|
3201
|
+
TROUBLE_TYPE_PRIME$1 as TROUBLE_TYPE_PRIME,
|
|
3202
|
+
TROUBLE_TYPE_PURGE$1 as TROUBLE_TYPE_PURGE,
|
|
3203
|
+
TroubleAction as TroubleActionManager,
|
|
3204
|
+
Utilities,
|
|
3205
|
+
UtilitiesContainer,
|
|
3206
|
+
index$1 as UtilitiesServices,
|
|
3207
|
+
calculateTimeDifference,
|
|
3208
|
+
createDdkMockHelpers,
|
|
3209
|
+
descriptorSetupSteps,
|
|
3210
|
+
descriptorValue,
|
|
3211
|
+
executeDashboardKeyFactory,
|
|
3212
|
+
isMacroGroup,
|
|
3213
|
+
isMicroGroup,
|
|
3214
|
+
macroHolderMap,
|
|
3215
|
+
registerDashboardKeyFactory,
|
|
3216
|
+
registerDdkMock,
|
|
3217
|
+
toSeconds,
|
|
3218
|
+
toTimeComponents,
|
|
3219
|
+
troubleVisibilityFilter,
|
|
3220
|
+
withNavigation,
|
|
3221
|
+
withSetupStep,
|
|
3222
|
+
withUtility
|
|
2509
3223
|
};
|
|
3224
|
+
//# sourceMappingURL=index.mjs.map
|