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
4a8effdd
Commit
4a8effdd
authored
Feb 03, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed panel removal
parent
09efa24f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
33 deletions
+40
-33
public/app/core/services/keybindingSrv.ts
+2
-4
public/app/features/dashboard/components/DashNav/DashNav.tsx
+18
-22
public/app/features/dashboard/state/DashboardModel.ts
+8
-3
public/app/features/dashboard/state/initDashboard.ts
+10
-1
public/app/features/panel/panel_ctrl.ts
+2
-3
No files found.
public/app/core/services/keybindingSrv.ts
View file @
4a8effdd
...
...
@@ -144,7 +144,7 @@ export class KeybindingSrv {
this
.
$location
.
search
(
search
);
}
setupDashboardBindings
(
scope
,
dashboard
)
{
setupDashboardBindings
(
scope
,
dashboard
,
onRemovePanel
)
{
this
.
bind
(
'mod+o'
,
()
=>
{
dashboard
.
graphTooltip
=
(
dashboard
.
graphTooltip
+
1
)
%
3
;
appEvents
.
emit
(
'graph-hover-clear'
);
...
...
@@ -212,9 +212,7 @@ export class KeybindingSrv {
// delete panel
this
.
bind
(
'p r'
,
()
=>
{
if
(
dashboard
.
meta
.
focusPanelId
&&
dashboard
.
meta
.
canEdit
)
{
this
.
$rootScope
.
appEvent
(
'panel-remove'
,
{
panelId
:
dashboard
.
meta
.
focusPanelId
,
});
onRemovePanel
(
dashboard
.
meta
.
focusPanelId
);
dashboard
.
meta
.
focusPanelId
=
0
;
}
});
...
...
public/app/features/dashboard/components/DashNav/DashNav.tsx
View file @
4a8effdd
...
...
@@ -171,33 +171,29 @@ export class DashNav extends PureComponent<Props> {
<
i
className=
"fa fa-link"
/>
</
a
>
)
}
</
div
>
<
div
className=
"navbar-buttons navbar-buttons--tv"
>
<
button
className=
"btn navbar-button navbar-button--tv"
onClick=
{
this
.
onToggleTVMode
}
title=
"Cycle view mode"
>
<
i
className=
"fa fa-desktop"
/>
</
button
>
</
div
>
{
// <gf-time-picker class="gf-timepicker-nav" dashboard="ctrl.dashboard" ng-if="!ctrl.dashboard.timepicker.hidden"></gf-time-picker>
}
<
div
className=
"navbar-buttons navbar-buttons--tv"
>
{
(
isFullscreen
||
editview
)
&&
(
<
div
className=
"navbar-buttons navbar-buttons--close"
>
<
button
className=
"btn navbar-button navbar-button--
tv
"
onClick=
{
this
.
on
ToggleTVMod
e
}
title=
"
Cycle view mode
"
className=
"btn navbar-button navbar-button--
primary
"
onClick=
{
this
.
on
Clos
e
}
title=
"
Back to dashboard
"
>
<
i
className=
"fa fa-
desktop
"
/>
<
i
className=
"fa fa-
reply
"
/>
</
button
>
</
div
>
{
// <gf-time-picker class="gf-timepicker-nav" dashboard="ctrl.dashboard" ng-if="!ctrl.dashboard.timepicker.hidden"></gf-time-picker>
}
{
(
isFullscreen
||
editview
)
&&
(
<
div
className=
"navbar-buttons navbar-buttons--close"
>
<
button
className=
"btn navbar-button navbar-button--primary"
onClick=
{
this
.
onClose
}
title=
"Back to dashboard"
>
<
i
className=
"fa fa-reply"
/>
</
button
>
</
div
>
)
}
</
div
>
)
}
</
div
>
);
}
...
...
public/app/features/dashboard/state/DashboardModel.ts
View file @
4a8effdd
// Libaries
import
moment
from
'moment'
;
import
_
from
'lodash'
;
import
{
DEFAULT_ANNOTATION_COLOR
}
from
'@grafana/ui'
;
// Constants
import
{
DEFAULT_ANNOTATION_COLOR
}
from
'@grafana/ui'
;
import
{
GRID_COLUMN_COUNT
,
REPEAT_DIR_VERTICAL
,
GRID_CELL_HEIGHT
,
GRID_CELL_VMARGIN
}
from
'app/core/constants'
;
// Utils & Services
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
contextSrv
}
from
'app/core/services/context_srv'
;
import
sortByKeys
from
'app/core/utils/sort_by_keys'
;
// Types
import
{
PanelModel
}
from
'./PanelModel'
;
import
{
DashboardMigrator
}
from
'./DashboardMigrator'
;
import
{
TimeRange
}
from
'@grafana/ui/src'
;
export
class
DashboardModel
{
id
:
any
;
uid
:
any
;
title
:
any
;
uid
:
string
;
title
:
string
;
autoUpdate
:
any
;
description
:
any
;
tags
:
any
;
...
...
public/app/features/dashboard/state/initDashboard.ts
View file @
4a8effdd
...
...
@@ -7,6 +7,7 @@ import { updateLocation } from 'app/core/actions';
import
{
notifyApp
}
from
'app/core/actions'
;
import
locationUtil
from
'app/core/utils/location_util'
;
import
{
setDashboardLoadingState
,
ThunkResult
,
setDashboardModel
}
from
'./actions'
;
import
{
removePanel
}
from
'../utils/panel'
;
// Types
import
{
DashboardLoadingState
}
from
'app/types/dashboard'
;
...
...
@@ -102,7 +103,15 @@ export function initDashboard({ $injector, $scope, urlUid, urlSlug, urlType }: I
$scope
.
dashboard
=
dashboard
;
$injector
.
get
(
'dashboardViewStateSrv'
).
create
(
$scope
);
$injector
.
get
(
'keybindingSrv'
).
setupDashboardBindings
(
$scope
,
dashboard
);
// dashboard keybindings should not live in core, this needs a bigger refactoring
// So declaring this here so it can depend on the removePanel util function
// Long term onRemovePanel should be handled via react prop callback
const
onRemovePanel
=
(
panelId
:
number
)
=>
{
removePanel
(
dashboard
,
dashboard
.
getPanelById
(
panelId
),
true
);
};
$injector
.
get
(
'keybindingSrv'
).
setupDashboardBindings
(
$scope
,
dashboard
,
onRemovePanel
);
}
catch
(
err
)
{
dispatch
(
notifyApp
(
createErrorNotification
(
'Dashboard init failed'
,
err
.
toString
())));
console
.
log
(
err
);
...
...
public/app/features/panel/panel_ctrl.ts
View file @
4a8effdd
...
...
@@ -7,6 +7,7 @@ import { Emitter } from 'app/core/core';
import
getFactors
from
'app/core/utils/factors'
;
import
{
duplicatePanel
,
removePanel
,
copyPanel
as
copyPanelUtil
,
editPanelJson
as
editPanelJsonUtil
,
sharePanel
as
sharePanelUtil
,
...
...
@@ -213,9 +214,7 @@ export class PanelCtrl {
}
removePanel
()
{
this
.
publishAppEvent
(
'panel-remove'
,
{
panelId
:
this
.
panel
.
id
,
});
removePanel
(
this
.
dashboard
,
this
.
panel
,
true
);
}
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