当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ui.PanelPlugin类代码示例

本文整理汇总了TypeScript中@grafana/ui.PanelPlugin的典型用法代码示例。如果您正苦于以下问题:TypeScript PanelPlugin类的具体用法?TypeScript PanelPlugin怎么用?TypeScript PanelPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PanelPlugin类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: pluginLoaded

  pluginLoaded(plugin: PanelPlugin) {
    this.plugin = plugin;

    if (plugin.panel && plugin.onPanelMigration) {
      const version = getPluginVersion(plugin);
      if (version !== this.pluginVersion) {
        this.options = plugin.onPanelMigration(this);
        this.pluginVersion = version;
      }
    }
  }
开发者ID:johntdyer,项目名称:grafana,代码行数:11,代码来源:PanelModel.ts

示例2: changePlugin

  changePlugin(newPlugin: PanelPlugin) {
    const pluginId = newPlugin.meta.id;
    const oldOptions: any = this.getOptionsToRemember();
    const oldPluginId = this.type;

    // for angular panels we must remove all events and let angular panels do some cleanup
    if (this.plugin.angularPanelCtrl) {
      this.destroy();
    }

    // remove panel type specific  options
    for (const key of _.keys(this)) {
      if (mustKeepProps[key]) {
        continue;
      }

      delete (this as any)[key];
    }

    this.cachedPluginOptions[oldPluginId] = oldOptions;
    this.restorePanelOptions(pluginId);

    // switch
    this.type = pluginId;
    this.plugin = newPlugin;

    // Let panel plugins inspect options from previous panel and keep any that it can use
    if (newPlugin.onPanelTypeChanged) {
      this.options = this.options || {};
      const old = oldOptions && oldOptions.options ? oldOptions.options : {};
      Object.assign(this.options, newPlugin.onPanelTypeChanged(this.options, oldPluginId, old));
    }

    if (newPlugin.onPanelMigration) {
      this.pluginVersion = getPluginVersion(newPlugin);
    }
  }
开发者ID:johntdyer,项目名称:grafana,代码行数:37,代码来源:PanelModel.ts


注:本文中的@grafana/ui.PanelPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。