本文整理汇总了TypeScript中src/shared/utils/view.createView函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createView函数的具体用法?TypeScript createView怎么用?TypeScript createView使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createView函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createView
export const initialStateHelper = (): TimeMachineState => ({
timeRange: {lower: 'now() - 1h'},
autoRefresh: AUTOREFRESH_DEFAULT,
view: createView(),
draftQueries: [{...defaultViewQuery(), hidden: false}],
isViewingRawData: false,
activeTab: TimeMachineTab.Queries,
activeQueryIndex: 0,
queryResults: initialQueryResultsState(),
queryBuilder: {
buckets: [],
bucketsStatus: RemoteDataState.NotStarted,
aggregateWindow: {period: 'auto'},
functions: [],
tags: [
{
valuesSearchTerm: '',
keysSearchTerm: '',
keys: [],
keysStatus: RemoteDataState.NotStarted,
values: [],
valuesStatus: RemoteDataState.NotStarted,
},
],
},
})
示例2: test
test('it resets tab and draftScript state on a timeMachine when activated', () => {
const state = initialState()
expect(state.activeTimeMachineID).toEqual(DE_TIME_MACHINE_ID)
const activeTimeMachine = state.timeMachines[state.activeTimeMachineID]
activeTimeMachine.activeQueryIndex = 2
const view = createView<QueryViewProperties>()
view.properties.queries = [
{
name: '',
text: 'foo',
editMode: QueryEditMode.Advanced,
builderConfig: {
buckets: [],
tags: [],
functions: [],
aggregateWindow: {period: 'auto'},
},
},
{
name: '',
text: 'bar',
editMode: QueryEditMode.Builder,
builderConfig: {
buckets: [],
tags: [],
functions: [],
aggregateWindow: {period: 'auto'},
},
},
]
const nextState = timeMachinesReducer(
state,
setActiveTimeMachine(VEO_TIME_MACHINE_ID, {view})
)
expect(nextState.activeTimeMachineID).toEqual(VEO_TIME_MACHINE_ID)
const nextTimeMachine =
nextState.timeMachines[nextState.activeTimeMachineID]
expect(nextTimeMachine.activeTab).toEqual(TimeMachineTab.Queries)
expect(nextTimeMachine.activeQueryIndex).toEqual(0)
expect(
_.map(nextTimeMachine.draftQueries, q => _.omit(q, ['hidden']))
).toEqual(view.properties.queries)
})
示例3: createView
export const initialStateHelper = (): TimeMachineState => ({
timeRange: {lower: 'now() - 1h'},
view: createView(),
draftQueries: [{...defaultViewQuery(), hidden: false}],
isViewingRawData: false,
activeTab: TimeMachineTab.Queries,
activeQueryIndex: 0,
submitToken: 0,
queryBuilder: {
buckets: [],
bucketsStatus: RemoteDataState.NotStarted,
tags: [],
},
})
示例4: async
export const createNoteCell = (dashboardID: string) => async (
dispatch,
getState: GetState
) => {
const dashboard = getState().dashboards.find(d => d.id === dashboardID)
if (!dashboard) {
throw new Error(`could not find dashboard with id "${dashboardID}"`)
}
const {note} = getState().noteEditor
const view = createView<MarkdownView>(ViewType.Markdown)
view.properties.note = note
return dispatch(createCellWithView(dashboard, view))
}