* Remove navigation from Discover to Visualize * Remove unused translation * Remove oss check from functional test * Fix functional test * Skip test for OSS * Fix * Should not remove the uiSettings getter and setter * Move the isOss flag inside the test * Cleanup Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
d843d7f273
commit
cc3eb8ec51
|
@ -11,7 +11,6 @@
|
|||
"visualizations",
|
||||
"embeddable",
|
||||
"dashboard",
|
||||
"uiActions",
|
||||
"presentationUtil"
|
||||
],
|
||||
"optionalPlugins": [
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* and the Server Side Public License, v 1; you may not use this file except in
|
||||
* compliance with, at your election, the Elastic License or the Server Side
|
||||
* Public License, v 1.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
createAction,
|
||||
ACTION_VISUALIZE_FIELD,
|
||||
VisualizeFieldContext,
|
||||
} from '../../../ui_actions/public';
|
||||
import {
|
||||
getApplication,
|
||||
getUISettings,
|
||||
getIndexPatterns,
|
||||
getQueryService,
|
||||
getShareService,
|
||||
} from '../services';
|
||||
import { VISUALIZE_APP_URL_GENERATOR, VisualizeUrlGeneratorState } from '../url_generator';
|
||||
import { AGGS_TERMS_SIZE_SETTING } from '../../common/constants';
|
||||
|
||||
export const visualizeFieldAction = createAction<VisualizeFieldContext>({
|
||||
type: ACTION_VISUALIZE_FIELD,
|
||||
id: ACTION_VISUALIZE_FIELD,
|
||||
getDisplayName: () =>
|
||||
i18n.translate('visualize.discover.visualizeFieldLabel', {
|
||||
defaultMessage: 'Visualize field',
|
||||
}),
|
||||
isCompatible: async () => !!getApplication().capabilities.visualize.show,
|
||||
getHref: async (context) => {
|
||||
const url = await getVisualizeUrl(context);
|
||||
return url;
|
||||
},
|
||||
execute: async (context) => {
|
||||
const url = await getVisualizeUrl(context);
|
||||
const hash = url.split('#')[1];
|
||||
|
||||
getApplication().navigateToApp('visualize', {
|
||||
path: `/#${hash}`,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const getVisualizeUrl = async (context: VisualizeFieldContext) => {
|
||||
const indexPattern = await getIndexPatterns().get(context.indexPatternId);
|
||||
const field = indexPattern.fields.find((fld) => fld.name === context.fieldName);
|
||||
const aggsTermSize = getUISettings().get(AGGS_TERMS_SIZE_SETTING);
|
||||
let agg;
|
||||
|
||||
// If we're visualizing a date field, and our index is time based (and thus has a time filter),
|
||||
// then run a date histogram
|
||||
if (field?.type === 'date' && indexPattern.timeFieldName === context.fieldName) {
|
||||
agg = {
|
||||
type: 'date_histogram',
|
||||
schema: 'segment',
|
||||
params: {
|
||||
field: context.fieldName,
|
||||
interval: 'auto',
|
||||
},
|
||||
};
|
||||
} else {
|
||||
agg = {
|
||||
type: 'terms',
|
||||
schema: 'segment',
|
||||
params: {
|
||||
field: context.fieldName,
|
||||
size: parseInt(aggsTermSize, 10),
|
||||
orderBy: '1',
|
||||
},
|
||||
};
|
||||
}
|
||||
const generator = getShareService().urlGenerators.getUrlGenerator(VISUALIZE_APP_URL_GENERATOR);
|
||||
const urlState: VisualizeUrlGeneratorState = {
|
||||
filters: getQueryService().filterManager.getFilters(),
|
||||
query: getQueryService().queryString.getQuery(),
|
||||
timeRange: getQueryService().timefilter.timefilter.getTime(),
|
||||
indexPatternId: context.indexPatternId,
|
||||
type: 'histogram',
|
||||
vis: {
|
||||
type: 'histogram',
|
||||
aggs: [{ schema: 'metric', type: 'count', id: '1' }, agg],
|
||||
},
|
||||
};
|
||||
return generator.createUrl(urlState);
|
||||
};
|
|
@ -39,18 +39,8 @@ import { DEFAULT_APP_CATEGORIES } from '../../../core/public';
|
|||
import { SavedObjectsStart } from '../../saved_objects/public';
|
||||
import { EmbeddableStart } from '../../embeddable/public';
|
||||
import { DashboardStart } from '../../dashboard/public';
|
||||
import { UiActionsSetup, VISUALIZE_FIELD_TRIGGER } from '../../ui_actions/public';
|
||||
import type { SavedObjectTaggingOssPluginStart } from '../../saved_objects_tagging_oss/public';
|
||||
import {
|
||||
setUISettings,
|
||||
setApplication,
|
||||
setIndexPatterns,
|
||||
setQueryService,
|
||||
setShareService,
|
||||
setVisEditorsRegistry,
|
||||
} from './services';
|
||||
import { visualizeFieldAction } from './actions/visualize_field_action';
|
||||
import { createVisualizeUrlGenerator } from './url_generator';
|
||||
import { setVisEditorsRegistry, setUISettings } from './services';
|
||||
import { createVisEditorsRegistry, VisEditorsRegistry } from './vis_editors_registry';
|
||||
|
||||
export interface VisualizePluginStartDependencies {
|
||||
|
@ -71,7 +61,6 @@ export interface VisualizePluginSetupDependencies {
|
|||
urlForwarding: UrlForwardingSetup;
|
||||
data: DataPublicPluginSetup;
|
||||
share?: SharePluginSetup;
|
||||
uiActions: UiActionsSetup;
|
||||
}
|
||||
|
||||
export interface VisualizePluginSetup {
|
||||
|
@ -96,7 +85,7 @@ export class VisualizePlugin
|
|||
|
||||
public async setup(
|
||||
core: CoreSetup<VisualizePluginStartDependencies>,
|
||||
{ home, urlForwarding, data, share, uiActions }: VisualizePluginSetupDependencies
|
||||
{ home, urlForwarding, data }: VisualizePluginSetupDependencies
|
||||
) {
|
||||
const {
|
||||
appMounted,
|
||||
|
@ -129,19 +118,8 @@ export class VisualizePlugin
|
|||
this.stopUrlTracking = () => {
|
||||
stopUrlTracker();
|
||||
};
|
||||
if (share) {
|
||||
share.urlGenerators.registerUrlGenerator(
|
||||
createVisualizeUrlGenerator(async () => {
|
||||
const [coreStart] = await core.getStartServices();
|
||||
return {
|
||||
appBasePath: coreStart.application.getUrlForApp('visualize'),
|
||||
useHashedUrl: coreStart.uiSettings.get('state:storeInSessionStorage'),
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
setUISettings(core.uiSettings);
|
||||
uiActions.addTriggerAction(VISUALIZE_FIELD_TRIGGER, visualizeFieldAction);
|
||||
|
||||
core.application.register({
|
||||
id: 'visualize',
|
||||
|
@ -245,12 +223,6 @@ export class VisualizePlugin
|
|||
|
||||
public start(core: CoreStart, plugins: VisualizePluginStartDependencies) {
|
||||
setVisEditorsRegistry(this.visEditorsRegistry);
|
||||
setApplication(core.application);
|
||||
setIndexPatterns(plugins.data.indexPatterns);
|
||||
setQueryService(plugins.data.query);
|
||||
if (plugins.share) {
|
||||
setShareService(plugins.share);
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
|
|
@ -5,28 +5,13 @@
|
|||
* compliance with, at your election, the Elastic License or the Server Side
|
||||
* Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ApplicationStart, IUiSettingsClient } from '../../../core/public';
|
||||
import { IUiSettingsClient } from '../../../core/public';
|
||||
import { createGetterSetter } from '../../../plugins/kibana_utils/public';
|
||||
import { IndexPatternsContract, DataPublicPluginStart } from '../../../plugins/data/public';
|
||||
import { SharePluginStart } from '../../../plugins/share/public';
|
||||
import { VisEditorsRegistry } from './vis_editors_registry';
|
||||
|
||||
export const [getUISettings, setUISettings] = createGetterSetter<IUiSettingsClient>('UISettings');
|
||||
|
||||
export const [getApplication, setApplication] = createGetterSetter<ApplicationStart>('Application');
|
||||
|
||||
export const [getShareService, setShareService] = createGetterSetter<SharePluginStart>('Share');
|
||||
|
||||
export const [getIndexPatterns, setIndexPatterns] = createGetterSetter<IndexPatternsContract>(
|
||||
'IndexPatterns'
|
||||
);
|
||||
|
||||
export const [
|
||||
getVisEditorsRegistry,
|
||||
setVisEditorsRegistry,
|
||||
] = createGetterSetter<VisEditorsRegistry>('VisEditorsRegistry');
|
||||
|
||||
export const [getQueryService, setQueryService] = createGetterSetter<
|
||||
DataPublicPluginStart['query']
|
||||
>('Query');
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* and the Server Side Public License, v 1; you may not use this file except in
|
||||
* compliance with, at your election, the Elastic License or the Server Side
|
||||
* Public License, v 1.
|
||||
*/
|
||||
|
||||
import { createVisualizeUrlGenerator } from './url_generator';
|
||||
import { esFilters } from '../../data/public';
|
||||
|
||||
const APP_BASE_PATH: string = 'test/app/visualize';
|
||||
const VISUALIZE_ID: string = '13823000-99b9-11ea-9eb6-d9e8adceb647';
|
||||
const INDEXPATTERN_ID: string = '13823000-99b9-11ea-9eb6-d9e8adceb647';
|
||||
|
||||
describe('visualize url generator', () => {
|
||||
test('creates a link to a new visualization', async () => {
|
||||
const generator = createVisualizeUrlGenerator(() =>
|
||||
Promise.resolve({
|
||||
appBasePath: APP_BASE_PATH,
|
||||
useHashedUrl: false,
|
||||
})
|
||||
);
|
||||
const url = await generator.createUrl!({ indexPatternId: INDEXPATTERN_ID, type: 'table' });
|
||||
expect(url).toMatchInlineSnapshot(
|
||||
`"test/app/visualize#/create?_g=()&_a=()&indexPattern=${INDEXPATTERN_ID}&type=table"`
|
||||
);
|
||||
});
|
||||
|
||||
test('creates a link with global time range set up', async () => {
|
||||
const generator = createVisualizeUrlGenerator(() =>
|
||||
Promise.resolve({
|
||||
appBasePath: APP_BASE_PATH,
|
||||
useHashedUrl: false,
|
||||
})
|
||||
);
|
||||
const url = await generator.createUrl!({
|
||||
timeRange: { to: 'now', from: 'now-15m', mode: 'relative' },
|
||||
indexPatternId: INDEXPATTERN_ID,
|
||||
type: 'table',
|
||||
});
|
||||
expect(url).toMatchInlineSnapshot(
|
||||
`"test/app/visualize#/create?_g=(time:(from:now-15m,mode:relative,to:now))&_a=()&indexPattern=${INDEXPATTERN_ID}&type=table"`
|
||||
);
|
||||
});
|
||||
|
||||
test('creates a link with filters, time range, refresh interval and query to a saved visualization', async () => {
|
||||
const generator = createVisualizeUrlGenerator(() =>
|
||||
Promise.resolve({
|
||||
appBasePath: APP_BASE_PATH,
|
||||
useHashedUrl: false,
|
||||
indexPatternId: INDEXPATTERN_ID,
|
||||
type: 'table',
|
||||
})
|
||||
);
|
||||
const url = await generator.createUrl!({
|
||||
timeRange: { to: 'now', from: 'now-15m', mode: 'relative' },
|
||||
refreshInterval: { pause: false, value: 300 },
|
||||
visualizationId: VISUALIZE_ID,
|
||||
filters: [
|
||||
{
|
||||
meta: {
|
||||
alias: null,
|
||||
disabled: false,
|
||||
negate: false,
|
||||
},
|
||||
query: { query: 'q1' },
|
||||
},
|
||||
{
|
||||
meta: {
|
||||
alias: null,
|
||||
disabled: false,
|
||||
negate: false,
|
||||
},
|
||||
query: { query: 'q1' },
|
||||
$state: {
|
||||
store: esFilters.FilterStateStore.GLOBAL_STATE,
|
||||
},
|
||||
},
|
||||
],
|
||||
query: { query: 'q2', language: 'kuery' },
|
||||
indexPatternId: INDEXPATTERN_ID,
|
||||
type: 'table',
|
||||
});
|
||||
expect(url).toMatchInlineSnapshot(
|
||||
`"test/app/visualize#/edit/${VISUALIZE_ID}?_g=(filters:!(('$state':(store:globalState),meta:(alias:!n,disabled:!f,negate:!f),query:(query:q1))),refreshInterval:(pause:!f,value:300),time:(from:now-15m,mode:relative,to:now))&_a=(filters:!((meta:(alias:!n,disabled:!f,negate:!f),query:(query:q1))),query:(language:kuery,query:q2))&indexPattern=${INDEXPATTERN_ID}&type=table"`
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* and the Server Side Public License, v 1; you may not use this file except in
|
||||
* compliance with, at your election, the Elastic License or the Server Side
|
||||
* Public License, v 1.
|
||||
*/
|
||||
|
||||
import {
|
||||
TimeRange,
|
||||
Filter,
|
||||
Query,
|
||||
esFilters,
|
||||
QueryState,
|
||||
RefreshInterval,
|
||||
} from '../../data/public';
|
||||
import { setStateToKbnUrl } from '../../kibana_utils/public';
|
||||
import { UrlGeneratorsDefinition } from '../../share/public';
|
||||
import { STATE_STORAGE_KEY, GLOBAL_STATE_STORAGE_KEY } from '../common/constants';
|
||||
|
||||
export const VISUALIZE_APP_URL_GENERATOR = 'VISUALIZE_APP_URL_GENERATOR';
|
||||
|
||||
export interface VisualizeUrlGeneratorState {
|
||||
/**
|
||||
* If given, it will load the given visualization else will load the create a new visualization page.
|
||||
*/
|
||||
visualizationId?: string;
|
||||
/**
|
||||
* Optionally set the time range in the time picker.
|
||||
*/
|
||||
timeRange?: TimeRange;
|
||||
|
||||
/**
|
||||
* Optional set indexPatternId.
|
||||
*/
|
||||
indexPatternId?: string;
|
||||
|
||||
/**
|
||||
* Optional set visualization type.
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* Optionally set the visualization.
|
||||
*/
|
||||
vis?: unknown;
|
||||
|
||||
/**
|
||||
* Optionally set the refresh interval.
|
||||
*/
|
||||
refreshInterval?: RefreshInterval;
|
||||
|
||||
/**
|
||||
* Optionally apply filers. NOTE: if given and used in conjunction with `dashboardId`, and the
|
||||
* saved dashboard has filters saved with it, this will _replace_ those filters.
|
||||
*/
|
||||
filters?: Filter[];
|
||||
/**
|
||||
* Optionally set a query. NOTE: if given and used in conjunction with `dashboardId`, and the
|
||||
* saved dashboard has a query saved with it, this will _replace_ that query.
|
||||
*/
|
||||
query?: Query;
|
||||
/**
|
||||
* If not given, will use the uiSettings configuration for `storeInSessionStorage`. useHash determines
|
||||
* whether to hash the data in the url to avoid url length issues.
|
||||
*/
|
||||
hash?: boolean;
|
||||
}
|
||||
|
||||
export const createVisualizeUrlGenerator = (
|
||||
getStartServices: () => Promise<{
|
||||
appBasePath: string;
|
||||
useHashedUrl: boolean;
|
||||
}>
|
||||
): UrlGeneratorsDefinition<typeof VISUALIZE_APP_URL_GENERATOR> => ({
|
||||
id: VISUALIZE_APP_URL_GENERATOR,
|
||||
createUrl: async ({
|
||||
visualizationId,
|
||||
filters,
|
||||
indexPatternId,
|
||||
query,
|
||||
refreshInterval,
|
||||
vis,
|
||||
type,
|
||||
timeRange,
|
||||
hash,
|
||||
}: VisualizeUrlGeneratorState): Promise<string> => {
|
||||
const startServices = await getStartServices();
|
||||
const useHash = hash ?? startServices.useHashedUrl;
|
||||
const appBasePath = startServices.appBasePath;
|
||||
const mode = visualizationId ? `edit/${visualizationId}` : `create`;
|
||||
|
||||
const appState: {
|
||||
query?: Query;
|
||||
filters?: Filter[];
|
||||
vis?: unknown;
|
||||
} = {};
|
||||
const queryState: QueryState = {};
|
||||
|
||||
if (query) appState.query = query;
|
||||
if (filters && filters.length)
|
||||
appState.filters = filters?.filter((f) => !esFilters.isFilterPinned(f));
|
||||
if (vis) appState.vis = vis;
|
||||
|
||||
if (timeRange) queryState.time = timeRange;
|
||||
if (filters && filters.length)
|
||||
queryState.filters = filters?.filter((f) => esFilters.isFilterPinned(f));
|
||||
if (refreshInterval) queryState.refreshInterval = refreshInterval;
|
||||
|
||||
let url = `${appBasePath}#/${mode}`;
|
||||
url = setStateToKbnUrl<QueryState>(GLOBAL_STATE_STORAGE_KEY, queryState, { useHash }, url);
|
||||
url = setStateToKbnUrl(STATE_STORAGE_KEY, appState, { useHash }, url);
|
||||
|
||||
if (indexPatternId) {
|
||||
url = `${url}&indexPattern=${indexPatternId}`;
|
||||
}
|
||||
|
||||
if (type) {
|
||||
url = `${url}&type=${type}`;
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
});
|
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* and the Server Side Public License, v 1; you may not use this file except in
|
||||
* compliance with, at your election, the Elastic License or the Server Side
|
||||
* Public License, v 1.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const filterBar = getService('filterBar');
|
||||
const inspector = getService('inspector');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const log = getService('log');
|
||||
const queryBar = getService('queryBar');
|
||||
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker', 'visualize']);
|
||||
const defaultSettings = {
|
||||
defaultIndex: 'logstash-*',
|
||||
};
|
||||
|
||||
describe('discover field visualize button', function () {
|
||||
// unskipped on cloud as these tests test the navigation
|
||||
// from Discover to Visualize which happens only on OSS
|
||||
this.tags(['skipCloud']);
|
||||
before(async function () {
|
||||
log.debug('load kibana index with default index pattern');
|
||||
await esArchiver.load('discover');
|
||||
|
||||
// and load a set of makelogs data
|
||||
await esArchiver.loadIfNeeded('logstash_functional');
|
||||
await kibanaServer.uiSettings.replace(defaultSettings);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
log.debug('go to discover');
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.timePicker.setDefaultAbsoluteRange();
|
||||
});
|
||||
|
||||
it('should be able to visualize a field and save the visualization', async () => {
|
||||
await PageObjects.discover.findFieldByName('type');
|
||||
log.debug('visualize a type field');
|
||||
await PageObjects.discover.clickFieldListItemVisualize('type');
|
||||
await PageObjects.visualize.saveVisualizationExpectSuccess('Top 5 server types');
|
||||
});
|
||||
|
||||
it('should visualize a field in area chart', async () => {
|
||||
await PageObjects.discover.findFieldByName('phpmemory');
|
||||
log.debug('visualize a phpmemory field');
|
||||
await PageObjects.discover.clickFieldListItemVisualize('phpmemory');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const expectedTableData = [
|
||||
['0', '10'],
|
||||
['58,320', '2'],
|
||||
['171,080', '2'],
|
||||
['3,240', '1'],
|
||||
['3,520', '1'],
|
||||
['3,880', '1'],
|
||||
['4,120', '1'],
|
||||
['4,640', '1'],
|
||||
['4,760', '1'],
|
||||
['5,680', '1'],
|
||||
['7,160', '1'],
|
||||
['7,400', '1'],
|
||||
['8,400', '1'],
|
||||
['8,800', '1'],
|
||||
['8,960', '1'],
|
||||
['9,400', '1'],
|
||||
['10,280', '1'],
|
||||
['10,840', '1'],
|
||||
['13,080', '1'],
|
||||
['13,360', '1'],
|
||||
];
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should not show the "Visualize" button for geo field', async () => {
|
||||
await PageObjects.discover.findFieldByName('geo.coordinates');
|
||||
log.debug('visualize a geo field');
|
||||
await PageObjects.discover.expectMissingFieldListItemVisualize('geo.coordinates');
|
||||
});
|
||||
|
||||
it('should preserve app filters in visualize', async () => {
|
||||
await filterBar.addFilter('bytes', 'is between', '3500', '4000');
|
||||
await PageObjects.discover.findFieldByName('geo.src');
|
||||
log.debug('visualize a geo.src field with filter applied');
|
||||
await PageObjects.discover.clickFieldListItemVisualize('geo.src');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
expect(await filterBar.hasFilter('bytes', '3,500 to 4,000')).to.be(true);
|
||||
const expectedTableData = [
|
||||
['CN', '133'],
|
||||
['IN', '120'],
|
||||
['US', '58'],
|
||||
['ID', '28'],
|
||||
['BD', '25'],
|
||||
['BR', '22'],
|
||||
['EG', '14'],
|
||||
['NG', '14'],
|
||||
['PK', '13'],
|
||||
['IR', '12'],
|
||||
['PH', '12'],
|
||||
['JP', '11'],
|
||||
['RU', '11'],
|
||||
['DE', '8'],
|
||||
['FR', '8'],
|
||||
['MX', '8'],
|
||||
['TH', '8'],
|
||||
['TR', '8'],
|
||||
['CA', '6'],
|
||||
['SA', '6'],
|
||||
];
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should preserve query in visualize', async () => {
|
||||
await queryBar.setQuery('machine.os : ios');
|
||||
await queryBar.submitQuery();
|
||||
await PageObjects.discover.findFieldByName('geo.dest');
|
||||
log.debug('visualize a geo.dest field with query applied');
|
||||
await PageObjects.discover.clickFieldListItemVisualize('geo.dest');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
expect(await queryBar.getQueryString()).to.equal('machine.os : ios');
|
||||
const expectedTableData = [
|
||||
['CN', '519'],
|
||||
['IN', '495'],
|
||||
['US', '275'],
|
||||
['ID', '82'],
|
||||
['PK', '75'],
|
||||
['BR', '71'],
|
||||
['NG', '54'],
|
||||
['BD', '51'],
|
||||
['JP', '47'],
|
||||
['MX', '47'],
|
||||
['IR', '44'],
|
||||
['PH', '44'],
|
||||
['RU', '42'],
|
||||
['ET', '33'],
|
||||
['TH', '33'],
|
||||
['EG', '32'],
|
||||
['VN', '32'],
|
||||
['DE', '31'],
|
||||
['FR', '30'],
|
||||
['GB', '30'],
|
||||
];
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
await inspector.close();
|
||||
});
|
||||
});
|
||||
}
|
|
@ -27,7 +27,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./_discover'));
|
||||
loadTestFile(require.resolve('./_discover_histogram'));
|
||||
loadTestFile(require.resolve('./_doc_table'));
|
||||
loadTestFile(require.resolve('./_field_visualize'));
|
||||
loadTestFile(require.resolve('./_filter_editor'));
|
||||
loadTestFile(require.resolve('./_errors'));
|
||||
loadTestFile(require.resolve('./_field_data'));
|
||||
|
|
|
@ -27,13 +27,12 @@ import expect from '@kbn/expect';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const deployment = getService('deployment');
|
||||
const log = getService('log');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const filterBar = getService('filterBar');
|
||||
const deployment = getService('deployment');
|
||||
const PageObjects = getPageObjects([
|
||||
'common',
|
||||
'header',
|
||||
|
@ -188,39 +187,11 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should visualize scripted field in vertical bar chart', async function () {
|
||||
await filterBar.removeAllFilters();
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
if (await deployment.isOss()) {
|
||||
// OSS renders a vertical bar chart and we check the data in the Inspect panel
|
||||
const expectedChartValues = [
|
||||
['14', '31'],
|
||||
['10', '29'],
|
||||
['7', '24'],
|
||||
['11', '24'],
|
||||
['12', '23'],
|
||||
['20', '23'],
|
||||
['19', '21'],
|
||||
['6', '20'],
|
||||
['17', '20'],
|
||||
['30', '20'],
|
||||
['13', '19'],
|
||||
['18', '18'],
|
||||
['16', '17'],
|
||||
['5', '16'],
|
||||
['8', '16'],
|
||||
['15', '14'],
|
||||
['3', '13'],
|
||||
['2', '12'],
|
||||
['9', '10'],
|
||||
['4', '9'],
|
||||
];
|
||||
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedChartValues);
|
||||
} else {
|
||||
const isOss = await deployment.isOss();
|
||||
if (!isOss) {
|
||||
await filterBar.removeAllFilters();
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
// verify Lens opens a visualization
|
||||
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
|
||||
'Average of ram_Pain1'
|
||||
|
@ -306,16 +277,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should visualize scripted field in vertical bar chart', async function () {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
if (await deployment.isOss()) {
|
||||
// OSS renders a vertical bar chart and we check the data in the Inspect panel
|
||||
await inspector.open();
|
||||
await inspector.expectTableData([
|
||||
['good', '359'],
|
||||
['bad', '27'],
|
||||
]);
|
||||
} else {
|
||||
const isOss = await deployment.isOss();
|
||||
if (!isOss) {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
// verify Lens opens a visualization
|
||||
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
|
||||
'Top values of painString'
|
||||
|
@ -402,16 +367,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should visualize scripted field in vertical bar chart', async function () {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
if (await deployment.isOss()) {
|
||||
// OSS renders a vertical bar chart and we check the data in the Inspect panel
|
||||
await inspector.open();
|
||||
await inspector.expectTableData([
|
||||
['true', '359'],
|
||||
['false', '27'],
|
||||
]);
|
||||
} else {
|
||||
const isOss = await deployment.isOss();
|
||||
if (!isOss) {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
// verify Lens opens a visualization
|
||||
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
|
||||
'Top values of painBool'
|
||||
|
@ -501,36 +460,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should visualize scripted field in vertical bar chart', async function () {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
if (await deployment.isOss()) {
|
||||
// OSS renders a vertical bar chart and we check the data in the Inspect panel
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData([
|
||||
['2015-09-17 20:00', '1'],
|
||||
['2015-09-17 21:00', '1'],
|
||||
['2015-09-17 23:00', '1'],
|
||||
['2015-09-18 00:00', '1'],
|
||||
['2015-09-18 03:00', '1'],
|
||||
['2015-09-18 04:00', '1'],
|
||||
['2015-09-18 04:00', '1'],
|
||||
['2015-09-18 04:00', '1'],
|
||||
['2015-09-18 04:00', '1'],
|
||||
['2015-09-18 05:00', '1'],
|
||||
['2015-09-18 05:00', '1'],
|
||||
['2015-09-18 05:00', '1'],
|
||||
['2015-09-18 05:00', '1'],
|
||||
['2015-09-18 06:00', '1'],
|
||||
['2015-09-18 06:00', '1'],
|
||||
['2015-09-18 06:00', '1'],
|
||||
['2015-09-18 06:00', '1'],
|
||||
['2015-09-18 07:00', '1'],
|
||||
['2015-09-18 07:00', '1'],
|
||||
['2015-09-18 07:00', '1'],
|
||||
]);
|
||||
} else {
|
||||
const isOss = await deployment.isOss();
|
||||
if (!isOss) {
|
||||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
// verify Lens opens a visualization
|
||||
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
|
||||
'painDate'
|
||||
|
|
|
@ -31,10 +31,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./_index_pattern_results_sort'));
|
||||
loadTestFile(require.resolve('./_index_pattern_popularity'));
|
||||
loadTestFile(require.resolve('./_kibana_settings'));
|
||||
loadTestFile(require.resolve('./_scripted_fields'));
|
||||
loadTestFile(require.resolve('./_scripted_fields_preview'));
|
||||
loadTestFile(require.resolve('./_mgmt_import_saved_objects'));
|
||||
loadTestFile(require.resolve('./_index_patterns_empty'));
|
||||
loadTestFile(require.resolve('./_scripted_fields'));
|
||||
});
|
||||
|
||||
describe('', function () {
|
||||
|
|
|
@ -4718,7 +4718,6 @@
|
|||
"visualize.createVisualization.failedToLoadErrorMessage": "ビジュアライゼーションを読み込めませんでした",
|
||||
"visualize.createVisualization.noIndexPatternOrSavedSearchIdErrorMessage": "indexPatternまたはsavedSearchIdが必要です",
|
||||
"visualize.createVisualization.noVisTypeErrorMessage": "有効なビジュアライゼーションタイプを指定してください",
|
||||
"visualize.discover.visualizeFieldLabel": "Visualizeフィールド",
|
||||
"visualize.editor.createBreadcrumb": "作成",
|
||||
"visualize.editor.defaultEditBreadcrumbText": "編集",
|
||||
"visualize.experimentalVisInfoText": "このビジュアライゼーションはまだ実験段階であり、オフィシャルGA機能のサポートSLAが適用されません。フィードバックがある場合は、{githubLink}で問題を報告してください。",
|
||||
|
|
|
@ -4723,7 +4723,6 @@
|
|||
"visualize.createVisualization.failedToLoadErrorMessage": "无法加载可视化",
|
||||
"visualize.createVisualization.noIndexPatternOrSavedSearchIdErrorMessage": "必须提供 indexPattern 或 savedSearchId",
|
||||
"visualize.createVisualization.noVisTypeErrorMessage": "必须提供有效的可视化类型",
|
||||
"visualize.discover.visualizeFieldLabel": "可视化字段",
|
||||
"visualize.editor.createBreadcrumb": "创建",
|
||||
"visualize.editor.defaultEditBreadcrumbText": "编辑",
|
||||
"visualize.experimentalVisInfoText": "此可视化为试验性功能,不受正式发行版功能支持 SLA 的约束。如欲提供反馈,请在 {githubLink} 中创建问题。",
|
||||
|
|
Loading…
Reference in a new issue