Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@ _Pvt_Extensions

# SPCTools JS File
**/SPCTools/Scripts/js/SPCTools.js*
.nuget/
Original file line number Diff line number Diff line change
Expand Up @@ -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<Array<Search.IFilter<SPCTools.IAlarmGroupView>>>([]);

Expand Down Expand Up @@ -156,6 +157,19 @@ const AlarmGroupHome = (props: { loadAlarm: () => void }) => {
>
Alarm Severity
</ReactTable.Column>
<ReactTable.Column<SPCTools.IAlarmGroupView>
Key={'Enabled'}
AllowSort={true}
Field={'Enabled'}
RowStyle={{ width: 'auto' }}
Content={({ item }) => (
<span className={item.Enabled ? 'badge badge-success' : 'badge badge-secondary'}>
{item.Enabled ? 'Enabled' : 'Disabled'}
</span>
)}
>
Status
</ReactTable.Column>
<ReactTable.Column<SPCTools.IAlarmGroupView>
Key={'LastAlarmEnd'}
AllowSort={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -80,6 +80,11 @@ const GeneralSettings = () => {
Valid={() => (group.Name != undefined && group.Name.length > 0 ? true : false)} />
</div>
<div className="col" style={{ width: '50%' }}>
<CheckBox<SPCTools.IAlarmGroup>
Record={group}
Field={'Enabled'}
Setter={(r) => dispatch(updateAlarmGroup(r))}
Label={'Enabled'} />
</div>
</div>
<div className="row" style={{ margin: 0 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<boolean>(false);
const [hoverSave, setHoverSave] = React.useState<boolean>(false);


// Define Step Numbers
Expand Down Expand Up @@ -116,6 +120,13 @@ const WizardHome = (props: IProps) => {
</div>
</div>
<div className="btn-group mr-2 " role="group">
{isEditMode && tab !== 'test' ?
<button type="button" className={"btn btn-success" + (errors.some(item => (item.complete == 'required')) ? ' disabled' : '')}
onClick={() => { if (!errors.some(item => (item.complete == 'required'))) dispatch(SaveWizard()); }}
data-tooltip='quickSaveTip' onMouseEnter={() => setHoverSave(true)} onMouseLeave={() => setHoverSave(false)}>
{status != 'idle' ? <LoadingIcon Show={true} Size={40} /> : "Save"}
</button>
: null}
<button type="button" className={"btn btn-success" + (errors.some(item => (item.complete == 'required')) ? ' disabled' : '')}
onClick={() => Continue()} data-tooltip='registerTip' onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>
{status != 'idle' ? <LoadingIcon Show={true} Size={40} /> : (tab == "test" ? "Save" : "Continue")}
Expand All @@ -127,6 +138,11 @@ const WizardHome = (props: IProps) => {
{errors.map((item, index) => <Requirements {...item} key={index} />)}
</ToolTip>
: null}
{isEditMode && tab !== 'test' ?
<ToolTip Show={hoverSave && errors.length > 0} Position={'left'} Theme={'dark'} Target={"quickSaveTip"}>
{errors.map((item, index) => <Requirements {...item} key={index} />)}
</ToolTip>
: null}
{tab == 'setpoint' ? <FunctionHelp /> : null}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ 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 }


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 }
Expand Down
12 changes: 8 additions & 4 deletions Source/Data/01 - openXDA.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -4199,15 +4201,17 @@ 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,
1.0 AS Factor,
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//******************************************************************************************************

using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using GSF.Data.Model;

Expand All @@ -41,6 +42,9 @@ public class AlarmGroup
public int AlarmTypeID { get; set; }

public int SeverityID { get; set; }

[DefaultValue(true)]
public bool Enabled { get; set; }
}

/// <summary>
Expand All @@ -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; }
}

}