Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into reporting/client-…
Browse files Browse the repository at this point in the history
…np-migration
  • Loading branch information
Joel Griffith committed Mar 13, 2020
2 parents a10e111 + 4dbe261 commit f20576f
Show file tree
Hide file tree
Showing 83 changed files with 364 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/dev_tools/ @elastic/kibana-app
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app
/src/plugins/dashboard/ @elastic/kibana-app

# App Architecture
/packages/kbn-interpreter/ @elastic/kibana-app-arch
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"common.ui": "src/legacy/ui",
"console": "src/plugins/console",
"core": "src/core",
"dashboardEmbeddableContainer": "src/plugins/dashboard_embeddable_container",
"dashboard": "src/plugins/dashboard",
"data": [
"src/legacy/core_plugins/data",
"src/plugins/data"
Expand Down
23 changes: 0 additions & 23 deletions src/legacy/core_plugins/dashboard_embeddable_container/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
import {
DEFAULT_PANEL_WIDTH,
DEFAULT_PANEL_HEIGHT,
} from '../../../../dashboard_embeddable_container/public/np_ready/public';
} from '../../../../../../plugins/dashboard/public';

test('6.0 migrates uiState, sort, scales, and gridData', async () => {
const uiState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
import semver from 'semver';
import { GridData } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { GridData } from 'src/plugins/dashboard/public';

import uuid from 'uuid';
import {
Expand Down Expand Up @@ -113,7 +113,7 @@ function migratePre61PanelToLatest(
? PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS
: PANEL_HEIGHT_SCALE_FACTOR;

// These are snapshotted here instead of imported form dashboard_embeddable_container because
// These are snapshotted here instead of imported from dashboard because
// this function is called from both client and server side, and having an import from a public
// folder will cause errors for the server side version. Also, this is only run for the point in time
// from panels created in < 7.3 so maybe using a snapshot of the default values when this migration was
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
DashboardContainerFactory,
DashboardContainerInput,
DashboardPanelState,
} from '../../../../dashboard_embeddable_container/public/np_ready/public';
} from '../../../../../../plugins/dashboard/public';
import {
EmbeddableFactoryNotFoundError,
ErrorEmbeddable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Observable, Subscription } from 'rxjs';
import { Moment } from 'moment';
import { History } from 'history';

import { DashboardContainer } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { DashboardContainer } from 'src/plugins/dashboard/public';
import { ViewMode } from '../../../../../../plugins/embeddable/public';
import { migrateLegacyQuery } from '../legacy_imports';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
convertPanelStateToSavedDashboardPanel,
} from './embeddable_saved_object_converters';
import { SavedDashboardPanel } from '../types';
import { DashboardPanelState } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { DashboardPanelState } from 'src/plugins/dashboard/public';
import { EmbeddableInput } from 'src/legacy/core_plugins/embeddable_api/public/np_ready/public';

interface CustomInput extends EmbeddableInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { omit } from 'lodash';
import { DashboardPanelState } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { DashboardPanelState } from 'src/plugins/dashboard/public';
import { SavedDashboardPanel } from '../types';

export function convertSavedDashboardPanelToPanelState(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "dashboard_embeddable_container",
"id": "dashboard",
"version": "kibana",
"requiredPlugins": [
"data",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,12 @@ export class ExpandPanelAction implements ActionByType<typeof ACTION_EXPAND_PANE
}

return isExpanded(embeddable)
? i18n.translate(
'dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.expandedDisplayName',
{
defaultMessage: 'Minimize',
}
)
: i18n.translate(
'dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.notExpandedDisplayName',
{
defaultMessage: 'Full screen',
}
);
? i18n.translate('dashboard.actions.toggleExpandPanelMenuItem.expandedDisplayName', {
defaultMessage: 'Minimize',
})
: i18n.translate('dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName', {
defaultMessage: 'Full screen',
});
}

public getIconType({ embeddable }: ExpandPanelActionContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class ReplacePanelAction implements ActionByType<typeof ACTION_REPLACE_PA
if (!embeddable.parent || !isDashboard(embeddable.parent)) {
throw new IncompatibleActionError();
}
return i18n.translate('dashboardEmbeddableContainer.panel.removePanel.replacePanel', {
return i18n.translate('dashboard.panel.removePanel.replacePanel', {
defaultMessage: 'Replace panel',
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ export class ReplacePanelFlyout extends React.Component<Props> {
}

this.lastToast = this.props.notifications.toasts.addSuccess({
title: i18n.translate(
'dashboardEmbeddableContainer.addPanel.savedObjectAddedToContainerSuccessMessageTitle',
{
defaultMessage: '{savedObjectName} was added',
values: {
savedObjectName: name,
},
}
),
title: i18n.translate('dashboard.addPanel.savedObjectAddedToContainerSuccessMessageTitle', {
defaultMessage: '{savedObjectName} was added',
values: {
savedObjectName: name,
},
}),
'data-test-subj': 'addObjectToContainerSuccess',
});
};
Expand Down Expand Up @@ -97,12 +94,9 @@ export class ReplacePanelFlyout extends React.Component<Props> {
const SavedObjectFinder = this.props.savedObjectsFinder;
const savedObjectsFinder = (
<SavedObjectFinder
noItemsMessage={i18n.translate(
'dashboardEmbeddableContainer.addPanel.noMatchingObjectsMessage',
{
defaultMessage: 'No matching objects found.',
}
)}
noItemsMessage={i18n.translate('dashboard.addPanel.noMatchingObjectsMessage', {
defaultMessage: 'No matching objects found.',
})}
savedObjectMetaData={[...this.props.getEmbeddableFactories()]
.filter(
embeddableFactory =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class DashboardContainerFactory extends EmbeddableFactory<
}

public getDisplayName() {
return i18n.translate('dashboardEmbeddableContainer.factory.displayName', {
return i18n.translate('dashboard.factory.displayName', {
defaultMessage: 'dashboard',
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class DashboardGridUi extends React.Component<DashboardGridProps, State> {
isLayoutInvalid = true;
this.props.kibana.notifications.toasts.danger({
title: this.props.intl.formatMessage({
id: 'dashboardEmbeddableContainer.dashboardGrid.toast.unableToLoadDashboardDangerMessage',
id: 'dashboard.dashboardGrid.toast.unableToLoadDashboardDangerMessage',
defaultMessage: 'Unable to load dashboard.',
}),
body: error.message,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/dashboard_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { PIE_CHART_VIS_NAME, AREA_CHART_VIS_NAME } from '../../page_objects/dash
// eslint-disable-next-line
import {
DEFAULT_PANEL_WIDTH
} from '../../../../src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_constants';
} from '../../../../src/plugins/dashboard/public/embeddable/dashboard_constants';

export default function({ getService, getPageObjects }) {
const PageObjects = getPageObjects([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function(kibana: any) {
order: 1,
main: 'plugins/kbn_tp_embeddable_explorer/np_ready/public/legacy',
},
hacks: ['plugins/dashboard_embeddable_container/initialize'],
},
init(server: Legacy.Server) {
server.injectUiAppVars('kbn_tp_embeddable_explorer', async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
DASHBOARD_CONTAINER_TYPE,
DashboardContainer,
DashboardContainerFactory,
} from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
} from '../../../../../../../../src/plugins/dashboard/public';

import { CoreStart } from '../../../../../../../../src/core/public';
import { dashboardInput } from './dashboard_input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { ViewMode, CONTACT_CARD_EMBEDDABLE, HELLO_WORLD_EMBEDDABLE } from '../embeddable_api';
import { DashboardContainerInput } from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { DashboardContainerInput } from '../../../../../../../../src/plugins/dashboard/public';

export const dashboardInput: DashboardContainerInput = {
panels: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function getLayoutOptions(
): cytoscape.LayoutOptions {
return {
name: 'breadthfirst',
roots: selectedRoots,
roots: selectedRoots.length ? selectedRoots : undefined,
fit: true,
padding: nodeHeight,
spacingFactor: 0.85,
Expand Down Expand Up @@ -111,18 +111,28 @@ export function Cytoscape({
const dataHandler = useCallback<cytoscape.EventHandler>(
event => {
if (cy) {
cy.edges().removeClass('highlight');

if (serviceName) {
const focusedNode = cy.getElementById(serviceName);
focusedNode.connectedEdges().addClass('highlight');
}

// Add the "primary" class to the node if its id matches the serviceName.
if (cy.nodes().length > 0 && serviceName) {
cy.nodes().removeClass('primary');
cy.getElementById(serviceName).addClass('primary');
}

if (event.cy.elements().length > 0) {
const selectedRoots = selectRoots(event.cy);
const layout = cy.layout(
getLayoutOptions(selectedRoots, height, width)
);
layout.one('layoutstop', () => {
if (serviceName) {
const focusedNode = cy.getElementById(serviceName);
cy.center(focusedNode);
}
// show elements after layout is applied
cy.elements().removeClass('invisible');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,29 @@ import { i18n } from '@kbn/i18n';
import React, { MouseEvent } from 'react';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { getAPMHref } from '../../../shared/Links/apm/APMLink';
import { APMQueryParams } from '../../../shared/Links/url_helpers';

interface ButtonsProps {
focusedServiceName?: string;
onFocusClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
selectedNodeServiceName: string;
}

export function Buttons({
focusedServiceName,
onFocusClick = () => {},
selectedNodeServiceName
}: ButtonsProps) {
const currentSearch = useUrlParams().urlParams.kuery ?? '';
const urlParams = useUrlParams().urlParams as APMQueryParams;
const detailsUrl = getAPMHref(
`/services/${selectedNodeServiceName}/transactions`,
currentSearch
'',
urlParams
);
const focusUrl = getAPMHref(
`/services/${selectedNodeServiceName}/service-map`,
currentSearch
'',
urlParams
);

const isAlreadyFocused = focusedServiceName === selectedNodeServiceName;

return (
<>
<EuiFlexItem>
Expand All @@ -45,19 +44,7 @@ export function Buttons({
</EuiButton>
</EuiFlexItem>
<EuiFlexItem>
<EuiButton
isDisabled={isAlreadyFocused}
color="secondary"
href={focusUrl}
onClick={onFocusClick}
title={
isAlreadyFocused
? i18n.translate('xpack.apm.serviceMap.alreadyFocusedTitleText', {
defaultMessage: 'Map is already focused'
})
: undefined
}
>
<EuiButton color="secondary" href={focusUrl} onClick={onFocusClick}>
{i18n.translate('xpack.apm.serviceMap.focusMapButtonText', {
defaultMessage: 'Focus map'
})}
Expand Down
Loading

0 comments on commit f20576f

Please sign in to comment.