How to use the @talend/react-cmf.registry 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 / ActionDropdown / ActionDropdown.connect.js View on Github external
export function mapStateToProps(state, ownProps = {}) {
	let props = {};
	const context = {
		registry: cmf.registry.getRegistry(),
		store: {
			getState: () => state,
		},
	};
	if (ownProps.actionId) {
		// deprecated
		props = cmf.action.getActionInfo(context, ownProps.actionId);
	}
	const actionIds = ownProps.actionIds || props.actionIds;
	if (actionIds) {
		// deprecated
		props.items = actionIds.map(itemId => cmf.action.getActionInfo(context, itemId));
	}
	return props;
}
github Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
export default function initialize(additionalConfiguration = {}) {
	// FIXME remove before release
	// for debug purpose
	window.registry = api.registry.getRegistry();

	// register all saga api
	api.registry.addToRegistry(
		'SEARCH_CATEGORIES_BY_PROVIDER',
		constants.search.SEARCH_CATEGORIES_BY_PROVIDER,
	);
	api.registry.addToRegistry('preparations:sort', preparationService.sort);

	const routerSagas = {
		...dataset.datasetSagas.datasetRoutesSagas,
	};
	const additionalRouterSagas = additionalConfiguration.routerSagas;
	if (additionalRouterSagas) {
		Object.assign(routerSagas, additionalRouterSagas);
	}

	const rootSagas = [
		fork(sagaRouter, browserHistory, routerSagas),
		fork(api.sagas.component.handle),
		fork(dataset.datasetSagas.datasetMainSaga),
		fork(cmfSagas.changeDocumentTitle),
	];
	const rootSagasToStart = {
github Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
export default function initialize(additionalConfiguration = {}) {
	// FIXME remove before release
	// for debug purpose
	window.registry = api.registry.getRegistry();

	// register all saga api
	api.registry.addToRegistry(
		'SEARCH_CATEGORIES_BY_PROVIDER',
		constants.search.SEARCH_CATEGORIES_BY_PROVIDER,
	);

	const routerSagas = {
		...dataset.datasetSagas.datasetRoutesSagas,
	};
	const additionalRouterSagas = additionalConfiguration.routerSagas;
	if (additionalRouterSagas) {
		Object.assign(routerSagas, additionalRouterSagas);
	}

	const rootSagas = [
github Talend / data-prep / dataprep-webapp / src / app / next / sagas / effects / search.effects.js View on Github external
export function* search(payload) {
	yield put(Typeahead.setStateAction({ searching: true }, 'headerbar:search'));

	const categories = api.registry.getFromRegistry('SEARCH_CATEGORIES_BY_PROVIDER');
	const providers = Object.keys(categories);
	const service = new SearchService(categories);
	const batches = providers.map(
		provider => service.build(
			provider,
			payload,
		)
	);
	const results = (
			yield all(batches.map(request => call(...request)))
		).map(
			(result, index) => service.transform(providers[index], result)
		);

	yield put(Typeahead.setStateAction({ searching: false }, 'headerbar:search'));
	yield put(actions.collections.addOrReplace(
github Talend / ui / packages / containers / .storybook / config.js View on Github external
},
	});
}

function* sagaPhotoGet3() {
	const answer = yield call(sagas.http.get, 'https://jsonplaceholder.typicode.com/photos/');
	yield put(actions.collections.addOrReplace('photos3', answer.data));
}

function sortByLength(sortBy) {
	return function sort(a, b) {
		return a.get(sortBy).length - b.get(sortBy).length;
	};
}

api.registry.addToRegistry('_list_sort:sortByLength', sortByLength);

api.sagas.register('saga:get:photos3', sagaPhotoGet3);
api.actionCreator.register('http:get:photos1', httpPhotosGet1);
api.actionCreator.register('http:get:photos2', httpPhotosGet2);
api.actionCreator.register('object:view', objectView);
api.actionCreator.register('cancel:hide:dialog', hideDialog);
api.actionCreator.register('confirm:dialog', confirmDialog);
api.actionCreator.register('item1:action', chooseItem1);
api.actionCreator.register('item2:action', chooseItem2);

api.actionCreator.register(
	'subheaderbar:display-sharing',
	actionsCreatorsSubHeader.sharingSubHeader,
);
api.actionCreator.register(
	'subheaderbar:display-bubbles',
github Talend / ui / packages / containers / src / Action / Action.connect.js View on Github external
export function mapStateToProps(state, ownProps) {
	if (ownProps.actionId) {
		return cmf.action.getActionInfo(
			{
				registry: cmf.registry.getRegistry(),
				store: {
					getState: () => state,
				},
			},
			ownProps.actionId,
		);
	}
	return {};
}
github Talend / ui / packages / containers / src / ActionIconToggle / ActionIconToggle.connect.js View on Github external
export function mapStateToProps(state, ownProps) {
	let props = {};
	if (ownProps.actionId) {
		props = cmf.action.getActionInfo(
			{
				registry: cmf.registry.getRegistry(),
				store: {
					getState: () => state,
				},
			},
			ownProps.actionId,
		);
	}
	return props;
}
github Talend / ui / packages / containers / src / ActionButton / ActionButton.connect.js View on Github external
export function mapStateToProps(state, ownProps) {
	let props = {};
	if (ownProps.actionId) {
		props = cmf.action.getActionInfo(
			{
				registry: cmf.registry.getRegistry(),
				store: {
					getState: () => state,
				},
			},
			ownProps.actionId,
		);
	}
	return props;
}
github Talend / ui / packages / containers / src / SidePanel / SidePanel.connect.js View on Github external
function getAction(id, currentRoute, state) {
	const action = { actionId: id };
	const info = cmf.action.getActionInfo(
		{
			registry: cmf.registry.getRegistry(),
			store: {
				getState: () => state,
			},
		},
		id,
	);
	action.label = info.label;
	action.id = info.id;

	const route = get(
		info,
		'payload.cmf.routerReplace',
		get(info, 'payload.cmf.routerPush', get(info, 'href')),
	);

	if (route && isBasePathOf(route, currentRoute)) {
github Talend / ui / packages / containers / src / ActionSplitDropdown / ActionSplitDropdown.connect.js View on Github external
export function mapStateToProps(state, { actionId, actionIds } = {}) {
	let props = {};
	const context = {
		registry: cmf.registry.getRegistry(),
		store: {
			getState: () => state,
		},
	};
	if (actionId) {
		props = cmf.action.getActionInfo(context, actionId);
	}
	if (actionIds) {
		props.actionIds = actionIds;
	}
	if (props.actionIds) {
		props.items = props.actionIds.map(itemId => cmf.action.getActionInfo(context, itemId));
	}
	return props;
}