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


TypeScript chrome.getKibanaVersion函数代码示例

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


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

示例1: createPanelState

export function createPanelState(
  id: string,
  type: string,
  panelIndex: string,
  currentPanels: PanelState[]
) {
  const { x, y } = findTopLeftMostOpenSpace(
    DEFAULT_PANEL_WIDTH,
    DEFAULT_PANEL_HEIGHT,
    currentPanels
  );
  return {
    gridData: {
      w: DEFAULT_PANEL_WIDTH,
      h: DEFAULT_PANEL_HEIGHT,
      x,
      y,
      i: panelIndex.toString(),
    },
    version: chrome.getKibanaVersion(),
    panelIndex: panelIndex.toString(),
    type,
    id,
    embeddableConfig: {},
  };
}
开发者ID:elastic,项目名称:kibana,代码行数:26,代码来源:panel_state.ts

示例2: convertPanelDataPre_6_3

  // 6.3 changed the panel dimensions to allow finer control over sizing
  // 1) decrease column height from 100 to 20.
  // 2) increase rows from 12 to 48
  // Need to scale pre 6.3 panels so they maintain the same layout
  public static convertPanelDataPre_6_3(
    panel: {
      gridData: GridData;
      version: string;
    },
    useMargins: boolean
  ) {
    ['w', 'x', 'h', 'y'].forEach(key => {
      if (!_.has(panel.gridData, key)) {
        throw new Error(
          i18n.translate(
            'kbn.dashboard.panel.unableToMigratePanelDataForSixThreeZeroErrorMessage',
            {
              defaultMessage:
                'Unable to migrate panel data for "6.3.0" backwards compatibility, panel does not contain expected field: {key}',
              values: { key },
            }
          )
        );
      }
    });

    // see https://github.com/elastic/kibana/issues/20635 on why the scale factor changes when margins are being used
    const heightScaleFactor = useMargins
      ? PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS
      : PANEL_HEIGHT_SCALE_FACTOR;

    panel.gridData.w = panel.gridData.w * PANEL_WIDTH_SCALE_FACTOR;
    panel.gridData.x = panel.gridData.x * PANEL_WIDTH_SCALE_FACTOR;
    panel.gridData.h = panel.gridData.h * heightScaleFactor;
    panel.gridData.y = panel.gridData.y * heightScaleFactor;
    panel.version = chrome.getKibanaVersion();

    return panel;
  }
开发者ID:njd5475,项目名称:kibana,代码行数:39,代码来源:panel_utils.ts

示例3: compose

export function compose(): FrontendLibs {
  const api = new AxiosRestAPIAdapter(chrome.getXsrfToken(), chrome.getBasePath());
  const esAdapter = new RestElasticsearchAdapter(api, INDEX_NAMES.BEATS);
  const elasticsearchLib = new ElasticsearchLib(esAdapter);
  const configBlocks = new ConfigBlocksLib(
    new RestConfigBlocksAdapter(api),
    translateConfigSchema(configBlockSchemas)
  );
  const tags = new TagsLib(new RestTagsAdapter(api), elasticsearchLib);
  const tokens = new RestTokensAdapter(api);
  const beats = new BeatsLib(new RestBeatsAdapter(api), elasticsearchLib);

  const framework = new FrameworkLib(
    new KibanaFrameworkAdapter(
      camelCase(PLUGIN.ID),
      management,
      routes,
      chrome.getBasePath,
      onKibanaReady,
      XPackInfoProvider,
      chrome.getKibanaVersion()
    )
  );

  const libs: FrontendLibs = {
    framework,
    elasticsearch: elasticsearchLib,
    tags,
    tokens,
    beats,
    configBlocks,
  };
  return libs;
}
开发者ID:elastic,项目名称:kibana,代码行数:34,代码来源:kibana.ts

示例4: convertPanelDataPre_6_1

  // 6.1 switched from gridster to react grid. React grid uses different variables for tracking layout
  public static convertPanelDataPre_6_1(panel: any): PanelState {
    ['col', 'row'].forEach(key => {
      if (!_.has(panel, key)) {
        throw new Error(
          i18n.translate('kbn.dashboard.panel.unableToMigratePanelDataForSixOneZeroErrorMessage', {
            defaultMessage:
              'Unable to migrate panel data for "6.1.0" backwards compatibility, panel does not contain expected field: {key}',
            values: { key },
          })
        );
      }
    });

    panel.gridData = {
      x: panel.col - 1,
      y: panel.row - 1,
      w: panel.size_x || DEFAULT_PANEL_WIDTH,
      h: panel.size_y || DEFAULT_PANEL_HEIGHT,
      i: panel.panelIndex.toString(),
    };
    panel.version = chrome.getKibanaVersion();
    panel.panelIndex = panel.panelIndex.toString();
    delete panel.size_x;
    delete panel.size_y;
    delete panel.row;
    delete panel.col;

    return panel;
  }
开发者ID:njd5475,项目名称:kibana,代码行数:30,代码来源:panel_utils.ts


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