@gpa-gemstone/common-pages 0.0.103 → 0.0.105
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 +9 -8
package/lib/SelectionPopup.js
CHANGED
@@ -1,90 +1,93 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// SelectionPopup.tsx - Gbtc
|
4
|
-
//
|
5
|
-
// Copyright © 2021, 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
|
-
// 12/19/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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
var
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// SelectionPopup.tsx - Gbtc
|
4
|
+
//
|
5
|
+
// Copyright © 2021, 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
|
+
// 12/19/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 __importDefault = (this && this.__importDefault) || function (mod) {
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
36
|
+
};
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
38
|
+
exports.DefaultSelects = void 0;
|
39
|
+
var React = require("react");
|
40
|
+
var StandardSelectPopup_1 = __importDefault(require("./StandardSelectPopup"));
|
41
|
+
var SearchBar_1 = require("./SearchBar");
|
42
|
+
/** This Implements a few standardized Selection Popups */
|
43
|
+
var DefaultSelects;
|
44
|
+
(function (DefaultSelects) {
|
45
|
+
/** This Implements a standard Meter Selection Modal */
|
46
|
+
function Meter(props) {
|
47
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.Meter, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
48
|
+
" ",
|
49
|
+
props.children,
|
50
|
+
" ");
|
51
|
+
}
|
52
|
+
DefaultSelects.Meter = Meter;
|
53
|
+
/** This Implements a standard Substation Selection Modal */
|
54
|
+
function Location(props) {
|
55
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.Location, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
56
|
+
" ",
|
57
|
+
props.children,
|
58
|
+
" ");
|
59
|
+
}
|
60
|
+
DefaultSelects.Location = Location;
|
61
|
+
/** This Implements a standard Transmission Asset Selection Modal */
|
62
|
+
function Asset(props) {
|
63
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.Asset, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
64
|
+
" ",
|
65
|
+
props.children,
|
66
|
+
" ");
|
67
|
+
}
|
68
|
+
DefaultSelects.Asset = Asset;
|
69
|
+
/** This Implements a standard Asset Group Selection Modal */
|
70
|
+
function AssetGroup(props) {
|
71
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.AssetGroup, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
72
|
+
" ",
|
73
|
+
props.children,
|
74
|
+
" ");
|
75
|
+
}
|
76
|
+
DefaultSelects.AssetGroup = AssetGroup;
|
77
|
+
/** This Implements a standard User Selection Modal */
|
78
|
+
function User(props) {
|
79
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.User, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
80
|
+
" ",
|
81
|
+
props.children,
|
82
|
+
" ");
|
83
|
+
}
|
84
|
+
DefaultSelects.User = User;
|
85
|
+
/** This Implements a standard Customer Selection Modal */
|
86
|
+
function Customer(props) {
|
87
|
+
return React.createElement(StandardSelectPopup_1.default, __assign({}, props, { Searchbar: function (children) { return React.createElement(SearchBar_1.DefaultSearch.Customer, { Slice: props.Slice, GetAddlFields: props.GetAddlFields, GetEnum: props.GetEnum, StorageID: props.StorageID, AddlFilters: props.AddlFilters }, children); } }),
|
88
|
+
" ",
|
89
|
+
props.children,
|
90
|
+
" ");
|
91
|
+
}
|
92
|
+
DefaultSelects.Customer = Customer;
|
93
|
+
})(DefaultSelects || (exports.DefaultSelects = DefaultSelects = {}));
|
package/lib/Setting.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
import { ISearchableSlice } from './SliceInterfaces';
|
3
|
-
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
4
|
-
interface IProps {
|
5
|
-
SettingsSlice: ISearchableSlice<SystemCenter.Types.Setting>;
|
6
|
-
}
|
7
|
-
declare function Setting(props: IProps): JSX.Element;
|
8
|
-
export default Setting;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { ISearchableSlice } from './SliceInterfaces';
|
3
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
4
|
+
interface IProps {
|
5
|
+
SettingsSlice: ISearchableSlice<SystemCenter.Types.Setting>;
|
6
|
+
}
|
7
|
+
declare function Setting(props: IProps): React.JSX.Element;
|
8
|
+
export default Setting;
|
package/lib/Setting.js
CHANGED
@@ -1,125 +1,151 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// Setting.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
|
-
// 04/28/2021 - C. Lackner
|
21
|
-
// Generated original version of source code.
|
22
|
-
// ******************************************************************************************************
|
23
|
-
Object.
|
24
|
-
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
function
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
var
|
42
|
-
var
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
var
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// Setting.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
|
+
// 04/28/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
|
+
var React = __importStar(require("react"));
|
51
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
52
|
+
var react_table_1 = __importDefault(require("@gpa-gemstone/react-table"));
|
53
|
+
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
54
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
55
|
+
var react_redux_1 = require("react-redux");
|
56
|
+
function Setting(props) {
|
57
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
58
|
+
var search = (0, react_redux_1.useSelector)(props.SettingsSlice.SearchFilters);
|
59
|
+
var searchStatus = (0, react_redux_1.useSelector)(props.SettingsSlice.SearchStatus);
|
60
|
+
var data = (0, react_redux_1.useSelector)(props.SettingsSlice.SearchResults);
|
61
|
+
var allSettings = (0, react_redux_1.useSelector)(props.SettingsSlice.Data);
|
62
|
+
var status = (0, react_redux_1.useSelector)(props.SettingsSlice.Status);
|
63
|
+
var _a = React.useState('Name'), sortField = _a[0], setSortField = _a[1];
|
64
|
+
var _b = React.useState(true), ascending = _b[0], setAscending = _b[1];
|
65
|
+
var emptySetting = { ID: 0, Name: '', Value: '', DefaultValue: '' };
|
66
|
+
var _c = React.useState(emptySetting), editnewSetting = _c[0], setEditNewSetting = _c[1];
|
67
|
+
var _d = React.useState('New'), editNew = _d[0], setEditNew = _d[1];
|
68
|
+
var _e = React.useState(false), showModal = _e[0], setShowModal = _e[1];
|
69
|
+
var _f = React.useState(false), showWarning = _f[0], setShowWarning = _f[1];
|
70
|
+
var _g = React.useState(false), hasChanged = _g[0], setHasChanged = _g[1];
|
71
|
+
var _h = React.useState([]), errors = _h[0], setErrors = _h[1];
|
72
|
+
React.useEffect(function () {
|
73
|
+
if (status === 'unintiated' || status === 'changed')
|
74
|
+
dispatch(props.SettingsSlice.Fetch());
|
75
|
+
}, [dispatch, status]);
|
76
|
+
React.useEffect(function () {
|
77
|
+
if (searchStatus === 'unintiated' || status === 'changed')
|
78
|
+
dispatch(props.SettingsSlice.DBSearch({ filter: search, sortField: sortField, ascending: ascending }));
|
79
|
+
}, [dispatch, searchStatus, ascending, sortField, search]);
|
80
|
+
React.useEffect(function () { setHasChanged(false); }, [showModal]);
|
81
|
+
React.useEffect(function () {
|
82
|
+
var e = [];
|
83
|
+
if (editnewSetting.Name == null || editnewSetting.Name.length === 0)
|
84
|
+
e.push('A Name is required');
|
85
|
+
if (editnewSetting.Name != null && editnewSetting.Name.length > 0 && allSettings.findIndex(function (s) { return s.Name.toLowerCase() === editnewSetting.Name.toLowerCase() && s.ID !== editnewSetting.ID; }) > -1)
|
86
|
+
e.push('A Settign with this Name already exists.');
|
87
|
+
if (editnewSetting.Value == null || editnewSetting.Value.length === 0)
|
88
|
+
e.push('A Value is required');
|
89
|
+
setErrors(e);
|
90
|
+
}, [editnewSetting]);
|
91
|
+
var searchFields = [
|
92
|
+
{ key: 'Name', label: 'Name', type: 'string', isPivotField: false },
|
93
|
+
{ key: 'DefaultValue', label: 'Default Value', type: 'string', isPivotField: false },
|
94
|
+
{ key: 'Value', label: 'Value', type: 'string', isPivotField: false }
|
95
|
+
];
|
96
|
+
if (status === 'error')
|
97
|
+
return React.createElement("div", { style: { width: '100%', height: '100%' } },
|
98
|
+
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: 'A Server Error Occured. Please Reload the Application' }));
|
99
|
+
return (React.createElement(React.Fragment, null,
|
100
|
+
React.createElement(react_interactive_1.LoadingScreen, { Show: status === 'loading' }),
|
101
|
+
React.createElement("div", { style: { width: '100%', height: '100%' } },
|
102
|
+
React.createElement(react_interactive_1.SearchBar, { CollumnList: searchFields, SetFilter: function (flds) { return dispatch(props.SettingsSlice.DBSearch({ filter: flds, sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: { key: 'Name', label: 'Name', type: 'string', isPivotField: false }, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Settings', GetEnum: function () {
|
103
|
+
return function () { };
|
104
|
+
} },
|
105
|
+
React.createElement("li", { className: "nav-item", style: { width: '15%', paddingRight: 10 } },
|
106
|
+
React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
|
107
|
+
React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Actions:"),
|
108
|
+
React.createElement("form", null,
|
109
|
+
React.createElement("button", { className: "btn btn-primary", onClick: function (event) { setEditNewSetting(emptySetting); setEditNew('New'); setShowModal(true); event.preventDefault(); } }, "Add Setting"))))),
|
110
|
+
React.createElement("div", { style: { width: '100%', height: 'calc( 100% - 136px)' } },
|
111
|
+
React.createElement(react_table_1.default, { cols: [
|
112
|
+
{ key: 'Name', field: 'Name', label: 'Setting Name', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
|
113
|
+
{ key: 'Value', field: 'Value', label: 'Current Value', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
|
114
|
+
{ key: 'DefaultValue', field: 'DefaultValue', label: 'Default Value', headerStyle: { width: '20%' }, rowStyle: { width: '20%' } },
|
115
|
+
{ key: 'scroll', label: '', headerStyle: { width: 17, padding: 0 }, rowStyle: { width: 0, padding: 0 } },
|
116
|
+
], tableClass: "table table-hover", data: data, sortKey: sortField, ascending: ascending, onSort: function (d) {
|
117
|
+
if (d.colKey === 'scroll' || d.colField === undefined)
|
118
|
+
return;
|
119
|
+
if (d.colField === sortField)
|
120
|
+
setAscending(!ascending);
|
121
|
+
else {
|
122
|
+
setAscending(true);
|
123
|
+
setSortField(d.colField);
|
124
|
+
}
|
125
|
+
if (d.colField === sortField)
|
126
|
+
dispatch(props.SettingsSlice.DBSearch({ filter: search, sortField: sortField, ascending: true }));
|
127
|
+
else
|
128
|
+
dispatch(props.SettingsSlice.DBSearch({ filter: search, sortField: d.colField, ascending: ascending }));
|
129
|
+
}, onClick: function (item) { setEditNewSetting(item.row); setShowModal(true); setEditNew('Edit'); }, 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 () { return false; } }))),
|
130
|
+
React.createElement(react_interactive_1.Modal, { Title: editNew === 'Edit' ? editnewSetting.Name + ' - Setting' : 'Add New Setting', Show: showModal, ShowX: true, Size: 'lg', ShowCancel: editNew === 'Edit', ConfirmText: 'Save', CancelText: 'Delete', CallBack: function (conf, isBtn) {
|
131
|
+
if (conf && editNew === 'New')
|
132
|
+
dispatch(props.SettingsSlice.DBAction({ verb: 'POST', record: editnewSetting }));
|
133
|
+
if (conf && editNew === 'Edit')
|
134
|
+
dispatch(props.SettingsSlice.DBAction({ verb: 'PATCH', record: editnewSetting }));
|
135
|
+
if (!conf && isBtn)
|
136
|
+
setShowWarning(true);
|
137
|
+
setShowModal(false);
|
138
|
+
}, DisableConfirm: (editNew === 'Edit' && !hasChanged) || errors.length > 0, ConfirmShowToolTip: errors.length > 0, ConfirmToolTipContent: errors.map(function (t, i) { return React.createElement("p", { key: i },
|
139
|
+
gpa_symbols_1.CrossMark,
|
140
|
+
" ",
|
141
|
+
t,
|
142
|
+
" "); }) },
|
143
|
+
React.createElement("div", { className: "row" },
|
144
|
+
React.createElement("div", { className: "col" },
|
145
|
+
React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Name', Label: 'Setting Name', Feedback: 'A unique Name is required.', Valid: function (field) { return editnewSetting.Name != null && editnewSetting.Name.length > 0 && allSettings.findIndex(function (s) { return s.Name === editnewSetting.Name && s.ID !== editnewSetting.ID; }) < 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
|
146
|
+
React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Value', Label: 'Value', Feedback: 'Value is required.', Valid: function (field) { return editnewSetting.Value != null && editnewSetting.Value.length > 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
|
147
|
+
React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'DefaultValue', Label: 'Default Value', Valid: function (field) { return true; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } })))),
|
148
|
+
React.createElement(react_interactive_1.Warning, { Title: 'Delete Setting', Message: 'This will Delete this Setting from the System. This can have unintended consequences and cause the System to crash. Are you sure you want to continue?', Show: showWarning, CallBack: function (conf) { if (conf)
|
149
|
+
dispatch(props.SettingsSlice.DBAction({ verb: 'DELETE', record: editnewSetting })); setShowWarning(false); } })));
|
150
|
+
}
|
151
|
+
exports.default = Setting;
|