@gpa-gemstone/common-pages 0.0.104 → 0.0.106
Sign up to get free protection for your applications and to get access to all the features.
- 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
package/lib/user/UserForm.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
import { Application } from '@gpa-gemstone/application-typings';
|
3
|
-
import { IUserAccountSlice } from '../SliceInterfaces';
|
4
|
-
interface IProps {
|
5
|
-
UserAccount: Application.Types.iUserAccount;
|
6
|
-
Setter: (record: Application.Types.iUserAccount) => void;
|
7
|
-
Edit: boolean;
|
8
|
-
SetErrors?: (e: string[]) => void;
|
9
|
-
UserSlice: IUserAccountSlice;
|
10
|
-
}
|
11
|
-
declare function UserForm(props: IProps): JSX.Element | null;
|
12
|
-
export default UserForm;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Application } from '@gpa-gemstone/application-typings';
|
3
|
+
import { IUserAccountSlice } from '../SliceInterfaces';
|
4
|
+
interface IProps {
|
5
|
+
UserAccount: Application.Types.iUserAccount;
|
6
|
+
Setter: (record: Application.Types.iUserAccount) => void;
|
7
|
+
Edit: boolean;
|
8
|
+
SetErrors?: (e: string[]) => void;
|
9
|
+
UserSlice: IUserAccountSlice;
|
10
|
+
}
|
11
|
+
declare function UserForm(props: IProps): React.JSX.Element | null;
|
12
|
+
export default UserForm;
|
package/lib/user/UserForm.js
CHANGED
@@ -1,143 +1,166 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// UserForm.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/14/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
|
-
|
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
|
-
React.createElement("div", { className: "col" },
|
123
|
-
React.createElement(
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
React.createElement("div", { className: "col" },
|
132
|
-
React.createElement(
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
143
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// UserForm.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/14/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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
47
|
+
var React = __importStar(require("react"));
|
48
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
49
|
+
var _ = __importStar(require("lodash"));
|
50
|
+
var react_redux_1 = require("react-redux");
|
51
|
+
function UserForm(props) {
|
52
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
53
|
+
var _a = React.useState(false), updatedAD = _a[0], setUpdatedAD = _a[1];
|
54
|
+
var userValidation = (0, react_redux_1.useSelector)(props.UserSlice.ADValidation);
|
55
|
+
var _b = React.useState([]), userError = _b[0], setUserError = _b[1];
|
56
|
+
React.useEffect(function () {
|
57
|
+
if (userValidation === 'Valid' && !props.Edit && updatedAD === false)
|
58
|
+
dispatch(props.UserSlice.ADUpdate());
|
59
|
+
}, [userValidation, updatedAD]);
|
60
|
+
React.useEffect(function () {
|
61
|
+
if (props.SetErrors !== undefined)
|
62
|
+
props.SetErrors(userError);
|
63
|
+
}, [userError, props.SetErrors]);
|
64
|
+
React.useEffect(function () {
|
65
|
+
if (props.UserAccount == null)
|
66
|
+
return;
|
67
|
+
var e = [];
|
68
|
+
if (props.UserAccount.Name == null || props.UserAccount.Name.length === 0)
|
69
|
+
e.push('An AccountName is required.');
|
70
|
+
if (props.UserAccount.UseADAuthentication && userValidation !== 'Valid')
|
71
|
+
e.push('The user could not be validated by the AD.');
|
72
|
+
setUserError(e);
|
73
|
+
}, [props.UserAccount, userValidation]);
|
74
|
+
function validUserAccountField(user, field) {
|
75
|
+
if (field === 'Name')
|
76
|
+
return user.Name != null && user.Name.length > 0 && user.Name.length <= 200;
|
77
|
+
else if (field === 'Password')
|
78
|
+
return user.Password == null || user.Password.length <= 200;
|
79
|
+
else if (field === 'FirstName')
|
80
|
+
return user.FirstName == null || user.FirstName.length <= 200;
|
81
|
+
else if (field === 'LastName')
|
82
|
+
return user.LastName == null || user.LastName.length <= 200;
|
83
|
+
else if (field === 'Phone')
|
84
|
+
return user.Phone == null || user.Phone.length <= 200;
|
85
|
+
else if (field === 'Email')
|
86
|
+
return user.Email == null || user.Email.length <= 200;
|
87
|
+
else if (field === "ChangePasswordOn")
|
88
|
+
return user.ChangePasswordOn == null;
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
if (props.UserAccount == null)
|
92
|
+
return null;
|
93
|
+
return (React.createElement(React.Fragment, null,
|
94
|
+
React.createElement("form", null,
|
95
|
+
React.createElement("div", { className: "row" },
|
96
|
+
React.createElement("div", { className: "col" },
|
97
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Disabled: props.Edit, Field: 'Name', Feedback: 'A Name of less than 200 characters is required.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: function (record) {
|
98
|
+
setUpdatedAD(false);
|
99
|
+
props.Setter(record);
|
100
|
+
} }),
|
101
|
+
React.createElement("div", { className: "row", style: { position: 'absolute', top: 0, left: 100 }, hidden: !props.UserAccount.UseADAuthentication },
|
102
|
+
React.createElement("span", { id: "resolvingAccount", hidden: userValidation !== 'Resolving' },
|
103
|
+
React.createElement("i", { style: { height: 10, width: 10, color: 'grey' }, className: "fa fa fa-spin fa-refresh" }),
|
104
|
+
"\u00A0",
|
105
|
+
React.createElement("em", { className: "small" }, "Resolving account details...")),
|
106
|
+
React.createElement("span", { id: "accountValid", hidden: userValidation !== 'Valid' },
|
107
|
+
React.createElement("i", { style: { height: 20, width: 20, color: 'green' }, className: "fa fa-check-circle" }),
|
108
|
+
"\u00A0",
|
109
|
+
React.createElement("em", { className: "small" }, "Resolved account name ")),
|
110
|
+
React.createElement("span", { id: "accountInvalid", hidden: userValidation !== 'Invalid' },
|
111
|
+
React.createElement("i", { style: { height: 20, width: 20, color: 'red' }, className: "fa fa-times-circle" }),
|
112
|
+
"\u00A0",
|
113
|
+
React.createElement("em", { className: "small" }, "Cannot resolve account name")),
|
114
|
+
React.createElement("span", { id: "accountUnknown", hidden: userValidation !== 'Unknown' },
|
115
|
+
React.createElement("i", { style: { height: 20, width: 20, color: 'orange' }, className: "fa fa-exclamation-circle" }),
|
116
|
+
"\u00A0",
|
117
|
+
React.createElement("em", { className: "small" }, "Valid account name is not a user or Active Directory access is limited"))),
|
118
|
+
React.createElement("button", { style: { marginBottom: 10 }, type: "button", className: "btn btn-primary btn-sm", onClick: function (evt) { evt.preventDefault(); dispatch(props.UserSlice.ADUpdate()); }, hidden: userValidation !== 'Valid' || !props.Edit }, "Load Information from AD"),
|
119
|
+
React.createElement("div", { className: "card" },
|
120
|
+
React.createElement("div", { className: "card-header" },
|
121
|
+
React.createElement("div", { className: "row" },
|
122
|
+
React.createElement("div", { className: "col-xs-4" },
|
123
|
+
React.createElement("div", { className: "form-check-inline" },
|
124
|
+
React.createElement("label", { className: "form-check-label" },
|
125
|
+
React.createElement("input", { disabled: props.Edit, className: 'form-check-input', type: 'radio', checked: props.UserAccount.UseADAuthentication, onChange: function (e) {
|
126
|
+
var record = _.clone(props.UserAccount);
|
127
|
+
record.UseADAuthentication = e.target.checked;
|
128
|
+
props.Setter(record);
|
129
|
+
} }),
|
130
|
+
"Active Directory User"))),
|
131
|
+
React.createElement("div", { className: "col-xs-4" },
|
132
|
+
React.createElement("div", { className: "form-check-inline" },
|
133
|
+
React.createElement("label", { className: "form-check-label" },
|
134
|
+
React.createElement("input", { disabled: props.Edit, className: 'form-check-input', type: 'radio', checked: !props.UserAccount.UseADAuthentication, onChange: function (e) {
|
135
|
+
var record = _.clone(props.UserAccount);
|
136
|
+
record.UseADAuthentication = !e.target.checked;
|
137
|
+
props.Setter(record);
|
138
|
+
} }),
|
139
|
+
"Database User"))))),
|
140
|
+
React.createElement("div", { className: "card-body", hidden: !props.UserAccount.UseADAuthentication },
|
141
|
+
React.createElement("div", { className: "row" },
|
142
|
+
React.createElement("div", { className: "col" },
|
143
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'FirstName', Label: 'First Name', Feedback: 'First Name must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
144
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'LastName', Label: 'Last Name', Feedback: 'Last Name must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter })),
|
145
|
+
React.createElement("div", { className: "col" },
|
146
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'Phone', Feedback: 'Phone must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
147
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'Email', Feedback: 'Email must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter })))),
|
148
|
+
React.createElement("div", { className: "card-body", hidden: props.UserAccount.UseADAuthentication },
|
149
|
+
React.createElement("div", { className: "row" },
|
150
|
+
React.createElement("div", { className: "col" },
|
151
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'Password', Feedback: 'Password must be less than 200 characters.', Type: 'password', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
152
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'FirstName', Label: 'First Name', Feedback: 'First Name must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
153
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'LastName', Label: 'Last Name', Feedback: 'Last Name must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter })),
|
154
|
+
React.createElement("div", { className: "col" },
|
155
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'Phone', Feedback: 'Password must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
156
|
+
React.createElement(react_forms_1.Input, { Record: props.UserAccount, Field: 'Email', Feedback: 'Password must be less than 200 characters.', Valid: function (field) { return validUserAccountField(props.UserAccount, field); }, Setter: props.Setter }),
|
157
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.UserAccount, Field: 'ChangePasswordOn', Label: 'Change Password On', Setter: props.Setter, Valid: function (field) { return validUserAccountField(props.UserAccount, field); } })))),
|
158
|
+
React.createElement("div", { className: "row" },
|
159
|
+
React.createElement("div", { className: "col", style: { margin: 10 } },
|
160
|
+
React.createElement(react_forms_1.CheckBox, { Record: props.UserAccount, Label: 'Locked Out', Field: 'LockedOut', Setter: props.Setter }),
|
161
|
+
React.createElement(react_forms_1.CheckBox, { Record: props.UserAccount, Field: 'Approved', Setter: props.Setter })),
|
162
|
+
React.createElement("div", { className: "col-lg-6" },
|
163
|
+
React.createElement(react_forms_1.CheckBox, { Record: props.UserAccount, Label: 'Phone Confirmed', Field: 'PhoneConfirmed', Setter: props.Setter }),
|
164
|
+
React.createElement(react_forms_1.CheckBox, { Record: props.UserAccount, Label: 'Email Confirmed', Field: 'EmailConfirmed', Setter: props.Setter })))))))));
|
165
|
+
}
|
166
|
+
exports.default = UserForm;
|
package/lib/user/UserInfo.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
import { IUserAccountSlice } from '../SliceInterfaces';
|
3
|
-
interface IProps {
|
4
|
-
UserSlice: IUserAccountSlice;
|
5
|
-
}
|
6
|
-
declare function UserInfo(props: IProps): JSX.Element;
|
7
|
-
export default UserInfo;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { IUserAccountSlice } from '../SliceInterfaces';
|
3
|
+
interface IProps {
|
4
|
+
UserSlice: IUserAccountSlice;
|
5
|
+
}
|
6
|
+
declare function UserInfo(props: IProps): React.JSX.Element;
|
7
|
+
export default UserInfo;
|