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
2d2800e7
Commit
2d2800e7
authored
Jul 24, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: url did not update correctly when closing settings view by using ESC key, fixes #8869
parent
cff1c370
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
24 deletions
+29
-24
public/app/core/directives/dash_edit_link.js
+9
-2
public/app/features/dashboard/time_srv.ts
+4
-1
public/app/features/dashboard/timepicker/dropdown.html
+2
-2
public/app/features/dashboard/timepicker/timepicker.ts
+14
-19
No files found.
public/app/core/directives/dash_edit_link.js
View file @
2d2800e7
...
...
@@ -25,7 +25,6 @@ function ($, angular, coreModule) {
function
hideEditorPane
(
hideToShowOtherView
)
{
if
(
editorScope
)
{
editorScope
.
dismiss
(
hideToShowOtherView
);
scope
.
appEvent
(
'dash-editor-hidden'
);
}
}
...
...
@@ -61,7 +60,15 @@ function ($, angular, coreModule) {
var
urlParams
=
$location
.
search
();
if
(
options
.
editview
===
urlParams
.
editview
)
{
delete
urlParams
.
editview
;
$location
.
search
(
urlParams
);
// even though we always are in apply phase here
// some angular bug is causing location search updates to
// not happen always so this is a hack fix or that
setTimeout
(
function
()
{
$rootScope
.
$apply
(
function
()
{
$location
.
search
(
urlParams
);
});
});
}
}
};
...
...
public/app/features/dashboard/time_srv.ts
View file @
2d2800e7
...
...
@@ -129,10 +129,13 @@ class TimeSrv {
}
// update url
var
params
=
this
.
$location
.
search
();
if
(
interval
)
{
var
params
=
this
.
$location
.
search
();
params
.
refresh
=
interval
;
this
.
$location
.
search
(
params
);
}
else
if
(
params
.
refresh
)
{
delete
params
.
refresh
;
this
.
$location
.
search
(
params
);
}
}
...
...
public/app/features/dashboard/timepicker/dropdown.html
View file @
2d2800e7
...
...
@@ -5,7 +5,7 @@
<label
class=
"small"
>
From:
</label>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form max-width-28"
>
<input
type=
"text"
class=
"gf-form-input input-large"
ng-model=
"ctrl.
t
imeRaw.from"
input-datetime
>
<input
type=
"text"
class=
"gf-form-input input-large"
ng-model=
"ctrl.
editT
imeRaw.from"
input-datetime
>
</div>
<div
class=
"gf-form"
>
<button
class=
"btn gf-form-btn btn-primary"
type=
"button"
ng-click=
"openFromPicker=!openFromPicker"
>
...
...
@@ -22,7 +22,7 @@
<label
class=
"small"
>
To:
</label>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form max-width-28"
>
<input
type=
"text"
class=
"gf-form-input input-large"
ng-model=
"ctrl.
t
imeRaw.to"
input-datetime
>
<input
type=
"text"
class=
"gf-form-input input-large"
ng-model=
"ctrl.
editT
imeRaw.to"
input-datetime
>
</div>
<div
class=
"gf-form"
>
<button
class=
"btn gf-form-btn btn-primary"
type=
"button"
ng-click=
"openToPicker=!openToPicker"
>
...
...
public/app/features/dashboard/timepicker/timepicker.ts
View file @
2d2800e7
...
...
@@ -18,11 +18,11 @@ export class TimePickerCtrl {
panel
:
any
;
absolute
:
any
;
timeRaw
:
any
;
editTimeRaw
:
any
;
tooltip
:
string
;
rangeString
:
string
;
timeOptions
:
any
;
refresh
:
any
;
isOpen
:
boolean
;
isUtc
:
boolean
;
firstDayOfWeek
:
number
;
...
...
@@ -32,18 +32,18 @@ export class TimePickerCtrl {
$rootScope
.
onAppEvent
(
'shift-time-forward'
,
()
=>
this
.
move
(
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-backward'
,
()
=>
this
.
move
(
-
1
),
$scope
);
$rootScope
.
onAppEvent
(
'refresh'
,
()
=>
this
.
init
(),
$scope
);
$rootScope
.
onAppEvent
(
'dash-editor-hidden'
,
()
=>
this
.
isOpen
=
false
,
$scope
);
this
.
init
();
}
$rootScope
.
onAppEvent
(
'refresh'
,
this
.
onRefresh
.
bind
(
this
),
$scope
);
init
()
{
// init options
this
.
panel
=
this
.
dashboard
.
timepicker
;
_
.
defaults
(
this
.
panel
,
TimePickerCtrl
.
defaults
);
this
.
firstDayOfWeek
=
moment
.
localeData
().
firstDayOfWeek
();
// init time stuff
this
.
onRefresh
();
}
onRefresh
()
{
var
time
=
angular
.
copy
(
this
.
timeSrv
.
timeRange
());
var
timeRaw
=
angular
.
copy
(
time
.
raw
);
...
...
@@ -65,12 +65,7 @@ export class TimePickerCtrl {
this
.
absolute
=
{
fromJs
:
time
.
from
.
toDate
(),
toJs
:
time
.
to
.
toDate
()};
this
.
tooltip
=
this
.
dashboard
.
formatDate
(
time
.
from
)
+
' <br>to<br>'
;
this
.
tooltip
+=
this
.
dashboard
.
formatDate
(
time
.
to
);
// do not update time raw when dropdown is open
// as auto refresh will reset the from/to input fields
if
(
!
this
.
isOpen
)
{
this
.
timeRaw
=
timeRaw
;
}
this
.
timeRaw
=
timeRaw
;
}
zoom
(
factor
)
{
...
...
@@ -101,8 +96,8 @@ export class TimePickerCtrl {
}
openDropdown
()
{
this
.
init
();
this
.
isOpen
=
true
;
this
.
onRefresh
();
this
.
editTimeRaw
=
this
.
timeRaw
;
this
.
timeOptions
=
rangeUtil
.
getRelativeTimesList
(
this
.
panel
,
this
.
rangeString
);
this
.
refresh
=
{
value
:
this
.
dashboard
.
refresh
,
...
...
@@ -125,16 +120,16 @@ export class TimePickerCtrl {
this
.
timeSrv
.
setAutoRefresh
(
this
.
refresh
.
value
);
}
this
.
timeSrv
.
setTime
(
this
.
t
imeRaw
);
this
.
timeSrv
.
setTime
(
this
.
editT
imeRaw
);
this
.
$rootScope
.
appEvent
(
'hide-dash-editor'
);
}
absoluteFromChanged
()
{
this
.
t
imeRaw
.
from
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
fromJs
);
this
.
editT
imeRaw
.
from
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
fromJs
);
}
absoluteToChanged
()
{
this
.
t
imeRaw
.
to
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
toJs
);
this
.
editT
imeRaw
.
to
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
toJs
);
}
getAbsoluteMomentForTimezone
(
jsDate
)
{
...
...
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