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
52644bb2
Commit
52644bb2
authored
Jan 07, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(timepicker): fixed recent breaking of datetime picker when swithing from requirejs to systemjs
parent
7cad3c89
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
43 deletions
+40
-43
public/app/features/dashboard/timepicker/input_date.ts
+36
-39
public/app/features/dashboard/timepicker/timepicker.ts
+3
-3
public/app/grafana.ts
+1
-1
No files found.
public/app/features/dashboard/timepicker/input_date.
j
s
→
public/app/features/dashboard/timepicker/input_date.
t
s
View file @
52644bb2
define
([
"angular"
,
"lodash"
,
"moment"
,
],
function
(
angular
,
_
,
moment
)
{
'use strict'
;
///<reference path="../../../headers/common.d.ts" />
angular
.
module
(
"grafana.directives"
).
directive
(
'inputDatetime'
,
function
()
{
return
{
restrict
:
'A'
,
require
:
'ngModel'
,
link
:
function
(
$scope
,
$elem
,
attrs
,
ngModel
)
{
var
format
=
'YYYY-MM-DD HH:mm:ss'
;
import
_
from
'lodash'
;
import
angular
from
'angular'
;
import
moment
from
'moment'
;
var
fromUser
=
function
(
text
)
{
if
(
text
.
indexOf
(
'now'
)
!==
-
1
)
{
return
text
;
}
var
parsed
;
if
(
$scope
.
ctrl
.
isUtc
)
{
parsed
=
moment
.
utc
(
text
,
format
);
}
else
{
parsed
=
moment
(
text
,
format
);
}
export
function
inputDateDirective
()
{
return
{
restrict
:
'A'
,
require
:
'ngModel'
,
link
:
function
(
$scope
,
$elem
,
attrs
,
ngModel
)
{
var
format
=
'YYYY-MM-DD HH:mm:ss'
;
return
parsed
.
isValid
()
?
parsed
:
undefined
;
};
var
fromUser
=
function
(
text
)
{
if
(
text
.
indexOf
(
'now'
)
!==
-
1
)
{
return
text
;
}
var
parsed
;
if
(
$scope
.
ctrl
.
isUtc
)
{
parsed
=
moment
.
utc
(
text
,
format
);
}
else
{
parsed
=
moment
(
text
,
format
);
}
var
toUser
=
function
(
currentValue
)
{
if
(
moment
.
isMoment
(
currentValue
))
{
return
currentValue
.
format
(
format
);
}
else
{
return
currentValue
;
}
};
return
parsed
.
isValid
()
?
parsed
:
undefined
;
};
var
toUser
=
function
(
currentValue
)
{
if
(
moment
.
isMoment
(
currentValue
))
{
return
currentValue
.
format
(
format
);
}
else
{
return
currentValue
;
}
};
ngModel
.
$parsers
.
push
(
fromUser
);
ngModel
.
$formatters
.
push
(
toUser
);
}
};
}
ngModel
.
$parsers
.
push
(
fromUser
);
ngModel
.
$formatters
.
push
(
toUser
);
}
};
});
});
public/app/features/dashboard/timepicker/timepicker.ts
View file @
52644bb2
///<reference path="../../../headers/common.d.ts" />
///<amd-dependency path="./input_date" name="inputDate" />
import
_
from
'lodash'
;
import
kbn
from
'app/core/utils/kbn'
;
...
...
@@ -9,8 +8,6 @@ import moment from 'moment';
import
*
as
dateMath
from
'app/core/utils/datemath'
;
import
*
as
rangeUtil
from
'app/core/utils/rangeutil'
;
declare
var
inputDate
:
any
;
export
class
TimePickerCtrl
{
static
tooltipFormat
=
'MMM D, YYYY HH:mm:ss'
;
...
...
@@ -179,3 +176,6 @@ export function timePickerDirective() {
angular
.
module
(
'grafana.directives'
).
directive
(
'gfTimePickerSettings'
,
settingsDirective
);
angular
.
module
(
'grafana.directives'
).
directive
(
'gfTimePicker'
,
timePickerDirective
);
import
{
inputDateDirective
}
from
'./input_date'
;
angular
.
module
(
"grafana.directives"
).
directive
(
'inputDatetime'
,
inputDateDirective
);
public/app/grafana.ts
View file @
52644bb2
...
...
@@ -56,7 +56,7 @@ export class GrafanaApp {
'ang-drag-drop'
,
'grafana'
,
'pasvaz.bindonce'
,
'ui.bootstrap
.tabs
'
,
'ui.bootstrap'
,
'ui.bootstrap.tpls'
,
];
...
...
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