Show tooltip when no plugins are selected
Summary: Shows tooltip when no plugins are selected. Before it used to select all the plugins Reviewed By: jknoxville Differential Revision: D19537054 fbshipit-source-id: 567b90f981a2a2ddcf68a1dce902db0a9d6214d2
This commit is contained in:
committed by
Facebook Github Bot
parent
dc60d33b3a
commit
f61d578b26
@@ -76,12 +76,6 @@ class ExportDataPluginSheet extends Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.plugins.selectedPlugins.length <= 0) {
|
||||
this.props.setSelectedPlugins(this.state.availablePluginsToExport);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {onHide} = this.props;
|
||||
const onHideWithUnsettingShare = () => {
|
||||
@@ -119,13 +113,7 @@ class ExportDataPluginSheet extends Component<Props, State> {
|
||||
}
|
||||
}}
|
||||
onChange={selectedArray => {
|
||||
if (selectedArray.length > 0) {
|
||||
this.props.setSelectedPlugins(selectedArray);
|
||||
} else {
|
||||
this.props.setSelectedPlugins(
|
||||
this.state.availablePluginsToExport,
|
||||
);
|
||||
}
|
||||
this.props.setSelectedPlugins(selectedArray);
|
||||
}}
|
||||
elements={this.state.availablePluginsToExport}
|
||||
selectedElements={new Set(this.props.plugins.selectedPlugins)}
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
Checkbox,
|
||||
colors,
|
||||
View,
|
||||
Tooltip,
|
||||
} from '../ui';
|
||||
import React, {Component} from 'react';
|
||||
|
||||
@@ -169,9 +170,22 @@ export default class ListView extends Component<Props, State> {
|
||||
<Button compact padded onClick={this.props.onHide}>
|
||||
Close
|
||||
</Button>
|
||||
<Button compact padded type="primary" onClick={onSubmit}>
|
||||
Submit
|
||||
</Button>
|
||||
<Tooltip
|
||||
title={
|
||||
this.state.selectedElements.size <= 0
|
||||
? `Please select atleast one plugin`
|
||||
: null
|
||||
}
|
||||
options={{position: 'toRight'}}>
|
||||
<Button
|
||||
compact
|
||||
padded
|
||||
type="primary"
|
||||
onClick={onSubmit}
|
||||
disabled={this.state.selectedElements.size <= 0}>
|
||||
Submit
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</FlexRow>
|
||||
</Padder>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user