in src/report.ts [1031:1065]
private createMenuCommand(type: string, commandName: string, commandTitle: string, menuTitle: string, menuLocation: MenuLocation, visualName: string, visualType: string, groupName: string, icon?: string): ICommandExtension[] {
const newCommandObj: ICommandExtension = {
name: commandName,
title: commandTitle,
extend: {
}
};
newCommandObj.extend[type] = {
title: menuTitle,
menuLocation: menuLocation,
};
if (type === "visualOptionsMenu") {
newCommandObj.icon = icon;
}
if (groupName) {
const extend = newCommandObj.extend[type] as IFlatMenuExtension;
delete extend.menuLocation;
const groupExtend = newCommandObj.extend[type] as IGroupedMenuExtension;
groupExtend.groupName = groupName;
}
if (visualName) {
newCommandObj.selector = {
$schema: "http://powerbi.com/product/schema#visualSelector",
visualName: visualName
};
}
if (visualType) {
newCommandObj.selector = {
$schema: "http://powerbi.com/product/schema#visualTypeSelector",
visualType: visualType
};
}
return [...this.commands, newCommandObj];
}