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
9e3514a9
Commit
9e3514a9
authored
Aug 14, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More small performance tweaks, trying to clean up watcher & scope counts
parent
aee3ddd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
src/app/panels/text/module.js
+15
-19
src/app/panels/timepicker/module.html
+1
-2
src/app/panels/timepicker/module.js
+12
-2
No files found.
src/app/panels/text/module.js
View file @
9e3514a9
/** @scratch /panels/5
* include::panels/text.asciidoc[]
*/
/** @scratch /panels/text/0
* == text
* Status: *Stable*
*
* The text panel is used for displaying static text formated as markdown, sanitized html or as plain
* text.
*
*/
define
([
'angular'
,
'app'
,
...
...
@@ -23,6 +11,8 @@ function (angular, app, _, require) {
var
module
=
angular
.
module
(
'grafana.panels.text'
,
[]);
app
.
useModule
(
module
);
var
converter
;
module
.
controller
(
'text'
,
function
(
$scope
,
filterSrv
,
$sce
,
panelSrv
)
{
$scope
.
panelMeta
=
{
...
...
@@ -68,15 +58,21 @@ function (angular, app, _, require) {
};
$scope
.
renderMarkdown
=
function
(
content
)
{
require
([
'./lib/showdown'
],
function
(
Showdown
)
{
var
converter
=
new
Showdown
.
converter
();
var
text
=
content
.
replace
(
/&/g
,
'&'
)
.
replace
(
/>/g
,
'>'
)
.
replace
(
/</g
,
'<'
);
var
text
=
content
.
replace
(
/&/g
,
'&'
)
.
replace
(
/>/g
,
'>'
)
.
replace
(
/</g
,
'<'
);
if
(
converter
)
{
console
.
log
(
"markdown render cached"
);
$scope
.
updateContent
(
converter
.
makeHtml
(
text
));
});
}
else
{
require
([
'./lib/showdown'
],
function
(
Showdown
)
{
converter
=
new
Showdown
.
converter
();
$scope
.
updateContent
(
converter
.
makeHtml
(
text
));
});
}
};
$scope
.
updateContent
=
function
(
html
)
{
...
...
src/app/panels/timepicker/module.html
View file @
9e3514a9
...
...
@@ -15,8 +15,7 @@
<ul
class=
"nav nav-pills timepicker-dropdown"
>
<li
class=
"dropdown"
>
<a
class=
"dropdown-toggle timepicker-dropdown"
data-toggle=
"dropdown"
href=
""
bs-tooltip=
"time.from.date ? (time.from.date | date:'yyyy-MM-dd HH:mm:ss.sss') + ' <br>to<br>' +(time.to.date | date:'yyyy-MM-dd HH:mm:ss.sss') : 'Click to set a time filter'"
data-placement=
"bottom"
ng-click=
"dismiss();"
>
<a
class=
"dropdown-toggle timepicker-dropdown"
data-toggle=
"dropdown"
href=
""
bs-tooltip=
"time.tooltip"
data-placement=
"bottom"
ng-click=
"dismiss();"
>
<span
ng-show=
"filter.time"
>
<span
class=
"pointer"
ng-hide=
"panel.now"
>
{{time.from.date | date:'MMM d, y HH:mm:ss'}}
</span>
<span
class=
"pointer"
ng-show=
"panel.now"
>
{{time.from.date | moment:'ago'}}
</span>
...
...
src/app/panels/timepicker/module.js
View file @
9e3514a9
...
...
@@ -172,10 +172,20 @@ function (angular, app, _, moment, kbn) {
};
var
getScopeTimeObj
=
function
(
from
,
to
)
{
return
{
var
model
=
{
from
:
getTimeObj
(
from
),
to
:
getTimeObj
(
to
)
to
:
getTimeObj
(
to
)
,
};
if
(
model
.
from
.
date
)
{
model
.
tooltip
=
moment
(
model
.
from
.
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
+
' <br>to<br>'
;
model
.
tooltip
+=
moment
(
model
.
to
.
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
else
{
model
.
tooltip
=
'Click to set time filter'
;
}
return
model
;
};
var
getTimeObj
=
function
(
date
)
{
...
...
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