Skip to content

Commit

Permalink
Moved getId back to canvas and removed from pres_util.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Jul 29, 2021
1 parent 7d43909 commit 19917d4
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/plugins/expression_shape/common/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

export * from './view_box';
export * from './available_shapes';
export * from './get_id';
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import { IInterpreterRenderHandlers } from '../../../../expressions';
import { NodeDimensions, ProgressRendererConfig } from '../../../common/types';
import { ShapeRef, SvgConfig, SvgTextAttributes } from '../reusable/types';
import { getShapeContentElement } from '../reusable/shape_factory';
import { getId, withSuspense } from '../../../../presentation_util/public';
import { withSuspense } from '../../../../presentation_util/public';
import { getTextAttributes, getViewBox } from './utils';
import { getId } from '../../../common/lib';
import { getDefaultShapeData } from '../reusable';
import { LazyProgressDrawer } from '../..';

Expand Down
1 change: 0 additions & 1 deletion src/plugins/presentation_util/common/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export * from './dataurl';
export * from './httpurl';
export * from './resolve_dataurl';
export * from './url';
export * from './get_id';

export async function getElasticLogo() {
return await import('./elastic_logo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { get } from 'lodash';
// @ts-expect-error untyped local
import { findExistingAsset } from '../../lib/find_existing_asset';
import { VALID_IMAGE_TYPES } from '../../../common/lib/constants';
import { encode, getId } from '../../../../../../src/plugins/presentation_util/public';
import { encode } from '../../../../../../src/plugins/presentation_util/public';
import { getId } from '../../lib/get_id';
// @ts-expect-error untyped local
import { elementsRegistry } from '../../lib/elements_registry';
// @ts-expect-error untyped local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { findExpressionType } from '../../lib/find_expression_type';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';
import { createAsset } from '../../state/actions/assets';
import {
fetchContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useHistory } from 'react-router-dom';
import { i18n } from '@kbn/i18n';

import { useNotifyService, useWorkpadService } from '../../../services';
import { getId } from '../../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../../lib/get_id';

export const useCloneWorkpad = () => {
const workpadService = useWorkpadService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { i18n } from '@kbn/i18n';

import { CANVAS, JSON as JSONString } from '../../../../i18n/constants';
import { useNotifyService } from '../../../services';
import { getId } from '../../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../../lib/get_id';

import { useCreateWorkpad } from './use_create_workpad';
import type { CanvasWorkpad } from '../../../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n';
import { keymap } from '../../lib/keymap';
import { ShortcutMap, ShortcutNameSpace } from '../../../types/shortcuts';
import { getClientPlatform } from '../../lib/get_client_platform';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';
import { getPrettyShortcut } from '../../lib/get_pretty_shortcut';

const strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { Fragment, FunctionComponent } from 'react';
import PropTypes from 'prop-types';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';
import { Tag } from '../tag';
import { TagSpec } from '../../lib/tag';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
EuiContextMenuPanelItemDescriptor,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { getId } from '../../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../../lib/get_id';
import { Popover, ClosePopoverFn } from '../../popover';
import { CONTEXT_MENU_TOP_BORDER_CLASSNAME } from '../../../../common/lib';
import { ElementSpec } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* 2.0.
*/

import { getId as rawGetId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId as rawGetId } from '../get_id';

import { insideAABB, landmarkPoint, shapesAt } from './geometry';

import {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/lib/clone_subgraphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// @ts-expect-error untyped local
import { arrayToMap } from './aeroelastic/functional';
import { getId } from '../../../../../src/plugins/presentation_util/common/lib';
import { getId } from './get_id';
import { PositionedElement } from '../../types';

export const cloneSubgraphs = (nodes: PositionedElement[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getClipboardData, setClipboardData } from './clipboard';
import { cloneSubgraphs } from './clone_subgraphs';
import { pluginServices } from '../services';
import * as customElementService from './custom_element_service';
import { getId } from '../../../../../src/plugins/presentation_util/common/lib';
import { getId } from './get_id';
import { PositionedElement } from '../../types';
import { ELEMENT_NUDGE_OFFSET, ELEMENT_SHIFT_OFFSET } from '../../common/lib/constants';

Expand Down
12 changes: 12 additions & 0 deletions x-pack/plugins/canvas/public/lib/get_id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import uuid from 'uuid/v4';

export function getId(type: string): string {
return `${type}-${uuid()}`;
}
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { tagsRegistry } from '../lib/tags_registry';
import { getDefaultWorkpad } from '../state/defaults';
import { getId } from '../../../../../src/plugins/presentation_util/common/lib';
import { getId } from './get_id';

const defaultWorkpad = getDefaultWorkpad();

Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/canvas/public/services/storybook/workpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import moment from 'moment';

import { action } from '@storybook/addon-actions';
import { PluginServiceFactory } from '../../../../../../src/plugins/presentation_util/public';

import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';
// @ts-expect-error
import { getDefaultWorkpad } from '../../state/defaults';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/state/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { getId } from '../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../lib/get_id';
import { DEFAULT_WORKPAD_CSS } from '../../common/lib/constants';

export const getDefaultElement = () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/state/reducers/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { handleActions, combineActions } from 'redux-actions';
import immutable from 'object-path-immutable';
import { get } from 'lodash';
import { createAsset, setAssetValue, removeAsset, setAssets, resetAssets } from '../actions/assets';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';

const { set, assign, del } = immutable;

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/state/reducers/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { handleActions } from 'redux-actions';
import immutable from 'object-path-immutable';
import { cloneSubgraphs } from '../../lib/clone_subgraphs';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../lib/get_id';
import { getDefaultPage } from '../defaults';
import * as actions from '../actions/pages';
import { getSelectedPageIndex } from '../selectors/workpad';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/server/routes/workpad/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { schema } from '@kbn/config-schema';
import { RouteInitializerDeps } from '../';
import { CANVAS_TYPE, API_ROUTE_WORKPAD, TEMPLATE_TYPE } from '../../../common/lib/constants';
import { CanvasWorkpad } from '../../../types';
import { getId } from '../../../../../../src/plugins/presentation_util/common/lib';
import { getId } from '../../../common/lib/get_id';
import { WorkpadAttributes } from './workpad_attributes';
import { WorkpadSchema } from './workpad_schema';
import { okResponse } from '../ok_response';
Expand Down

0 comments on commit 19917d4

Please sign in to comment.