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
960a4f71
Commit
960a4f71
authored
Aug 21, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jsc): fixed javascript indenting
parent
292db86c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
37 deletions
+37
-37
public/app/components/kbn.js
+36
-36
public/app/features/panel/panelHelper.js
+1
-1
No files found.
public/app/components/kbn.js
View file @
960a4f71
...
...
@@ -163,20 +163,6 @@ function($, _, moment) {
return
info
.
sec
*
info
.
count
;
};
kbn
.
getRelativeTimeInfo
=
function
(
str
)
{
var
info
=
{
value
:
str
};
if
(
str
===
'today'
)
{
info
.
text
=
'Today'
;
info
.
from
=
'today'
;
info
.
to
=
'now'
;
}
else
{
info
.
text
=
'Last '
+
str
;
info
.
from
=
'now-'
+
str
;
info
.
to
=
'now'
;
}
return
info
;
};
/* This is a simplified version of elasticsearch's date parser */
kbn
.
parseDate
=
function
(
text
)
{
if
(
_
.
isDate
(
text
))
{
...
...
@@ -219,6 +205,20 @@ function($, _, moment) {
return
kbn
.
parseDateMath
(
mathString
,
time
);
};
kbn
.
getRelativeTimeInfo
=
function
(
str
)
{
var
info
=
{
value
:
str
};
if
(
str
===
'today'
)
{
info
.
text
=
'Today'
;
info
.
from
=
'today'
;
info
.
to
=
'now'
;
}
else
{
info
.
text
=
'Last '
+
str
;
info
.
from
=
'now-'
+
str
;
info
.
to
=
'now'
;
}
return
info
;
};
kbn
.
_timespanRegex
=
/^
(\d
+
[
h,m,M,w,s,H,d
])
|today$/
;
kbn
.
isValidTimeSpan
=
function
(
str
)
{
return
kbn
.
_timespanRegex
.
test
(
str
);
...
...
@@ -229,8 +229,8 @@ function($, _, moment) {
for
(
var
i
=
0
;
i
<
mathString
.
length
;)
{
var
c
=
mathString
.
charAt
(
i
++
),
type
,
num
,
unit
;
num
,
unit
;
if
(
c
===
'/'
)
{
type
=
0
;
}
else
if
(
c
===
'+'
)
{
...
...
@@ -258,8 +258,8 @@ function($, _, moment) {
}
unit
=
mathString
.
charAt
(
i
++
);
switch
(
unit
)
{
case
'y'
:
if
(
type
===
0
)
{
case
'y'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'year'
)
:
dateTime
.
startOf
(
'year'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'years'
);
...
...
@@ -267,8 +267,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'years'
);
}
break
;
case
'M'
:
if
(
type
===
0
)
{
case
'M'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'month'
)
:
dateTime
.
startOf
(
'month'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'months'
);
...
...
@@ -276,8 +276,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'months'
);
}
break
;
case
'w'
:
if
(
type
===
0
)
{
case
'w'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'week'
)
:
dateTime
.
startOf
(
'week'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'weeks'
);
...
...
@@ -285,8 +285,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'weeks'
);
}
break
;
case
'd'
:
if
(
type
===
0
)
{
case
'd'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'day'
)
:
dateTime
.
startOf
(
'day'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'days'
);
...
...
@@ -294,9 +294,9 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'days'
);
}
break
;
case
'h'
:
case
'H'
:
if
(
type
===
0
)
{
case
'h'
:
case
'H'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'hour'
)
:
dateTime
.
startOf
(
'hour'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'hours'
);
...
...
@@ -304,8 +304,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'hours'
);
}
break
;
case
'm'
:
if
(
type
===
0
)
{
case
'm'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'minute'
)
:
dateTime
.
startOf
(
'minute'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'minutes'
);
...
...
@@ -313,8 +313,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'minutes'
);
}
break
;
case
's'
:
if
(
type
===
0
)
{
case
's'
:
if
(
type
===
0
)
{
roundUp
?
dateTime
.
endOf
(
'second'
)
:
dateTime
.
startOf
(
'second'
);
}
else
if
(
type
===
1
)
{
dateTime
.
add
(
num
,
'seconds'
);
...
...
@@ -322,8 +322,8 @@ function($, _, moment) {
dateTime
.
subtract
(
num
,
'seconds'
);
}
break
;
default
:
return
false
;
default
:
return
false
;
}
}
return
dateTime
.
toDate
();
...
...
@@ -523,9 +523,9 @@ function($, _, moment) {
kbn
.
slugifyForUrl
=
function
(
str
)
{
return
str
.
toLowerCase
()
.
replace
(
/
[^\w
]
+/g
,
''
)
.
replace
(
/ +/g
,
'-'
);
.
toLowerCase
()
.
replace
(
/
[^\w
]
+/g
,
''
)
.
replace
(
/ +/g
,
'-'
);
};
kbn
.
exportSeriesListToCsv
=
function
(
seriesList
)
{
...
...
public/app/features/panel/panelHelper.js
View file @
960a4f71
...
...
@@ -69,7 +69,7 @@ function (angular, _, kbn, $) {
}
if
(
_
.
isString
(
scope
.
rangeUnparsed
.
from
))
{
var
timeInfo
=
kbn
.
getRelativeTimeInfo
(
scope
.
panel
.
timeFrom
)
var
timeInfo
=
kbn
.
getRelativeTimeInfo
(
scope
.
panel
.
timeFrom
)
;
scope
.
panelMeta
.
timeInfo
=
timeInfo
.
text
;
scope
.
rangeUnparsed
.
from
=
timeInfo
.
from
;
scope
.
rangeUnparsed
.
to
=
timeInfo
.
to
;
...
...
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