本文整理汇总了TypeScript中ui/chrome.getUiSettingsClient函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getUiSettingsClient函数的具体用法?TypeScript getUiSettingsClient怎么用?TypeScript getUiSettingsClient使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUiSettingsClient函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fetchFirstLastSeenHost
async function fetchFirstLastSeenHost() {
updateLoading(true);
return apolloClient
.query<GetHostFirstLastSeenQuery.Query, GetHostFirstLastSeenQuery.Variables>({
query: HostFirstLastSeenGqlQuery,
fetchPolicy: 'cache-first',
variables: {
sourceId,
hostName,
defaultIndex: chrome.getUiSettingsClient().get(DEFAULT_INDEX_KEY),
},
})
.then(
result => {
updateLoading(false);
updateFirstSeen(get('data.source.HostFirstLastSeen.firstSeen', result));
updateLastSeen(get('data.source.HostFirstLastSeen.lastSeen', result));
updateErrorMessage(null);
return result;
},
error => {
updateLoading(false);
updateErrorMessage(error.message);
return error;
}
);
}
示例2: fetchLastEventTime
async function fetchLastEventTime() {
updateLoading(true);
return apolloClient
.query<GetLastEventTimeQuery.Query, GetLastEventTimeQuery.Variables>({
query: LastEventTimeGqlQuery,
fetchPolicy: 'cache-first',
variables: {
sourceId,
indexKey,
details,
defaultIndex: chrome.getUiSettingsClient().get(DEFAULT_INDEX_KEY),
},
})
.then(
result => {
updateLoading(false);
updateLastSeen(get('data.source.LastEventTime.lastSeen', result));
updateErrorMessage(null);
updateCurrentIndexKey(currentIndexKey);
return result;
},
error => {
updateLoading(false);
updateErrorMessage(error.message);
return error;
}
);
}
示例3: getIndexPattern
export async function getIndexPattern(
savedVis: VisSavedObject
): Promise<StaticIndexPattern | undefined> {
if (savedVis.vis.type.name !== 'metrics') {
return savedVis.vis.indexPattern;
}
const config = chrome.getUiSettingsClient();
const savedObjectsClient = chrome.getSavedObjectsClient();
const defaultIndex = config.get('defaultIndex');
if (savedVis.vis.params.index_pattern) {
const indexPatternObjects = await savedObjectsClient.find({
type: 'index-pattern',
fields: ['title', 'fields'],
search: `"${savedVis.vis.params.index_pattern}"`,
searchFields: ['title'],
});
const [indexPattern] = indexPatternObjects.savedObjects.map(getFromSavedObject);
return indexPattern;
}
const savedObject = await savedObjectsClient.get('index-pattern', defaultIndex);
return getFromSavedObject(savedObject);
}
示例4: compose
export function compose(): FrontendLibs {
const api = new AxiosRestAPIAdapter(chrome.getXsrfToken(), chrome.getBasePath());
const esAdapter = new RestElasticsearchAdapter(api, INDEX_NAMES.BEATS);
const tags = new TagsLib(new RestTagsAdapter(api), getSupportedConfig());
const tokens = new RestTokensAdapter(api);
const beats = new BeatsLib(new RestBeatsAdapter(api), {
tags,
});
const framework = new FrameworkLib(
new KibanaFrameworkAdapter(
PLUGIN.ID,
management,
routes,
chrome.getBasePath,
onKibanaReady,
XPackInfoProvider,
chrome.getUiSettingsClient()
)
);
const libs: FrontendLibs = {
framework,
elasticsearch: new ElasticsearchLib(esAdapter),
tags,
tokens,
beats,
};
return libs;
}
示例5:
showSavedObject: savedObject => {
if (chrome.getUiSettingsClient().get('visualize:enableLabs')) {
return true;
}
const typeName: string = JSON.parse(savedObject.attributes.visState).type;
const visType = visTypes.byName[typeName];
return visType.stage !== 'experimental';
},
示例6:
// import 'monaco-editor/esm/vs/basic-languages/less/less.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/lua/lua.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/markdown/markdown.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/msdax/msdax.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/mysql/mysql.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/objective-c/objective-c.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/pgsql/pgsql.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/php/php.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/postiats/postiats.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/powershell/powershell.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/pug/pug.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/python/python.contribution.js';
import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
import chrome from 'ui/chrome';
const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
const themeName = IS_DARK_THEME ? darkTheme : lightTheme;
const syntaxTheme = {
keyword: themeName.euiColorAccent,
comment: themeName.euiColorMediumShade,
delimiter: themeName.euiColorSecondary,
string: themeName.euiColorPrimary,
number: themeName.euiColorWarning,
regexp: themeName.euiColorPrimary,
types: `${IS_DARK_THEME ? themeName.euiColorVis5 : themeName.euiColorVis9}`,
annotation: themeName.euiColorLightShade,
tag: themeName.euiColorAccent,
symbol: themeName.euiColorDanger,
foreground: themeName.euiColorDarkestShade,
示例7: fetchIndexPatterns
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import chrome from 'ui/chrome';
import { getFromSavedObject } from 'ui/index_patterns/static_utils';
const config = chrome.getUiSettingsClient();
export async function fetchIndexPatterns(indexPatternStrings: string[]) {
const quotedIndexPatternStrings = indexPatternStrings.map(
indexPatternString => `"${indexPatternString}"`
);
const searchString = quotedIndexPatternStrings.join(' | ');
const indexPatternsFromSavedObjects = await chrome.getSavedObjectsClient().find({
type: 'index-pattern',
fields: ['title', 'fields'],
search: `"${searchString}"`,
searchFields: ['title'],
});
const exactMatches = indexPatternsFromSavedObjects.savedObjects.filter(savedObject => {
return indexPatternStrings.includes(savedObject.attributes.title as string);
示例8: getSuggestionsProvider
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import chrome from 'ui/chrome';
import { kfetch } from 'ui/kfetch';
import { getSuggestionsProvider } from './value_suggestions';
export const getSuggestions = getSuggestionsProvider(chrome.getUiSettingsClient(), kfetch);