diff --git a/src/ic/ic-action.js b/src/ic/ic-action.js index 9c39da4..c5358c5 100644 --- a/src/ic/ic-action.js +++ b/src/ic/ic-action.js @@ -16,23 +16,24 @@ ******************************************************************************/ import React from 'react'; -import { Button, DropdownButton, Dropdown, InputGroup, FormControl } from 'react-bootstrap'; +import { Form, SplitButton, Dropdown, FormControl } from 'react-bootstrap'; import AppDispatcher from "../common/app-dispatcher"; import NotificationsFactory from "../common/data-managers/notifications-factory"; import NotificationsDataManager from "../common/data-managers/notifications-data-manager"; + +Number.prototype.pad = function(size) { + var s = String(this); + while (s.length < (size || 2)) { + s = "0" + s; + } + return s; +} + class ICAction extends React.Component { constructor(props) { super(props); - let t = new Date() - - Number.prototype.pad = function(size) { - var s = String(this); - while (s.length < (size || 2)) {s = "0" + s;} - return s; - } - let time = new Date(); time.setMinutes(5 * Math.round(time.getMinutes() / 5 + 1)) @@ -60,7 +61,7 @@ class ICAction extends React.Component { return; } - if (!this.props.hasConfigs) { + if (!this.props.configs) { let newAction = {}; newAction["action"] = action.data.action newAction["when"] = when @@ -203,13 +204,15 @@ class ICAction extends React.Component { render() { - let sendCommandDisabled = false; - if (!this.props.hasConfigs && this.props.selectedICs.length === 0 || this.state.selectedAction == null || this.state.selectedAction.id === "-1") { - sendCommandDisabled = true; - } - if (this.props.hasConfigs && this.props.selectedConfigs.length === 0|| this.state.selectedAction == null || this.state.selectedAction.id === "-1") { - sendCommandDisabled = true; - } + let disabled = this.state.selectedAction == null || + (this.props.configs + ? this.props.selectedConfigs.length === 0 + : this.props.selectedICs.length === 0 + ); + + let splitButtonStyle = { + marginLeft: '10px' + }; let time = this.state.time.getFullYear().pad(4) + '-' + this.state.time.getMonth().pad(2) + '-' + @@ -223,29 +226,24 @@ class ICAction extends React.Component { )); - return