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
84371f03
Commit
84371f03
authored
Sep 10, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(typescript): more testing and migration
parent
20407bca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
69 deletions
+79
-69
public/app/app.js
+1
-1
public/app/core/core.ts
+1
-0
public/app/core/filters/filters.ts
+68
-59
tasks/build_task.js
+8
-8
tasks/options/requirejs.js
+1
-1
No files found.
public/app/app.js
View file @
84371f03
...
...
@@ -80,11 +80,11 @@ function (angular, $, _, appLevelRequire) {
});
var
preBootRequires
=
[
'core/core'
,
'services/all'
,
'features/all'
,
'controllers/all'
,
'directives/all'
,
'filters/all'
,
'components/partials'
,
'routes/all'
,
];
...
...
public/app/core/core.ts
View file @
84371f03
export
*
from
'./directives/cool_dir'
export
*
from
'./routes/module_loader'
export
*
from
'./filters/filters'
public/app/
filters/all.j
s
→
public/app/
core/filters/filters.t
s
100755 → 100644
View file @
84371f03
define
([
'angular'
,
'jquery'
,
'lodash'
,
'moment'
],
function
(
angular
,
$
,
_
,
moment
)
{
'use strict'
;
///<reference path="../../headers/require/require.d.ts" />
///<reference path="../../headers/angularjs/angularjs.d.ts" />
///<amd-dependency path="angular"/>
///<amd-dependency path="config"/>
///<amd-dependency path="moment"/>
///<amd-dependency path="lodash"/>
var
module
=
angular
.
module
(
'grafana.filters'
);
var
angular
=
require
(
'angular'
);
var
jquery
=
require
(
'jquery'
);
var
moment
=
require
(
'moment'
);
var
_
=
require
(
'lodash'
);
module
.
filter
(
'stringSort'
,
function
()
{
return
function
(
input
)
{
return
input
.
sort
();
};
});
var
module
=
angular
.
module
(
'grafana.filters'
);
module
.
filter
(
'slice'
,
function
()
{
return
function
(
arr
,
start
,
end
)
{
if
(
!
_
.
isUndefined
(
arr
))
{
return
arr
.
slice
(
start
,
end
);
}
};
});
module
.
filter
(
'stringSort'
,
function
()
{
return
function
(
input
)
{
return
input
.
sort
();
};
});
module
.
filter
(
'slice'
,
function
()
{
return
function
(
arr
,
start
,
end
)
{
if
(
!
_
.
isUndefined
(
arr
))
{
return
arr
.
slice
(
start
,
end
);
}
};
});
module
.
filter
(
'stringify'
,
function
()
{
return
function
(
arr
)
{
if
(
_
.
isObject
(
arr
)
&&
!
_
.
isArray
(
arr
))
{
return
angular
.
toJson
(
arr
);
}
else
{
return
_
.
isNull
(
arr
)
?
null
:
arr
.
toString
();
}
};
});
module
.
filter
(
'stringify'
,
function
()
{
return
function
(
arr
)
{
if
(
_
.
isObject
(
arr
)
&&
!
_
.
isArray
(
arr
))
{
return
angular
.
toJson
(
arr
);
}
else
{
return
_
.
isNull
(
arr
)
?
null
:
arr
.
toString
();
}
};
});
module
.
filter
(
'moment'
,
function
()
{
return
function
(
date
,
mode
)
{
switch
(
mode
)
{
module
.
filter
(
'moment'
,
function
()
{
return
function
(
date
,
mode
)
{
switch
(
mode
)
{
case
'ago'
:
return
moment
(
date
).
fromNow
();
}
return
moment
(
date
).
fromNow
();
};
});
}
return
moment
(
date
).
fromNow
();
};
});
module
.
filter
(
'noXml'
,
function
()
{
var
noXml
=
function
(
text
)
{
return
_
.
isString
(
text
)
?
text
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
.
replace
(
/'/g
,
'''
)
.
replace
(
/"/g
,
'"'
)
:
text
;
};
return
function
(
text
)
{
return
_
.
isArray
(
text
)
?
_
.
map
(
text
,
noXml
)
:
noXml
(
text
);
};
});
module
.
filter
(
'noXml'
,
function
()
{
var
noXml
=
function
(
text
)
{
return
_
.
isString
(
text
)
?
text
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
.
replace
(
/'/g
,
'''
)
.
replace
(
/"/g
,
'"'
)
:
text
;
};
return
function
(
text
)
{
return
_
.
isArray
(
text
)
?
_
.
map
(
text
,
noXml
)
:
noXml
(
text
);
};
});
module
.
filter
(
'interpolateTemplateVars'
,
function
(
templateSrv
)
{
function
interpolateTemplateVars
(
text
,
scope
)
{
if
(
scope
.
panel
)
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
panel
.
scopedVars
);
}
else
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
row
.
scopedVars
);
}
module
.
filter
(
'interpolateTemplateVars'
,
function
(
templateSrv
)
{
var
interpolateTemplateVars
:
any
=
function
(
text
,
scope
)
{
if
(
scope
.
panel
)
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
panel
.
scopedVars
);
}
else
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
row
.
scopedVars
);
}
}
interpolateTemplateVars
.
$stateful
=
true
;
return
interpolateTemplateVars
;
});
interpolateTemplateVars
.
$stateful
=
true
;
return
interpolateTemplateVars
;
});
export
function
filters
()
{}
tasks/build_task.js
View file @
84371f03
...
...
@@ -15,14 +15,14 @@ module.exports = function(grunt) {
'ngtemplates'
,
'cssmin:build'
,
'ngAnnotate:build'
,
//
'requirejs:build',
//
'concat:js',
//
'clean:temp',
//
'filerev',
//
'remapFilerev',
//
'usemin',
//
'clean:temp',
//
'uglify:genDir'
'requirejs:build'
,
'concat:js'
,
'clean:temp'
,
'filerev'
,
'remapFilerev'
,
'usemin'
,
'clean:temp'
,
'uglify:genDir'
]);
// task to add [[.AppSubUrl]] to reved path
...
...
tasks/options/requirejs.js
View file @
84371f03
...
...
@@ -54,10 +54,10 @@ module.exports = function(config,grunt) {
'jquery.flot'
,
'angular-strap'
,
'angular-dragdrop'
,
'core/core'
,
'services/all'
,
'features/all'
,
'directives/all'
,
'filters/all'
,
'controllers/all'
,
'routes/all'
,
'components/partials'
,
...
...
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