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
2d5d5e63
Unverified
Commit
2d5d5e63
authored
Feb 23, 2018
by
Carl Bergquist
Committed by
GitHub
Feb 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10998 from grafana/10995_shortcut
Fix keyboard shortcuts
parents
3b836c9c
cacfdc64
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
55 deletions
+76
-55
public/app/core/components/help/help.ts
+0
-4
public/app/core/services/keybindingSrv.ts
+5
-26
public/app/features/dashboard/dashboard_ctrl.ts
+39
-0
public/app/features/dashboard/dashboard_model.ts
+28
-0
public/app/features/panel/panel_ctrl.ts
+4
-25
No files found.
public/app/core/components/help/help.ts
View file @
2d5d5e63
...
...
@@ -33,10 +33,6 @@ export class HelpCtrl {
{
keys
:
[
'p'
,
's'
],
description
:
'Open Panel Share Modal'
},
{
keys
:
[
'p'
,
'r'
],
description
:
'Remove Panel'
},
],
'Focused Row'
:
[
{
keys
:
[
'r'
,
'c'
],
description
:
'Collapse Row'
},
{
keys
:
[
'r'
,
'r'
],
description
:
'Remove Row'
},
],
'Time Range'
:
[
{
keys
:
[
't'
,
'z'
],
description
:
'Zoom out time range'
},
{
...
...
public/app/core/services/keybindingSrv.ts
View file @
2d5d5e63
...
...
@@ -171,8 +171,9 @@ export class KeybindingSrv {
// delete panel
this
.
bind
(
'p r'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
&&
dashboard
.
meta
.
canEdit
)
{
var
panelInfo
=
dashboard
.
getPanelInfoById
(
dashboard
.
meta
.
focusPanelId
);
panelInfo
.
row
.
removePanel
(
panelInfo
.
panel
);
this
.
$rootScope
.
appEvent
(
'panel-remove'
,
{
panelId
:
dashboard
.
meta
.
focusPanelId
,
});
dashboard
.
meta
.
focusPanelId
=
0
;
}
});
...
...
@@ -192,36 +193,14 @@ export class KeybindingSrv {
}
});
// delete row
this
.
bind
(
'r r'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
&&
dashboard
.
meta
.
canEdit
)
{
var
panelInfo
=
dashboard
.
getPanelInfoById
(
dashboard
.
meta
.
focusPanelId
);
dashboard
.
removeRow
(
panelInfo
.
row
);
dashboard
.
meta
.
focusPanelId
=
0
;
}
});
// collapse row
this
.
bind
(
'r c'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
)
{
var
panelInfo
=
dashboard
.
getPanelInfoById
(
dashboard
.
meta
.
focusPanelId
);
panelInfo
.
row
.
toggleCollapse
();
dashboard
.
meta
.
focusPanelId
=
0
;
}
});
// collapse all rows
this
.
bind
(
'd shift+c'
,
()
=>
{
for
(
let
row
of
dashboard
.
rows
)
{
row
.
collapse
=
true
;
}
dashboard
.
collapseRows
();
});
// expand all rows
this
.
bind
(
'd shift+e'
,
()
=>
{
for
(
let
row
of
dashboard
.
rows
)
{
row
.
collapse
=
false
;
}
dashboard
.
expandRows
();
});
this
.
bind
(
'd n'
,
e
=>
{
...
...
public/app/features/dashboard/dashboard_ctrl.ts
View file @
2d5d5e63
...
...
@@ -3,6 +3,7 @@ import config from 'app/core/config';
import
coreModule
from
'app/core/core_module'
;
import
{
PanelContainer
}
from
'./dashgrid/PanelContainer'
;
import
{
DashboardModel
}
from
'./dashboard_model'
;
import
{
PanelModel
}
from
'./panel_model'
;
export
class
DashboardCtrl
implements
PanelContainer
{
dashboard
:
DashboardModel
;
...
...
@@ -130,9 +131,47 @@ export class DashboardCtrl implements PanelContainer {
return
this
;
}
onRemovingPanel
(
evt
,
options
)
{
options
=
options
||
{};
if
(
!
options
.
panelId
)
{
return
;
}
var
panelInfo
=
this
.
dashboard
.
getPanelInfoById
(
options
.
panelId
);
this
.
removePanel
(
panelInfo
.
panel
,
true
);
}
removePanel
(
panel
:
PanelModel
,
ask
:
boolean
)
{
// confirm deletion
if
(
ask
!==
false
)
{
var
text2
,
confirmText
;
if
(
panel
.
alert
)
{
text2
=
'Panel includes an alert rule, removing panel will also remove alert rule'
;
confirmText
=
'YES'
;
}
this
.
$scope
.
appEvent
(
'confirm-modal'
,
{
title
:
'Remove Panel'
,
text
:
'Are you sure you want to remove this panel?'
,
text2
:
text2
,
icon
:
'fa-trash'
,
confirmText
:
confirmText
,
yesText
:
'Remove'
,
onConfirm
:
()
=>
{
this
.
removePanel
(
panel
,
false
);
},
});
return
;
}
this
.
dashboard
.
removePanel
(
panel
);
}
init
(
dashboard
)
{
this
.
$scope
.
onAppEvent
(
'show-json-editor'
,
this
.
showJsonEditor
.
bind
(
this
));
this
.
$scope
.
onAppEvent
(
'template-variable-value-updated'
,
this
.
templateVariableUpdated
.
bind
(
this
));
this
.
$scope
.
onAppEvent
(
'panel-remove'
,
this
.
onRemovingPanel
.
bind
(
this
));
this
.
setupDashboard
(
dashboard
);
}
}
...
...
public/app/features/dashboard/dashboard_model.ts
View file @
2d5d5e63
...
...
@@ -524,6 +524,34 @@ export class DashboardModel {
this
.
removePanel
(
row
);
}
expandRows
()
{
for
(
let
i
=
0
;
i
<
this
.
panels
.
length
;
i
++
)
{
var
panel
=
this
.
panels
[
i
];
if
(
panel
.
type
!==
'row'
)
{
continue
;
}
if
(
panel
.
collapsed
)
{
this
.
toggleRow
(
panel
);
}
}
}
collapseRows
()
{
for
(
let
i
=
0
;
i
<
this
.
panels
.
length
;
i
++
)
{
var
panel
=
this
.
panels
[
i
];
if
(
panel
.
type
!==
'row'
)
{
continue
;
}
if
(
!
panel
.
collapsed
)
{
this
.
toggleRow
(
panel
);
}
}
}
setPanelFocus
(
id
)
{
this
.
meta
.
focusPanelId
=
id
;
}
...
...
public/app/features/panel/panel_ctrl.ts
View file @
2d5d5e63
...
...
@@ -241,31 +241,10 @@ export class PanelCtrl {
});
}
removePanel
(
ask
:
boolean
)
{
// confirm deletion
if
(
ask
!==
false
)
{
var
text2
,
confirmText
;
if
(
this
.
panel
.
alert
)
{
text2
=
'Panel includes an alert rule, removing panel will also remove alert rule'
;
confirmText
=
'YES'
;
}
appEvents
.
emit
(
'confirm-modal'
,
{
title
:
'Remove Panel'
,
text
:
'Are you sure you want to remove this panel?'
,
text2
:
text2
,
icon
:
'fa-trash'
,
confirmText
:
confirmText
,
yesText
:
'Remove'
,
onConfirm
:
()
=>
{
this
.
removePanel
(
false
);
},
});
return
;
}
this
.
dashboard
.
removePanel
(
this
.
panel
);
removePanel
()
{
this
.
publishAppEvent
(
'panel-remove'
,
{
panelId
:
this
.
panel
.
id
,
});
}
editPanelJson
()
{
...
...
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