Beispiel #1
0
				route = get(info, 'href');
			}
			if (route) {
				const currentRoute = ownProps.location.pathname;
				if (currentRoute.indexOf(route) !== -1) {
					action.active = true;
				}
			}
			return action;
		});
	}
	return props;
}

export function mergeProps(stateProps, dispatchProps, ownProps) {
	const props = Object.assign({}, ownProps, stateProps, dispatchProps);
	if (props.actionIds) {
		delete props.actionIds;
	}
	return props;
}

export default withRouter(
	cmfConnect({
		defaultState: DEFAULT_STATE,
		keepComponentState: true,
		mapStateToProps,
		mergeProps,
	})(Container),
);
Beispiel #2
0
				props.dispatch(
					Object.assign(
						{
							model: props.model,
						},
						props.payload,
					),
				);
			}
		};
	}
	return <ActionButton {...newProps} />;
}

ContainerActionButton.displayName = 'Container(ActionButton)';

ContainerActionButton.propTypes = {
	actionCreator: PropTypes.string,
	dispatch: PropTypes.func,
	dispatchActionCreator: PropTypes.func,
	model: PropTypes.Object,
	overlayComponent: PropTypes.string,
	overlayComponentProps: PropTypes.object,
	payload: PropTypes.Object,
};

export default cmfConnect({
	mapStateToProps,
	mergeProps,
})(ContainerActionButton);
Beispiel #3
0
import { cmfConnect } from '@talend/react-cmf';
import { Map } from 'immutable';
import PreparationCropyMoveModal from './PreparationCopyMoveModal.component';


export default cmfConnect({
	componentId: 'default',
	defaultState: new Map({ show: false }),
})(PreparationCropyMoveModal);
Beispiel #4
0
import { cmfConnect } from '@talend/react-cmf';

import Container, { DEFAULT_STATE } from './<%= props.name %>.container';

export function mapStateToProps(state, ownProps, cmfProps) {
	// cmfProps.state
	const props = {};
	return props;
}

export function mapDispatchToProps(dispatch, ownProps, cmfProps) {
	// cmfProps.updateState, initState, deleteState, dispatch, dispatchActionCreator
	const props = {};
	return props;
}

export default cmfConnect({
	componentId: '<%= props.name %>',  // can be a function
	defaultState: DEFAULT_STATE,
	mapStateToProps,
	mapDispatchToProps,
})(Container);
Beispiel #5
0
	ActionSplitDropdown,
	ActionDropdown,
};

export function mapStateToProps(state, ownProps) {
	const props = {
		renderers: getRenderers(renderers),
	};

	if (!ownProps.actionId && !ownProps.name) {
		return props;
	}
	const info = api.action.getActionInfo(
		{
			registry: api.registry.getRegistry(),
			store: {
				getState: () => state,
			},
		},
		ownProps.actionId || ownProps.name,
	);

	props.actionId = ownProps.actionId || ownProps.name;
	props.displayMode = info.displayMode;
	return props;
}

export default cmfConnect({
	mapStateToProps,
})(Action);
Beispiel #6
0
import { cmfConnect } from '@talend/react-cmf';

import Container, { DEFAULT_STATE } from './Form.container';

export default cmfConnect({
	defaultState: DEFAULT_STATE,
	componentId(props) {
		return props.formId;
	},
})(Container);
Beispiel #7
0
import React from 'react';
import { cmfConnect } from '@talend/react-cmf';
import { HeaderBar as PureHeaderBar } from '@talend/react-components';
import Action from '../Action';

function HeaderBar(props) {
	const renderers = {
		Action,
	};
	return <PureHeaderBar renderers={renderers} {...props} />;
}

export default cmfConnect({})(HeaderBar);
Beispiel #8
0
import { cmfConnect } from '@talend/react-cmf';
import FolderCreatorModal, { DEFAULT_STATE } from './FolderCreatorModal.component';


export default cmfConnect({
	componentId: 'default',
	defaultState: DEFAULT_STATE,
})(FolderCreatorModal);
Beispiel #9
0
export function deleteNotification(indexNotification) {
	return function mutator(prevStateProps) {
		const notifications = prevStateProps.state.get('notifications');
		const index = notifications.indexOf(indexNotification);
		if (index === -1) {
			invariant(true, `notification not found ${JSON.stringify(indexNotification)}`);
		}
		const newNotif = notifications.delete(index);
		return prevStateProps.state.set('notifications', newNotif);
	};
}

export function mergeProps(stateProps, dispatchProps, ownProps) {
	return Object.assign(
		{
			deleteNotification(i) {
				dispatchProps.setState(deleteNotification(i));
			},
		},
		ownProps,
		stateProps,
		dispatchProps,
	);
}

export default cmfConnect({
	componentId,
	defaultState: DEFAULT_STATE,
	mergeProps,
})(Container);
Beispiel #10
0
import { cmfConnect } from '@talend/react-cmf';
import Container from './DeleteResource.container';

export default cmfConnect({ componentId: 'DeleteResource' })(Container);
Beispiel #11
0
import { cmfConnect } from '@talend/react-cmf';
import Container, { DEFAULT_STATE } from './ConfirmDialog.container';

export default cmfConnect({
	defaultState: DEFAULT_STATE,
	componentId: ownProps => (ownProps && ownProps.id) || 'ConfirmDialog',
})(Container);