本文整理汇总了TypeScript中app/core/utils/explore.parseUrlState函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parseUrlState函数的具体用法?TypeScript parseUrlState怎么用?TypeScript parseUrlState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseUrlState函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: return
return (dispatch, getState) => {
// Clone left state to become the right state
const leftState = getState().explore[ExploreId.left];
const queryState = getState().location.query[ExploreId.left] as string;
const urlState = parseUrlState(queryState);
const queryTransactions: QueryTransaction[] = [];
const itemState = {
...leftState,
queryTransactions,
queries: leftState.queries.slice(),
exploreId: ExploreId.right,
urlState,
};
dispatch(splitOpenAction({ itemState }));
dispatch(stateSave());
};
开发者ID:johntdyer,项目名称:grafana,代码行数:16,代码来源:actions.ts
示例2: parseUrlState
export const updateChildRefreshState = (
state: Readonly<ExploreItemState>,
payload: LocationUpdate,
exploreId: ExploreId
): ExploreItemState => {
const path = payload.path || '';
const queryState = payload.query[exploreId] as string;
if (!queryState) {
return state;
}
const urlState = parseUrlState(queryState);
if (!state.urlState || path !== '/explore') {
// we only want to refresh when browser back/forward
return {
...state,
urlState,
update: { datasource: false, queries: false, range: false, ui: false },
};
}
const datasource = _.isEqual(urlState ? urlState.datasource : '', state.urlState.datasource) === false;
const queries = _.isEqual(urlState ? urlState.queries : [], state.urlState.queries) === false;
const range = _.isEqual(urlState ? urlState.range : DEFAULT_RANGE, state.urlState.range) === false;
const ui = _.isEqual(urlState ? urlState.ui : DEFAULT_UI_STATE, state.urlState.ui) === false;
return {
...state,
urlState,
update: {
...state.update,
datasource,
queries,
range,
ui,
},
};
};
开发者ID:grafana,项目名称:grafana,代码行数:38,代码来源:reducers.ts
注:本文中的app/core/utils/explore.parseUrlState函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论