Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private readonly urlManager: UrlManagerService,
private readonly location: Location,
private readonly context: ContextService,
private readonly mask: MaskService,
private readonly error: ErrorService,
private readonly configService: ConfigService,
private readonly ciceroContext: CiceroContextService,
private readonly ciceroRenderer: CiceroRendererService) { }
private commandsInitialised = false;
private commandTypes = [Action, Back, Cancel, Clipboard, Edit, Enter, Forward, Gemini, Goto, Help, Menu, OK, Page, Reload, Root, Save, Selection, Show, Where];
private allCommands: Command[] = map(this.commandTypes, T => new T(this.urlManager, this.location, this, this.context, this.mask, this.error, this.configService, this.ciceroContext, this.ciceroRenderer));
private commands: Dictionary = fromPairs(map(this.allCommands, c => [c.shortCommand, c]));
private mapInputToCommands(input: string) {
if (!input) {
// Special case for hitting Enter with no input
return [this.getCommand('wh')];
}
const commands = input.split(';');
return map(commands, c => this.getSingleCommand(c, commands.length > 1));
}
getCommands(input: string): ParseResult {
try {
return ParseResult.create(this.mapInputToCommands(input));
} catch (e) {
return ParseResult.createError(e.message);
}
this.widgetOptions.fieldHtmlClass, this.options.style || 'btn-default');
this.options.icon = 'glyphicon glyphicon-plus';
break;
// Default - including regular inputs
default:
this.widgetOptions.fieldHtmlClass = addClasses(
this.widgetOptions.fieldHtmlClass, 'form-control');
}
if (this.formControl) {
this.updateHelpBlock(this.formControl.status);
this.formControl.statusChanges.subscribe(status => this.updateHelpBlock(status));
if (this.options.debug) {
const vars: any[] = [];
this.debugOutput = map(vars, thisVar => JSON.stringify(thisVar, null, 2)).join('\n');
}
}
this.frameworkInitialized = true;
}
}
processLayers() {
const layers = this._tileLayerService.getCropProductionAreaLayers(this.crop);
// assemble the layers payload for saving to the application store.
const processedLayers = map(layers, (layer: L.WMSOptions) => {
const payload: Layer = {
id: layer.layers,
type: 'crop-production-area',
url: this._wmsTileUrl,
layerOptions: layer
};
return payload;
});
// remove all layers present on the map
this.removeLayers();
// add the new layer to the store
this._store.dispatch({
type: 'ADD_LAYERS',
this.widgetOptions.fieldHtmlClass, this.options.style || 'btn-default');
this.options.icon = 'glyphicon glyphicon-plus';
break;
// Default - including regular inputs
default:
this.widgetOptions.fieldHtmlClass = addClasses(
this.widgetOptions.fieldHtmlClass, 'form-control');
}
if (this.formControl) {
this.updateHelpBlock(this.formControl.status);
this.formControl.statusChanges.subscribe(status => this.updateHelpBlock(status));
if (this.options.debug) {
const vars: any[] = [];
this.debugOutput = map(vars, thisVar => JSON.stringify(thisVar, null, 2)).join('\n');
}
}
this.frameworkInitialized = true;
}
}
export function createSubmenuItems(avms: ActionViewModel[], menuSlot: { name: string, action: ActionViewModel }, level: number): MenuItemViewModel {
// if not root menu aggregate all actions with same name
let menuActions: ActionViewModel[];
let menuItems: MenuItemViewModel[] | null;
if (menuSlot.name) {
const actions = filter(avms, a => getMenuNameForLevel(a.menuPath, level) === menuSlot.name && !getMenuNameForLevel(a.menuPath, level + 1));
menuActions = actions;
// then collate submenus
const submenuActions = filter(avms, a => getMenuNameForLevel(a.menuPath, level) === menuSlot.name && !!getMenuNameForLevel(a.menuPath, level + 1));
let menuSubSlots = map(submenuActions, a => ({ name: getMenuNameForLevel(a.menuPath, level + 1), action: a }));
menuSubSlots = removeDuplicateMenuNames(menuSubSlots);
menuItems = map(menuSubSlots, slot => createSubmenuItems(submenuActions, slot, level + 1));
} else {
menuActions = [menuSlot.action];
menuItems = null;
}
return new MenuItemViewModel(menuSlot.name, menuActions, menuItems);
}
private refreshItems() {
const items = map(this.recentlyViewed, (o, i) => ({ obj: o, link: o.updateSelfLinkWithTitle(), index: i }));
this.recentItems = map(items, i => this.viewModelFactory.recentItemViewModel(i.obj, i.link!, this.onPaneId, false, i.index));
}
focus(actions: QueryList) {
if (actions && actions.length > 0) {
const actionChildrenNames = map(actions.toArray(), a => a.action.value);
const newActions = difference(actionChildrenNames, this.previousActionChildrenNames);
let index = 0;
if (newActions && newActions.length > 0) {
const firstAction = first(newActions);
index = findIndex(actions.toArray(), a => a.action.value === firstAction);
index = index < 0 ? 0 : index;
}
this.previousActionChildrenNames = actionChildrenNames;
this.focusFromIndex(actions, index);
}
}
render() {
const { disabled, prefix } = this.props;
const conf = this.getConfig();
return (
<div>
{map(conf, (value, index) => this.getPoint(value, index))}
{!disabled && (
)}
{!disabled && (
)}
</div>
);
}
}
private refreshItems() {
const items = map(this.recentlyViewed, (o, i) => ({ obj: o, link: o.updateSelfLinkWithTitle(), index: i }));
this.recentItems = map(items, i => this.viewModelFactory.recentItemViewModel(i.obj, i.link!, this.onPaneId, false, i.index));
}
imageryUsed: function(sources) {
if (sources) {
imageryUsed = sources;
return history;
} else {
var arr = _map(stack.slice(1, index + 1), 'imageryUsed');
return _without(_uniq(_flatten(arr)), 'Custom');
}
},