@gpa-gemstone/common-pages 0.0.122 → 0.0.124

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/Setting.js DELETED
@@ -1,151 +0,0 @@
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;
@@ -1,10 +0,0 @@
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,141 +0,0 @@
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;
@@ -1,11 +0,0 @@
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 {};
@@ -1,97 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { SystemCenter } from '@gpa-gemstone/application-typings';
3
- interface IProps {
4
- Record: SystemCenter.Types.ValueListGroup;
5
- Setter: (record: SystemCenter.Types.ValueListGroup) => void;
6
- ErrorSetter?: (errors: string[]) => void;
7
- }
8
- export default function GroupForm(props: IProps): React.JSX.Element;
9
- export {};
@@ -1,74 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // GroupForm.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
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.default = GroupForm;
48
- var React = __importStar(require("react"));
49
- var react_forms_1 = require("@gpa-gemstone/react-forms");
50
- function GroupForm(props) {
51
- var _a = React.useState([]), errors = _a[0], setErrors = _a[1];
52
- React.useEffect(function () {
53
- var e = [];
54
- if (props.Record.Name == null || props.Record.Name.length === 0)
55
- e.push('A Name is required.');
56
- if (props.Record.Name != null && props.Record.Name.length > 200)
57
- e.push('Name has to be less than 200 characters.');
58
- setErrors(e);
59
- }, [props.Record]);
60
- React.useEffect(function () {
61
- if (props.ErrorSetter !== undefined)
62
- props.ErrorSetter(errors);
63
- }, [errors, props.ErrorSetter]);
64
- function Valid(field) {
65
- if (field === 'Name')
66
- return props.Record.Name != null && props.Record.Name.length > 0 && props.Record.Name.length <= 200;
67
- else if (field === 'Description')
68
- return true;
69
- return false;
70
- }
71
- return (React.createElement("form", null,
72
- React.createElement(react_forms_1.Input, { Record: props.Record, Field: 'Name', Feedback: 'Name must be less than 200 characters.', Valid: Valid, Setter: props.Setter }),
73
- React.createElement(react_forms_1.TextArea, { Rows: 3, Record: props.Record, Field: 'Description', Valid: Valid, Setter: props.Setter })));
74
- }
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { SystemCenter } from '@gpa-gemstone/application-typings';
3
- interface IProps {
4
- Record: SystemCenter.Types.ValueListGroup;
5
- Setter: (record: SystemCenter.Types.ValueListGroup) => void;
6
- }
7
- declare const InfoWindow: (props: IProps) => React.JSX.Element | null;
8
- export default InfoWindow;
@@ -1,95 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // GroupInfo.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
- // 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
- var React = __importStar(require("react"));
51
- var GroupForm_1 = __importDefault(require("./GroupForm"));
52
- var react_interactive_1 = require("@gpa-gemstone/react-interactive");
53
- var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
54
- var InfoWindow = function (props) {
55
- var _a = React.useState(props.Record), record = _a[0], setRecord = _a[1];
56
- var _b = React.useState([]), errors = _b[0], setErrors = _b[1];
57
- var _c = React.useState([]), warnings = _c[0], setWarnings = _c[1];
58
- var _d = React.useState('None'), hover = _d[0], setHover = _d[1];
59
- React.useEffect(function () {
60
- var w = [];
61
- if (record == null)
62
- return;
63
- if (record.Name !== props.Record.Name)
64
- w.push('Changes to Name will be lost.');
65
- if (record.Description !== props.Record.Description)
66
- w.push('Changes to Description will be lost.');
67
- setWarnings(w);
68
- }, [props.Record, record]);
69
- if (record == null)
70
- return null;
71
- return (React.createElement("div", { className: "card", style: { marginBottom: 10 } },
72
- React.createElement("div", { className: "card-header" },
73
- React.createElement("div", { className: "row" },
74
- React.createElement("div", { className: "col" },
75
- React.createElement("h4", null, "Value List Group Information:")))),
76
- React.createElement("div", { className: "card-body" },
77
- React.createElement(GroupForm_1.default, { Record: record, Setter: function (r) { return setRecord(r); }, ErrorSetter: setErrors })),
78
- React.createElement("div", { className: "card-footer" },
79
- React.createElement("div", { className: "btn-group mr-2" },
80
- React.createElement("button", { className: "btn btn-primary" + (errors.length > 0 || warnings.length === 0 ? ' disabled' : ''), onClick: function () {
81
- if (errors.length === 0 && warnings.length > 0)
82
- props.Setter(record);
83
- }, hidden: record.ID === 0, "data-tooltip": 'Update', onMouseEnter: function () { return setHover('Update'); }, onMouseLeave: function () { return setHover('None'); } }, "Update")),
84
- React.createElement(react_interactive_1.ToolTip, { Show: hover === 'Clear' && (errors.length > 0), Position: 'top', Target: "Update" }, errors.map(function (t, i) { return React.createElement("p", { key: i },
85
- gpa_symbols_1.CrossMark,
86
- " ",
87
- t); })),
88
- React.createElement("div", { className: "btn-group mr-2" },
89
- React.createElement("button", { className: "btn btn-default", onClick: function () { return setRecord(props.Record); }, disabled: warnings.length === 0, "data-tooltip": 'Clr', onMouseEnter: function () { return setHover('Clear'); }, onMouseLeave: function () { return setHover('None'); } }, "Reset")),
90
- React.createElement(react_interactive_1.ToolTip, { Show: hover === 'Clear' && (warnings.length > 0), Position: 'top', Target: "Clr" }, warnings.map(function (t, i) { return React.createElement("p", { key: i },
91
- gpa_symbols_1.Warning,
92
- " ",
93
- t); })))));
94
- };
95
- exports.default = InfoWindow;
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { SystemCenter } from '@gpa-gemstone/application-typings';
3
- import { IGenericSlice } from '../SliceInterfaces';
4
- interface IProps {
5
- Record: SystemCenter.Types.ValueListGroup;
6
- ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
7
- }
8
- export default function GroupItemsWindow(props: IProps): React.JSX.Element;
9
- export {};