Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
f91e0672
Commit
f91e0672
authored
Nov 03, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ux(dashboard): keybinding changes / new, #6442
parent
8ea2d3f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
14 deletions
+53
-14
public/app/core/services/keybindingSrv.ts
+38
-11
public/app/features/dashboard/dashnav/dashnav.html
+5
-0
public/app/features/dashboard/dashnav/dashnav.ts
+7
-0
public/app/features/org/prefs_control.ts
+3
-3
No files found.
public/app/core/services/keybindingSrv.ts
View file @
f91e0672
///<reference path="../../headers/common.d.ts" />
import
$
from
'jquery'
;
import
_
from
'lodash'
;
import
coreModule
from
'app/core/core_module'
;
import
appEvents
from
'app/core/app_events'
;
...
...
@@ -9,10 +10,15 @@ import Mousetrap from 'mousetrap';
export
class
KeybindingSrv
{
helpModal
:
boolean
;
bindings
:
any
;
/** @ngInject */
constructor
(
private
$rootScope
,
private
$modal
,
private
$location
,
private
contextSrv
)
{
constructor
(
private
$rootScope
,
private
$modal
,
private
$location
,
private
contextSrv
,
private
$timeout
)
{
// clear out all shortcuts on route change
$rootScope
.
$on
(
'$routeChangeSuccess'
,
()
=>
{
Mousetrap
.
reset
();
...
...
@@ -23,9 +29,8 @@ export class KeybindingSrv {
this
.
setupGlobal
();
}
setupGlobal
()
{
this
.
bind
(
"?"
,
this
.
showHelpModal
);
this
.
bind
(
[
'?'
,
'h'
]
,
this
.
showHelpModal
);
this
.
bind
(
"g h"
,
this
.
goToHome
);
this
.
bind
(
"g a"
,
this
.
openAlerting
);
this
.
bind
(
"g p"
,
this
.
goToProfile
);
...
...
@@ -54,7 +59,6 @@ export class KeybindingSrv {
}
showHelpModal
()
{
console
.
log
(
'showing help modal'
);
appEvents
.
emit
(
'show-modal'
,
{
src
:
'public/app/partials/help_modal.html'
,
model
:
{}
...
...
@@ -69,6 +73,11 @@ export class KeybindingSrv {
});
}
showDashEditView
(
view
)
{
var
search
=
_
.
extend
(
this
.
$location
.
search
(),
{
editview
:
view
});
this
.
$location
.
search
(
search
);
}
setupDashboardBindings
(
scope
,
dashboard
)
{
this
.
bind
(
'b'
,
()
=>
{
dashboard
.
toggleEditMode
();
...
...
@@ -82,11 +91,6 @@ export class KeybindingSrv {
this
.
bind
([
'ctrl+s'
,
'command+s'
],
()
=>
{
scope
.
appEvent
(
'save-dashboard'
);
});
this
.
bind
(
'r'
,
()
=>
{
scope
.
broadcastRefresh
();
});
this
.
bind
(
'ctrl+z'
,
()
=>
{
scope
.
appEvent
(
'zoom-out'
);
});
...
...
@@ -128,7 +132,7 @@ export class KeybindingSrv {
});
// delete panel
this
.
bind
(
'
d
'
,
()
=>
{
this
.
bind
(
'
r
'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
&&
dashboard
.
meta
.
canEdit
)
{
var
panelInfo
=
dashboard
.
getPanelInfoById
(
dashboard
.
meta
.
focusPanelId
);
panelInfo
.
row
.
removePanel
(
panelInfo
.
panel
);
...
...
@@ -136,6 +140,29 @@ export class KeybindingSrv {
}
});
// delete panel
this
.
bind
(
's'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
)
{
var
shareScope
=
scope
.
$new
();
var
panelInfo
=
dashboard
.
getPanelInfoById
(
dashboard
.
meta
.
focusPanelId
);
shareScope
.
panel
=
panelInfo
.
panel
;
shareScope
.
dashboard
=
dashboard
;
appEvents
.
emit
(
'show-modal'
,
{
src
:
'public/app/features/dashboard/partials/shareModal.html'
,
scope
:
shareScope
});
}
});
this
.
bind
(
'd r'
,
()
=>
{
scope
.
broadcastRefresh
();
});
this
.
bind
(
'd s'
,
()
=>
{
this
.
showDashEditView
(
'settings'
);
});
this
.
bind
(
'esc'
,
()
=>
{
var
popups
=
$
(
'.popover.in'
);
if
(
popups
.
length
>
0
)
{
...
...
public/app/features/dashboard/dashnav/dashnav.html
View file @
f91e0672
...
...
@@ -64,6 +64,11 @@
<li
ng-if=
"dashboardMeta.canEdit"
><a
class=
"pointer"
ng-click=
"viewJson();"
>
View JSON
</a></li>
<li
ng-if=
"contextSrv.isEditor && !dashboard.editable"
><a
class=
"pointer"
ng-click=
"makeEditable();"
>
Make Editable
</a></li>
<li
ng-if=
"contextSrv.isEditor"
><a
class=
"pointer"
ng-click=
"saveDashboardAs();"
>
Save As...
</a></li>
<li
class=
"dropdown-menu-item-with-shortcut"
>
<a
class=
"pointer"
ng-click=
"showHelpModal();"
>
Help
<span
class=
"dropdown-menu-item-shortcut"
>
h
</span>
</a>
</li>
<li
ng-if=
"dashboardMeta.canSave"
><a
class=
"pointer"
ng-click=
"deleteDashboard();"
>
Delete dashboard
</a></li>
</ul>
</li>
...
...
public/app/features/dashboard/dashnav/dashnav.ts
View file @
f91e0672
...
...
@@ -33,6 +33,13 @@ export class DashNavCtrl {
$location
.
search
(
search
);
};
$scope
.
showHelpModal
=
function
()
{
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'public/app/partials/help_modal.html'
,
model
:
{}
});
};
$scope
.
starDashboard
=
function
()
{
if
(
$scope
.
dashboardMeta
.
isStarred
)
{
backendSrv
.
delete
(
'/api/user/stars/dashboard/'
+
$scope
.
dashboard
.
id
).
then
(
function
()
{
...
...
public/app/features/org/prefs_control.ts
View file @
f91e0672
...
...
@@ -53,21 +53,21 @@ var template = `
<h3 class="page-heading">Preferences</h3>
<div class="gf-form">
<span class="gf-form-label width-
9
">UI Theme</span>
<span class="gf-form-label width-
10
">UI Theme</span>
<div class="gf-form-select-wrapper max-width-20">
<select class="gf-form-input" ng-model="ctrl.prefs.theme" ng-options="f.value as f.text for f in ctrl.themes"></select>
</div>
</div>
<div class="gf-form">
<span class="gf-form-label width-
9
">Home Dashboard</span>
<span class="gf-form-label width-
10
">Home Dashboard</span>
<dashboard-selector class="gf-form-select-wrapper max-width-20 gf-form-select-wrapper--has-help-icon"
model="ctrl.prefs.homeDashboardId">
</dashboard-selector>
</div>
<div class="gf-form">
<label class="gf-form-label width-
9
">Timezone</label>
<label class="gf-form-label width-
10
">Timezone</label>
<div class="gf-form-select-wrapper max-width-20">
<select class="gf-form-input" ng-model="ctrl.prefs.timezone" ng-options="f.value as f.text for f in ctrl.timezones"></select>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment