mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Maps] show map saved objects in visualize listing page (#87165)
* [Maps] show map saved objects in visualize listing page * tslint * tslint * tslint fixes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
e0db4a3f0b
commit
bd91c16036
7 changed files with 80 additions and 41 deletions
|
@ -57,5 +57,5 @@ export {
|
|||
VisToExpressionAst,
|
||||
} from './types';
|
||||
export { ExprVisAPIEvents } from './expressions/vis';
|
||||
export { VisualizationListItem } from './vis_types/vis_type_alias_registry';
|
||||
export { VisualizationListItem, VisualizationStage } from './vis_types/vis_type_alias_registry';
|
||||
export { VISUALIZE_ENABLE_LABS_SETTING } from '../common/constants';
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SavedObject } from '../../../../core/types/saved_objects';
|
||||
|
||||
export type VisualizationStage = 'experimental' | 'beta' | 'production';
|
||||
|
||||
export interface VisualizationListItem {
|
||||
editUrl: string;
|
||||
|
@ -23,7 +26,7 @@ export interface VisualizationListItem {
|
|||
error?: string;
|
||||
icon: string;
|
||||
id: string;
|
||||
stage: 'experimental' | 'beta' | 'production';
|
||||
stage: VisualizationStage;
|
||||
savedObjectType: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
|
@ -35,11 +38,7 @@ export interface VisualizationListItem {
|
|||
export interface VisualizationsAppExtension {
|
||||
docTypes: string[];
|
||||
searchFields?: string[];
|
||||
toListItem: (savedObject: {
|
||||
id: string;
|
||||
type: string;
|
||||
attributes: object;
|
||||
}) => VisualizationListItem;
|
||||
toListItem: (savedObject: SavedObject) => VisualizationListItem;
|
||||
}
|
||||
|
||||
export interface VisTypeAliasPromoTooltip {
|
||||
|
@ -59,7 +58,7 @@ export interface VisTypeAlias {
|
|||
note?: string;
|
||||
disabled?: boolean;
|
||||
getSupportedTriggers?: () => string[];
|
||||
stage: 'experimental' | 'beta' | 'production';
|
||||
stage: VisualizationStage;
|
||||
|
||||
appExtensions?: {
|
||||
visualizations: VisualizationsAppExtension;
|
||||
|
|
|
@ -28,6 +28,9 @@ export const MAP_SAVED_OBJECT_TYPE = 'map';
|
|||
export const APP_ID = 'maps';
|
||||
export const APP_ICON = 'gisApp';
|
||||
export const APP_ICON_SOLUTION = 'logoKibana';
|
||||
export const APP_NAME = i18n.translate('xpack.maps.visTypeAlias.title', {
|
||||
defaultMessage: 'Maps',
|
||||
});
|
||||
export const INITIAL_LAYERS_KEY = 'initialLayers';
|
||||
|
||||
export const MAPS_APP_PATH = `app/${APP_ID}`;
|
||||
|
@ -50,6 +53,9 @@ export function getNewMapPath() {
|
|||
export function getExistingMapPath(id: string) {
|
||||
return `${MAP_BASE_URL}/${id}`;
|
||||
}
|
||||
export function getEditPath(id: string) {
|
||||
return `/${MAP_PATH}/${id}`;
|
||||
}
|
||||
|
||||
export enum LAYER_TYPE {
|
||||
TILE = 'TILE',
|
||||
|
|
|
@ -1,30 +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;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { APP_ID, APP_ICON, MAP_PATH } from '../common/constants';
|
||||
|
||||
export function getMapsVisTypeAlias(visualizations, showMapVisualizationTypes) {
|
||||
if (!showMapVisualizationTypes) {
|
||||
visualizations.hideTypes(['region_map', 'tile_map']);
|
||||
}
|
||||
|
||||
const description = i18n.translate('xpack.maps.visTypeAlias.description', {
|
||||
defaultMessage: 'Create and style maps with multiple layers and indices.',
|
||||
});
|
||||
|
||||
return {
|
||||
aliasApp: APP_ID,
|
||||
aliasPath: `/${MAP_PATH}`,
|
||||
name: APP_ID,
|
||||
title: i18n.translate('xpack.maps.visTypeAlias.title', {
|
||||
defaultMessage: 'Maps',
|
||||
}),
|
||||
description: description,
|
||||
icon: APP_ICON,
|
||||
stage: 'production',
|
||||
};
|
||||
}
|
65
x-pack/plugins/maps/public/maps_vis_type_alias.ts
Normal file
65
x-pack/plugins/maps/public/maps_vis_type_alias.ts
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
VisualizationsSetup,
|
||||
VisualizationStage,
|
||||
} from '../../../../src/plugins/visualizations/public';
|
||||
import { SavedObject } from '../../../../src/core/types/saved_objects';
|
||||
import { MapSavedObject } from '../common/map_saved_object_type';
|
||||
import {
|
||||
APP_ID,
|
||||
APP_ICON,
|
||||
APP_NAME,
|
||||
getEditPath,
|
||||
MAP_PATH,
|
||||
MAP_SAVED_OBJECT_TYPE,
|
||||
} from '../common/constants';
|
||||
|
||||
export function getMapsVisTypeAlias(
|
||||
visualizations: VisualizationsSetup,
|
||||
showMapVisualizationTypes: boolean
|
||||
) {
|
||||
if (!showMapVisualizationTypes) {
|
||||
visualizations.hideTypes(['region_map', 'tile_map']);
|
||||
}
|
||||
|
||||
const appDescription = i18n.translate('xpack.maps.visTypeAlias.description', {
|
||||
defaultMessage: 'Create and style maps with multiple layers and indices.',
|
||||
});
|
||||
|
||||
return {
|
||||
aliasApp: APP_ID,
|
||||
aliasPath: `/${MAP_PATH}`,
|
||||
name: APP_ID,
|
||||
title: APP_NAME,
|
||||
description: appDescription,
|
||||
icon: APP_ICON,
|
||||
stage: 'production' as VisualizationStage,
|
||||
appExtensions: {
|
||||
visualizations: {
|
||||
docTypes: [MAP_SAVED_OBJECT_TYPE],
|
||||
searchFields: ['title^3'],
|
||||
toListItem(savedObject: SavedObject) {
|
||||
const { id, type, attributes } = savedObject as MapSavedObject;
|
||||
const { title, description } = attributes;
|
||||
return {
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
editUrl: getEditPath(id),
|
||||
editApp: APP_ID,
|
||||
icon: APP_ICON,
|
||||
stage: 'production' as VisualizationStage,
|
||||
savedObjectType: type,
|
||||
typeTitle: APP_NAME,
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
|
@ -27,7 +27,6 @@ import {
|
|||
setStartServices,
|
||||
} from './kibana_services';
|
||||
import { featureCatalogueEntry } from './feature_catalogue_entry';
|
||||
// @ts-ignore
|
||||
import { getMapsVisTypeAlias } from './maps_vis_type_alias';
|
||||
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
||||
import {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { EuiLink } from '@elastic/eui';
|
|||
import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/basic_table';
|
||||
import { TableListView } from '../../../../../../src/plugins/kibana_react/public';
|
||||
import { goToSpecifiedPath } from '../../render_app';
|
||||
import { APP_ID, MAP_PATH, MAP_SAVED_OBJECT_TYPE } from '../../../common/constants';
|
||||
import { APP_ID, getEditPath, MAP_PATH, MAP_SAVED_OBJECT_TYPE } from '../../../common/constants';
|
||||
import {
|
||||
getMapsCapabilities,
|
||||
getToasts,
|
||||
|
@ -47,7 +47,7 @@ const tableColumns: Array<EuiBasicTableColumn<any>> = [
|
|||
<EuiLink
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
goToSpecifiedPath(`/${MAP_PATH}/${record.id}`);
|
||||
goToSpecifiedPath(getEditPath(record.id));
|
||||
}}
|
||||
data-test-subj={`mapListingTitleLink-${record.title.split(' ').join('-')}`}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue