Merge pull request #3048 from influxdata/bugfix/multi-select-dropdown
Prevent Multi-Select Dropdown in InfluxDB Admin Users and Roles tabs from losing selection statepull/3068/head
commit
bce1877798
|
@ -18,6 +18,7 @@
|
||||||
1. [#2919](https://github.com/influxdata/chronograf/pull/2919): Automatically add graph type 'line' to any graph missing a type
|
1. [#2919](https://github.com/influxdata/chronograf/pull/2919): Automatically add graph type 'line' to any graph missing a type
|
||||||
1. [#2970](https://github.com/influxdata/chronograf/pull/2970): Fix hanging browser on docker host dashboard
|
1. [#2970](https://github.com/influxdata/chronograf/pull/2970): Fix hanging browser on docker host dashboard
|
||||||
1. [#3006](https://github.com/influxdata/chronograf/pull/3006): Fix Kapacitor Rules task enabled checkboxes to only toggle exactly as clicked
|
1. [#3006](https://github.com/influxdata/chronograf/pull/3006): Fix Kapacitor Rules task enabled checkboxes to only toggle exactly as clicked
|
||||||
|
1. [#3048](https://github.com/influxdata/chronograf/pull/3048): Prevent Multi-Select Dropdown in InfluxDB Admin Users and Roles tabs from losing selection state
|
||||||
|
|
||||||
## v1.4.2.3 [2018-03-08]
|
## v1.4.2.3 [2018-03-08]
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ const RoleRow = ({
|
||||||
customClass={classnames(`dropdown-${ROLES_TABLE.colPermissions}`, {
|
customClass={classnames(`dropdown-${ROLES_TABLE.colPermissions}`, {
|
||||||
'admin-table--multi-select-empty': !permissions.length,
|
'admin-table--multi-select-empty': !permissions.length,
|
||||||
})}
|
})}
|
||||||
|
resetStateOnReceiveProps={false}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</td>
|
</td>
|
||||||
|
@ -92,6 +93,7 @@ const RoleRow = ({
|
||||||
customClass={classnames(`dropdown-${ROLES_TABLE.colUsers}`, {
|
customClass={classnames(`dropdown-${ROLES_TABLE.colUsers}`, {
|
||||||
'admin-table--multi-select-empty': !users.length,
|
'admin-table--multi-select-empty': !users.length,
|
||||||
})}
|
})}
|
||||||
|
resetStateOnReceiveProps={false}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -96,6 +96,7 @@ const UserRow = ({
|
||||||
customClass={classnames(`dropdown-${USERS_TABLE.colRoles}`, {
|
customClass={classnames(`dropdown-${USERS_TABLE.colRoles}`, {
|
||||||
'admin-table--multi-select-empty': !roles.length,
|
'admin-table--multi-select-empty': !roles.length,
|
||||||
})}
|
})}
|
||||||
|
resetStateOnReceiveProps={false}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -113,6 +114,7 @@ const UserRow = ({
|
||||||
customClass={classnames(`dropdown-${USERS_TABLE.colPermissions}`, {
|
customClass={classnames(`dropdown-${USERS_TABLE.colPermissions}`, {
|
||||||
'admin-table--multi-select-empty': !permissions.length,
|
'admin-table--multi-select-empty': !permissions.length,
|
||||||
})}
|
})}
|
||||||
|
resetStateOnReceiveProps={false}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -40,7 +40,10 @@ class MultiSelectDropdown extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (!_.isEqual(this.props.selectedItems, nextProps.selectedItems)) {
|
if (
|
||||||
|
!this.props.resetStateOnReceiveProps ||
|
||||||
|
!_.isEqual(this.props.selectedItems, nextProps.selectedItems)
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,17 +109,16 @@ class MultiSelectDropdown extends Component {
|
||||||
|
|
||||||
renderMenu() {
|
renderMenu() {
|
||||||
const {items, isApplyShown} = this.props
|
const {items, isApplyShown} = this.props
|
||||||
const applyButton = isApplyShown ? (
|
|
||||||
|
return (
|
||||||
|
<ul className="dropdown-menu">
|
||||||
|
{isApplyShown && (
|
||||||
<li className="multi-select--apply">
|
<li className="multi-select--apply">
|
||||||
<button className="btn btn-xs btn-info" onClick={this.handleApply}>
|
<button className="btn btn-xs btn-info" onClick={this.handleApply}>
|
||||||
Apply
|
Apply
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
) : null
|
)}
|
||||||
|
|
||||||
return (
|
|
||||||
<ul className="dropdown-menu">
|
|
||||||
{applyButton}
|
|
||||||
<FancyScrollbar
|
<FancyScrollbar
|
||||||
autoHide={false}
|
autoHide={false}
|
||||||
autoHeight={true}
|
autoHeight={true}
|
||||||
|
@ -162,6 +164,7 @@ MultiSelectDropdown.propTypes = {
|
||||||
customClass: string,
|
customClass: string,
|
||||||
iconName: string,
|
iconName: string,
|
||||||
isApplyShown: bool,
|
isApplyShown: bool,
|
||||||
|
resetStateOnReceiveProps: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiSelectDropdown.defaultProps = {
|
MultiSelectDropdown.defaultProps = {
|
||||||
|
@ -170,6 +173,7 @@ MultiSelectDropdown.defaultProps = {
|
||||||
customClass: 'dropdown-160',
|
customClass: 'dropdown-160',
|
||||||
selectedItems: [],
|
selectedItems: [],
|
||||||
isApplyShown: true,
|
isApplyShown: true,
|
||||||
|
resetStateOnReceiveProps: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OnClickOutside(MultiSelectDropdown)
|
export default OnClickOutside(MultiSelectDropdown)
|
||||||
|
|
Loading…
Reference in New Issue