• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript notify.toastNotifications类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fetch

  public async fetch(params: RequestHandlerParams): Promise<any> {
    this.vis.filters = { timeRange: params.timeRange };
    this.vis.requestError = undefined;
    this.vis.showRequestError = false;

    try {
      // searchSource is only there for courier request handler
      const requestHandlerResponse = await this.requestHandler({
        partialRows: this.vis.params.partialRows || this.vis.type.requiresPartialRows,
        isHierarchical: this.vis.isHierarchical(),
        visParams: this.vis.params,
        ...params,
        filters: params.filters
          ? params.filters.filter(filter => !filter.meta.disabled)
          : undefined,
      });

      // No need to call the response handler when there have been no data nor has been there changes
      // in the vis-state (response handler does not depend on uiStat
      const canSkipResponseHandler =
        this.previousRequestHandlerResponse &&
        this.previousRequestHandlerResponse === requestHandlerResponse &&
        this.previousVisState &&
        isEqual(this.previousVisState, this.vis.getState());

      this.previousVisState = this.vis.getState();
      this.previousRequestHandlerResponse = requestHandlerResponse;

      if (!canSkipResponseHandler) {
        this.visData = await Promise.resolve(this.responseHandler(requestHandlerResponse));
      }
      return this.visData;
    } catch (error) {
      params.searchSource.cancelQueued();

      this.vis.requestError = error;
      this.vis.showRequestError =
        error.type && ['NO_OP_SEARCH_STRATEGY', 'UNSUPPORTED_QUERY'].includes(error.type);

      // tslint:disable-next-line
      console.error(error);

      if (isTermSizeZeroError(error)) {
        return toastNotifications.addDanger(
          `Your visualization ('${this.vis.title}') has an error: it has a term ` +
            `aggregation with a size of 0. Please set it to a number greater than 0 to resolve ` +
            `the error.`
        );
      }

      toastNotifications.addDanger({
        title: 'Error in visualization',
        text: error.message,
      });
    }
  }
开发者ID:gingerwizard,项目名称:kibana,代码行数:56,代码来源:visualize_data_loader.ts


示例2: async

): GetJobs => async (forceRefresh = false) => {
  if (forceRefresh === true || blockRefresh === false) {
    try {
      const jobConfigs: GetDataFrameTransformsResponse = await ml.dataFrame.getDataFrameTransforms();
      const jobStats: GetDataFrameTransformsStatsResponse = await ml.dataFrame.getDataFrameTransformsStats();

      const tableRows = jobConfigs.transforms.map(config => {
        const stats = jobStats.transforms.find(d => config.id === d.id);

        if (stats === undefined) {
          throw new Error('job stats not available');
        }

        // table with expandable rows requires `id` on the outer most level
        return { config, id: config.id, state: stats.state, stats: stats.stats };
      });

      setDataFrameJobs(tableRows);
    } catch (e) {
      toastNotifications.addDanger(
        i18n.translate('xpack.ml.dataframe.jobsList.errorGettingDataFrameJobsList', {
          defaultMessage: 'An error occurred getting the data frame jobs list: {error}',
          values: { error: JSON.stringify(e) },
        })
      );
    }
  }
};
开发者ID:elastic,项目名称:kibana,代码行数:28,代码来源:get_jobs.ts


示例3:

 .catch(resp => {
   toastNotifications.addDanger(
     i18n.translate('xpack.ml.fullTimeRangeSelector.errorSettingTimeRangeNotification', {
       defaultMessage: 'An error occurred setting the time range.',
     })
   );
 });
开发者ID:elastic,项目名称:kibana,代码行数:7,代码来源:full_time_range_selector_service.ts


示例4: queryGeohashBounds

