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
7083e8a0
Commit
7083e8a0
authored
Apr 05, 2018
by
Patrick O'Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrated segment_srv to ts
parent
32b833e4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
public/app/core/services/segment_srv.ts
+24
-24
No files found.
public/app/core/services/segment_srv.
j
s
→
public/app/core/services/segment_srv.
t
s
View file @
7083e8a0
define
([
'angular'
,
'lodash'
,
'../core_module'
,
],
function
(
angular
,
_
,
coreModule
)
{
'use strict'
;
import
_
from
'lodash'
;
import
coreModule
from
'../core_module'
;
coreModule
.
default
.
service
(
'uiSegmentSrv'
,
function
(
$sce
,
templateSrv
)
{
var
self
=
this
;
/** @ngInject */
export
function
uiSegmentSrv
(
$sce
,
templateSrv
)
{
let
self
=
this
;
function
MetricSegment
(
options
)
{
if
(
options
===
'*'
||
options
.
value
===
'*'
)
{
...
...
@@ -42,16 +38,16 @@ function (angular, _, coreModule) {
if
(
value
)
{
return
this
.
newSegment
(
value
);
}
else
{
return
this
.
newSegment
({
value
:
fallbackText
,
fake
:
true
});
return
this
.
newSegment
({
value
:
fallbackText
,
fake
:
true
});
}
};
this
.
newSelectMeasurement
=
function
()
{
return
new
MetricSegment
({
value
:
'select measurement'
,
fake
:
true
});
return
new
MetricSegment
({
value
:
'select measurement'
,
fake
:
true
});
};
this
.
newFake
=
function
(
text
,
type
,
cssClass
)
{
return
new
MetricSegment
({
value
:
text
,
fake
:
true
,
type
:
type
,
cssClass
:
cssClass
});
return
new
MetricSegment
({
value
:
text
,
fake
:
true
,
type
:
type
,
cssClass
:
cssClass
});
};
this
.
newSegment
=
function
(
options
)
{
...
...
@@ -59,31 +55,31 @@ function (angular, _, coreModule) {
};
this
.
newKey
=
function
(
key
)
{
return
new
MetricSegment
({
value
:
key
,
type
:
'key'
,
cssClass
:
'query-segment-key'
});
return
new
MetricSegment
({
value
:
key
,
type
:
'key'
,
cssClass
:
'query-segment-key'
});
};
this
.
newKeyValue
=
function
(
value
)
{
return
new
MetricSegment
({
value
:
value
,
type
:
'value'
,
cssClass
:
'query-segment-value'
});
return
new
MetricSegment
({
value
:
value
,
type
:
'value'
,
cssClass
:
'query-segment-value'
});
};
this
.
newCondition
=
function
(
condition
)
{
return
new
MetricSegment
({
value
:
condition
,
type
:
'condition'
,
cssClass
:
'query-keyword'
});
return
new
MetricSegment
({
value
:
condition
,
type
:
'condition'
,
cssClass
:
'query-keyword'
});
};
this
.
newOperator
=
function
(
op
)
{
return
new
MetricSegment
({
value
:
op
,
type
:
'operator'
,
cssClass
:
'query-segment-operator'
});
return
new
MetricSegment
({
value
:
op
,
type
:
'operator'
,
cssClass
:
'query-segment-operator'
});
};
this
.
newOperators
=
function
(
ops
)
{
return
_
.
map
(
ops
,
function
(
op
)
{
return
new
MetricSegment
({
value
:
op
,
type
:
'operator'
,
cssClass
:
'query-segment-operator'
});
return
new
MetricSegment
({
value
:
op
,
type
:
'operator'
,
cssClass
:
'query-segment-operator'
});
});
};
this
.
transformToSegments
=
function
(
addTemplateVars
,
variableTypeFilter
)
{
return
function
(
results
)
{
var
segments
=
_
.
map
(
results
,
function
(
segment
)
{
return
self
.
newSegment
({
value
:
segment
.
text
,
expandable
:
segment
.
expandable
});
let
segments
=
_
.
map
(
results
,
function
(
segment
)
{
return
self
.
newSegment
({
value
:
segment
.
text
,
expandable
:
segment
.
expandable
});
});
if
(
addTemplateVars
)
{
...
...
@@ -99,13 +95,17 @@ function (angular, _, coreModule) {
};
this
.
newSelectMetric
=
function
()
{
return
new
MetricSegment
({
value
:
'select metric'
,
fake
:
true
});
return
new
MetricSegment
({
value
:
'select metric'
,
fake
:
true
});
};
this
.
newPlusButton
=
function
()
{
return
new
MetricSegment
({
fake
:
true
,
html
:
'<i class="fa fa-plus "></i>'
,
type
:
'plus-button'
,
cssClass
:
'query-part'
});
};
return
new
MetricSegment
({
fake
:
true
,
html
:
'<i class="fa fa-plus "></i>'
,
type
:
'plus-button'
,
cssClass
:
'query-part'
,
});
};
}
}
);
coreModule
.
service
(
'uiSegmentSrv'
,
uiSegmentSrv
);
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