@gpa-gemstone/common-pages 0.0.186 → 0.0.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/HeartBeatCheck.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ interface IProps {
|
|
|
10
10
|
* Interval, in milliseconds, between successive HeartBeat checks
|
|
11
11
|
* */
|
|
12
12
|
IntervalMS: number;
|
|
13
|
+
/**
|
|
14
|
+
* Interval, in milliseconds, before checking an in-flight HeartBeat again
|
|
15
|
+
* */
|
|
16
|
+
RetryIntervalMS?: number;
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
15
19
|
* Periodically calls HeartBeat to verify connectivity to the server and, when a
|
package/lib/HeartBeatCheck.js
CHANGED
|
@@ -53,26 +53,39 @@ var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
|
|
53
53
|
* reconnect. Renders nothing while the server is reachable.
|
|
54
54
|
*/
|
|
55
55
|
var HeartBeatCheck = function (props) {
|
|
56
|
-
var _a
|
|
56
|
+
var _a;
|
|
57
|
+
var _b = React.useState(false), showError = _b[0], setShowError = _b[1];
|
|
58
|
+
var retryIntervalMS = (_a = props.RetryIntervalMS) !== null && _a !== void 0 ? _a : 10000;
|
|
57
59
|
//Effect to call heartbeat on consumer defined interval
|
|
58
60
|
React.useEffect(function () {
|
|
59
61
|
var updateServiceStatus = null;
|
|
62
|
+
var nextCheck;
|
|
63
|
+
var isActive = true;
|
|
60
64
|
var checkServiceStatus = function () {
|
|
65
|
+
if (updateServiceStatus != null) {
|
|
66
|
+
nextCheck = setTimeout(checkServiceStatus, retryIntervalMS);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
61
69
|
updateServiceStatus = props.HeartBeat();
|
|
70
|
+
nextCheck = setTimeout(checkServiceStatus, props.IntervalMS);
|
|
62
71
|
updateServiceStatus.then(function () {
|
|
63
|
-
|
|
72
|
+
updateServiceStatus = null;
|
|
73
|
+
if (isActive)
|
|
74
|
+
setShowError(false);
|
|
64
75
|
}, function () {
|
|
65
|
-
|
|
76
|
+
updateServiceStatus = null;
|
|
77
|
+
if (isActive)
|
|
78
|
+
setShowError(true);
|
|
66
79
|
});
|
|
67
80
|
};
|
|
68
81
|
checkServiceStatus();
|
|
69
|
-
var interval = setInterval(checkServiceStatus, props.IntervalMS);
|
|
70
82
|
return function () {
|
|
71
|
-
|
|
83
|
+
isActive = false;
|
|
84
|
+
clearTimeout(nextCheck);
|
|
72
85
|
if ((updateServiceStatus === null || updateServiceStatus === void 0 ? void 0 : updateServiceStatus.abort) != null)
|
|
73
86
|
updateServiceStatus.abort();
|
|
74
87
|
};
|
|
75
|
-
}, [props.HeartBeat, props.IntervalMS]);
|
|
88
|
+
}, [props.HeartBeat, props.IntervalMS, retryIntervalMS]);
|
|
76
89
|
if (!showError)
|
|
77
90
|
return null;
|
|
78
91
|
return (React.createElement(react_interactive_1.Modal, { Show: true, Title: "Error Communicating with Application", Size: 'sm', ShowCancel: false, ShowConfirm: false, ShowX: false, CallBack: function () { } },
|
|
@@ -49,11 +49,12 @@ var react_forms_1 = require("@gpa-gemstone/react-forms");
|
|
|
49
49
|
var TimeFilter_1 = require("../TimeFilter");
|
|
50
50
|
var QuickSelects_1 = __importStar(require("../QuickSelects"));
|
|
51
51
|
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
|
52
|
+
var FirstFallbackBreakpointQS = 1768;
|
|
53
|
+
var SecondFallbackBreakpointQS = 550;
|
|
54
|
+
var FirstFallbacKBreakpointNoQS = 612;
|
|
55
|
+
var ModalBreakpointQS = 350;
|
|
52
56
|
var DateTimeLocalFilter = function (props) {
|
|
53
57
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
|
-
var FirstFallbackBreakpointQS = 1768;
|
|
55
|
-
var SecondFallbackBreakpointQS = 612, FirstFallbacKBreakpointNoQS = 612;
|
|
56
|
-
var ModalBreakpointQS = 450;
|
|
57
58
|
var _k = React.useState(false), showQuickPickModal = _k[0], setShowQuickPickModal = _k[1];
|
|
58
59
|
var handleSetTimeWindowFilter = React.useCallback(function (record) {
|
|
59
60
|
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, end: record.end }, props.Format);
|
|
@@ -109,10 +110,13 @@ var DateTimeLocalFilter = function (props) {
|
|
|
109
110
|
props.ShowQuickSelects ?
|
|
110
111
|
React.createElement("div", { className: 'row m-0 w-100' },
|
|
111
112
|
React.createElement("div", { className: 'col-12 d-flex align-items-center justify-content-center' },
|
|
112
|
-
React.createElement("button", { className: 'btn btn-primary
|
|
113
|
+
React.createElement("button", { className: 'btn btn-primary w-100', onClick: function () { return setShowQuickPickModal(true); } }, "Quick Selects")),
|
|
113
114
|
React.createElement(react_interactive_1.Modal, { Show: showQuickPickModal, Title: 'Quick Selects', CallBack: function () { return setShowQuickPickModal(false); }, ShowX: true, ShowCancel: false, ShowConfirm: false, Size: 'xlg' },
|
|
114
115
|
React.createElement("div", { className: quickSelectCol },
|
|
115
|
-
React.createElement(QuickSelects_1.default, { SplitSelects: true, Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter:
|
|
116
|
+
React.createElement(QuickSelects_1.default, { SplitSelects: true, Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: function (start, end, unit, duration) {
|
|
117
|
+
props.SetFilter(start, end, unit, duration);
|
|
118
|
+
setShowQuickPickModal(false);
|
|
119
|
+
}, Format: props.Format, DateUnit: props.DateUnit, QuickSelectRange: (_j = props.QuickSelectRange) !== null && _j !== void 0 ? _j : (0, QuickSelects_1.getQuickSelectRange)(props.DateUnit) }))))
|
|
116
120
|
: null));
|
|
117
121
|
}
|
|
118
122
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpa-gemstone/common-pages",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.188",
|
|
4
4
|
"description": "Common UI pages for GPA products",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"bugs": {"url": "https://github.com/GridProtectionAlliance/gpa-gemstone/issues"},
|
|
33
33
|
"homepage": "https://github.com/GridProtectionAlliance/gpa-gemstone#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@testing-library/react": "^14.3.1",
|
|
35
36
|
"@types/crypto-js": "^4.2.0",
|
|
36
37
|
"@types/jest": "^27.0.0",
|
|
37
38
|
"@types/jquery": "3.5.6",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"@typescript-eslint/parser": "^5.60.0",
|
|
43
44
|
"eslint": "^8.43.0",
|
|
44
45
|
"jest": "^29.0.0",
|
|
46
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
45
47
|
"prettier": "^2.3.2",
|
|
46
48
|
"ts-jest": "^29.0.0",
|
|
47
49
|
"typescript": "5.5.3"
|