diff --git a/.gitignore b/.gitignore index 68f6d70ed3..e0038d8c9c 100644 --- a/.gitignore +++ b/.gitignore @@ -218,3 +218,4 @@ _Pvt_Extensions # SPCTools JS File **/SPCTools/Scripts/js/SPCTools.js* +.nuget/ diff --git a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/AlarmGroup/AlarmGroup.tsx b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/AlarmGroup/AlarmGroup.tsx index 8c09a48219..7236eb20f9 100644 --- a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/AlarmGroup/AlarmGroup.tsx +++ b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/AlarmGroup/AlarmGroup.tsx @@ -51,7 +51,8 @@ const AlarmGroupHome = (props: { loadAlarm: () => void }) => { { label: 'Name', key: 'Name', type: 'string', isPivotField: false }, { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: true }, { label: 'Number of Channels', key: 'Channels', type: 'integer', isPivotField: true }, - { label: 'Severity', key: 'AlarmSeverity', type: 'string', isPivotField: true } + { label: 'Severity', key: 'AlarmSeverity', type: 'string', isPivotField: true }, + { label: 'Enabled', key: 'Enabled', type: 'boolean', isPivotField: false } ] const [search, setSearch] = React.useState>>([]); @@ -156,6 +157,19 @@ const AlarmGroupHome = (props: { loadAlarm: () => void }) => { > Alarm Severity + + Key={'Enabled'} + AllowSort={true} + Field={'Enabled'} + RowStyle={{ width: 'auto' }} + Content={({ item }) => ( + + {item.Enabled ? 'Enabled' : 'Disabled'} + + )} + > + Status + Key={'LastAlarmEnd'} AllowSort={true} diff --git a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/DynamicWizzardSlice.tsx b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/DynamicWizzardSlice.tsx index c0c18bf3c5..b33d714bc2 100644 --- a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/DynamicWizzardSlice.tsx +++ b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/DynamicWizzardSlice.tsx @@ -103,7 +103,7 @@ export const DynamicWizzardSlice = createSlice({ const dt = new Date(); state.Step = 'general' - state.AlarmGroup = { AlarmTypeID: 1, SeverityID: 1, ID: -1, Name: "" } + state.AlarmGroup = { AlarmTypeID: 1, SeverityID: 1, ID: -1, Name: "", Enabled: true } state.Status = 'idle' state.SelectedMeter = [] state.MeasurmentTypeID = 1 diff --git a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/GeneralSettings.tsx b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/GeneralSettings.tsx index 811cf09f47..4cd2c5423d 100644 --- a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/GeneralSettings.tsx +++ b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/GeneralSettings.tsx @@ -25,7 +25,7 @@ import * as React from 'react'; import { SearchBar, LoadingIcon } from '@gpa-gemstone/react-interactive' import { SPCTools, openXDA, Filter } from '../global'; import { SelectTable, ReactTable } from '@gpa-gemstone/react-table'; -import { Input, Select, ArrayCheckBoxes } from '@gpa-gemstone/react-forms'; +import { Input, Select, ArrayCheckBoxes, CheckBox } from '@gpa-gemstone/react-forms'; import { updateAlarmGroup, selectSelectedMeter, selectSelectedMeterASC, selectSelectedMeterSort, sortSelectedMeters, removeMeter, addMeter, selectMeasurmentTypeID, updateMeasurmentTypeID, selectAlarmGroup, selectSeriesTypeID, updateSeriesTypeID, updateAlarmDayGroupID, selectAlarmDayGroupID, SelectWizardType } from './DynamicWizzardSlice' import { useSelector, useDispatch } from 'react-redux'; import { SelectMeasurmentTypes } from '../store/MeasurmentTypeSlice'; @@ -80,6 +80,11 @@ const GeneralSettings = () => { Valid={() => (group.Name != undefined && group.Name.length > 0 ? true : false)} />
+ + Record={group} + Field={'Enabled'} + Setter={(r) => dispatch(updateAlarmGroup(r))} + Label={'Enabled'} />
diff --git a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/WizardHome.tsx b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/WizardHome.tsx index e5458b536b..222854de94 100644 --- a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/WizardHome.tsx +++ b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/Wizard/WizardHome.tsx @@ -24,7 +24,7 @@ import * as React from 'react'; import GeneralSettings from './GeneralSettings'; -import { selectStatus, next, back, selectTab, selectErrors, SaveWizard, selectWizardEror, ResetWizzard } from './DynamicWizzardSlice' +import { selectStatus, next, back, selectTab, selectErrors, SaveWizard, selectWizardEror, ResetWizzard, selectAlarmGroup } from './DynamicWizzardSlice' import { useSelector, useDispatch } from 'react-redux'; import { ToolTip, ProgressBar, ServerErrorIcon, LoadingIcon } from '@gpa-gemstone/react-interactive'; @@ -47,8 +47,12 @@ const WizardHome = (props: IProps) => { const dispatch = useDispatch(); const errors = useSelector(selectErrors); const wizardError = useSelector(selectWizardEror); + const alarmGroup = useSelector(selectAlarmGroup); + + const isEditMode = alarmGroup != null && alarmGroup.ID != null && alarmGroup.ID !== -1; const [hover, setHover] = React.useState(false); + const [hoverSave, setHoverSave] = React.useState(false); // Define Step Numbers @@ -116,6 +120,13 @@ const WizardHome = (props: IProps) => {
+ {isEditMode && tab !== 'test' ? + + : null}
); diff --git a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/global.d.ts b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/global.d.ts index 2966439544..0b907ba46e 100644 --- a/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/global.d.ts +++ b/Source/Applications/openXDA/openXDA/wwwroot/SPCTools/Scripts/TSX/global.d.ts @@ -89,7 +89,7 @@ export namespace SPCTools { //r export type IntervallDataType = ('Minimum' | 'Maximum' | 'Average'); - export interface IAlarmGroupView { ID: number, Name: string, Channels: number, Meters: number, AlarmSeverity: string, LastAlarmStart: string, LastAlarmEnd: string, LastChannel: string, LastMeter: string, AlarmType: string } + export interface IAlarmGroupView { ID: number, Name: string, Channels: number, Meters: number, AlarmSeverity: string, LastAlarmStart: string, LastAlarmEnd: string, LastChannel: string, LastMeter: string, AlarmType: string, Enabled: boolean } export interface IChannelOverview { ID: number, Meter: string, Channel: string, Type: string, Phase: string, Asset: string } @@ -97,7 +97,7 @@ export namespace SPCTools { export interface IChannelAlarmGroup { ID: number, ChannelID: number, Name: string, AlarmSeverityID: number, AlarmSeverity: string, TimeInAlarm: string } export interface IMeterAlarmGroup { ID: number, Channel: number, Name: string, AlarmSeverity: string, TimeInAlarm: string } - export interface IAlarmGroup { ID: number, Name: string, AlarmTypeID: number, SeverityID: number } + export interface IAlarmGroup { ID: number, Name: string, AlarmTypeID: number, SeverityID: number, Enabled: boolean } //r export interface IStatisticData { StartDate: string, EndDate: string, DataFilter: IDataFilter } diff --git a/Source/Data/01 - openXDA.sql b/Source/Data/01 - openXDA.sql index 5850d82657..0451daa036 100644 --- a/Source/Data/01 - openXDA.sql +++ b/Source/Data/01 - openXDA.sql @@ -3887,7 +3887,8 @@ CREATE TABLE AlarmGroup ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY, Name VARCHAR(200) NOT NULL, AlarmTypeID INT NOT NULL REFERENCES AlarmType(ID), - SeverityID INT NOT NULL REFERENCES AlarmSeverity(ID) + SeverityID INT NOT NULL REFERENCES AlarmSeverity(ID), + Enabled BIT NOT NULL DEFAULT(1) ) GO @@ -4088,7 +4089,8 @@ SELECT LastAlarm.EndTime LastAlarmEnd, LastAlarm.ChannelName LastChannel, LastAlarm.MeterName LastMeter, - AlarmType.Description AS AlarmType + AlarmType.Description AS AlarmType, + AlarmGroup.Enabled FROM AlarmGroup LEFT JOIN AlarmSeverity ON AlarmGroup.SeverityID = AlarmSeverity.ID LEFT JOIN @@ -4199,8 +4201,9 @@ SELECT AlarmFactor.Factor AS Value FROM ( - SELECT ID, Factor, AlarmGroupID, SeverityID - FROM AlarmFactor + SELECT AF.ID, AF.Factor, AF.AlarmGroupID, AF.SeverityID + FROM AlarmFactor AF + INNER JOIN AlarmGroup AG ON AF.AlarmGroupID = AG.ID AND AG.Enabled = 1 UNION SELECT NULL AS ID, @@ -4208,6 +4211,7 @@ FROM AlarmGroup.ID AS AlarmGroupID, AlarmGroup.SeverityID FROM AlarmGroup + WHERE AlarmGroup.Enabled = 1 ) AlarmFactor LEFT JOIN Alarm ON AlarmFactor.AlarmGroupID = alarm.AlarmGroupID LEFT JOIN AlarmGroup ON Alarm.AlarmGroupID = AlarmGroup.ID diff --git a/Source/Libraries/openXDA.Model/Alarms/AlarmGroups/AlarmGroup.cs b/Source/Libraries/openXDA.Model/Alarms/AlarmGroups/AlarmGroup.cs index 7ca5739ff1..4f7d88b2c8 100644 --- a/Source/Libraries/openXDA.Model/Alarms/AlarmGroups/AlarmGroup.cs +++ b/Source/Libraries/openXDA.Model/Alarms/AlarmGroups/AlarmGroup.cs @@ -22,6 +22,7 @@ //****************************************************************************************************** using System; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using GSF.Data.Model; @@ -41,6 +42,9 @@ public class AlarmGroup public int AlarmTypeID { get; set; } public int SeverityID { get; set; } + + [DefaultValue(true)] + public bool Enabled { get; set; } } /// @@ -60,6 +64,7 @@ public class AlarmGroupView public string LastChannel { get; set; } public string LastMeter { get; set; } public string AlarmType { get; set; } + public bool Enabled { get; set; } } }