forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow plugins to hide write controls in the dashboard app (elastic#11537
) * Implement a way to hide write controls from dashboard * Add roles definition to the saved dashboard object * Remove roles from dashboard * Use an angular provider to control the hideWriteControls flag * Add an api to chrome to show only a single app by id * Refactor injectVars logic * Fix tests * Refactor kibana root controller * add additional test functionality * Missed a couple spots for hiding edit controls * add retry and help text for dash only mode failures See if it helps. Tests pass locally. * Move element into screen when clicking * use shorthand for object creation * Hide checkboxes, show 'no dashboard' message with the button
- Loading branch information
1 parent
0887f81
commit 1f72d49
Showing
16 changed files
with
136 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function injectVars(server) { | ||
const serverConfig = server.config(); | ||
|
||
//DEPRECATED SETTINGS | ||
//if the url is set, the old settings must be used. | ||
//keeping this logic for backward compatibilty. | ||
const configuredUrl = server.config().get('tilemap.url'); | ||
const isOverridden = typeof configuredUrl === 'string' && configuredUrl !== ''; | ||
const tilemapConfig = serverConfig.get('tilemap'); | ||
|
||
return { | ||
kbnDefaultAppId: serverConfig.get('kibana.defaultAppId'), | ||
tilemapsConfig: { | ||
deprecated: { | ||
isOverridden, | ||
config: tilemapConfig, | ||
}, | ||
manifestServiceUrl: serverConfig.get('tilemap.manifestServiceUrl') | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/core_plugins/kibana/public/dashboard/dashboard_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { uiModules } from 'ui/modules'; | ||
uiModules.get('kibana') | ||
.provider('dashboardConfig', () => { | ||
let hideWriteControls = false; | ||
|
||
return { | ||
/** | ||
* Part of the exposed plugin API - do not remove without careful consideration. | ||
* @type {boolean} | ||
*/ | ||
turnHideWriteControlsOn() { | ||
hideWriteControls = true; | ||
}, | ||
$get() { | ||
return { | ||
getHideWriteControls() { | ||
return hideWriteControls; | ||
} | ||
}; | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import moment from 'moment-timezone'; | ||
|
||
export function KibanaRootController($scope, courier, config) { | ||
// wait for the application to finish loading | ||
$scope.$on('application.load', function () { | ||
courier.start(); | ||
}); | ||
|
||
config.watch('dateFormat:tz', setDefaultTimezone, $scope); | ||
config.watch('dateFormat:dow', setStartDayOfWeek, $scope); | ||
|
||
function setDefaultTimezone(tz) { | ||
moment.tz.setDefault(tz); | ||
} | ||
|
||
function setStartDayOfWeek(day) { | ||
const dow = moment.weekdays().indexOf(day); | ||
moment.updateLocale(moment.locale(), { week: { dow } }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.