mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
0cbd62c2fe
commit
fdfd477ccf
2 changed files with 15 additions and 7 deletions
|
@ -267,7 +267,7 @@ app.directive('dashboardApp', function ($injector) {
|
|||
$scope.$listen(timefilter, 'fetch', $scope.refresh);
|
||||
|
||||
function updateViewMode(newMode) {
|
||||
$scope.topNavMenu = dashboardConfig.getHideWriteControls() ? [] : getTopNavConfig(newMode, navActions); // eslint-disable-line no-use-before-define
|
||||
$scope.topNavMenu = getTopNavConfig(newMode, navActions, dashboardConfig.getHideWriteControls()); // eslint-disable-line no-use-before-define
|
||||
dashboardState.switchViewMode(newMode);
|
||||
$scope.dashboardViewMode = newMode;
|
||||
}
|
||||
|
|
|
@ -5,17 +5,25 @@ import { TopNavIds } from './top_nav_ids';
|
|||
* @param {DashboardMode} dashboardMode.
|
||||
* @param actions {Object} - A mapping of TopNavIds to an action function that should run when the
|
||||
* corresponding top nav is clicked.
|
||||
* @param hideWriteControls {boolean} if true, does not include any controls that allow editing or creating objects.
|
||||
* @return {Array<kbnTopNavConfig>} - Returns an array of objects for a top nav configuration, based on the
|
||||
* mode.
|
||||
*/
|
||||
export function getTopNavConfig(dashboardMode, actions) {
|
||||
export function getTopNavConfig(dashboardMode, actions, hideWriteControls) {
|
||||
switch (dashboardMode) {
|
||||
case DashboardViewMode.VIEW:
|
||||
return [
|
||||
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN]),
|
||||
getShareConfig(),
|
||||
getCloneConfig(actions[TopNavIds.CLONE]),
|
||||
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE])];
|
||||
return (
|
||||
hideWriteControls ?
|
||||
[
|
||||
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN])
|
||||
]
|
||||
: [
|
||||
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN]),
|
||||
getShareConfig(),
|
||||
getCloneConfig(actions[TopNavIds.CLONE]),
|
||||
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE])
|
||||
]
|
||||
);
|
||||
case DashboardViewMode.EDIT:
|
||||
return [
|
||||
getSaveConfig(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue