@gpa-gemstone/common-pages 0.0.104 → 0.0.106
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/ErrorBoundary.d.ts +17 -17
- package/lib/ErrorBoundary.js +91 -68
- package/lib/Note.d.ts +22 -22
- package/lib/Note.js +256 -230
- package/lib/SearchBar.d.ts +37 -37
- package/lib/SearchBar.js +203 -180
- package/lib/SelectionPopup.d.ts +42 -42
- package/lib/SelectionPopup.js +93 -90
- package/lib/Setting.d.ts +8 -8
- package/lib/Setting.js +151 -125
- package/lib/SliceInterfaces.d.ts +76 -76
- package/lib/SliceInterfaces.js +2 -2
- package/lib/StandardSelectPopup.d.ts +20 -20
- package/lib/StandardSelectPopup.js +135 -109
- package/lib/TimeFilter/QuickSelects.d.ts +7 -0
- package/lib/TimeFilter/QuickSelects.js +240 -0
- package/lib/TimeFilter.d.ts +26 -0
- package/lib/TimeFilter.js +270 -0
- package/lib/TimeWindowUtils.d.ts +33 -0
- package/lib/TimeWindowUtils.js +121 -0
- package/lib/ValueList/ByValueList.d.ts +10 -10
- package/lib/ValueList/ByValueList.js +141 -115
- package/lib/ValueList/Group.d.ts +11 -11
- package/lib/ValueList/Group.js +97 -71
- package/lib/ValueList/GroupForm.d.ts +9 -9
- package/lib/ValueList/GroupForm.js +74 -51
- package/lib/ValueList/GroupInfo.d.ts +8 -8
- package/lib/ValueList/GroupInfo.js +95 -69
- package/lib/ValueList/GroupItem.d.ts +9 -9
- package/lib/ValueList/GroupItem.js +142 -116
- package/lib/ValueList/ItemForm.d.ts +9 -9
- package/lib/ValueList/ItemForm.js +82 -59
- package/lib/index.d.ts +12 -11
- package/lib/index.js +50 -45
- package/lib/user/AdditionalField.d.ts +26 -26
- package/lib/user/AdditionalField.js +290 -264
- package/lib/user/ByUser.d.ts +12 -12
- package/lib/user/ByUser.js +174 -148
- package/lib/user/User.d.ts +14 -14
- package/lib/user/User.js +97 -71
- package/lib/user/UserForm.d.ts +12 -12
- package/lib/user/UserForm.js +166 -143
- package/lib/user/UserInfo.d.ts +7 -7
- package/lib/user/UserInfo.js +123 -97
- package/lib/user/UserPermissions.d.ts +8 -8
- package/lib/user/UserPermissions.js +106 -83
- package/package.json +11 -10
@@ -0,0 +1,121 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.isCenterDuration = exports.isEndDuration = exports.isStartDuration = exports.isStartEnd = exports.momentTimeFormat = exports.momentDateFormat = exports.units = void 0;
|
7
|
+
exports.findAppropriateUnit = findAppropriateUnit;
|
8
|
+
exports.getStartEndTime = getStartEndTime;
|
9
|
+
exports.getMoment = getMoment;
|
10
|
+
exports.readableUnit = readableUnit;
|
11
|
+
//******************************************************************************************************
|
12
|
+
// TimeWindowUtils.tsx - Gbtc
|
13
|
+
//
|
14
|
+
// Copyright © 2023, Grid Protection Alliance. All Rights Reserved.
|
15
|
+
//
|
16
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
17
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
18
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
19
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
20
|
+
//
|
21
|
+
// http://opensource.org/licenses/MIT
|
22
|
+
//
|
23
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
24
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
25
|
+
// License for the specific language governing permissions and limitations.
|
26
|
+
//
|
27
|
+
// Code Modification History:
|
28
|
+
// ----------------------------------------------------------------------------------------------------
|
29
|
+
// 07/11/2023 - C. Lackner
|
30
|
+
// Generated original version of source code.
|
31
|
+
// 06/20/2024 - Ali Karrar
|
32
|
+
// Moved TimeWindowUtil from SEBrowser to gemstone
|
33
|
+
//******************************************************************************************************
|
34
|
+
var moment_1 = __importDefault(require("moment"));
|
35
|
+
exports.units = ['ms', 's', 'm', 'h', 'd', 'w', 'M', 'y'];
|
36
|
+
exports.momentDateFormat = "MM/DD/YYYY";
|
37
|
+
exports.momentTimeFormat = "HH:mm:ss.SSS"; // Also is the gemstone format
|
38
|
+
// Takes ITimeFilter as input and returns type
|
39
|
+
var isStartEnd = function (filter) { return 'start' in filter && 'end' in filter; };
|
40
|
+
exports.isStartEnd = isStartEnd;
|
41
|
+
var isStartDuration = function (filter) { return 'start' in filter && 'duration' in filter; };
|
42
|
+
exports.isStartDuration = isStartDuration;
|
43
|
+
var isEndDuration = function (filter) { return 'end' in filter && 'duration' in filter; };
|
44
|
+
exports.isEndDuration = isEndDuration;
|
45
|
+
var isCenterDuration = function (filter) { return 'center' in filter && 'halfDuration' in filter; };
|
46
|
+
exports.isCenterDuration = isCenterDuration;
|
47
|
+
/*
|
48
|
+
* A Function to determine the most appropriate unit for a window of time specified by start and end time
|
49
|
+
*/
|
50
|
+
function findAppropriateUnit(startTime, endTime, unit, useHalfWindow) {
|
51
|
+
var unitIndex = exports.units.findIndex(function (u) { return u == unit; });
|
52
|
+
if (unit === undefined)
|
53
|
+
unitIndex = 7;
|
54
|
+
var diff = endTime.diff(startTime, exports.units[unitIndex], true);
|
55
|
+
if (useHalfWindow !== undefined && useHalfWindow)
|
56
|
+
diff = diff / 2;
|
57
|
+
for (var i = unitIndex; i >= 1; i--) {
|
58
|
+
if (i == 6) // Remove month as appropriate due to innacuracy in definition (31/30/28/29 days)
|
59
|
+
continue;
|
60
|
+
if (Number.isInteger(diff)) {
|
61
|
+
return [exports.units[i], diff];
|
62
|
+
}
|
63
|
+
var nextI = i - 1;
|
64
|
+
if (nextI == 6)
|
65
|
+
nextI = 5;
|
66
|
+
diff = endTime.diff(startTime, exports.units[nextI], true);
|
67
|
+
if (useHalfWindow !== undefined && useHalfWindow)
|
68
|
+
diff = diff / 2;
|
69
|
+
if (diff > 65000) {
|
70
|
+
diff = endTime.diff(startTime, exports.units[i], true);
|
71
|
+
if (useHalfWindow !== undefined && useHalfWindow)
|
72
|
+
diff = diff / 2;
|
73
|
+
return [exports.units[i], Math.round(diff)];
|
74
|
+
}
|
75
|
+
}
|
76
|
+
return [exports.units[0], Math.round(diff)];
|
77
|
+
}
|
78
|
+
/*
|
79
|
+
* Determines a start time and end time for a window given by center time and duration
|
80
|
+
*/
|
81
|
+
function getStartEndTime(center, duration, unit) {
|
82
|
+
var d = moment_1.default.duration(duration, unit);
|
83
|
+
var start = center.clone().subtract(d.asHours(), 'h');
|
84
|
+
var end = center.clone().add(d.asHours(), 'h');
|
85
|
+
return [start, end];
|
86
|
+
}
|
87
|
+
/*
|
88
|
+
* Returns a formatted version of date and time provided
|
89
|
+
*/
|
90
|
+
function getMoment(date, time) {
|
91
|
+
if (time === undefined)
|
92
|
+
return (0, moment_1.default)(date, 'MM/DD/YYYY HH:mm:ss.SSS');
|
93
|
+
return (0, moment_1.default)(date + ' ' + time, 'MM/DD/YYYY HH:mm:ss.SSS');
|
94
|
+
}
|
95
|
+
/*
|
96
|
+
* Returns a unit string based on unit char input
|
97
|
+
*/
|
98
|
+
function readableUnit(unit) {
|
99
|
+
if (unit == 'y') {
|
100
|
+
return 'Year(s)';
|
101
|
+
}
|
102
|
+
else if (unit == 'M') {
|
103
|
+
return 'Month(s)';
|
104
|
+
}
|
105
|
+
else if (unit == 'w') {
|
106
|
+
return 'Week(s)';
|
107
|
+
}
|
108
|
+
else if (unit == 'd') {
|
109
|
+
return 'Day(s)';
|
110
|
+
}
|
111
|
+
else if (unit == 'h') {
|
112
|
+
return 'Hour(s)';
|
113
|
+
}
|
114
|
+
else if (unit == 'm') {
|
115
|
+
return 'Minute(s)';
|
116
|
+
}
|
117
|
+
else if (unit == 's') {
|
118
|
+
return 'Second(s)';
|
119
|
+
}
|
120
|
+
return 'Millisecond(s)';
|
121
|
+
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
-
import { IGenericSlice, ISearchableSlice } from '../SliceInterfaces';
|
4
|
-
interface IProps {
|
5
|
-
OnValueListSelect: (id: number) => void;
|
6
|
-
ValueListSlice: ISearchableSlice<SystemCenter.Types.ValueListGroup>;
|
7
|
-
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
8
|
-
}
|
9
|
-
declare function ByValueListGroup(props: IProps): JSX.Element;
|
10
|
-
export default ByValueListGroup;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
import { IGenericSlice, ISearchableSlice } from '../SliceInterfaces';
|
4
|
+
interface IProps {
|
5
|
+
OnValueListSelect: (id: number) => void;
|
6
|
+
ValueListSlice: ISearchableSlice<SystemCenter.Types.ValueListGroup>;
|
7
|
+
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
8
|
+
}
|
9
|
+
declare function ByValueListGroup(props: IProps): React.JSX.Element;
|
10
|
+
export default ByValueListGroup;
|
@@ -1,115 +1,141 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// ValueList.tsx - Gbtc
|
4
|
-
//
|
5
|
-
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
6
|
-
//
|
7
|
-
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
8
|
-
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
9
|
-
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
10
|
-
// file except in compliance with the License. You may obtain a copy of the License at:
|
11
|
-
//
|
12
|
-
// http://opensource.org/licenses/MIT
|
13
|
-
//
|
14
|
-
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
15
|
-
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
16
|
-
// License for the specific language governing permissions and limitations.
|
17
|
-
//
|
18
|
-
// Code Modification History:
|
19
|
-
// ----------------------------------------------------------------------------------------------------
|
20
|
-
// 07/10/2021 - C. Lackner
|
21
|
-
// Generated original version of source code.
|
22
|
-
// ******************************************************************************************************
|
23
|
-
var __assign = (this && this.__assign) || function () {
|
24
|
-
__assign = Object.assign || function(t) {
|
25
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
26
|
-
s = arguments[i];
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
28
|
-
t[p] = s[p];
|
29
|
-
}
|
30
|
-
return t;
|
31
|
-
};
|
32
|
-
return __assign.apply(this, arguments);
|
33
|
-
};
|
34
|
-
Object.
|
35
|
-
|
36
|
-
var
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
function
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
var
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
"
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
}
|
115
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// ValueList.tsx - Gbtc
|
4
|
+
//
|
5
|
+
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
6
|
+
//
|
7
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
8
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
9
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
10
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
11
|
+
//
|
12
|
+
// http://opensource.org/licenses/MIT
|
13
|
+
//
|
14
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
15
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
16
|
+
// License for the specific language governing permissions and limitations.
|
17
|
+
//
|
18
|
+
// Code Modification History:
|
19
|
+
// ----------------------------------------------------------------------------------------------------
|
20
|
+
// 07/10/2021 - C. Lackner
|
21
|
+
// Generated original version of source code.
|
22
|
+
// ******************************************************************************************************
|
23
|
+
var __assign = (this && this.__assign) || function () {
|
24
|
+
__assign = Object.assign || function(t) {
|
25
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
26
|
+
s = arguments[i];
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
28
|
+
t[p] = s[p];
|
29
|
+
}
|
30
|
+
return t;
|
31
|
+
};
|
32
|
+
return __assign.apply(this, arguments);
|
33
|
+
};
|
34
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
35
|
+
if (k2 === undefined) k2 = k;
|
36
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
37
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
38
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
39
|
+
}
|
40
|
+
Object.defineProperty(o, k2, desc);
|
41
|
+
}) : (function(o, m, k, k2) {
|
42
|
+
if (k2 === undefined) k2 = k;
|
43
|
+
o[k2] = m[k];
|
44
|
+
}));
|
45
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
46
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
47
|
+
}) : function(o, v) {
|
48
|
+
o["default"] = v;
|
49
|
+
});
|
50
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
51
|
+
if (mod && mod.__esModule) return mod;
|
52
|
+
var result = {};
|
53
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
54
|
+
__setModuleDefault(result, mod);
|
55
|
+
return result;
|
56
|
+
};
|
57
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
59
|
+
};
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
61
|
+
var React = __importStar(require("react"));
|
62
|
+
var react_table_1 = __importDefault(require("@gpa-gemstone/react-table"));
|
63
|
+
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
64
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
65
|
+
var GroupForm_1 = __importDefault(require("./GroupForm"));
|
66
|
+
var react_redux_1 = require("react-redux");
|
67
|
+
function ByValueListGroup(props) {
|
68
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
69
|
+
var data = (0, react_redux_1.useSelector)(props.ValueListSlice.SearchResults);
|
70
|
+
var dataStatus = (0, react_redux_1.useSelector)(props.ValueListSlice.SearchStatus);
|
71
|
+
var groups = (0, react_redux_1.useSelector)(props.ValueListSlice.Data);
|
72
|
+
var groupStatus = (0, react_redux_1.useSelector)(props.ValueListSlice.Status);
|
73
|
+
var _a = React.useState('Name'), sortKey = _a[0], setSortKey = _a[1];
|
74
|
+
var _b = React.useState(false), asc = _b[0], setASC = _b[1];
|
75
|
+
var emptyRecord = { ID: 0, Name: '', Description: '' };
|
76
|
+
var _c = React.useState(false), showNew = _c[0], setShowNew = _c[1];
|
77
|
+
var _d = React.useState(emptyRecord), record = _d[0], setRecord = _d[1];
|
78
|
+
var items = (0, react_redux_1.useSelector)(props.ValueListItemSlice.Data);
|
79
|
+
var itemStatus = (0, react_redux_1.useSelector)(props.ValueListItemSlice.Status);
|
80
|
+
var _e = React.useState([]), search = _e[0], setSearch = _e[1];
|
81
|
+
var _f = React.useState([]), newErrors = _f[0], setNewErrors = _f[1];
|
82
|
+
var _g = React.useState(true), validName = _g[0], setValidName = _g[1];
|
83
|
+
React.useEffect(function () {
|
84
|
+
if (dataStatus === 'unintiated' || dataStatus === 'changed')
|
85
|
+
dispatch(props.ValueListSlice.DBSearch({ filter: search, sortField: sortKey, ascending: asc }));
|
86
|
+
}, [dispatch]);
|
87
|
+
React.useEffect(function () {
|
88
|
+
dispatch(props.ValueListSlice.DBSearch({ filter: search, sortField: sortKey, ascending: asc }));
|
89
|
+
}, [search, asc, sortKey]);
|
90
|
+
React.useEffect(function () {
|
91
|
+
if (itemStatus === 'unintiated' || itemStatus === 'changed')
|
92
|
+
dispatch(props.ValueListItemSlice.Fetch());
|
93
|
+
}, [dispatch]);
|
94
|
+
React.useEffect(function () {
|
95
|
+
if (groupStatus === 'unintiated' || groupStatus === 'changed')
|
96
|
+
dispatch(props.ValueListSlice.Fetch());
|
97
|
+
}, [dispatch]);
|
98
|
+
React.useEffect(function () {
|
99
|
+
if (record.Name == null)
|
100
|
+
setValidName(true);
|
101
|
+
else
|
102
|
+
setValidName(groups.findIndex(function (g) { return g.Name.toLowerCase() === record.Name.toLowerCase(); }) < 0);
|
103
|
+
}, [record]);
|
104
|
+
return (React.createElement("div", { style: { width: '100%', height: '100%' } },
|
105
|
+
React.createElement(react_interactive_1.SearchBar, { CollumnList: [{ label: 'Name', key: 'Name', type: 'string', isPivotField: false }], SetFilter: function (flds) { return setSearch(flds); }, Direction: 'left', defaultCollumn: { label: 'Name', key: 'Name', type: 'string', isPivotField: false }, Width: '50%', Label: 'Search', ShowLoading: dataStatus === 'loading' || itemStatus === 'loading', ResultNote: dataStatus === 'error' || itemStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Groups', GetEnum: function () { return function () { }; } },
|
106
|
+
React.createElement("li", { className: "nav-item", style: { width: '15%', paddingRight: 10 } },
|
107
|
+
React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
|
108
|
+
React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Actions:"),
|
109
|
+
React.createElement("form", null,
|
110
|
+
React.createElement("button", { className: "btn btn-primary", onClick: function (evt) { evt.preventDefault(); setRecord(__assign({}, emptyRecord)); setShowNew(true); } }, "Add Group"))))),
|
111
|
+
React.createElement("div", { style: { width: '100%', height: 'calc( 100% - 136px)' } },
|
112
|
+
React.createElement(react_table_1.default, { cols: [
|
113
|
+
{ key: 'Name', field: 'Name', label: 'Name', headerStyle: { width: '15%' }, rowStyle: { width: '15%' } },
|
114
|
+
{ key: 'Description', field: 'Description', label: 'Description/Comments', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' } },
|
115
|
+
{ key: 'Items', field: 'Items', label: 'Items', headerStyle: { width: '10%' }, rowStyle: { width: '10%' }, content: function (item) { return items.filter(function (i) { return i.GroupID === item.ID; }).length; } },
|
116
|
+
{ key: 'Scroll', label: '', headerStyle: { width: 17, padding: 0 }, rowStyle: { width: 0, padding: 0 } },
|
117
|
+
], tableClass: "table table-hover", data: data, sortKey: sortKey, ascending: asc, onSort: function (d) {
|
118
|
+
if (d.colKey === 'remove' || d.colKey === 'scroll' || d.colField === undefined)
|
119
|
+
return;
|
120
|
+
setSortKey(d.colField);
|
121
|
+
if (d.colField === sortKey)
|
122
|
+
setASC(function (b) { return !b; });
|
123
|
+
else
|
124
|
+
setASC(true);
|
125
|
+
}, onClick: function (d) { return props.OnValueListSelect(d.row.ID); }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: window.innerHeight - 300, width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return false; } })),
|
126
|
+
React.createElement(react_interactive_1.Modal, { Show: showNew, Title: 'Add new Value List', ShowX: true, ShowCancel: false, DisableConfirm: newErrors.length > 0 || !validName, ConfirmShowToolTip: newErrors.length > 0 || !validName, ConfirmToolTipContent: React.createElement(React.Fragment, null,
|
127
|
+
newErrors.map(function (t, i) { return React.createElement("p", { key: i },
|
128
|
+
" ",
|
129
|
+
gpa_symbols_1.CrossMark,
|
130
|
+
" ",
|
131
|
+
t); }),
|
132
|
+
!validName ? React.createElement("p", null,
|
133
|
+
gpa_symbols_1.CrossMark,
|
134
|
+
" The Name has to be unique.") : null), CallBack: function (c) {
|
135
|
+
setShowNew(false);
|
136
|
+
if (c)
|
137
|
+
dispatch(props.ValueListSlice.DBAction({ verb: 'POST', record: record }));
|
138
|
+
} },
|
139
|
+
React.createElement(GroupForm_1.default, { Record: record, Setter: setRecord, ErrorSetter: setNewErrors }))));
|
140
|
+
}
|
141
|
+
exports.default = ByValueListGroup;
|
package/lib/ValueList/Group.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
-
import { IGenericSlice } from '../SliceInterfaces';
|
4
|
-
interface IProps {
|
5
|
-
Id: number;
|
6
|
-
ValueListSlice: IGenericSlice<SystemCenter.Types.ValueListGroup>;
|
7
|
-
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
8
|
-
OnDelete: () => {};
|
9
|
-
}
|
10
|
-
export default function ValueListGroup(props: IProps): JSX.Element | null;
|
11
|
-
export {};
|
1
|
+
import * as React from 'react';
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
import { IGenericSlice } from '../SliceInterfaces';
|
4
|
+
interface IProps {
|
5
|
+
Id: number;
|
6
|
+
ValueListSlice: IGenericSlice<SystemCenter.Types.ValueListGroup>;
|
7
|
+
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
8
|
+
OnDelete: () => {};
|
9
|
+
}
|
10
|
+
export default function ValueListGroup(props: IProps): React.JSX.Element | null;
|
11
|
+
export {};
|
package/lib/ValueList/Group.js
CHANGED
@@ -1,71 +1,97 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// Group.tsx - Gbtc
|
4
|
-
//
|
5
|
-
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
6
|
-
//
|
7
|
-
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
8
|
-
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
9
|
-
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
10
|
-
// file except in compliance with the License. You may obtain a copy of the License at:
|
11
|
-
//
|
12
|
-
// http://opensource.org/licenses/MIT
|
13
|
-
//
|
14
|
-
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
15
|
-
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
16
|
-
// License for the specific language governing permissions and limitations.
|
17
|
-
//
|
18
|
-
// Code Modification History:
|
19
|
-
// ----------------------------------------------------------------------------------------------------
|
20
|
-
// 07/04/2021 - C. Lackner
|
21
|
-
// Generated original version of source code.
|
22
|
-
// ******************************************************************************************************
|
23
|
-
Object.
|
24
|
-
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// Group.tsx - Gbtc
|
4
|
+
//
|
5
|
+
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
6
|
+
//
|
7
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
8
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
9
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
10
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
11
|
+
//
|
12
|
+
// http://opensource.org/licenses/MIT
|
13
|
+
//
|
14
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
15
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
16
|
+
// License for the specific language governing permissions and limitations.
|
17
|
+
//
|
18
|
+
// Code Modification History:
|
19
|
+
// ----------------------------------------------------------------------------------------------------
|
20
|
+
// 07/04/2021 - C. Lackner
|
21
|
+
// Generated original version of source code.
|
22
|
+
// ******************************************************************************************************
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
24
|
+
if (k2 === undefined) k2 = k;
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
28
|
+
}
|
29
|
+
Object.defineProperty(o, k2, desc);
|
30
|
+
}) : (function(o, m, k, k2) {
|
31
|
+
if (k2 === undefined) k2 = k;
|
32
|
+
o[k2] = m[k];
|
33
|
+
}));
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
36
|
+
}) : function(o, v) {
|
37
|
+
o["default"] = v;
|
38
|
+
});
|
39
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
40
|
+
if (mod && mod.__esModule) return mod;
|
41
|
+
var result = {};
|
42
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
43
|
+
__setModuleDefault(result, mod);
|
44
|
+
return result;
|
45
|
+
};
|
46
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
exports.default = ValueListGroup;
|
51
|
+
var React = __importStar(require("react"));
|
52
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
53
|
+
var GroupInfo_1 = __importDefault(require("./GroupInfo"));
|
54
|
+
var GroupItem_1 = __importDefault(require("./GroupItem"));
|
55
|
+
var react_redux_1 = require("react-redux");
|
56
|
+
function ValueListGroup(props) {
|
57
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
58
|
+
var record = (0, react_redux_1.useSelector)(function (state) { return props.ValueListSlice.Data(state).find(function (i) { return i.ID === props.Id; }); });
|
59
|
+
var recordStatus = (0, react_redux_1.useSelector)(props.ValueListSlice.Status);
|
60
|
+
var _a = React.useState('items'), tab = _a[0], setTab = _a[1];
|
61
|
+
var _b = React.useState(false), showWarning = _b[0], setShowWarning = _b[1];
|
62
|
+
React.useEffect(function () {
|
63
|
+
if (recordStatus === 'unintiated' || recordStatus === 'changed')
|
64
|
+
dispatch(props.ValueListSlice.Fetch());
|
65
|
+
}, [dispatch, recordStatus]);
|
66
|
+
var Tabs = [
|
67
|
+
{ Id: "info", Label: "Value List Group Info" },
|
68
|
+
{ Id: "items", Label: "List Items" }
|
69
|
+
];
|
70
|
+
if (recordStatus === 'error')
|
71
|
+
return React.createElement("div", { style: { width: '100%', height: '100%' } },
|
72
|
+
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: 'A Server Error Occured. Please Reload the Application' }));
|
73
|
+
if (record == null)
|
74
|
+
return null;
|
75
|
+
return (React.createElement("div", { style: { width: '100%', height: window.innerHeight - 63, maxHeight: window.innerHeight - 63, overflow: 'hidden', padding: 15 } },
|
76
|
+
React.createElement("div", { className: "row" },
|
77
|
+
React.createElement("div", { className: "col" },
|
78
|
+
React.createElement("h2", null, record.Name)),
|
79
|
+
React.createElement("div", { className: "col" },
|
80
|
+
React.createElement("button", { className: "btn btn-danger pull-right", hidden: record == null, onClick: function () { return setShowWarning(true); } }, "Delete Value List Group (Permanent)"))),
|
81
|
+
React.createElement("hr", null),
|
82
|
+
React.createElement(react_interactive_1.TabSelector, { CurrentTab: tab, SetTab: function (t) { return setTab(t); }, Tabs: Tabs }),
|
83
|
+
React.createElement("div", { className: "tab-content", style: { maxHeight: window.innerHeight - 235, overflow: 'hidden' } },
|
84
|
+
React.createElement("div", { className: "tab-pane " + (tab === "info" ? " active" : "fade"), id: "info" },
|
85
|
+
React.createElement(GroupInfo_1.default, { Record: record, Setter: function (r) {
|
86
|
+
dispatch(props.ValueListSlice.DBAction({ verb: 'PATCH', record: r }));
|
87
|
+
} })),
|
88
|
+
React.createElement("div", { className: "tab-pane " + (tab === "items" ? " active" : "fade"), id: "items" },
|
89
|
+
React.createElement(GroupItem_1.default, { Record: record, ValueListItemSlice: props.ValueListItemSlice }))),
|
90
|
+
React.createElement(react_interactive_1.Warning, { Message: 'This will permanently remove the ValueList Group. Are you sure you want to continue?', Title: 'Warning', Show: showWarning, CallBack: function (c) {
|
91
|
+
setShowWarning(false);
|
92
|
+
if (c) {
|
93
|
+
dispatch(props.ValueListSlice.DBAction({ verb: 'DELETE', record: record }));
|
94
|
+
props.OnDelete();
|
95
|
+
}
|
96
|
+
} })));
|
97
|
+
}
|