本文整理汇总了TypeScript中src/utils/wrappers.getDeep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDeep函数的具体用法?TypeScript getDeep怎么用?TypeScript getDeep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDeep函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: generateColumnConfig
export const serverToUIConfig = (logView: View | NewView): LogConfig => {
const logConfigID = getDeep<string>(logView, 'id', null)
const logsConfigLink = getDeep<string>(logView, 'links.self', null)
const logViewProperties = getDeep<LogViewerView>(logView, 'properties', null)
const columns = getDeep<LogViewerColumn[]>(logViewProperties, 'columns', [])
if (_.isEmpty(columns)) {
return
}
const sortedColumns = sortViewColumns(columns)
let severityFormat: SeverityFormatOptions
let severityLevelColors: SeverityLevelColor[]
const convertedColumns = sortedColumns.map(c => {
if (c.name === 'severity') {
severityFormat = generateColumnFormatConfig(c)
severityLevelColors = generateColumnColorsConfig(c)
}
return generateColumnConfig(c)
})
return {
id: logConfigID,
link: logsConfigLink,
isTruncated: DEFAULT_TRUNCATION,
tableColumns: convertedColumns,
severityFormat,
severityLevelColors,
}
}
开发者ID:viccom,项目名称:influxdb,代码行数:32,代码来源:config.ts
示例2: async
export const importScript = (script: string, fileName: string) => async (
dispatch,
getState: GetStateFunc
): Promise<void> => {
try {
const validFileExtension = '.flux'
const fileExtensionRegex = new RegExp(`${validFileExtension}$`)
if (!fileName.match(fileExtensionRegex)) {
dispatch(notify(taskImportFailed(fileName, 'Please import a .flux file')))
return
}
if (_.isEmpty(script)) {
dispatch(notify(taskImportFailed(fileName, 'No Flux found in file')))
return
}
const {orgs} = await getState()
const orgID = getDeep<string>(orgs, '0.id', '') // TODO org selection by user.
await submitNewTask(orgID, script)
dispatch(populateTasks())
dispatch(notify(taskImportSuccess(fileName)))
} catch (error) {
console.error(error)
const message = getDeep<string>(error, 'message', '')
dispatch(notify(taskImportFailed(fileName, message)))
}
}
开发者ID:viccom,项目名称:influxdb,代码行数:33,代码来源:index.ts
示例3: generateViewColumnSettings
export const generateViewProperties = (config: LogConfig): LogViewerView => {
const tableColumns = getDeep<LogsTableColumn[]>(config, 'tableColumns', [])
const severityFormat = getDeep<SeverityFormat>(config, 'severityFormat', null)
const severityLevelColors = getDeep<SeverityLevelColor[]>(
config,
'severityLevelColors',
[]
)
if (_.isEmpty(tableColumns)) {
return EMPTY_VIEW_PROPERTIES
}
const columns: LogViewerColumn[] = tableColumns.map((c, i) => {
const settings = generateViewColumnSettings(
c,
severityFormat,
severityLevelColors
)
const name = c.internalName
const position = i
return {name, position, settings}
})
return {
...EMPTY_VIEW_PROPERTIES,
columns,
}
}
开发者ID:viccom,项目名称:influxdb,代码行数:30,代码来源:config.ts
示例4:
const getTableSelectedTime = (state: State): number => {
const custom = getDeep<string>(state, 'logs.tableTime.custom', '')
if (!_.isEmpty(custom)) {
return Date.parse(custom)
}
const relative = getDeep<number>(state, 'logs.tableTime.relative', 0)
return Date.now() - relative * 1000
}
开发者ID:viccom,项目名称:influxdb,代码行数:11,代码来源:index.ts
示例5: async
export const getTelegrafConfigs = async (org: string): Promise<Telegraf[]> => {
try {
const data = await telegrafsAPI.telegrafsGet(org)
return getDeep<Telegraf[]>(data, 'data.configurations', [])
} catch (error) {
console.error(error)
}
}
开发者ID:viccom,项目名称:influxdb,代码行数:9,代码来源:index.ts
示例6: async
export const getCollectors = async (org: Organization): Promise<Telegraf[]> => {
try {
const data = await telegrafsAPI.telegrafsGet(org.id)
return getDeep<Telegraf[]>(data, 'data.configurations', [])
} catch (error) {
console.error(error)
}
}
开发者ID:viccom,项目名称:influxdb,代码行数:9,代码来源:index.ts
注:本文中的src/utils/wrappers.getDeep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论