Skip to content

Commit

Permalink
Add documentation links to Visualize/Dashboard (#31406)
Browse files Browse the repository at this point in the history
* Add documentation links to Visualize/Dashboard

* Add more targeted links
  • Loading branch information
timroes authored Feb 19, 2019
1 parent c90b972 commit 597c142
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { ContextMenuActionsRegistryProvider } from 'ui/embeddable';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';
import { timefilter } from 'ui/timefilter';
import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';
import { documentationLinks } from 'ui/documentation_links';

import { DashboardViewportProvider } from './viewport/dashboard_viewport_provider';

Expand Down Expand Up @@ -86,6 +87,7 @@ app.directive('dashboardApp', function ($injector) {
$rootScope,
$route,
$routeParams,
$window,
getAppState,
dashboardConfig,
localStorage,
Expand Down Expand Up @@ -364,6 +366,7 @@ app.directive('dashboardApp', function ($injector) {
$scope.kbnTopNav.click('edit');
};
const navActions = {};
navActions[TopNavIds.DOCUMENTATION] = () => $window.open(documentationLinks.kibana.dashboard);
navActions[TopNavIds.FULL_SCREEN] = () =>
dashboardStateManager.setFullScreenMode(true);
navActions[TopNavIds.EXIT_EDIT_MODE] = () => onChangeViewMode(DashboardViewMode.VIEW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function getTopNavConfig(dashboardMode, actions, hideWriteControls) {
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN]),
getShareConfig(actions[TopNavIds.SHARE]),
getCloneConfig(actions[TopNavIds.CLONE]),
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE])
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE]),
getDocumentationConfig(actions[TopNavIds.DOCUMENTATION]),
]
);
case DashboardViewMode.EDIT:
Expand All @@ -50,7 +51,9 @@ export function getTopNavConfig(dashboardMode, actions, hideWriteControls) {
getViewConfig(actions[TopNavIds.EXIT_EDIT_MODE]),
getAddConfig(actions[TopNavIds.ADD]),
getOptionsConfig(actions[TopNavIds.OPTIONS]),
getShareConfig(actions[TopNavIds.SHARE])];
getShareConfig(actions[TopNavIds.SHARE]),
getDocumentationConfig(actions[TopNavIds.DOCUMENTATION]),
];
default:
return [];
}
Expand Down Expand Up @@ -180,3 +183,15 @@ function getOptionsConfig(action) {
run: action,
};
}

function getDocumentationConfig(action) {
return {
key: i18n.translate('kbn.dashboard.topNav.documentationButtonKey', {
defaultMessage: 'documentation',
}),
description: i18n.translate('kbn.dashboard.topNav.documentationButtonDescription', {
defaultMessage: 'Documentation',
}),
run: action,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export const TopNavIds = {
ADD: 'add',
SHARE: 'share',
DOCUMENTATION: 'documentation',
OPTIONS: 'options',
SAVE: 'save',
EXIT_EDIT_MODE: 'exitEditMode',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { showShareContextMenu, ShareContextMenuExtensionsRegistryProvider } from
import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';
import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal';
import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal';
import { documentationLinks } from 'ui/documentation_links';

uiRoutes
.when(VisualizeConstants.CREATE_PATH, {
Expand Down Expand Up @@ -234,6 +235,14 @@ function VisEditor(
vis.forceReload();
},
testId: 'visualizeRefreshButton',
}, {
key: i18n('kbn.topNavManu.documentationLabel', { defaultMessage: 'documentation' }),
description: i18n('kbn.visualize.topNavMenu.documentationButtonDescription', {
defaultMessage: 'Documentation',
}),
run() {
$window.open(documentationLinks.kibana.visualize);
},
}];

let stateMonitor;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/public/documentation_links/documentation_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const documentationLinks = {
loadingData: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/tutorial-load-dataset.html`,
introduction: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index-patterns.html`,
},
kibana: {
visualize: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/visualize.html`,
dashboard: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html`,
},
query: {
luceneQuerySyntax: `${ELASTIC_DOCS}query-dsl-query-string-query.html#query-string-syntax`,
queryDsl: `${ELASTIC_DOCS}query-dsl.html`,
Expand Down

0 comments on commit 597c142

Please sign in to comment.