Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Introduce custom dashboards tab in service overview #166789

Merged
merged 76 commits into from Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
9c09111
Add dashboards svg
kpatticha Sep 12, 2023
32cfd91
Introduce dashboards tab
kpatticha Sep 12, 2023
435f133
Add empty component
kpatticha Sep 12, 2023
448478f
List available dashboards to select
kpatticha Sep 12, 2023
87d3c05
Add dashboard as a saved object
kpatticha Sep 13, 2023
7597387
wip
kpatticha Sep 13, 2023
8842051
Add linkTo property
kpatticha Sep 18, 2023
d7dfd7a
wip
kpatticha Sep 18, 2023
3ea1c10
Merge branch 'main' of github.com:elastic/kibana into 163590-dashboard
kpatticha Sep 18, 2023
3a831f2
Fetch dashboard specific to the service
kpatticha Sep 18, 2023
bcc0879
Add contect menu
kpatticha Sep 19, 2023
4e29c2d
Fix context menu
kpatticha Sep 19, 2023
01896c7
Fix refresh
kpatticha Sep 19, 2023
0070117
Add unlink option
kpatticha Sep 19, 2023
776c330
Go to dashboard link
kpatticha Sep 19, 2023
38a2d91
Additional actions
kpatticha Sep 19, 2023
bfbdb32
Clean up
kpatticha Sep 19, 2023
1cf717c
Move state to the component
kpatticha Sep 20, 2023
abd138e
Add edit mode
kpatticha Sep 20, 2023
17071a7
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 20, 2023
ed23453
Rename components
kpatticha Sep 20, 2023
8124da3
Polish the UI
kpatticha Sep 20, 2023
b5576e2
Fix loading
kpatticha Sep 20, 2023
c00caa1
Disable adding existing service dashboards
kpatticha Sep 20, 2023
1eb36e4
Fix preselect current dashboard
kpatticha Sep 20, 2023
ed642a3
Return latest updated service dashboard
kpatticha Sep 20, 2023
26f526a
Use context filter
kpatticha Sep 20, 2023
c2d2533
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 20, 2023
b825d57
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 20, 2023
280eae6
Merge branch 'main' of github.com:elastic/kibana into 163590-dashboard
kpatticha Sep 21, 2023
61b98e0
Fix packages
kpatticha Sep 21, 2023
e41add7
Fix types
kpatticha Sep 21, 2023
468cf94
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 21, 2023
4938015
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 21, 2023
3f996b7
Revert change regarding telemetry task
kpatticha Sep 21, 2023
2057c02
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 21, 2023
7fc3ddc
Address design feedback
kpatticha Sep 21, 2023
d3d9fda
Add api tests
kpatticha Sep 21, 2023
6cdf44a
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 21, 2023
511ff54
Fix i18n keys
kpatticha Sep 22, 2023
b440043
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 22, 2023
21813e8
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Sep 22, 2023
5799238
Rename SO to `apm-custom-dashboards`
kpatticha Sep 22, 2023
e0ce670
Remove not used attributes
kpatticha Sep 22, 2023
a889f3d
Fetch dashboard title dynamically
kpatticha Sep 22, 2023
dc83340
Show dashboard that exists
kpatticha Sep 22, 2023
d4dcf1e
Merge branch 'main' of github.com:elastic/kibana into 163590-dashboard
kpatticha Sep 25, 2023
09a0234
Get service that match dashboard kuery
kpatticha Sep 25, 2023
f69c8a7
Update API tests
kpatticha Sep 25, 2023
0dec0fa
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 25, 2023
2b5ae27
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 25, 2023
eb1f920
Deep-link specific dashboard
kpatticha Sep 25, 2023
4b37f76
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 25, 2023
9d2e573
Fix eslint
kpatticha Sep 25, 2023
e49b972
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 25, 2023
acb2da7
Fix dashboard updateInput
kpatticha Sep 25, 2023
3106f02
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Sep 25, 2023
1fef7be
Rename useContextFilter to useServiceFiltet
kpatticha Sep 27, 2023
8ed3d8a
Fix mapping
kpatticha Sep 27, 2023
d3c66fc
Make SO exportable
kpatticha Sep 27, 2023
2e54123
Make sure we search only if there any linked dashboards
kpatticha Sep 27, 2023
fac14a6
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Sep 27, 2023
928d739
Merge branch 'main' into 163590-dashboard
kibanamachine Sep 29, 2023
86ae010
Pass timerange
kpatticha Sep 29, 2023
43f4545
Fix checks
kpatticha Sep 29, 2023
14079de
Fix types
kpatticha Sep 29, 2023
cdeeff2
Fix types in testing
kpatticha Sep 29, 2023
db629d8
Address feedback, rename to customDashboard
kpatticha Oct 2, 2023
878fec0
t pMerge branch 'main' of github.com:elastic/kibana into 163590-dashb…
kpatticha Oct 2, 2023
e8c8e2d
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Oct 2, 2023
01ca59b
Merge branch 'main' into 163590-dashboard
kpatticha Oct 2, 2023
e911284
Fix tests
kpatticha Oct 2, 2023
8e7be83
Merge branch '163590-dashboard' of github.com:kpatticha/kibana into 1…
kpatticha Oct 2, 2023
6093ebf
Merge branch 'main' of github.com:elastic/kibana into 163590-dashboard
kpatticha Oct 2, 2023
869f7be
Update snapshot
kpatticha Oct 3, 2023
7cb024b
Rename getLinkedCustomDashboards to getCustomDashboards
kpatticha Oct 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_mappings.json
Expand Up @@ -3131,6 +3131,22 @@
}
}
},
"apm-custom-dashboards": {
"properties": {
"dashboardSavedObjectId": {
"type": "keyword"
},
"kuery": {
"type": "text"
},
"serviceEnvironmentFilterEnabled": {
"type": "boolean"
},
"serviceNameFilterEnabled": {
"type": "boolean"
}
}
},
"enterprise_search_telemetry": {
"dynamic": false,
"properties": {}
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-shared-svg/index.ts
Expand Up @@ -8,5 +8,7 @@

import noResultsIllustrationDark from './src/assets/no_results_dark.svg';
import noResultsIllustrationLight from './src/assets/no_results_light.svg';
import dashboardsLight from './src/assets/dashboards_light.svg';
import dashboardsDark from './src/assets/dashboards_dark.svg';

export { noResultsIllustrationDark, noResultsIllustrationLight };
export { noResultsIllustrationDark, noResultsIllustrationLight, dashboardsLight, dashboardsDark };
1 change: 1 addition & 0 deletions packages/kbn-shared-svg/src/assets/dashboards_dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/kbn-shared-svg/src/assets/dashboards_light.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -59,6 +59,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"action_task_params": "96e27e7f4e8273ffcd87060221e2b75e81912dd5",
"alert": "dc710bc17dfc98a9a703d388569abccce5f8bf07",
"api_key_pending_invalidation": "1399e87ca37b3d3a65d269c924eda70726cfe886",
"apm-custom-dashboards": "b67128f78160c288bd7efe25b2da6e2afd5e82fc",
"apm-indices": "8a2d68d415a4b542b26b0d292034a28ffac6fed4",
"apm-server-schema": "58a8c6468edae3d1dc520f0134f59cf3f4fd7eff",
"apm-service-group": "66dfc1ddd40bad8f693c873bf6002ca30079a4ae",
Expand Down
Expand Up @@ -15,6 +15,7 @@ const previouslyRegisteredTypes = [
'action_task_params',
'alert',
'api_key_pending_invalidation',
'apm-custom-dashboards',
'apm-indices',
'apm-server-schema',
'apm-service-group',
Expand Down
Expand Up @@ -181,6 +181,7 @@ describe('split .kibana index into multiple system indices', () => {
"action_task_params",
"alert",
"api_key_pending_invalidation",
"apm-custom-dashboards",
"apm-indices",
"apm-server-schema",
"apm-service-group",
Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugins/apm/common/custom_dashboards.ts
@@ -0,0 +1,20 @@
/*
* 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.
*/

export const APM_CUSTOM_DASHBOARDS_SAVED_OBJECT_TYPE = 'apm-custom-dashboards';

export interface ApmCustomDashboard {
dashboardSavedObjectId: string;
serviceNameFilterEnabled: boolean;
serviceEnvironmentFilterEnabled: boolean;
kuery?: string;
}

export interface SavedApmCustomDashboard extends ApmCustomDashboard {
id: string;
updatedAt: number;
}
Expand Up @@ -109,7 +109,7 @@ async function getCreationOptions(
}
}

function getFilters(
export function getFilters(
serviceName: string,
environment: string,
dataView: DataView
Expand Down Expand Up @@ -139,7 +139,7 @@ function getFilters(
} else {
const environmentFilter = buildPhraseFilter(
environmentField,
serviceName,
environment,
dataView
);
filters.push(environmentFilter);
Expand Down
@@ -0,0 +1,44 @@
/*
* 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 { EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { SaveDashboardModal } from './save_dashboard_modal';
import { MergedServiceDashboard } from '..';

export function EditDashboard({
onRefresh,
currentDashboard,
}: {
onRefresh: () => void;
currentDashboard: MergedServiceDashboard;
}) {
const [isModalVisible, setIsModalVisible] = useState(false);
return (
<>
<EuiButtonEmpty
color="text"
size="s"
iconType={'pencil'}
data-test-subj="apmEditServiceDashboardMenu"
onClick={() => setIsModalVisible(!isModalVisible)}
>
{i18n.translate('xpack.apm.serviceDashboards.editEmptyButtonLabel', {
defaultMessage: 'Edit dashboard link',
})}
</EuiButtonEmpty>

{isModalVisible && (
<SaveDashboardModal
onClose={() => setIsModalVisible(!isModalVisible)}
onRefresh={onRefresh}
currentDashboard={currentDashboard}
/>
)}
</>
);
}
@@ -0,0 +1,41 @@
/*
* 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 { EuiButtonEmpty } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { ApmPluginStartDeps } from '../../../../plugin';
import { SavedApmCustomDashboard } from '../../../../../common/custom_dashboards';

export function GotoDashboard({
currentDashboard,
}: {
currentDashboard: SavedApmCustomDashboard;
}) {
const {
services: {
dashboard: { locator: dashboardLocator },
},
} = useKibana<ApmPluginStartDeps>();

const url = dashboardLocator?.getRedirectUrl({
dashboardId: currentDashboard?.dashboardSavedObjectId,
});
return (
<EuiButtonEmpty
data-test-subj="apmGotoDashboardGoToDashboardButton"
color="text"
size="s"
iconType={'visGauge'}
href={url}
>
{i18n.translate('xpack.apm.serviceDashboards.contextMenu.goToDashboard', {
defaultMessage: 'Go to dashboard',
})}
</EuiButtonEmpty>
);
}
@@ -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 { LinkDashboard } from './link_dashboard';
import { GotoDashboard } from './goto_dashboard';
import { EditDashboard } from './edit_dashboard';

export { LinkDashboard, GotoDashboard, EditDashboard };
@@ -0,0 +1,58 @@
/*
* 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 { EuiButton, EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { MergedServiceDashboard } from '..';
import { SaveDashboardModal } from './save_dashboard_modal';

export function LinkDashboard({
onRefresh,
emptyButton = false,
serviceDashboards,
}: {
onRefresh: () => void;
emptyButton?: boolean;
serviceDashboards?: MergedServiceDashboard[];
}) {
const [isModalVisible, setIsModalVisible] = useState(false);

return (
<>
{emptyButton ? (
<EuiButtonEmpty
color="text"
size="s"
iconType={'plusInCircle'}
data-test-subj="apmLinkServiceDashboardMenu"
onClick={() => setIsModalVisible(true)}
>
{i18n.translate('xpack.apm.serviceDashboards.linkEmptyButtonLabel', {
defaultMessage: 'Link new dashboard',
})}
</EuiButtonEmpty>
) : (
<EuiButton
data-test-subj="apmAddServiceDashboard"
onClick={() => setIsModalVisible(true)}
>
{i18n.translate('xpack.apm.serviceDashboards.linkButtonLabel', {
defaultMessage: 'Link dashboard',
})}
</EuiButton>
)}

{isModalVisible && (
<SaveDashboardModal
onClose={() => setIsModalVisible(false)}
onRefresh={onRefresh}
serviceDashboards={serviceDashboards}
/>
)}
</>
);
}