How to use the @talend/react-cmf.selectors function in @talend/react-cmf

To help you get started, we’ve selected a few @talend/react-cmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Talend / ui / packages / containers / src / AppLoader / AppLoader.saga.js View on Github external
export function* waitFor(collectionName, interval = 10) {
	// eslint-disable-next-line no-constant-condition
	while (true) {
		const collection = yield select(api.selectors.collections.get, collectionName);
		if (collection !== undefined) {
			break;
		}
		yield call(delay, interval);
	}
}
/**
github Talend / ui / packages / containers / src / AboutDialog / AboutDialog.connect.js View on Github external
export const mapStateToProps = state => ({
	...cmf.selectors.collections.toJS(state, Constants.COLLECTION_ID),
});
github Talend / ui / packages / containers / src / HeaderBar / HeaderBar.connect.js View on Github external
export function mapStateToProps(state, ownProps) {
	const props = {
		productsItems: cmf.selectors.collections.toJS(state, Constants.COLLECTION_ID),
	};
	const expression = get(ownProps, 'callToAction.renderIfExpression');
	if (expression) {
		props.callToAction = Object.assign(
			{},
			ownProps.callToAction,
			cmf.expression.mapStateToProps(state, ownProps.callToAction),
		);
		if (props.callToAction.renderIf === false) {
			props.callToAction = null;
		}
	}
	return props;
}
github Talend / ui / packages / containers / src / DeleteResource / sagas.js View on Github external
export function* deleteResourceValidate(
	uri,
	resourceType,
	itemId,
	resourcePath,
	collectionId,
	resourceUri,
) {
	const action = yield take(deleteResourceConst.DIALOG_BOX_DELETE_RESOURCE_OK);
	const safeURI = get(action, 'data.model.uri', uri);
	const safeType = get(action, 'data.model.resourceType', resourceType);
	const safeId = get(action, 'data.model.id', itemId);
	const safePath = get(action, 'data.model.resourcePath', resourcePath);
	const resourceCollectionId = get(action, 'data.model.collectionId', collectionId);
	const resourceLocator = getResourceLocator(resourceCollectionId || safeType, safePath);
	const resource = yield select(cmf.selectors.collections.findListItem, resourceLocator, safeId);
	const safeResourceUri = get(
		action,
		'data.model.resourceUri',
		resourceUri || `${safeURI}/${safeType}/${safeId}`,
	);
	if (resource && safeResourceUri) {
		const result = yield call(cmf.sagas.http.delete, safeResourceUri);
		if (result.response.ok) {
			yield put({
				type: deleteResourceConst.DIALOG_BOX_DELETE_RESOURCE_SUCCESS,
				model: {
					...get(action, 'data.model', {}),
					id: safeId,
					labelResource: resource.get('label') || resource.get('name', ''),
				},
			});