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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
public/app/core/directives/dash_edit_link.js
+8
-1
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
+13
-18
No files found.
public/app/core/directives/dash_edit_link.js
View file @
2d2800e7
...
@@ -25,7 +25,6 @@ function ($, angular, coreModule) {
...
@@ -25,7 +25,6 @@ function ($, angular, coreModule) {
function
hideEditorPane
(
hideToShowOtherView
)
{
function
hideEditorPane
(
hideToShowOtherView
)
{
if
(
editorScope
)
{
if
(
editorScope
)
{
editorScope
.
dismiss
(
hideToShowOtherView
);
editorScope
.
dismiss
(
hideToShowOtherView
);
scope
.
appEvent
(
'dash-editor-hidden'
);
}
}
}
}
...
@@ -61,7 +60,15 @@ function ($, angular, coreModule) {
...
@@ -61,7 +60,15 @@ function ($, angular, coreModule) {
var
urlParams
=
$location
.
search
();
var
urlParams
=
$location
.
search
();
if
(
options
.
editview
===
urlParams
.
editview
)
{
if
(
options
.
editview
===
urlParams
.
editview
)
{
delete
urlParams
.
editview
;
delete
urlParams
.
editview
;
// 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
);
$location
.
search
(
urlParams
);
});
});
}
}
}
}
};
};
...
...
public/app/features/dashboard/time_srv.ts
View file @
2d2800e7
...
@@ -129,10 +129,13 @@ class TimeSrv {
...
@@ -129,10 +129,13 @@ class TimeSrv {
}
}
// update url
// update url
if
(
interval
)
{
var
params
=
this
.
$location
.
search
();
var
params
=
this
.
$location
.
search
();
if
(
interval
)
{
params
.
refresh
=
interval
;
params
.
refresh
=
interval
;
this
.
$location
.
search
(
params
);
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 @@
...
@@ -5,7 +5,7 @@
<label
class=
"small"
>
From:
</label>
<label
class=
"small"
>
From:
</label>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form max-width-28"
>
<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>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<button
class=
"btn gf-form-btn btn-primary"
type=
"button"
ng-click=
"openFromPicker=!openFromPicker"
>
<button
class=
"btn gf-form-btn btn-primary"
type=
"button"
ng-click=
"openFromPicker=!openFromPicker"
>
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<label
class=
"small"
>
To:
</label>
<label
class=
"small"
>
To:
</label>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form max-width-28"
>
<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>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<button
class=
"btn gf-form-btn btn-primary"
type=
"button"
ng-click=
"openToPicker=!openToPicker"
>
<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 {
...
@@ -18,11 +18,11 @@ export class TimePickerCtrl {
panel
:
any
;
panel
:
any
;
absolute
:
any
;
absolute
:
any
;
timeRaw
:
any
;
timeRaw
:
any
;
editTimeRaw
:
any
;
tooltip
:
string
;
tooltip
:
string
;
rangeString
:
string
;
rangeString
:
string
;
timeOptions
:
any
;
timeOptions
:
any
;
refresh
:
any
;
refresh
:
any
;
isOpen
:
boolean
;
isUtc
:
boolean
;
isUtc
:
boolean
;
firstDayOfWeek
:
number
;
firstDayOfWeek
:
number
;
...
@@ -32,18 +32,18 @@ export class TimePickerCtrl {
...
@@ -32,18 +32,18 @@ export class TimePickerCtrl {
$rootScope
.
onAppEvent
(
'shift-time-forward'
,
()
=>
this
.
move
(
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-forward'
,
()
=>
this
.
move
(
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-backward'
,
()
=>
this
.
move
(
-
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-backward'
,
()
=>
this
.
move
(
-
1
),
$scope
);
$rootScope
.
onAppEvent
(
'refresh'
,
()
=>
this
.
init
(),
$scope
);
$rootScope
.
onAppEvent
(
'refresh'
,
this
.
onRefresh
.
bind
(
this
),
$scope
);
$rootScope
.
onAppEvent
(
'dash-editor-hidden'
,
()
=>
this
.
isOpen
=
false
,
$scope
);
this
.
init
();
}
init
()
{
// init options
this
.
panel
=
this
.
dashboard
.
timepicker
;
this
.
panel
=
this
.
dashboard
.
timepicker
;
_
.
defaults
(
this
.
panel
,
TimePickerCtrl
.
defaults
);
_
.
defaults
(
this
.
panel
,
TimePickerCtrl
.
defaults
);
this
.
firstDayOfWeek
=
moment
.
localeData
().
firstDayOfWeek
();
this
.
firstDayOfWeek
=
moment
.
localeData
().
firstDayOfWeek
();
// init time stuff
this
.
onRefresh
();
}
onRefresh
()
{
var
time
=
angular
.
copy
(
this
.
timeSrv
.
timeRange
());
var
time
=
angular
.
copy
(
this
.
timeSrv
.
timeRange
());
var
timeRaw
=
angular
.
copy
(
time
.
raw
);
var
timeRaw
=
angular
.
copy
(
time
.
raw
);
...
@@ -65,13 +65,8 @@ export class TimePickerCtrl {
...
@@ -65,13 +65,8 @@ export class TimePickerCtrl {
this
.
absolute
=
{
fromJs
:
time
.
from
.
toDate
(),
toJs
:
time
.
to
.
toDate
()};
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
.
from
)
+
' <br>to<br>'
;
this
.
tooltip
+=
this
.
dashboard
.
formatDate
(
time
.
to
);
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
)
{
zoom
(
factor
)
{
this
.
$rootScope
.
appEvent
(
'zoom-out'
,
2
);
this
.
$rootScope
.
appEvent
(
'zoom-out'
,
2
);
...
@@ -101,8 +96,8 @@ export class TimePickerCtrl {
...
@@ -101,8 +96,8 @@ export class TimePickerCtrl {
}
}
openDropdown
()
{
openDropdown
()
{
this
.
init
();
this
.
onRefresh
();
this
.
isOpen
=
true
;
this
.
editTimeRaw
=
this
.
timeRaw
;
this
.
timeOptions
=
rangeUtil
.
getRelativeTimesList
(
this
.
panel
,
this
.
rangeString
);
this
.
timeOptions
=
rangeUtil
.
getRelativeTimesList
(
this
.
panel
,
this
.
rangeString
);
this
.
refresh
=
{
this
.
refresh
=
{
value
:
this
.
dashboard
.
refresh
,
value
:
this
.
dashboard
.
refresh
,
...
@@ -125,16 +120,16 @@ export class TimePickerCtrl {
...
@@ -125,16 +120,16 @@ export class TimePickerCtrl {
this
.
timeSrv
.
setAutoRefresh
(
this
.
refresh
.
value
);
this
.
timeSrv
.
setAutoRefresh
(
this
.
refresh
.
value
);
}
}
this
.
timeSrv
.
setTime
(
this
.
t
imeRaw
);
this
.
timeSrv
.
setTime
(
this
.
editT
imeRaw
);
this
.
$rootScope
.
appEvent
(
'hide-dash-editor'
);
this
.
$rootScope
.
appEvent
(
'hide-dash-editor'
);
}
}
absoluteFromChanged
()
{
absoluteFromChanged
()
{
this
.
t
imeRaw
.
from
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
fromJs
);
this
.
editT
imeRaw
.
from
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
fromJs
);
}
}
absoluteToChanged
()
{
absoluteToChanged
()
{
this
.
t
imeRaw
.
to
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
toJs
);
this
.
editT
imeRaw
.
to
=
this
.
getAbsoluteMomentForTimezone
(
this
.
absolute
.
toJs
);
}
}
getAbsoluteMomentForTimezone
(
jsDate
)
{
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