Options
All
  • Public
  • Public/Protected
  • All
Menu

@mavenomics/dashboard-devtools

Index

Variables

Const IDashboardTracker

IDashboardTracker: Token<IDashboardTracker> = new Token<IDashboardTracker>("Dashboard Tracker")

Const globalsEditorPlugin

globalsEditorPlugin: IPlugin<Application<Widget>, void> = {id: "@mavenomics/dashboard-devtools:globals-editor",autoStart: true,requires: [IDashboardTracker],activate: (app, tracker: IDashboardTracker) => {const { commands, contextMenu } = app;commands.addCommand(GlobalsEditorCommands.OpenGlobals, {label: "Open Globals Editor",iconClass: "fa fa-globe",isEnabled: () => tracker.getCurrentDashboard() != null,execute: async () => {let dashboard = tracker.getCurrentDashboard();if (dashboard == null) {return;}let globals = dashboard.globals;let serializedGlobals = serializeGlobals(globals);const hover = new class extends ReactWrapperWidget {private context: TypeEditorHost.IContext = {portalHostNode: void 0,owner: this,};protected render() {return React.createElement(TypeEditorHost.Context.Provider,{ value: this.context },React.createElement(OptionsEditor, {arguments: serializedGlobals,onArgsChanged: (newArgs) => {serializedGlobals = newArgs;}} as OptionsEditor.IProps)) as React.ReactElement<unknown>;}protected onAfterChangeDocumentOwner() {this.context = {portalHostNode: this.node.ownerDocument!.body,owner: this};this.update();}};await HoverManager.GetManager().launchEditorDialog(hover,dashboard,700,500,"Globals Editor",() => {// TODO: Globals#mergeGlobals()const unvisitedGlobals = new Set(IterTools.map(globals, i => i.name));const visitedGlobals = new Set<string>();for (const global of serializedGlobals) {if (!unvisitedGlobals.has(global.name)) {globals.addGlobal(global.name,Types.findType(global.typeAnnotation) || Types.Any,Converters.deserialize(global.defaultValue));continue;}unvisitedGlobals.delete(global.name);visitedGlobals.add(global.name);}for (const toDelete of unvisitedGlobals.values()) {globals.removeGlobal(toDelete);}for (const toChange of visitedGlobals.values()) {const global = serializedGlobals.find(i => i.name === toChange)!;globals.changeType(toChange, Types.findType(global.typeAnnotation) || Types.Any);globals.set(toChange, Converters.deserialize(global.defaultValue));}});}});commands.addKeyBinding({command: GlobalsEditorCommands.OpenGlobals,keys: ["Accel G"],selector: ".jp-Notebook.jp-mod-commandMode:not(.p-mod-hidden)"});contextMenu.addItem({command: GlobalsEditorCommands.OpenGlobals,selector: ".jp-Notebook:not(.p-mod-hidden)"});commands.addKeyBinding({command: GlobalsEditorCommands.OpenGlobals,keys: ["Accel G"],selector: ".m-DashboardEditor:not(.p-mod-hidden)"});contextMenu.addItem({command: GlobalsEditorCommands.OpenGlobals,selector: ".m-DashboardEditor:not(.p-mod-hidden)"});}} as IPlugin<Application<Widget>, void>

Const plugins

plugins: IPlugin<Application<Widget>, void>[] = [globalsEditorPlugin,visualEditorPlugin]

Functions

DashboardActions

  • DashboardActions(dashboard: Dashboard): (Anonymous class)
  • A set of routines to perform actions on dashboards.

    This is meant as a stand-in for real Phosphor commands, since due to the current architechture we need to duplicate some work here. Until we can factor out the dashboards into an independent plugin, this will have to do for now.

    Parameters

    • dashboard: Dashboard

    Returns (Anonymous class)

ExportToWorkbook

  • ExportToWorkbook(table: Table, config?: Partial<IExcelExportConfig>, formatting?: undefined | object): Workbook

RegisterActions

  • RegisterActions(app: JupyterFrontEnd, getDashboard: function, namespace: string, regionSelector: string, namePrefix?: undefined | string, palette?: ICmdPalette): void
  • Register Phosphor commands for interacting with dashboards

    Notes

    These exist because we don't currently have the Dashboard as an independent plugin. Without that, there is some duplicated effort. This function abstracts most of that away, so at least we just have to repeat a single function call.

    Parameters

    • app: JupyterFrontEnd
    • getDashboard: function
        • (): Dashboard | null
        • Returns Dashboard | null

    • namespace: string
    • regionSelector: string
    • Optional namePrefix: undefined | string
    • Optional palette: ICmdPalette

    Returns void

Object literals

Const visualEditorPlugin

visualEditorPlugin: object

autoStart

autoStart: true = true

id

id: string = "@mavenomics/dashboard-devtools:visual-editor"

requires

requires: Token<IDashboardTracker>[] = [IDashboardTracker]

activate

Generated using TypeDoc