mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Removes redux selectors from loading component. Fixes how loading accesses page background color * Fixed props
This commit is contained in:
parent
1edb9a9bc8
commit
a9bde972d6
5 changed files with 14 additions and 14 deletions
|
@ -16,10 +16,7 @@ import {
|
|||
EuiButton,
|
||||
EuiFieldText,
|
||||
} from '@elastic/eui';
|
||||
|
||||
// TODO: (clintandrewhall) This is a quick fix for #25342 -- we should figure out how to use the overall component.
|
||||
import { Loading } from '../../../../public/components/loading/loading';
|
||||
|
||||
import { Loading } from '../../../../public/components/loading';
|
||||
import { FileUpload } from '../../../../public/components/file_upload';
|
||||
import { elasticOutline } from '../../../lib/elastic_outline';
|
||||
import { resolveFromArgs } from '../../../../common/lib/resolve_dataurl';
|
||||
|
|
|
@ -23,8 +23,7 @@ const branches = [
|
|||
// no renderable or renderable config value, render loading
|
||||
branch(({ renderable, state }) => {
|
||||
return !state || !renderable;
|
||||
}, renderComponent(Loading)),
|
||||
|
||||
}, renderComponent(({ backgroundColor }) => <Loading backgroundColor={backgroundColor} />)),
|
||||
// renderable is available, but no matching element is found, render invalid
|
||||
branch(({ renderable, renderFunction }) => {
|
||||
return renderable && getType(renderable) !== 'render' && !renderFunction;
|
||||
|
@ -90,4 +89,5 @@ ElementContent.propTypes = {
|
|||
onComplete: PropTypes.func.isRequired, // local, not passed through
|
||||
}).isRequired,
|
||||
state: PropTypes.string,
|
||||
backgroundColor: PropTypes.string,
|
||||
};
|
||||
|
|
|
@ -5,12 +5,19 @@
|
|||
*/
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { compose, withProps } from 'recompose';
|
||||
import { get } from 'lodash';
|
||||
import { renderFunctionsRegistry } from '../../lib/render_functions_registry';
|
||||
import { getSelectedPage, getPageById } from '../../state/selectors/workpad';
|
||||
import { ElementContent as Component } from './element_content';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
backgroundColor: getPageById(state, getSelectedPage(state)).style.background,
|
||||
});
|
||||
|
||||
export const ElementContent = compose(
|
||||
connect(mapStateToProps),
|
||||
withProps(({ renderable }) => ({
|
||||
renderFunction: renderFunctionsRegistry.get(get(renderable, 'as')),
|
||||
}))
|
||||
|
|
|
@ -4,12 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { getSelectedPage, getPageById } from '../../state/selectors/workpad';
|
||||
import { pure } from 'recompose';
|
||||
import { Loading as Component } from './loading';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
backgroundColor: getPageById(state, getSelectedPage(state)).style.background,
|
||||
});
|
||||
|
||||
export const Loading = connect(mapStateToProps)(Component);
|
||||
export const Loading = pure(Component);
|
||||
|
|
|
@ -41,11 +41,12 @@ export const Loading = ({ animated, text, backgroundColor }) => {
|
|||
|
||||
Loading.propTypes = {
|
||||
animated: PropTypes.bool,
|
||||
text: PropTypes.string,
|
||||
backgroundColor: PropTypes.string,
|
||||
text: PropTypes.string,
|
||||
};
|
||||
|
||||
Loading.defaultProps = {
|
||||
animated: false,
|
||||
backgroundColor: '#000000',
|
||||
text: '',
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue