Skip to content

Commit

Permalink
fix filter checkbox and input coordination
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Oct 31, 2017
1 parent 546c07b commit de68795
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/ui/src/components/LogViewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
background-color: #555; }

.filter-check.disabled svg, .filter-check.disabled label {
fill: #4f4f4f !important;
color: #4f4f4f !important; }
18 changes: 17 additions & 1 deletion pkg/ui/src/components/LogViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { selectLogsFor } from '../state/actions/logs'
import sizeMe from 'react-sizeme'
import XTerm from './xterm/XTerm'
import lcs from 'longest-common-subsequence'
import './LogViewer.scss'
import './LogViewer.css'

const mapStateToProps = function(store) {

Expand Down Expand Up @@ -111,6 +111,7 @@ class LogViewer extends React.Component {
containersOpen: false,
selectedContainers: props.selectedContainers,
filterErrorText: null,
filterCheckDisabled: true,
}
this.logs = props.logs
}
Expand Down Expand Up @@ -154,6 +155,16 @@ class LogViewer extends React.Component {
} else if (this.state.filterErrorText) {
this.setState({
filterErrorText: null,
filterCheckDisabled: !this.filterLogsInput.input.value
})
}
}

handleFilterKeyUp = (event) => {
if (!!this.filterLogsInput.input.value === this.state.filterCheckDisabled) {
this.setState({
filterCheckDisabled: !this.filterLogsInput.input.value,
filterChecked: this.state.filterChecked && !!this.filterLogsInput.input.value,
})
}
}
Expand Down Expand Up @@ -311,6 +322,7 @@ class LogViewer extends React.Component {
if (ref) {
this.filterLogsInput=ref
this.filterLogsInput.input.onkeydown = this.handleFilterKeydown
this.filterLogsInput.input.onkeyup = this.handleFilterKeyUp
}
}}
errorText={this.state.filterErrorText}
Expand All @@ -319,12 +331,16 @@ class LogViewer extends React.Component {

/>
<Checkbox
className={`filter-check${this.state.filterCheckDisabled ? ' disabled':''}`}
label="filter"
disabled={this.state.filterCheckDisabled}
checked={this.state.filterChecked}
onCheck={this.toggleFilter}
style={styles.checkbox}
labelStyle={styles.checkboxLabel}
iconStyle={styles.checkboxIcon}
data-rh={'Only output new log lines containing the filter text will be displayed'}
data-rh-at={'left'}
/>
</ToolbarGroup>
)
Expand Down
7 changes: 7 additions & 0 deletions pkg/ui/src/components/LogViewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@
}
}
}
}

.filter-check.disabled {
svg, label {
fill: rgb(79, 79, 79) !important;
color: rgb(79, 79, 79) !important;
}
}

0 comments on commit de68795

Please sign in to comment.