Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setInstance(this.props.d2)
this.i18n = this.props.d2.i18n;
this.i18n.strings.add('description');
this.i18n.strings.add('program_tracked_entity_attributes');
this.i18n.strings.add('program_indicators');
this.i18n.strings.add('program_data_elements');
this.i18n.strings.add('field_is_required');
this.i18n.strings.add('organisation_unit_counts'); // shorten to org_unit_counts in maintenance
this.i18n.strings.add('reporting_rates');
this.i18n.strings.add('data_elements');
this.i18n.strings.add('constants');
this.i18n.strings.add('programs');
this.requestExpressionStatusAction = Action.create('requestExpressionStatus');
}
import { Action } from '@dhis2/d2-ui-core';
import { setDialogStateTo } from './LegendItem.store';
export const setDialogStateToAction = Action.create('setDialogStateToAction'); // name in debug
setDialogStateToAction.subscribe(action => setDialogStateTo(action.data));
...searchResult,
searchResults: appsMenuItems,
};
}
return searchResult;
},
)
.map(resultState => ({
...resultState,
searchResults: resultState.searchResults
.map((item, index) => Object.assign({}, item, { selected: resultState.selected === index })),
open: Boolean(resultState.isSearchFieldFocused),
}));
export const handleKeyPress = Action.create();
const keyPress$ = handleKeyPress
.map(action => action.data);
// Handle an enter key press to go the location of the first item
keyPress$
.filter(([event]) => event.keyCode === 13 || event.key === 'Enter')
.flatMap(() => searchResultBoxStateStore$.take(1))
// Find the selected menu item in the search results list by the `selected` index
.map(state => state.searchResults.find((item, index) => index === state.selected))
.filter(identity)
.subscribe(
itemToGoTo => window.location = itemToGoTo.action,
log.error,
);
return;
}
searchResultBoxStateStore$.setState({
...searchResultBoxStateStore$.getState(),
selected: searchResultBoxStateStore$.getState().selected + selected,
});
}
export function hideWhenNotHovering() {
if (searchResultBoxStateStore$.getState() && !searchResultBoxStateStore$.getState().isHoveringOverResults) {
setSearchFieldFocusTo(false);
}
}
export const search = Action.create('Search Apps');
search
.map(action => action.data || '')
.subscribe(setSearchValue);
const searchSourceStore$ = headerBarStore$
.map(headerBarState => [].concat(headerBarState.appItems, headerBarState.profileItems))
.flatMap(addDeepLinksForMaintenance)
.flatMap(addDeepLinksForSettings);
export const searchStore$ = Observable
.combineLatest(
searchResultBoxStateStore$,
appsMenuItems$,
(searchResult, appsMenuItems) => {
if (!searchResult.searchValue) {
return {