Skip to content

Commit

Permalink
Add logAlarm method to AlarmsTable component.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Jan 20, 2025
1 parent d2630b5 commit e11234e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
23 changes: 20 additions & 3 deletions love/src/components/Watcher/AlarmsTable/AlarmsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ export default class AlarmsTable extends PureComponent {

return (
<>
<td className={styles.ackButton} />
<td className={styles.actionButton}></td>
<td className={styles.actionButton}></td>
<ColumnHeader
{...defaultColumnProps}
className={styles.status}
Expand Down Expand Up @@ -304,7 +305,22 @@ export default class AlarmsTable extends PureComponent {
].join(' ')}
onClick={() => this.clickGearIcon(key)}
>
<td title={reasonStr} className={[styles.firstColumn, styles.ackButton].join(' ')}>
<td title={reasonStr} className={[styles.firstColumn, styles.actionButton].join(' ')}>
<div className={styles.statusWrapper}>
<Button
title="Log this alarm to the Narrativelog"
status="info"
onClick={(event) => {
event.stopPropagation();
this.props.logAlarm(row.name.value);
}}
command
>
LOG
</Button>
</div>
</td>
<td title={reasonStr} className={[styles.firstColumn, styles.actionButton].join(' ')}>
{!isAcknowledged(row) ? (
<div className={styles.statusWrapper}>
<Button
Expand Down Expand Up @@ -374,7 +390,8 @@ export default class AlarmsTable extends PureComponent {
' ',
)}
>
<td colSpan={1} className={styles.ackButton}></td>
<td colSpan={1} className={styles.actionButton}></td>
<td colSpan={1} className={styles.actionButton}></td>
<td colSpan={4} className={styles.expandedRowContent}>
<DetailsPanel
alarm={row}
Expand Down
36 changes: 21 additions & 15 deletions love/src/components/Watcher/AlarmsTable/AlarmsTable.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ table {
}

.wrapper {
display: flex;
/* display: flex;
flex-flow: column;
align-items: flex-end;
width: inherit;
height: 100%;
height: 100%; */
}

.controlsContainer {
Expand All @@ -55,23 +55,24 @@ table {
}

.dataTableWrapper {
display: flex;
/* display: flex;
flex-flow: row;
justify-content: center;
width: inherit;
flex: 1;
min-height: 0;
min-height: 0; */
}

.dataTable {
display: grid;
grid-template-rows: min-content minmax(0, 1fr);
table-layout: fixed;
overflow-x: auto;
/* display: grid; */
/* grid-template-rows: min-content minmax(0, 1fr); */
/* table-layout: fixed; */
border-collapse: collapse;
}

/****************** Columns styles ***************/
.dataTable .ackButton {
.dataTable .actionButton {
width: var(--ack-width);
text-align: center;
}
Expand Down Expand Up @@ -123,21 +124,21 @@ table {

/****************** General table head and body styles ***************/
.dataTable thead {
display: table;
/* display: table;
table-layout: fixed;
width: 100%;
word-wrap: break-word;
word-wrap: break-word; */
}

.dataTable tbody {
display: block;
height: 100%; /* necessary for scroll */
overflow-x: hidden;
/* display: block; */
/* height: 100%; necessary for scroll */
/* overflow-x: hidden; */
}
.dataTable tbody tr {
display: table;
/* display: table;
table-layout: fixed;
width: 100%;
width: 100%; */
}
.dataTable th,
td {
Expand Down Expand Up @@ -229,6 +230,11 @@ td {
padding: 1em;
}

.dataTable .expandedRow .actionButton {
width: calc(var(--ack-width) * 1.365);
text-align: center;
}

.dataTable .unackExpandedRow .expandedRowContent {
background: var(--table-unack-row-background);
border-bottom: 1px solid var(--table-unack-row-border);
Expand Down
2 changes: 2 additions & 0 deletions love/src/components/Watcher/Watcher.container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { getUsername, getAllAlarms, getTaiToUtc, getAllTime } from '../../redux/selectors';
import { addGroup, removeGroup, requestSALCommand } from '../../redux/actions/ws';
import { logAlarm } from '../../redux/actions/alarms';
import SubscriptionTableContainer from '../GeneralPurpose/SubscriptionTable/SubscriptionTable.container';
import Watcher from './Watcher';
// import mockAlarms from './AlarmsTable/mock'
Expand Down Expand Up @@ -138,6 +139,7 @@ const mapDispatchToProps = (dispatch) => {
}),
);
},
logAlarm: (name) => dispatch(logAlarm(name)),
};
};

Expand Down
6 changes: 6 additions & 0 deletions love/src/components/Watcher/Watcher.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default class Watcher extends Component {
muteAlarm: PropTypes.func,
/** Function to dispatch an alarm unmute */
unmuteAlarm: PropTypes.func,
/** Function to dispatch an alarm logging */
logAlarm: PropTypes.func,
/** Function to subscribe to streams to receive the alarms */
subscribeToStreams: PropTypes.func,
/** Function to unsubscribe to streams to stop receiving the alarms */
Expand Down Expand Up @@ -196,6 +198,10 @@ export default class Watcher extends Component {
unackAlarm={this.props.unackAlarm}
muteAlarm={this.props.muteAlarm}
unmuteAlarm={this.props.unmuteAlarm}
logAlarm={(name) => {
this.setState({ waiting: true });
this.props.logAlarm(name);
}}
sortFunctions={this.state.selectedTab === 'unmuted' ? this.sortFunctions : this.mutedSortFunctions}
/>
</div>
Expand Down

0 comments on commit e11234e

Please sign in to comment.