export async function queryGeohashBounds(vis: Vis, params: QueryGeohashBoundsParams) {
  const agg = vis.getAggConfig().find((a: AggConfig) => {
    return get(a, 'type.dslName') === 'geohash_grid';
  });

  if (agg) {
    const searchSource = vis.searchSource.createChild();
    searchSource.setField('size', 0);
    searchSource.setField('aggs', () => {
      const geoBoundsAgg = vis.getAggConfig().createAggConfig(
        {
          type: 'geo_bounds',
          enabled: true,
          params: {
            field: agg.getField(),
          },
          schema: 'metric',
        },
        {
          addToAggConfigs: false,
        }
      );
      return {
        '1': geoBoundsAgg.toDsl(),
      };
    });

    const { filters, query } = params;
    if (filters) {
      searchSource.setField('filter', () => {
        const activeFilters = [...filters];
        const indexPattern = agg.getIndexPattern();
        const useTimeFilter = !!indexPattern.timeFieldName;
        if (useTimeFilter) {
          activeFilters.push(vis.API.timeFilter.createFilter(indexPattern));
        }
        return activeFilters;
      });
    }
    if (query) {
      searchSource.setField('query', query);
    }

    try {
      const esResp = await searchSource.fetch();
      return get(esResp, 'aggregations.1.bounds');
    } catch (error) {
      toastNotifications.addDanger({
        title: i18n.translate('common.ui.visualize.queryGeohashBounds.unableToGetBoundErrorTitle', {
          defaultMessage: 'Unable to get bounds',
        }),
        text: `${error.message}`,
      });
      return;
    }
  }
}
开发者ID:elastic,项目名称:kibana,代码行数:57,代码来源:query_geohash_bounds.ts


示例5: _displayError

 public _displayError() {
   toastNotifications.addDanger({
     title: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningTitle', {
       defaultMessage: 'Unable to change your Space',
     }),
     text: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningDescription', {
       defaultMessage: 'please try again later',
     }),
   });
 }
开发者ID:,项目名称:,代码行数:10,代码来源:


示例6: async

export const startJobFactory = (getJobs: GetJobs) => async (d: DataFrameJobListRow) => {
  try {
    await ml.dataFrame.startDataFrameTransformsJob(d.config.id);
    toastNotifications.addSuccess(
      i18n.translate('xpack.ml.dataframe.jobsList.startJobSuccessMessage', {
        defaultMessage: 'Data frame job {jobId} started successfully.',
        values: { jobId: d.config.id },
      })
    );
    getJobs(true);
  } catch (e) {
    toastNotifications.addDanger(
      i18n.translate('xpack.ml.dataframe.jobsList.startJobErrorMessage', {
        defaultMessage: 'An error occurred starting the data frame job {jobId}: {error}',
        values: { jobId: d.config.id, error: JSON.stringify(e) },
      })
    );
  }
};
开发者ID:elastic,项目名称:kibana,代码行数:19,代码来源:start_job.ts


示例7: fetch

  public async fetch(params: RequestHandlerParams): Promise<any> {
    this.vis.filters = { timeRange: params.timeRange };

    try {
      // searchSource is only there for courier request handler
      const requestHandlerResponse = await this.requestHandler(this.vis, {
        partialRows: this.vis.params.partialRows || this.vis.type.requiresPartialRows,
        ...params,
      });

      // No need to call the response handler when there have been no data nor has been there changes
      // in the vis-state (response handler does not depend on uiStat
      const canSkipResponseHandler =
        this.previousRequestHandlerResponse &&
        this.previousRequestHandlerResponse === requestHandlerResponse &&
        this.previousVisState &&
        isEqual(this.previousVisState, this.vis.getState());

      this.previousVisState = this.vis.getState();
      this.previousRequestHandlerResponse = requestHandlerResponse;

      if (!canSkipResponseHandler) {
        this.visData = await Promise.resolve(this.responseHandler(requestHandlerResponse));
      }
      return this.visData;
    } catch (e) {
      params.searchSource.cancelQueued();
      this.vis.requestError = e;
      if (isTermSizeZeroError(e)) {
        return toastNotifications.addDanger(
          `Your visualization ('${this.vis.title}') has an error: it has a term ` +
            `aggregation with a size of 0. Please set it to a number greater than 0 to resolve ` +
            `the error.`
        );
      }
      toastNotifications.addDanger({
        title: 'Error in visualization',
        text: e.message,
      });
    }
  }
开发者ID:salihkardan,项目名称:kibana,代码行数:41,代码来源:visualize_data_loader.ts


示例8: _displayError

 public _displayError() {
   toastNotifications.addDanger({
     title: 'Unable to change your Space',
     text: 'please try again later',
   });
 }
开发者ID:salihkardan,项目名称:kibana,代码行数:6,代码来源:spaces_manager.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript page.Page类代码示例发布时间:2022-05-25
下一篇:
TypeScript modules.uiModules类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap