當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。