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
00c0b71f
Commit
00c0b71f
authored
Sep 05, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '12918-only-arrow-functions4'
parents
99133c4f
dc4f547a
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
243 additions
and
241 deletions
+243
-241
public/app/core/components/code_editor/code_editor.ts
+2
-2
public/app/core/components/colorpicker/spectrum_picker.ts
+1
-1
public/app/core/components/json_explorer/json_explorer.ts
+2
-2
public/app/core/components/jsontree/jsontree.ts
+1
-1
public/app/core/directives/dash_class.ts
+5
-5
public/app/core/directives/dropdown_typeahead.ts
+30
-30
public/app/core/directives/give_focus.ts
+5
-5
public/app/core/directives/metric_segment.ts
+20
-20
public/app/core/directives/misc.ts
+13
-13
public/app/core/directives/ng_model_on_blur.ts
+7
-7
public/app/core/directives/rebuild_on_change.ts
+3
-3
public/app/core/directives/tags.ts
+5
-5
public/app/core/directives/value_select_dropdown.ts
+3
-3
public/app/core/jquery_extended.ts
+2
-2
public/app/core/partials.ts
+1
-1
public/app/core/profiler.ts
+3
-3
public/app/core/services/analytics.ts
+1
-0
public/app/core/services/context_srv.ts
+1
-1
public/app/core/services/ng_react.ts
+14
-13
public/app/core/table_model.ts
+1
-1
public/app/core/utils/file_export.ts
+2
-2
public/app/core/utils/flatten.ts
+1
-1
public/app/core/utils/kbn.ts
+51
-51
public/app/core/utils/outline.ts
+4
-4
public/app/core/utils/rangeutil.ts
+1
-1
public/app/core/utils/url.ts
+3
-3
public/app/features/dashboard/dashboard_migration.ts
+14
-14
public/app/features/dashboard/dashboard_model.ts
+3
-3
public/app/features/panel/panel_ctrl.ts
+1
-1
public/app/plugins/datasource/graphite/add_graphite_func.ts
+12
-12
public/app/plugins/datasource/graphite/datasource.ts
+8
-8
public/app/plugins/datasource/graphite/func_editor.ts
+11
-11
public/app/plugins/datasource/graphite/gfunc.ts
+2
-2
public/app/plugins/datasource/opentsdb/specs/datasource.test.ts
+9
-9
public/app/stores/FolderStore/FolderStore.ts
+1
-1
No files found.
public/app/core/components/code_editor/code_editor.ts
View file @
00c0b71f
...
@@ -97,7 +97,7 @@ function link(scope, elem, attrs) {
...
@@ -97,7 +97,7 @@ function link(scope, elem, attrs) {
textarea
.
addClass
(
'gf-form-input'
);
textarea
.
addClass
(
'gf-form-input'
);
if
(
scope
.
codeEditorFocus
)
{
if
(
scope
.
codeEditorFocus
)
{
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
textarea
.
focus
();
textarea
.
focus
();
const
domEl
=
textarea
[
0
];
const
domEl
=
textarea
[
0
];
if
(
domEl
.
setSelectionRange
)
{
if
(
domEl
.
setSelectionRange
)
{
...
@@ -119,7 +119,7 @@ function link(scope, elem, attrs) {
...
@@ -119,7 +119,7 @@ function link(scope, elem, attrs) {
scope
.
$watch
(
'content'
,
(
newValue
,
oldValue
)
=>
{
scope
.
$watch
(
'content'
,
(
newValue
,
oldValue
)
=>
{
const
editorValue
=
codeEditor
.
getValue
();
const
editorValue
=
codeEditor
.
getValue
();
if
(
newValue
!==
editorValue
&&
newValue
!==
oldValue
)
{
if
(
newValue
!==
editorValue
&&
newValue
!==
oldValue
)
{
scope
.
$$postDigest
(
function
()
{
scope
.
$$postDigest
(
()
=>
{
setEditorContent
(
newValue
);
setEditorContent
(
newValue
);
});
});
}
}
...
...
public/app/core/components/colorpicker/spectrum_picker.ts
View file @
00c0b71f
...
@@ -13,7 +13,7 @@ export function spectrumPicker() {
...
@@ -13,7 +13,7 @@ export function spectrumPicker() {
scope
:
true
,
scope
:
true
,
replace
:
true
,
replace
:
true
,
template
:
'<color-picker color="ngModel.$viewValue" onChange="onColorChange"></color-picker>'
,
template
:
'<color-picker color="ngModel.$viewValue" onChange="onColorChange"></color-picker>'
,
link
:
function
(
scope
,
element
,
attrs
,
ngModel
)
{
link
:
(
scope
,
element
,
attrs
,
ngModel
)
=>
{
scope
.
ngModel
=
ngModel
;
scope
.
ngModel
=
ngModel
;
scope
.
onColorChange
=
color
=>
{
scope
.
onColorChange
=
color
=>
{
ngModel
.
$setViewValue
(
color
);
ngModel
.
$setViewValue
(
color
);
...
...
public/app/core/components/json_explorer/json_explorer.ts
View file @
00c0b71f
...
@@ -14,10 +14,10 @@ const MAX_ANIMATED_TOGGLE_ITEMS = 10;
...
@@ -14,10 +14,10 @@ const MAX_ANIMATED_TOGGLE_ITEMS = 10;
const
requestAnimationFrame
=
const
requestAnimationFrame
=
window
.
requestAnimationFrame
||
window
.
requestAnimationFrame
||
function
(
cb
:
()
=>
void
)
{
((
cb
:
()
=>
void
)
=>
{
cb
();
cb
();
return
0
;
return
0
;
};
}
)
;
export
interface
JsonExplorerConfig
{
export
interface
JsonExplorerConfig
{
animateOpen
?:
boolean
;
animateOpen
?:
boolean
;
...
...
public/app/core/components/jsontree/jsontree.ts
View file @
00c0b71f
...
@@ -10,7 +10,7 @@ coreModule.directive('jsonTree', [
...
@@ -10,7 +10,7 @@ coreModule.directive('jsonTree', [
startExpanded
:
'@'
,
startExpanded
:
'@'
,
rootName
:
'@'
,
rootName
:
'@'
,
},
},
link
:
function
(
scope
,
elem
)
{
link
:
(
scope
,
elem
)
=>
{
const
jsonExp
=
new
JsonExplorer
(
scope
.
object
,
3
,
{
const
jsonExp
=
new
JsonExplorer
(
scope
.
object
,
3
,
{
animateOpen
:
true
,
animateOpen
:
true
,
});
});
...
...
public/app/core/directives/dash_class.ts
View file @
00c0b71f
...
@@ -4,19 +4,19 @@ import coreModule from '../core_module';
...
@@ -4,19 +4,19 @@ import coreModule from '../core_module';
/** @ngInject */
/** @ngInject */
export
function
dashClass
()
{
export
function
dashClass
()
{
return
{
return
{
link
:
function
(
$scope
,
elem
)
{
link
:
(
$scope
,
elem
)
=>
{
$scope
.
onAppEvent
(
'panel-fullscreen-enter'
,
function
()
{
$scope
.
onAppEvent
(
'panel-fullscreen-enter'
,
()
=>
{
elem
.
toggleClass
(
'panel-in-fullscreen'
,
true
);
elem
.
toggleClass
(
'panel-in-fullscreen'
,
true
);
});
});
$scope
.
onAppEvent
(
'panel-fullscreen-exit'
,
function
()
{
$scope
.
onAppEvent
(
'panel-fullscreen-exit'
,
()
=>
{
elem
.
toggleClass
(
'panel-in-fullscreen'
,
false
);
elem
.
toggleClass
(
'panel-in-fullscreen'
,
false
);
});
});
$scope
.
$watch
(
'ctrl.dashboardViewState.state.editview'
,
function
(
newValue
)
{
$scope
.
$watch
(
'ctrl.dashboardViewState.state.editview'
,
newValue
=>
{
if
(
newValue
)
{
if
(
newValue
)
{
elem
.
toggleClass
(
'dashboard-page--settings-opening'
,
_
.
isString
(
newValue
));
elem
.
toggleClass
(
'dashboard-page--settings-opening'
,
_
.
isString
(
newValue
));
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
elem
.
toggleClass
(
'dashboard-page--settings-open'
,
_
.
isString
(
newValue
));
elem
.
toggleClass
(
'dashboard-page--settings-open'
,
_
.
isString
(
newValue
));
},
10
);
},
10
);
}
else
{
}
else
{
...
...
public/app/core/directives/dropdown_typeahead.ts
View file @
00c0b71f
...
@@ -20,7 +20,7 @@ export function dropdownTypeahead($compile) {
...
@@ -20,7 +20,7 @@ export function dropdownTypeahead($compile) {
dropdownTypeaheadOnSelect
:
'&dropdownTypeaheadOnSelect'
,
dropdownTypeaheadOnSelect
:
'&dropdownTypeaheadOnSelect'
,
model
:
'=ngModel'
,
model
:
'=ngModel'
,
},
},
link
:
function
(
$scope
,
elem
,
attrs
)
{
link
:
(
$scope
,
elem
,
attrs
)
=>
{
const
$input
=
$
(
inputTemplate
);
const
$input
=
$
(
inputTemplate
);
const
$button
=
$
(
buttonTemplate
);
const
$button
=
$
(
buttonTemplate
);
$input
.
appendTo
(
elem
);
$input
.
appendTo
(
elem
);
...
@@ -31,9 +31,9 @@ export function dropdownTypeahead($compile) {
...
@@ -31,9 +31,9 @@ export function dropdownTypeahead($compile) {
}
}
if
(
attrs
.
ngModel
)
{
if
(
attrs
.
ngModel
)
{
$scope
.
$watch
(
'model'
,
function
(
newValue
)
{
$scope
.
$watch
(
'model'
,
newValue
=>
{
_
.
each
(
$scope
.
menuItems
,
function
(
item
)
{
_
.
each
(
$scope
.
menuItems
,
item
=>
{
_
.
each
(
item
.
submenu
,
function
(
subItem
)
{
_
.
each
(
item
.
submenu
,
subItem
=>
{
if
(
subItem
.
value
===
newValue
)
{
if
(
subItem
.
value
===
newValue
)
{
$button
.
html
(
subItem
.
text
);
$button
.
html
(
subItem
.
text
);
}
}
...
@@ -44,12 +44,12 @@ export function dropdownTypeahead($compile) {
...
@@ -44,12 +44,12 @@ export function dropdownTypeahead($compile) {
const
typeaheadValues
=
_
.
reduce
(
const
typeaheadValues
=
_
.
reduce
(
$scope
.
menuItems
,
$scope
.
menuItems
,
function
(
memo
,
value
,
index
)
{
(
memo
,
value
,
index
)
=>
{
if
(
!
value
.
submenu
)
{
if
(
!
value
.
submenu
)
{
value
.
click
=
'menuItemSelected('
+
index
+
')'
;
value
.
click
=
'menuItemSelected('
+
index
+
')'
;
memo
.
push
(
value
.
text
);
memo
.
push
(
value
.
text
);
}
else
{
}
else
{
_
.
each
(
value
.
submenu
,
function
(
item
,
subIndex
)
{
_
.
each
(
value
.
submenu
,
(
item
,
subIndex
)
=>
{
item
.
click
=
'menuItemSelected('
+
index
+
','
+
subIndex
+
')'
;
item
.
click
=
'menuItemSelected('
+
index
+
','
+
subIndex
+
')'
;
memo
.
push
(
value
.
text
+
' '
+
item
.
text
);
memo
.
push
(
value
.
text
+
' '
+
item
.
text
);
});
});
...
@@ -59,7 +59,7 @@ export function dropdownTypeahead($compile) {
...
@@ -59,7 +59,7 @@ export function dropdownTypeahead($compile) {
[]
[]
);
);
$scope
.
menuItemSelected
=
function
(
index
,
subIndex
)
{
$scope
.
menuItemSelected
=
(
index
,
subIndex
)
=>
{
const
menuItem
=
$scope
.
menuItems
[
index
];
const
menuItem
=
$scope
.
menuItems
[
index
];
const
payload
:
any
=
{
$item
:
menuItem
};
const
payload
:
any
=
{
$item
:
menuItem
};
if
(
menuItem
.
submenu
&&
subIndex
!==
void
0
)
{
if
(
menuItem
.
submenu
&&
subIndex
!==
void
0
)
{
...
@@ -73,10 +73,10 @@ export function dropdownTypeahead($compile) {
...
@@ -73,10 +73,10 @@ export function dropdownTypeahead($compile) {
source
:
typeaheadValues
,
source
:
typeaheadValues
,
minLength
:
1
,
minLength
:
1
,
items
:
10
,
items
:
10
,
updater
:
function
(
value
)
{
updater
:
value
=>
{
const
result
:
any
=
{};
const
result
:
any
=
{};
_
.
each
(
$scope
.
menuItems
,
function
(
menuItem
)
{
_
.
each
(
$scope
.
menuItems
,
menuItem
=>
{
_
.
each
(
menuItem
.
submenu
,
function
(
submenuItem
)
{
_
.
each
(
menuItem
.
submenu
,
submenuItem
=>
{
if
(
value
===
menuItem
.
text
+
' '
+
submenuItem
.
text
)
{
if
(
value
===
menuItem
.
text
+
' '
+
submenuItem
.
text
)
{
result
.
$subItem
=
submenuItem
;
result
.
$subItem
=
submenuItem
;
result
.
$item
=
menuItem
;
result
.
$item
=
menuItem
;
...
@@ -85,7 +85,7 @@ export function dropdownTypeahead($compile) {
...
@@ -85,7 +85,7 @@ export function dropdownTypeahead($compile) {
});
});
if
(
result
.
$item
)
{
if
(
result
.
$item
)
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
$scope
.
dropdownTypeaheadOnSelect
(
result
);
$scope
.
dropdownTypeaheadOnSelect
(
result
);
});
});
}
}
...
@@ -95,24 +95,24 @@ export function dropdownTypeahead($compile) {
...
@@ -95,24 +95,24 @@ export function dropdownTypeahead($compile) {
},
},
});
});
$button
.
click
(
function
()
{
$button
.
click
(
()
=>
{
$button
.
hide
();
$button
.
hide
();
$input
.
show
();
$input
.
show
();
$input
.
focus
();
$input
.
focus
();
});
});
$input
.
keyup
(
function
()
{
$input
.
keyup
(
()
=>
{
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
});
});
$input
.
blur
(
function
()
{
$input
.
blur
(
()
=>
{
$input
.
hide
();
$input
.
hide
();
$input
.
val
(
''
);
$input
.
val
(
''
);
$button
.
show
();
$button
.
show
();
$button
.
focus
();
$button
.
focus
();
// clicking the function dropdown menu won't
// clicking the function dropdown menu won't
// work if you remove class at once
// work if you remove class at once
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
elem
.
removeClass
(
'open'
);
elem
.
removeClass
(
'open'
);
},
200
);
},
200
);
});
});
...
@@ -138,7 +138,7 @@ export function dropdownTypeahead2($compile) {
...
@@ -138,7 +138,7 @@ export function dropdownTypeahead2($compile) {
dropdownTypeaheadOnSelect
:
'&dropdownTypeaheadOnSelect'
,
dropdownTypeaheadOnSelect
:
'&dropdownTypeaheadOnSelect'
,
model
:
'=ngModel'
,
model
:
'=ngModel'
,
},
},
link
:
function
(
$scope
,
elem
,
attrs
)
{
link
:
(
$scope
,
elem
,
attrs
)
=>
{
const
$input
=
$
(
inputTemplate
);
const
$input
=
$
(
inputTemplate
);
const
$button
=
$
(
buttonTemplate
);
const
$button
=
$
(
buttonTemplate
);
$input
.
appendTo
(
elem
);
$input
.
appendTo
(
elem
);
...
@@ -149,9 +149,9 @@ export function dropdownTypeahead2($compile) {
...
@@ -149,9 +149,9 @@ export function dropdownTypeahead2($compile) {
}
}
if
(
attrs
.
ngModel
)
{
if
(
attrs
.
ngModel
)
{
$scope
.
$watch
(
'model'
,
function
(
newValue
)
{
$scope
.
$watch
(
'model'
,
newValue
=>
{
_
.
each
(
$scope
.
menuItems
,
function
(
item
)
{
_
.
each
(
$scope
.
menuItems
,
item
=>
{
_
.
each
(
item
.
submenu
,
function
(
subItem
)
{
_
.
each
(
item
.
submenu
,
subItem
=>
{
if
(
subItem
.
value
===
newValue
)
{
if
(
subItem
.
value
===
newValue
)
{
$button
.
html
(
subItem
.
text
);
$button
.
html
(
subItem
.
text
);
}
}
...
@@ -162,12 +162,12 @@ export function dropdownTypeahead2($compile) {
...
@@ -162,12 +162,12 @@ export function dropdownTypeahead2($compile) {
const
typeaheadValues
=
_
.
reduce
(
const
typeaheadValues
=
_
.
reduce
(
$scope
.
menuItems
,
$scope
.
menuItems
,
function
(
memo
,
value
,
index
)
{
(
memo
,
value
,
index
)
=>
{
if
(
!
value
.
submenu
)
{
if
(
!
value
.
submenu
)
{
value
.
click
=
'menuItemSelected('
+
index
+
')'
;
value
.
click
=
'menuItemSelected('
+
index
+
')'
;
memo
.
push
(
value
.
text
);
memo
.
push
(
value
.
text
);
}
else
{
}
else
{
_
.
each
(
value
.
submenu
,
function
(
item
,
subIndex
)
{
_
.
each
(
value
.
submenu
,
(
item
,
subIndex
)
=>
{
item
.
click
=
'menuItemSelected('
+
index
+
','
+
subIndex
+
')'
;
item
.
click
=
'menuItemSelected('
+
index
+
','
+
subIndex
+
')'
;
memo
.
push
(
value
.
text
+
' '
+
item
.
text
);
memo
.
push
(
value
.
text
+
' '
+
item
.
text
);
});
});
...
@@ -177,7 +177,7 @@ export function dropdownTypeahead2($compile) {
...
@@ -177,7 +177,7 @@ export function dropdownTypeahead2($compile) {
[]
[]
);
);
$scope
.
menuItemSelected
=
function
(
index
,
subIndex
)
{
$scope
.
menuItemSelected
=
(
index
,
subIndex
)
=>
{
const
menuItem
=
$scope
.
menuItems
[
index
];
const
menuItem
=
$scope
.
menuItems
[
index
];
const
payload
:
any
=
{
$item
:
menuItem
};
const
payload
:
any
=
{
$item
:
menuItem
};
if
(
menuItem
.
submenu
&&
subIndex
!==
void
0
)
{
if
(
menuItem
.
submenu
&&
subIndex
!==
void
0
)
{
...
@@ -191,10 +191,10 @@ export function dropdownTypeahead2($compile) {
...
@@ -191,10 +191,10 @@ export function dropdownTypeahead2($compile) {
source
:
typeaheadValues
,
source
:
typeaheadValues
,
minLength
:
1
,
minLength
:
1
,
items
:
10
,
items
:
10
,
updater
:
function
(
value
)
{
updater
:
value
=>
{
const
result
:
any
=
{};
const
result
:
any
=
{};
_
.
each
(
$scope
.
menuItems
,
function
(
menuItem
)
{
_
.
each
(
$scope
.
menuItems
,
menuItem
=>
{
_
.
each
(
menuItem
.
submenu
,
function
(
submenuItem
)
{
_
.
each
(
menuItem
.
submenu
,
submenuItem
=>
{
if
(
value
===
menuItem
.
text
+
' '
+
submenuItem
.
text
)
{
if
(
value
===
menuItem
.
text
+
' '
+
submenuItem
.
text
)
{
result
.
$subItem
=
submenuItem
;
result
.
$subItem
=
submenuItem
;
result
.
$item
=
menuItem
;
result
.
$item
=
menuItem
;
...
@@ -203,7 +203,7 @@ export function dropdownTypeahead2($compile) {
...
@@ -203,7 +203,7 @@ export function dropdownTypeahead2($compile) {
});
});
if
(
result
.
$item
)
{
if
(
result
.
$item
)
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
$scope
.
dropdownTypeaheadOnSelect
(
result
);
$scope
.
dropdownTypeaheadOnSelect
(
result
);
});
});
}
}
...
@@ -213,24 +213,24 @@ export function dropdownTypeahead2($compile) {
...
@@ -213,24 +213,24 @@ export function dropdownTypeahead2($compile) {
},
},
});
});
$button
.
click
(
function
()
{
$button
.
click
(
()
=>
{
$button
.
hide
();
$button
.
hide
();
$input
.
show
();
$input
.
show
();
$input
.
focus
();
$input
.
focus
();
});
});
$input
.
keyup
(
function
()
{
$input
.
keyup
(
()
=>
{
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
});
});
$input
.
blur
(
function
()
{
$input
.
blur
(
()
=>
{
$input
.
hide
();
$input
.
hide
();
$input
.
val
(
''
);
$input
.
val
(
''
);
$button
.
show
();
$button
.
show
();
$button
.
focus
();
$button
.
focus
();
// clicking the function dropdown menu won't
// clicking the function dropdown menu won't
// work if you remove class at once
// work if you remove class at once
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
elem
.
removeClass
(
'open'
);
elem
.
removeClass
(
'open'
);
},
200
);
},
200
);
});
});
...
...
public/app/core/directives/give_focus.ts
View file @
00c0b71f
import
coreModule
from
'../core_module'
;
import
coreModule
from
'../core_module'
;
coreModule
.
directive
(
'giveFocus'
,
function
()
{
coreModule
.
directive
(
'giveFocus'
,
()
=>
{
return
function
(
scope
,
element
,
attrs
)
{
return
(
scope
,
element
,
attrs
)
=>
{
element
.
click
(
function
(
e
)
{
element
.
click
(
e
=>
{
e
.
stopPropagation
();
e
.
stopPropagation
();
});
});
scope
.
$watch
(
scope
.
$watch
(
attrs
.
giveFocus
,
attrs
.
giveFocus
,
function
(
newValue
)
{
newValue
=>
{
if
(
!
newValue
)
{
if
(
!
newValue
)
{
return
;
return
;
}
}
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
element
.
focus
();
element
.
focus
();
const
domEl
=
element
[
0
];
const
domEl
=
element
[
0
];
if
(
domEl
.
setSelectionRange
)
{
if
(
domEl
.
setSelectionRange
)
{
...
...
public/app/core/directives/metric_segment.ts
View file @
00c0b71f
...
@@ -24,7 +24,7 @@ export function metricSegment($compile, $sce) {
...
@@ -24,7 +24,7 @@ export function metricSegment($compile, $sce) {
onChange
:
'&'
,
onChange
:
'&'
,
debounce
:
'@'
,
debounce
:
'@'
,
},
},
link
:
function
(
$scope
,
elem
)
{
link
:
(
$scope
,
elem
)
=>
{
const
$input
=
$
(
inputTemplate
);
const
$input
=
$
(
inputTemplate
);
const
segment
=
$scope
.
segment
;
const
segment
=
$scope
.
segment
;
const
$button
=
$
(
segment
.
selectMode
?
selectTemplate
:
linkTemplate
);
const
$button
=
$
(
segment
.
selectMode
?
selectTemplate
:
linkTemplate
);
...
@@ -36,14 +36,14 @@ export function metricSegment($compile, $sce) {
...
@@ -36,14 +36,14 @@ export function metricSegment($compile, $sce) {
$input
.
appendTo
(
elem
);
$input
.
appendTo
(
elem
);
$button
.
appendTo
(
elem
);
$button
.
appendTo
(
elem
);
$scope
.
updateVariableValue
=
function
(
value
)
{
$scope
.
updateVariableValue
=
value
=>
{
if
(
value
===
''
||
segment
.
value
===
value
)
{
if
(
value
===
''
||
segment
.
value
===
value
)
{
return
;
return
;
}
}
value
=
_
.
unescape
(
value
);
value
=
_
.
unescape
(
value
);
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
const
selected
=
_
.
find
(
$scope
.
altSegments
,
{
value
:
value
});
const
selected
=
_
.
find
(
$scope
.
altSegments
,
{
value
:
value
});
if
(
selected
)
{
if
(
selected
)
{
segment
.
value
=
selected
.
value
;
segment
.
value
=
selected
.
value
;
...
@@ -65,7 +65,7 @@ export function metricSegment($compile, $sce) {
...
@@ -65,7 +65,7 @@ export function metricSegment($compile, $sce) {
});
});
};
};
$scope
.
switchToLink
=
f
unction
(
fromClick
)
{
$scope
.
switchToLink
=
f
romClick
=>
{
if
(
linkMode
&&
!
fromClick
)
{
if
(
linkMode
&&
!
fromClick
)
{
return
;
return
;
}
}
...
@@ -78,17 +78,17 @@ export function metricSegment($compile, $sce) {
...
@@ -78,17 +78,17 @@ export function metricSegment($compile, $sce) {
$scope
.
updateVariableValue
(
$input
.
val
());
$scope
.
updateVariableValue
(
$input
.
val
());
};
};
$scope
.
inputBlur
=
function
()
{
$scope
.
inputBlur
=
()
=>
{
// happens long before the click event on the typeahead options
// happens long before the click event on the typeahead options
// need to have long delay because the blur
// need to have long delay because the blur
cancelBlur
=
setTimeout
(
$scope
.
switchToLink
,
200
);
cancelBlur
=
setTimeout
(
$scope
.
switchToLink
,
200
);
};
};
$scope
.
source
=
function
(
query
,
callback
)
{
$scope
.
source
=
(
query
,
callback
)
=>
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
$scope
.
getOptions
({
$query
:
query
}).
then
(
function
(
altSegments
)
{
$scope
.
getOptions
({
$query
:
query
}).
then
(
altSegments
=>
{
$scope
.
altSegments
=
altSegments
;
$scope
.
altSegments
=
altSegments
;
options
=
_
.
map
(
$scope
.
altSegments
,
function
(
alt
)
{
options
=
_
.
map
(
$scope
.
altSegments
,
alt
=>
{
return
_
.
escape
(
alt
.
value
);
return
_
.
escape
(
alt
.
value
);
});
});
...
@@ -104,7 +104,7 @@ export function metricSegment($compile, $sce) {
...
@@ -104,7 +104,7 @@ export function metricSegment($compile, $sce) {
});
});
};
};
$scope
.
updater
=
function
(
value
)
{
$scope
.
updater
=
value
=>
{
if
(
value
===
segment
.
value
)
{
if
(
value
===
segment
.
value
)
{
clearTimeout
(
cancelBlur
);
clearTimeout
(
cancelBlur
);
$input
.
focus
();
$input
.
focus
();
...
@@ -152,14 +152,14 @@ export function metricSegment($compile, $sce) {
...
@@ -152,14 +152,14 @@ export function metricSegment($compile, $sce) {
typeahead
.
lookup
=
_
.
debounce
(
typeahead
.
lookup
,
500
,
{
leading
:
true
});
typeahead
.
lookup
=
_
.
debounce
(
typeahead
.
lookup
,
500
,
{
leading
:
true
});
}
}
$button
.
keydown
(
function
(
evt
)
{
$button
.
keydown
(
evt
=>
{
// trigger typeahead on down arrow or enter key
// trigger typeahead on down arrow or enter key
if
(
evt
.
keyCode
===
40
||
evt
.
keyCode
===
13
)
{
if
(
evt
.
keyCode
===
40
||
evt
.
keyCode
===
13
)
{
$button
.
click
();
$button
.
click
();
}
}
});
});
$button
.
click
(
function
()
{
$button
.
click
(
()
=>
{
options
=
null
;
options
=
null
;
$input
.
css
(
'width'
,
Math
.
max
(
$button
.
width
(),
80
)
+
16
+
'px'
);
$input
.
css
(
'width'
,
Math
.
max
(
$button
.
width
(),
80
)
+
16
+
'px'
);
...
@@ -199,7 +199,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
...
@@ -199,7 +199,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
pre
:
function
postLink
(
$scope
,
elem
,
attrs
)
{
pre
:
function
postLink
(
$scope
,
elem
,
attrs
)
{
let
cachedOptions
;
let
cachedOptions
;
$scope
.
valueToSegment
=
function
(
value
)
{
$scope
.
valueToSegment
=
value
=>
{
const
option
=
_
.
find
(
$scope
.
options
,
{
value
:
value
});
const
option
=
_
.
find
(
$scope
.
options
,
{
value
:
value
});
const
segment
=
{
const
segment
=
{
cssClass
:
attrs
.
cssClass
,
cssClass
:
attrs
.
cssClass
,
...
@@ -211,18 +211,18 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
...
@@ -211,18 +211,18 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
return
uiSegmentSrv
.
newSegment
(
segment
);
return
uiSegmentSrv
.
newSegment
(
segment
);
};
};
$scope
.
getOptionsInternal
=
function
()
{
$scope
.
getOptionsInternal
=
()
=>
{
if
(
$scope
.
options
)
{
if
(
$scope
.
options
)
{
cachedOptions
=
$scope
.
options
;
cachedOptions
=
$scope
.
options
;
return
$q
.
when
(
return
$q
.
when
(
_
.
map
(
$scope
.
options
,
function
(
option
)
{
_
.
map
(
$scope
.
options
,
option
=>
{
return
{
value
:
option
.
text
};
return
{
value
:
option
.
text
};
})
})
);
);
}
else
{
}
else
{
return
$scope
.
getOptions
().
then
(
function
(
options
)
{
return
$scope
.
getOptions
().
then
(
options
=>
{
cachedOptions
=
options
;
cachedOptions
=
options
;
return
_
.
map
(
options
,
function
(
option
)
{
return
_
.
map
(
options
,
option
=>
{
if
(
option
.
html
)
{
if
(
option
.
html
)
{
return
option
;
return
option
;
}
}
...
@@ -232,7 +232,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
...
@@ -232,7 +232,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
}
}
};
};
$scope
.
onSegmentChange
=
function
()
{
$scope
.
onSegmentChange
=
()
=>
{
if
(
cachedOptions
)
{
if
(
cachedOptions
)
{
const
option
=
_
.
find
(
cachedOptions
,
{
text
:
$scope
.
segment
.
value
});
const
option
=
_
.
find
(
cachedOptions
,
{
text
:
$scope
.
segment
.
value
});
if
(
option
&&
option
.
value
!==
$scope
.
property
)
{
if
(
option
&&
option
.
value
!==
$scope
.
property
)
{
...
@@ -246,8 +246,8 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
...
@@ -246,8 +246,8 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
// needs to call this after digest so
// needs to call this after digest so
// property is synced with outerscope
// property is synced with outerscope
$scope
.
$$postDigest
(
function
()
{
$scope
.
$$postDigest
(
()
=>
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
$scope
.
onChange
();
$scope
.
onChange
();
});
});
});
});
...
...
public/app/core/directives/misc.ts
View file @
00c0b71f
...
@@ -8,7 +8,7 @@ import { appEvents } from 'app/core/core';
...
@@ -8,7 +8,7 @@ import { appEvents } from 'app/core/core';
function
tip
(
$compile
)
{
function
tip
(
$compile
)
{
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
(
scope
,
elem
,
attrs
)
=>
{
let
_t
=
let
_t
=
'<i class="grafana-tip fa fa-'
+
'<i class="grafana-tip fa fa-'
+
(
attrs
.
icon
||
'question-circle'
)
+
(
attrs
.
icon
||
'question-circle'
)
+
...
@@ -26,9 +26,9 @@ function clipboardButton() {
...
@@ -26,9 +26,9 @@ function clipboardButton() {
scope
:
{
scope
:
{
getText
:
'&clipboardButton'
,
getText
:
'&clipboardButton'
,
},
},
link
:
function
(
scope
,
elem
)
{
link
:
(
scope
,
elem
)
=>
{
scope
.
clipboard
=
new
Clipboard
(
elem
[
0
],
{
scope
.
clipboard
=
new
Clipboard
(
elem
[
0
],
{
text
:
function
()
{
text
:
()
=>
{
return
scope
.
getText
();
return
scope
.
getText
();
},
},
});
});
...
@@ -37,7 +37,7 @@ function clipboardButton() {
...
@@ -37,7 +37,7 @@ function clipboardButton() {
appEvents
.
emit
(
'alert-success'
,
[
'Content copied to clipboard'
]);
appEvents
.
emit
(
'alert-success'
,
[
'Content copied to clipboard'
]);
});
});
scope
.
$on
(
'$destroy'
,
function
()
{
scope
.
$on
(
'$destroy'
,
()
=>
{
if
(
scope
.
clipboard
)
{
if
(
scope
.
clipboard
)
{
scope
.
clipboard
.
destroy
();
scope
.
clipboard
.
destroy
();
}
}
...
@@ -50,12 +50,12 @@ function clipboardButton() {
...
@@ -50,12 +50,12 @@ function clipboardButton() {
function
compile
(
$compile
)
{
function
compile
(
$compile
)
{
return
{
return
{
restrict
:
'A'
,
restrict
:
'A'
,
link
:
function
(
scope
,
element
,
attrs
)
{
link
:
(
scope
,
element
,
attrs
)
=>
{
scope
.
$watch
(
scope
.
$watch
(
function
(
scope
)
{
scope
=>
{
return
scope
.
$eval
(
attrs
.
compile
);
return
scope
.
$eval
(
attrs
.
compile
);
},
},
function
(
value
)
{
value
=>
{
element
.
html
(
value
);
element
.
html
(
value
);
$compile
(
element
.
contents
())(
scope
);
$compile
(
element
.
contents
())(
scope
);
}
}
...
@@ -67,9 +67,9 @@ function compile($compile) {
...
@@ -67,9 +67,9 @@ function compile($compile) {
function
watchChange
()
{
function
watchChange
()
{
return
{
return
{
scope
:
{
onchange
:
'&watchChange'
},
scope
:
{
onchange
:
'&watchChange'
},
link
:
function
(
scope
,
element
)
{
link
:
(
scope
,
element
)
=>
{
element
.
on
(
'input'
,
function
()
{
element
.
on
(
'input'
,
()
=>
{
scope
.
$apply
(
function
()
{
scope
.
$apply
(
()
=>
{
scope
.
onchange
({
inputValue
:
element
.
val
()
});
scope
.
onchange
({
inputValue
:
element
.
val
()
});
});
});
});
});
...
@@ -81,7 +81,7 @@ function watchChange() {
...
@@ -81,7 +81,7 @@ function watchChange() {
function
editorOptBool
(
$compile
)
{
function
editorOptBool
(
$compile
)
{
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
(
scope
,
elem
,
attrs
)
=>
{
const
ngchange
=
attrs
.
change
?
' ng-change="'
+
attrs
.
change
+
'"'
:
''
;
const
ngchange
=
attrs
.
change
?
' ng-change="'
+
attrs
.
change
+
'"'
:
''
;
const
tip
=
attrs
.
tip
?
' <tip>'
+
attrs
.
tip
+
'</tip>'
:
''
;
const
tip
=
attrs
.
tip
?
' <tip>'
+
attrs
.
tip
+
'</tip>'
:
''
;
const
showIf
=
attrs
.
showIf
?
' ng-show="'
+
attrs
.
showIf
+
'" '
:
''
;
const
showIf
=
attrs
.
showIf
?
' ng-show="'
+
attrs
.
showIf
+
'" '
:
''
;
...
@@ -118,7 +118,7 @@ function editorOptBool($compile) {
...
@@ -118,7 +118,7 @@ function editorOptBool($compile) {
function
editorCheckbox
(
$compile
,
$interpolate
)
{
function
editorCheckbox
(
$compile
,
$interpolate
)
{
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
(
scope
,
elem
,
attrs
)
=>
{
const
text
=
$interpolate
(
attrs
.
text
)(
scope
);
const
text
=
$interpolate
(
attrs
.
text
)(
scope
);
const
model
=
$interpolate
(
attrs
.
model
)(
scope
);
const
model
=
$interpolate
(
attrs
.
model
)(
scope
);
const
ngchange
=
attrs
.
change
?
' ng-change="'
+
attrs
.
change
+
'"'
:
''
;
const
ngchange
=
attrs
.
change
?
' ng-change="'
+
attrs
.
change
+
'"'
:
''
;
...
@@ -194,7 +194,7 @@ function gfDropdown($parse, $compile, $timeout) {
...
@@ -194,7 +194,7 @@ function gfDropdown($parse, $compile, $timeout) {
link
:
function
postLink
(
scope
,
iElement
,
iAttrs
)
{
link
:
function
postLink
(
scope
,
iElement
,
iAttrs
)
{
const
getter
=
$parse
(
iAttrs
.
gfDropdown
),
const
getter
=
$parse
(
iAttrs
.
gfDropdown
),
items
=
getter
(
scope
);
items
=
getter
(
scope
);
$timeout
(
function
()
{
$timeout
(
()
=>
{
const
placement
=
iElement
.
data
(
'placement'
);
const
placement
=
iElement
.
data
(
'placement'
);
const
dropdown
=
angular
.
element
(
buildTemplate
(
items
,
placement
).
join
(
''
));
const
dropdown
=
angular
.
element
(
buildTemplate
(
items
,
placement
).
join
(
''
));
dropdown
.
insertAfter
(
iElement
);
dropdown
.
insertAfter
(
iElement
);
...
...
public/app/core/directives/ng_model_on_blur.ts
View file @
00c0b71f
...
@@ -6,14 +6,14 @@ function ngModelOnBlur() {
...
@@ -6,14 +6,14 @@ function ngModelOnBlur() {
restrict
:
'A'
,
restrict
:
'A'
,
priority
:
1
,
priority
:
1
,
require
:
'ngModel'
,
require
:
'ngModel'
,
link
:
function
(
scope
,
elm
,
attr
,
ngModelCtrl
)
{
link
:
(
scope
,
elm
,
attr
,
ngModelCtrl
)
=>
{
if
(
attr
.
type
===
'radio'
||
attr
.
type
===
'checkbox'
)
{
if
(
attr
.
type
===
'radio'
||
attr
.
type
===
'checkbox'
)
{
return
;
return
;
}
}
elm
.
off
(
'input keydown change'
);
elm
.
off
(
'input keydown change'
);
elm
.
bind
(
'blur'
,
function
()
{
elm
.
bind
(
'blur'
,
()
=>
{
scope
.
$apply
(
function
()
{
scope
.
$apply
(
()
=>
{
ngModelCtrl
.
$setViewValue
(
elm
.
val
());
ngModelCtrl
.
$setViewValue
(
elm
.
val
());
});
});
});
});
...
@@ -25,8 +25,8 @@ function emptyToNull() {
...
@@ -25,8 +25,8 @@ function emptyToNull() {
return
{
return
{
restrict
:
'A'
,
restrict
:
'A'
,
require
:
'ngModel'
,
require
:
'ngModel'
,
link
:
function
(
scope
,
elm
,
attrs
,
ctrl
)
{
link
:
(
scope
,
elm
,
attrs
,
ctrl
)
=>
{
ctrl
.
$parsers
.
push
(
function
(
viewValue
)
{
ctrl
.
$parsers
.
push
(
viewValue
=>
{
if
(
viewValue
===
''
)
{
if
(
viewValue
===
''
)
{
return
null
;
return
null
;
}
}
...
@@ -39,8 +39,8 @@ function emptyToNull() {
...
@@ -39,8 +39,8 @@ function emptyToNull() {
function
validTimeSpan
()
{
function
validTimeSpan
()
{
return
{
return
{
require
:
'ngModel'
,
require
:
'ngModel'
,
link
:
function
(
scope
,
elm
,
attrs
,
ctrl
)
{
link
:
(
scope
,
elm
,
attrs
,
ctrl
)
=>
{
ctrl
.
$validators
.
integer
=
function
(
modelValue
,
viewValue
)
{
ctrl
.
$validators
.
integer
=
(
modelValue
,
viewValue
)
=>
{
if
(
ctrl
.
$isEmpty
(
modelValue
))
{
if
(
ctrl
.
$isEmpty
(
modelValue
))
{
return
true
;
return
true
;
}
}
...
...
public/app/core/directives/rebuild_on_change.ts
View file @
00c0b71f
...
@@ -26,7 +26,7 @@ function rebuildOnChange($animate) {
...
@@ -26,7 +26,7 @@ function rebuildOnChange($animate) {
transclude
:
true
,
transclude
:
true
,
priority
:
600
,
priority
:
600
,
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
,
ctrl
,
transclude
)
{
link
:
(
scope
,
elem
,
attrs
,
ctrl
,
transclude
)
=>
{
let
block
,
childScope
,
previousElements
;
let
block
,
childScope
,
previousElements
;
function
cleanUp
()
{
function
cleanUp
()
{
...
@@ -40,7 +40,7 @@ function rebuildOnChange($animate) {
...
@@ -40,7 +40,7 @@ function rebuildOnChange($animate) {
}
}
if
(
block
)
{
if
(
block
)
{
previousElements
=
getBlockNodes
(
block
.
clone
);
previousElements
=
getBlockNodes
(
block
.
clone
);
$animate
.
leave
(
previousElements
).
then
(
function
()
{
$animate
.
leave
(
previousElements
).
then
(
()
=>
{
previousElements
=
null
;
previousElements
=
null
;
});
});
block
=
null
;
block
=
null
;
...
@@ -53,7 +53,7 @@ function rebuildOnChange($animate) {
...
@@ -53,7 +53,7 @@ function rebuildOnChange($animate) {
}
}
if
(
!
childScope
&&
(
value
||
attrs
.
showNull
))
{
if
(
!
childScope
&&
(
value
||
attrs
.
showNull
))
{
transclude
(
function
(
clone
,
newScope
)
{
transclude
(
(
clone
,
newScope
)
=>
{
childScope
=
newScope
;
childScope
=
newScope
;
clone
[
clone
.
length
++
]
=
document
.
createComment
(
' end rebuild on change '
);
clone
[
clone
.
length
++
]
=
document
.
createComment
(
' end rebuild on change '
);
block
=
{
clone
:
clone
};
block
=
{
clone
:
clone
};
...
...
public/app/core/directives/tags.ts
View file @
00c0b71f
...
@@ -13,7 +13,7 @@ function setColor(name, element) {
...
@@ -13,7 +13,7 @@ function setColor(name, element) {
function
tagColorFromName
()
{
function
tagColorFromName
()
{
return
{
return
{
scope
:
{
tagColorFromName
:
'='
},
scope
:
{
tagColorFromName
:
'='
},
link
:
function
(
scope
,
element
)
{
link
:
(
scope
,
element
)
=>
{
setColor
(
scope
.
tagColorFromName
,
element
);
setColor
(
scope
.
tagColorFromName
,
element
);
},
},
};
};
...
@@ -29,7 +29,7 @@ function bootstrapTagsinput() {
...
@@ -29,7 +29,7 @@ function bootstrapTagsinput() {
return
scope
.
$parent
[
property
];
return
scope
.
$parent
[
property
];
}
}
return
function
(
item
)
{
return
item
=>
{
return
item
[
property
];
return
item
[
property
];
};
};
}
}
...
@@ -64,7 +64,7 @@ function bootstrapTagsinput() {
...
@@ -64,7 +64,7 @@ function bootstrapTagsinput() {
itemText
:
getItemProperty
(
scope
,
attrs
.
itemtext
),
itemText
:
getItemProperty
(
scope
,
attrs
.
itemtext
),
tagClass
:
angular
.
isFunction
(
scope
.
$parent
[
attrs
.
tagclass
])
tagClass
:
angular
.
isFunction
(
scope
.
$parent
[
attrs
.
tagclass
])
?
scope
.
$parent
[
attrs
.
tagclass
]
?
scope
.
$parent
[
attrs
.
tagclass
]
:
function
()
{
:
()
=>
{
return
attrs
.
tagclass
;
return
attrs
.
tagclass
;
},
},
});
});
...
@@ -85,7 +85,7 @@ function bootstrapTagsinput() {
...
@@ -85,7 +85,7 @@ function bootstrapTagsinput() {
setColor
(
event
.
item
,
tagElement
);
setColor
(
event
.
item
,
tagElement
);
});
});
select
.
on
(
'itemRemoved'
,
function
(
event
)
{
select
.
on
(
'itemRemoved'
,
event
=>
{
const
idx
=
scope
.
model
.
indexOf
(
event
.
item
);
const
idx
=
scope
.
model
.
indexOf
(
event
.
item
);
if
(
idx
!==
-
1
)
{
if
(
idx
!==
-
1
)
{
scope
.
model
.
splice
(
idx
,
1
);
scope
.
model
.
splice
(
idx
,
1
);
...
@@ -97,7 +97,7 @@ function bootstrapTagsinput() {
...
@@ -97,7 +97,7 @@ function bootstrapTagsinput() {
scope
.
$watch
(
scope
.
$watch
(
'model'
,
'model'
,
function
()
{
()
=>
{
if
(
!
angular
.
isArray
(
scope
.
model
))
{
if
(
!
angular
.
isArray
(
scope
.
model
))
{
scope
.
model
=
[];
scope
.
model
=
[];
}
}
...
...
public/app/core/directives/value_select_dropdown.ts
View file @
00c0b71f
...
@@ -245,7 +245,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
...
@@ -245,7 +245,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
controller
:
'ValueSelectDropdownCtrl'
,
controller
:
'ValueSelectDropdownCtrl'
,
controllerAs
:
'vm'
,
controllerAs
:
'vm'
,
bindToController
:
true
,
bindToController
:
true
,
link
:
function
(
scope
,
elem
)
{
link
:
(
scope
,
elem
)
=>
{
const
bodyEl
=
angular
.
element
(
$window
.
document
.
body
);
const
bodyEl
=
angular
.
element
(
$window
.
document
.
body
);
const
linkEl
=
elem
.
find
(
'.variable-value-link'
);
const
linkEl
=
elem
.
find
(
'.variable-value-link'
);
const
inputEl
=
elem
.
find
(
'input'
);
const
inputEl
=
elem
.
find
(
'input'
);
...
@@ -258,7 +258,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
...
@@ -258,7 +258,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
inputEl
.
focus
();
inputEl
.
focus
();
$timeout
(
$timeout
(
function
()
{
()
=>
{
bodyEl
.
on
(
'click'
,
bodyOnClick
);
bodyEl
.
on
(
'click'
,
bodyOnClick
);
},
},
0
,
0
,
...
@@ -274,7 +274,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
...
@@ -274,7 +274,7 @@ export function valueSelectDropdown($compile, $window, $timeout, $rootScope) {
function
bodyOnClick
(
e
)
{
function
bodyOnClick
(
e
)
{
if
(
elem
.
has
(
e
.
target
).
length
===
0
)
{
if
(
elem
.
has
(
e
.
target
).
length
===
0
)
{
scope
.
$apply
(
function
()
{
scope
.
$apply
(
()
=>
{
scope
.
vm
.
commitChanges
();
scope
.
vm
.
commitChanges
();
});
});
}
}
...
...
public/app/core/jquery_extended.ts
View file @
00c0b71f
...
@@ -4,7 +4,7 @@ import _ from 'lodash';
...
@@ -4,7 +4,7 @@ import _ from 'lodash';
const
$win
=
$
(
window
);
const
$win
=
$
(
window
);
$
.
fn
.
place_tt
=
(
function
()
{
$
.
fn
.
place_tt
=
(
()
=>
{
const
defaults
=
{
const
defaults
=
{
offset
:
5
,
offset
:
5
,
};
};
...
@@ -28,7 +28,7 @@ $.fn.place_tt = (function() {
...
@@ -28,7 +28,7 @@ $.fn.place_tt = (function() {
.
invoke
([
.
invoke
([
'$compile'
,
'$compile'
,
'$rootScope'
,
'$rootScope'
,
function
(
$compile
,
$rootScope
)
{
(
$compile
,
$rootScope
)
=>
{
const
tmpScope
=
$rootScope
.
$new
(
true
);
const
tmpScope
=
$rootScope
.
$new
(
true
);
_
.
extend
(
tmpScope
,
opts
.
scopeData
);
_
.
extend
(
tmpScope
,
opts
.
scopeData
);
...
...
public/app/core/partials.ts
View file @
00c0b71f
let
templates
=
(
require
as
any
).
context
(
'../'
,
true
,
/
\.
html$/
);
let
templates
=
(
require
as
any
).
context
(
'../'
,
true
,
/
\.
html$/
);
templates
.
keys
().
forEach
(
function
(
key
)
{
templates
.
keys
().
forEach
(
key
=>
{
templates
(
key
);
templates
(
key
);
});
});
public/app/core/profiler.ts
View file @
00c0b71f
...
@@ -82,15 +82,15 @@ export class Profiler {
...
@@ -82,15 +82,15 @@ export class Profiler {
let
scopes
=
0
;
let
scopes
=
0
;
const
root
=
$
(
document
.
getElementsByTagName
(
'body'
));
const
root
=
$
(
document
.
getElementsByTagName
(
'body'
));
const
f
=
function
(
element
)
{
const
f
=
element
=>
{
if
(
element
.
data
().
hasOwnProperty
(
'$scope'
))
{
if
(
element
.
data
().
hasOwnProperty
(
'$scope'
))
{
scopes
++
;
scopes
++
;
angular
.
forEach
(
element
.
data
().
$scope
.
$$watchers
,
function
()
{
angular
.
forEach
(
element
.
data
().
$scope
.
$$watchers
,
()
=>
{
count
++
;
count
++
;
});
});
}
}
angular
.
forEach
(
element
.
children
(),
function
(
childElement
)
{
angular
.
forEach
(
element
.
children
(),
childElement
=>
{
f
(
$
(
childElement
));
f
(
$
(
childElement
));
});
});
};
};
...
...
public/app/core/services/analytics.ts
View file @
00c0b71f
...
@@ -15,6 +15,7 @@ export class Analytics {
...
@@ -15,6 +15,7 @@ export class Analytics {
const
ga
=
((
window
as
any
).
ga
=
const
ga
=
((
window
as
any
).
ga
=
(
window
as
any
).
ga
||
(
window
as
any
).
ga
||
function
()
{
function
()
{
//tslint:disable-line:only-arrow-functions
(
ga
.
q
=
ga
.
q
||
[]).
push
(
arguments
);
(
ga
.
q
=
ga
.
q
||
[]).
push
(
arguments
);
});
});
ga
.
l
=
+
new
Date
();
ga
.
l
=
+
new
Date
();
...
...
public/app/core/services/context_srv.ts
View file @
00c0b71f
...
@@ -64,6 +64,6 @@ export class ContextSrv {
...
@@ -64,6 +64,6 @@ export class ContextSrv {
const
contextSrv
=
new
ContextSrv
();
const
contextSrv
=
new
ContextSrv
();
export
{
contextSrv
};
export
{
contextSrv
};
coreModule
.
factory
(
'contextSrv'
,
function
()
{
coreModule
.
factory
(
'contextSrv'
,
()
=>
{
return
contextSrv
;
return
contextSrv
;
});
});
public/app/core/services/ng_react.ts
View file @
00c0b71f
...
@@ -34,7 +34,7 @@ function getReactComponent(name, $injector) {
...
@@ -34,7 +34,7 @@ function getReactComponent(name, $injector) {
if
(
!
reactComponent
)
{
if
(
!
reactComponent
)
{
try
{
try
{
reactComponent
=
name
.
split
(
'.'
).
reduce
(
function
(
current
,
namePart
)
{
reactComponent
=
name
.
split
(
'.'
).
reduce
(
(
current
,
namePart
)
=>
{
return
current
[
namePart
];
return
current
[
namePart
];
},
window
);
},
window
);
}
catch
(
e
)
{}
}
catch
(
e
)
{}
...
@@ -53,12 +53,13 @@ function applied(fn, scope) {
...
@@ -53,12 +53,13 @@ function applied(fn, scope) {
return
fn
;
return
fn
;
}
}
const
wrapped
:
any
=
function
()
{
const
wrapped
:
any
=
function
()
{
//tslint:disable-line:only-arrow-functions
const
args
=
arguments
;
const
args
=
arguments
;
const
phase
=
scope
.
$root
.
$$phase
;
const
phase
=
scope
.
$root
.
$$phase
;
if
(
phase
===
'$apply'
||
phase
===
'$digest'
)
{
if
(
phase
===
'$apply'
||
phase
===
'$digest'
)
{
return
fn
.
apply
(
null
,
args
);
return
fn
.
apply
(
null
,
args
);
}
else
{
}
else
{
return
scope
.
$apply
(
function
()
{
return
scope
.
$apply
(
()
=>
{
return
fn
.
apply
(
null
,
args
);
return
fn
.
apply
(
null
,
args
);
});
});
}
}
...
@@ -80,7 +81,7 @@ function applied(fn, scope) {
...
@@ -80,7 +81,7 @@ function applied(fn, scope) {
* @returns {Object} props with the functions wrapped in scope.$apply
* @returns {Object} props with the functions wrapped in scope.$apply
*/
*/
function
applyFunctions
(
obj
,
scope
,
propsConfig
?)
{
function
applyFunctions
(
obj
,
scope
,
propsConfig
?)
{
return
Object
.
keys
(
obj
||
{}).
reduce
(
function
(
prev
,
key
)
{
return
Object
.
keys
(
obj
||
{}).
reduce
(
(
prev
,
key
)
=>
{
const
value
=
obj
[
key
];
const
value
=
obj
[
key
];
const
config
=
(
propsConfig
||
{})[
key
]
||
{};
const
config
=
(
propsConfig
||
{})[
key
]
||
{};
/**
/**
...
@@ -108,7 +109,7 @@ function watchProps(watchDepth, scope, watchExpressions, listener) {
...
@@ -108,7 +109,7 @@ function watchProps(watchDepth, scope, watchExpressions, listener) {
const
watchGroupExpressions
=
[];
const
watchGroupExpressions
=
[];
watchExpressions
.
forEach
(
function
(
expr
)
{
watchExpressions
.
forEach
(
expr
=>
{
const
actualExpr
=
getPropExpression
(
expr
);
const
actualExpr
=
getPropExpression
(
expr
);
const
exprWatchDepth
=
getPropWatchDepth
(
watchDepth
,
expr
);
const
exprWatchDepth
=
getPropWatchDepth
(
watchDepth
,
expr
);
...
@@ -134,7 +135,7 @@ function watchProps(watchDepth, scope, watchExpressions, listener) {
...
@@ -134,7 +135,7 @@ function watchProps(watchDepth, scope, watchExpressions, listener) {
// render React component, with scope[attrs.props] being passed in as the component props
// render React component, with scope[attrs.props] being passed in as the component props
function
renderComponent
(
component
,
props
,
scope
,
elem
)
{
function
renderComponent
(
component
,
props
,
scope
,
elem
)
{
scope
.
$evalAsync
(
function
()
{
scope
.
$evalAsync
(
()
=>
{
ReactDOM
.
render
(
React
.
createElement
(
component
,
props
),
elem
[
0
]);
ReactDOM
.
render
(
React
.
createElement
(
component
,
props
),
elem
[
0
]);
});
});
}
}
...
@@ -156,7 +157,7 @@ function getPropExpression(prop) {
...
@@ -156,7 +157,7 @@ function getPropExpression(prop) {
// find the normalized attribute knowing that React props accept any type of capitalization
// find the normalized attribute knowing that React props accept any type of capitalization
function
findAttribute
(
attrs
,
propName
)
{
function
findAttribute
(
attrs
,
propName
)
{
const
index
=
Object
.
keys
(
attrs
).
filter
(
function
(
attr
)
{
const
index
=
Object
.
keys
(
attrs
).
filter
(
attr
=>
{
return
attr
.
toLowerCase
()
===
propName
.
toLowerCase
();
return
attr
.
toLowerCase
()
===
propName
.
toLowerCase
();
})[
0
];
})[
0
];
return
attrs
[
index
];
return
attrs
[
index
];
...
@@ -186,14 +187,14 @@ function getPropWatchDepth(defaultWatch, prop) {
...
@@ -186,14 +187,14 @@ function getPropWatchDepth(defaultWatch, prop) {
// }
// }
// }));
// }));
//
//
const
reactComponent
=
function
(
$injector
)
{
const
reactComponent
=
$injector
=>
{
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
replace
:
true
,
replace
:
true
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
function
(
scope
,
elem
,
attrs
)
{
const
reactComponent
=
getReactComponent
(
attrs
.
name
,
$injector
);
const
reactComponent
=
getReactComponent
(
attrs
.
name
,
$injector
);
const
renderMyComponent
=
function
()
{
const
renderMyComponent
=
()
=>
{
const
scopeProps
=
scope
.
$eval
(
attrs
.
props
);
const
scopeProps
=
scope
.
$eval
(
attrs
.
props
);
const
props
=
applyFunctions
(
scopeProps
,
scope
);
const
props
=
applyFunctions
(
scopeProps
,
scope
);
...
@@ -243,8 +244,8 @@ const reactComponent = function($injector) {
...
@@ -243,8 +244,8 @@ const reactComponent = function($injector) {
//
//
// <hello name="name"/>
// <hello name="name"/>
//
//
const
reactDirective
=
function
(
$injector
)
{
const
reactDirective
=
$injector
=>
{
return
function
(
reactComponentName
,
props
,
conf
,
injectableProps
)
{
return
(
reactComponentName
,
props
,
conf
,
injectableProps
)
=>
{
const
directive
=
{
const
directive
=
{
restrict
:
'E'
,
restrict
:
'E'
,
replace
:
true
,
replace
:
true
,
...
@@ -255,11 +256,11 @@ const reactDirective = function($injector) {
...
@@ -255,11 +256,11 @@ const reactDirective = function($injector) {
props
=
props
||
Object
.
keys
(
reactComponent
.
propTypes
||
{});
props
=
props
||
Object
.
keys
(
reactComponent
.
propTypes
||
{});
// for each of the properties, get their scope value and set it to scope.props
// for each of the properties, get their scope value and set it to scope.props
const
renderMyComponent
=
function
()
{
const
renderMyComponent
=
()
=>
{
let
scopeProps
=
{};
let
scopeProps
=
{};
const
config
=
{};
const
config
=
{};
props
.
forEach
(
function
(
prop
)
{
props
.
forEach
(
prop
=>
{
const
propName
=
getPropName
(
prop
);
const
propName
=
getPropName
(
prop
);
scopeProps
[
propName
]
=
scope
.
$eval
(
findAttribute
(
attrs
,
propName
));
scopeProps
[
propName
]
=
scope
.
$eval
(
findAttribute
(
attrs
,
propName
));
config
[
propName
]
=
getPropConfig
(
prop
);
config
[
propName
]
=
getPropConfig
(
prop
);
...
@@ -272,7 +273,7 @@ const reactDirective = function($injector) {
...
@@ -272,7 +273,7 @@ const reactDirective = function($injector) {
// watch each property name and trigger an update whenever something changes,
// watch each property name and trigger an update whenever something changes,
// to update scope.props with new values
// to update scope.props with new values
const
propExpressions
=
props
.
map
(
function
(
prop
)
{
const
propExpressions
=
props
.
map
(
prop
=>
{
return
Array
.
isArray
(
prop
)
?
[
attrs
[
getPropName
(
prop
)],
getPropConfig
(
prop
)]
:
attrs
[
prop
];
return
Array
.
isArray
(
prop
)
?
[
attrs
[
getPropName
(
prop
)],
getPropConfig
(
prop
)]
:
attrs
[
prop
];
});
});
...
...
public/app/core/table_model.ts
View file @
00c0b71f
...
@@ -26,7 +26,7 @@ export default class TableModel {
...
@@ -26,7 +26,7 @@ export default class TableModel {
return
;
return
;
}
}
this
.
rows
.
sort
(
function
(
a
,
b
)
{
this
.
rows
.
sort
(
(
a
,
b
)
=>
{
a
=
a
[
options
.
col
];
a
=
a
[
options
.
col
];
b
=
b
[
options
.
col
];
b
=
b
[
options
.
col
];
// Sort null or undefined seperately from comparable values
// Sort null or undefined seperately from comparable values
...
...
public/app/core/utils/file_export.ts
View file @
00c0b71f
...
@@ -84,7 +84,7 @@ export function convertSeriesListToCsvColumns(seriesList, dateTimeFormat = DEFAU
...
@@ -84,7 +84,7 @@ export function convertSeriesListToCsvColumns(seriesList, dateTimeFormat = DEFAU
formatSpecialHeader
(
excel
)
+
formatSpecialHeader
(
excel
)
+
formatRow
(
formatRow
(
[
'Time'
].
concat
(
[
'Time'
].
concat
(
seriesList
.
map
(
function
(
val
)
{
seriesList
.
map
(
val
=>
{
return
val
.
alias
;
return
val
.
alias
;
})
})
)
)
...
@@ -97,7 +97,7 @@ export function convertSeriesListToCsvColumns(seriesList, dateTimeFormat = DEFAU
...
@@ -97,7 +97,7 @@ export function convertSeriesListToCsvColumns(seriesList, dateTimeFormat = DEFAU
const
timestamp
=
moment
(
seriesList
[
0
].
datapoints
[
i
][
POINT_TIME_INDEX
]).
format
(
dateTimeFormat
);
const
timestamp
=
moment
(
seriesList
[
0
].
datapoints
[
i
][
POINT_TIME_INDEX
]).
format
(
dateTimeFormat
);
text
+=
formatRow
(
text
+=
formatRow
(
[
timestamp
].
concat
(
[
timestamp
].
concat
(
seriesList
.
map
(
function
(
series
)
{
seriesList
.
map
(
series
=>
{
return
series
.
datapoints
[
i
][
POINT_VALUE_INDEX
];
return
series
.
datapoints
[
i
][
POINT_VALUE_INDEX
];
})
})
),
),
...
...
public/app/core/utils/flatten.ts
View file @
00c0b71f
...
@@ -10,7 +10,7 @@ export default function flatten(target, opts): any {
...
@@ -10,7 +10,7 @@ export default function flatten(target, opts): any {
const
output
=
{};
const
output
=
{};
function
step
(
object
,
prev
)
{
function
step
(
object
,
prev
)
{
Object
.
keys
(
object
).
forEach
(
function
(
key
)
{
Object
.
keys
(
object
).
forEach
(
key
=>
{
const
value
=
object
[
key
];
const
value
=
object
[
key
];
const
isarray
=
opts
.
safe
&&
Array
.
isArray
(
value
);
const
isarray
=
opts
.
safe
&&
Array
.
isArray
(
value
);
const
type
=
Object
.
prototype
.
toString
.
call
(
value
);
const
type
=
Object
.
prototype
.
toString
.
call
(
value
);
...
...
public/app/core/utils/kbn.ts
View file @
00c0b71f
...
@@ -5,13 +5,13 @@ const kbn: any = {};
...
@@ -5,13 +5,13 @@ const kbn: any = {};
kbn
.
valueFormats
=
{};
kbn
.
valueFormats
=
{};
kbn
.
regexEscape
=
function
(
value
)
{
kbn
.
regexEscape
=
value
=>
{
return
value
.
replace
(
/
[\\
^$*+?.()|[
\]
{}
\/]
/g
,
'
\\
$&'
);
return
value
.
replace
(
/
[\\
^$*+?.()|[
\]
{}
\/]
/g
,
'
\\
$&'
);
};
};
///// HELPER FUNCTIONS /////
///// HELPER FUNCTIONS /////
kbn
.
round_interval
=
function
(
interval
)
{
kbn
.
round_interval
=
interval
=>
{
switch
(
true
)
{
switch
(
true
)
{
// 0.015s
// 0.015s
case
interval
<
15
:
case
interval
<
15
:
...
@@ -102,7 +102,7 @@ kbn.round_interval = function(interval) {
...
@@ -102,7 +102,7 @@ kbn.round_interval = function(interval) {
}
}
};
};
kbn
.
secondsToHms
=
function
(
seconds
)
{
kbn
.
secondsToHms
=
seconds
=>
{
const
numyears
=
Math
.
floor
(
seconds
/
31536000
);
const
numyears
=
Math
.
floor
(
seconds
/
31536000
);
if
(
numyears
)
{
if
(
numyears
)
{
return
numyears
+
'y'
;
return
numyears
+
'y'
;
...
@@ -131,7 +131,7 @@ kbn.secondsToHms = function(seconds) {
...
@@ -131,7 +131,7 @@ kbn.secondsToHms = function(seconds) {
return
'less than a millisecond'
;
//'just now' //or other string you like;
return
'less than a millisecond'
;
//'just now' //or other string you like;
};
};
kbn
.
secondsToHhmmss
=
function
(
seconds
)
{
kbn
.
secondsToHhmmss
=
seconds
=>
{
const
strings
=
[];
const
strings
=
[];
const
numhours
=
Math
.
floor
(
seconds
/
3600
);
const
numhours
=
Math
.
floor
(
seconds
/
3600
);
const
numminutes
=
Math
.
floor
((
seconds
%
3600
)
/
60
);
const
numminutes
=
Math
.
floor
((
seconds
%
3600
)
/
60
);
...
@@ -142,11 +142,11 @@ kbn.secondsToHhmmss = function(seconds) {
...
@@ -142,11 +142,11 @@ kbn.secondsToHhmmss = function(seconds) {
return
strings
.
join
(
':'
);
return
strings
.
join
(
':'
);
};
};
kbn
.
to_percent
=
function
(
nr
,
outof
)
{
kbn
.
to_percent
=
(
nr
,
outof
)
=>
{
return
Math
.
floor
(
nr
/
outof
*
10000
)
/
100
+
'%'
;
return
Math
.
floor
(
nr
/
outof
*
10000
)
/
100
+
'%'
;
};
};
kbn
.
addslashes
=
function
(
str
)
{
kbn
.
addslashes
=
str
=>
{
str
=
str
.
replace
(
/
\\
/g
,
'
\\\
\'
);
str
=
str
.
replace
(
/
\\
/g
,
'
\\\
\'
);
str = str.replace(/
\'
/g, "
\
\'
");
str = str.replace(/
\'
/g, "
\
\'
");
str = str.replace(/
\
"/g, '
\\
"');
str = str.replace(/
\
"/g, '
\\
"');
...
@@ -168,7 +168,7 @@ kbn.intervals_in_seconds = {
...
@@ -168,7 +168,7 @@ kbn.intervals_in_seconds = {
ms: 0.001,
ms: 0.001,
};
};
kbn.calculateInterval =
function(range, resolution, lowLimitInterval)
{
kbn.calculateInterval =
(range, resolution, lowLimitInterval) =>
{
let lowLimitMs = 1; // 1 millisecond default low limit
let lowLimitMs = 1; // 1 millisecond default low limit
let intervalMs;
let intervalMs;
...
@@ -190,7 +190,7 @@ kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
...
@@ -190,7 +190,7 @@ kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
};
};
};
};
kbn.describe_interval =
function(str)
{
kbn.describe_interval =
str =>
{
const matches = str.match(kbn.interval_regex);
const matches = str.match(kbn.interval_regex);
if (!matches || !_.has(kbn.intervals_in_seconds, matches[2])) {
if (!matches || !_.has(kbn.intervals_in_seconds, matches[2])) {
throw new Error('Invalid interval string, expecting a number followed by one of "
Mwdhmsy
"');
throw new Error('Invalid interval string, expecting a number followed by one of "
Mwdhmsy
"');
...
@@ -203,17 +203,17 @@ kbn.describe_interval = function(str) {
...
@@ -203,17 +203,17 @@ kbn.describe_interval = function(str) {
}
}
};
};
kbn.interval_to_ms =
function(str)
{
kbn.interval_to_ms =
str =>
{
const info = kbn.describe_interval(str);
const info = kbn.describe_interval(str);
return info.sec * 1000 * info.count;
return info.sec * 1000 * info.count;
};
};
kbn.interval_to_seconds =
function(str)
{
kbn.interval_to_seconds =
str =>
{
const info = kbn.describe_interval(str);
const info = kbn.describe_interval(str);
return info.sec * info.count;
return info.sec * info.count;
};
};
kbn.query_color_dot =
function(color, diameter)
{
kbn.query_color_dot =
(color, diameter) =>
{
return (
return (
'<div class="
icon
-
circle
" style="
' +
'<div class="
icon
-
circle
" style="
' +
['
display
:
inline
-
block
', '
color
:
' + color, '
font
-
size
:
' + diameter + '
px
'].join('
;
') +
['
display
:
inline
-
block
', '
color
:
' + color, '
font
-
size
:
' + diameter + '
px
'].join('
;
') +
...
@@ -221,14 +221,14 @@ kbn.query_color_dot = function(color, diameter) {
...
@@ -221,14 +221,14 @@ kbn.query_color_dot = function(color, diameter) {
);
);
};
};
kbn.slugifyForUrl =
function(str)
{
kbn.slugifyForUrl =
str =>
{
return str
return str
.toLowerCase()
.toLowerCase()
.replace(/[^
\
w ]+/g, '')
.replace(/[^
\
w ]+/g, '')
.replace(/ +/g, '-');
.replace(/ +/g, '-');
};
};
kbn.stringToJsRegex =
function(str)
{
kbn.stringToJsRegex =
str =>
{
if (str[0] !== '/') {
if (str[0] !== '/') {
return new RegExp('^' + str + '$');
return new RegExp('^' + str + '$');
}
}
...
@@ -237,7 +237,7 @@ kbn.stringToJsRegex = function(str) {
...
@@ -237,7 +237,7 @@ kbn.stringToJsRegex = function(str) {
return new RegExp(match[1], match[2]);
return new RegExp(match[1], match[2]);
};
};
kbn.toFixed =
function(value, decimals)
{
kbn.toFixed =
(value, decimals) =>
{
if (value === null) {
if (value === null) {
return '';
return '';
}
}
...
@@ -263,7 +263,7 @@ kbn.toFixed = function(value, decimals) {
...
@@ -263,7 +263,7 @@ kbn.toFixed = function(value, decimals) {
return formatted;
return formatted;
};
};
kbn.toFixedScaled =
function(value, decimals, scaledDecimals, additionalDecimals, ext)
{
kbn.toFixedScaled =
(value, decimals, scaledDecimals, additionalDecimals, ext) =>
{
if (scaledDecimals === null) {
if (scaledDecimals === null) {
return kbn.toFixed(value, decimals) + ext;
return kbn.toFixed(value, decimals) + ext;
} else {
} else {
...
@@ -271,7 +271,7 @@ kbn.toFixedScaled = function(value, decimals, scaledDecimals, additionalDecimals
...
@@ -271,7 +271,7 @@ kbn.toFixedScaled = function(value, decimals, scaledDecimals, additionalDecimals
}
}
};
};
kbn.roundValue =
function(num, decimals)
{
kbn.roundValue =
(num, decimals) =>
{
if (num === null) {
if (num === null) {
return null;
return null;
}
}
...
@@ -286,8 +286,8 @@ kbn.formatBuilders = {};
...
@@ -286,8 +286,8 @@ kbn.formatBuilders = {};
// Formatter which always appends a fixed unit string to the value. No
// Formatter which always appends a fixed unit string to the value. No
// scaling of the value is performed.
// scaling of the value is performed.
kbn.formatBuilders.fixedUnit =
function(unit)
{
kbn.formatBuilders.fixedUnit =
unit =>
{
return
function(size, decimals)
{
return
(size, decimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -298,8 +298,8 @@ kbn.formatBuilders.fixedUnit = function(unit) {
...
@@ -298,8 +298,8 @@ kbn.formatBuilders.fixedUnit = function(unit) {
// Formatter which scales the unit string geometrically according to the given
// Formatter which scales the unit string geometrically according to the given
// numeric factor. Repeatedly scales the value down by the factor until it is
// numeric factor. Repeatedly scales the value down by the factor until it is
// less than the factor in magnitude, or the end of the array is reached.
// less than the factor in magnitude, or the end of the array is reached.
kbn.formatBuilders.scaledUnits =
function(factor, extArray)
{
kbn.formatBuilders.scaledUnits =
(factor, extArray) =>
{
return
function(size, decimals, scaledDecimals)
{
return
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -327,10 +327,10 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
...
@@ -327,10 +327,10 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
// Extension of the scaledUnits builder which uses SI decimal prefixes. If an
// Extension of the scaledUnits builder which uses SI decimal prefixes. If an
// offset is given, it adjusts the starting units at the given prefix; a value
// offset is given, it adjusts the starting units at the given prefix; a value
// of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc.
// of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc.
kbn.formatBuilders.decimalSIPrefix =
function(unit, offset)
{
kbn.formatBuilders.decimalSIPrefix =
(unit, offset) =>
{
let prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
let prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
prefixes = prefixes.slice(3 + (offset || 0));
prefixes = prefixes.slice(3 + (offset || 0));
const units = prefixes.map(
function(p)
{
const units = prefixes.map(
p =>
{
return ' ' + p + unit;
return ' ' + p + unit;
});
});
return kbn.formatBuilders.scaledUnits(1000, units);
return kbn.formatBuilders.scaledUnits(1000, units);
...
@@ -339,9 +339,9 @@ kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
...
@@ -339,9 +339,9 @@ kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
// Extension of the scaledUnits builder which uses SI binary prefixes. If
// Extension of the scaledUnits builder which uses SI binary prefixes. If
// offset is given, it starts the units at the given prefix; otherwise, the
// offset is given, it starts the units at the given prefix; otherwise, the
// offset defaults to zero and the initial unit is not prefixed.
// offset defaults to zero and the initial unit is not prefixed.
kbn.formatBuilders.binarySIPrefix =
function(unit, offset)
{
kbn.formatBuilders.binarySIPrefix =
(unit, offset) =>
{
const prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset);
const prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset);
const units = prefixes.map(
function(p)
{
const units = prefixes.map(
p =>
{
return ' ' + p + unit;
return ' ' + p + unit;
});
});
return kbn.formatBuilders.scaledUnits(1024, units);
return kbn.formatBuilders.scaledUnits(1024, units);
...
@@ -349,10 +349,10 @@ kbn.formatBuilders.binarySIPrefix = function(unit, offset) {
...
@@ -349,10 +349,10 @@ kbn.formatBuilders.binarySIPrefix = function(unit, offset) {
// Currency formatter for prefixing a symbol onto a number. Supports scaling
// Currency formatter for prefixing a symbol onto a number. Supports scaling
// up to the trillions.
// up to the trillions.
kbn.formatBuilders.currency =
function(symbol)
{
kbn.formatBuilders.currency =
symbol =>
{
const units = ['', 'K', 'M', 'B', 'T'];
const units = ['', 'K', 'M', 'B', 'T'];
const scaler = kbn.formatBuilders.scaledUnits(1000, units);
const scaler = kbn.formatBuilders.scaledUnits(1000, units);
return
function(size, decimals, scaledDecimals)
{
return
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -361,10 +361,10 @@ kbn.formatBuilders.currency = function(symbol) {
...
@@ -361,10 +361,10 @@ kbn.formatBuilders.currency = function(symbol) {
};
};
};
};
kbn.formatBuilders.simpleCountUnit =
function(symbol)
{
kbn.formatBuilders.simpleCountUnit =
symbol =>
{
const units = ['', 'K', 'M', 'B', 'T'];
const units = ['', 'K', 'M', 'B', 'T'];
const scaler = kbn.formatBuilders.scaledUnits(1000, units);
const scaler = kbn.formatBuilders.scaledUnits(1000, units);
return
function(size, decimals, scaledDecimals)
{
return
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -390,14 +390,14 @@ kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, [
...
@@ -390,14 +390,14 @@ kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, [
]);
]);
kbn.valueFormats.dB = kbn.formatBuilders.fixedUnit('dB');
kbn.valueFormats.dB = kbn.formatBuilders.fixedUnit('dB');
kbn.valueFormats.percent =
function(size, decimals)
{
kbn.valueFormats.percent =
(size, decimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
return kbn.toFixed(size, decimals) + '%';
return kbn.toFixed(size, decimals) + '%';
};
};
kbn.valueFormats.percentunit =
function(size, decimals)
{
kbn.valueFormats.percentunit =
(size, decimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -407,7 +407,7 @@ kbn.valueFormats.percentunit = function(size, decimals) {
...
@@ -407,7 +407,7 @@ kbn.valueFormats.percentunit = function(size, decimals) {
/* Formats the value to hex. Uses float if specified decimals are not 0.
/* Formats the value to hex. Uses float if specified decimals are not 0.
* There are two options, one with 0x, and one without */
* There are two options, one with 0x, and one without */
kbn.valueFormats.hex =
function(value, decimals)
{
kbn.valueFormats.hex =
(value, decimals) =>
{
if (value == null) {
if (value == null) {
return '';
return '';
}
}
...
@@ -416,7 +416,7 @@ kbn.valueFormats.hex = function(value, decimals) {
...
@@ -416,7 +416,7 @@ kbn.valueFormats.hex = function(value, decimals) {
.toUpperCase();
.toUpperCase();
};
};
kbn.valueFormats.hex0x =
function(value, decimals)
{
kbn.valueFormats.hex0x =
(value, decimals) =>
{
if (value == null) {
if (value == null) {
return '';
return '';
}
}
...
@@ -427,11 +427,11 @@ kbn.valueFormats.hex0x = function(value, decimals) {
...
@@ -427,11 +427,11 @@ kbn.valueFormats.hex0x = function(value, decimals) {
return '0x' + hexString;
return '0x' + hexString;
};
};
kbn.valueFormats.sci =
function(value, decimals)
{
kbn.valueFormats.sci =
(value, decimals) =>
{
return value.toExponential(decimals);
return value.toExponential(decimals);
};
};
kbn.valueFormats.locale =
function(value, decimals)
{
kbn.valueFormats.locale =
(value, decimals) =>
{
return value.toLocaleString(undefined, { maximumFractionDigits: decimals });
return value.toLocaleString(undefined, { maximumFractionDigits: decimals });
};
};
...
@@ -618,7 +618,7 @@ kbn.valueFormats.congNm3 = kbn.formatBuilders.fixedUnit('g/Nm³');
...
@@ -618,7 +618,7 @@ kbn.valueFormats.congNm3 = kbn.formatBuilders.fixedUnit('g/Nm³');
// Time
// Time
kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('
Hz
');
kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('
Hz
');
kbn.valueFormats.ms =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.ms =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -642,7 +642,7 @@ kbn.valueFormats.ms = function(size, decimals, scaledDecimals) {
...
@@ -642,7 +642,7 @@ kbn.valueFormats.ms = function(size, decimals, scaledDecimals) {
return kbn.toFixedScaled(size / 31536000000, decimals, scaledDecimals, 10, '
year
');
return kbn.toFixedScaled(size / 31536000000, decimals, scaledDecimals, 10, '
year
');
};
};
kbn.valueFormats.s =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.s =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -679,7 +679,7 @@ kbn.valueFormats.s = function(size, decimals, scaledDecimals) {
...
@@ -679,7 +679,7 @@ kbn.valueFormats.s = function(size, decimals, scaledDecimals) {
return kbn.toFixedScaled(size / 3.15569e7, decimals, scaledDecimals, 7, '
year
');
return kbn.toFixedScaled(size / 3.15569e7, decimals, scaledDecimals, 7, '
year
');
};
};
kbn.valueFormats['
µ
s
'] =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats['
µ
s
'] =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -693,7 +693,7 @@ kbn.valueFormats['µs'] = function(size, decimals, scaledDecimals) {
...
@@ -693,7 +693,7 @@ kbn.valueFormats['µs'] = function(size, decimals, scaledDecimals) {
}
}
};
};
kbn.valueFormats.ns =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.ns =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -711,7 +711,7 @@ kbn.valueFormats.ns = function(size, decimals, scaledDecimals) {
...
@@ -711,7 +711,7 @@ kbn.valueFormats.ns = function(size, decimals, scaledDecimals) {
}
}
};
};
kbn.valueFormats.m =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.m =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -729,7 +729,7 @@ kbn.valueFormats.m = function(size, decimals, scaledDecimals) {
...
@@ -729,7 +729,7 @@ kbn.valueFormats.m = function(size, decimals, scaledDecimals) {
}
}
};
};
kbn.valueFormats.h =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.h =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -745,7 +745,7 @@ kbn.valueFormats.h = function(size, decimals, scaledDecimals) {
...
@@ -745,7 +745,7 @@ kbn.valueFormats.h = function(size, decimals, scaledDecimals) {
}
}
};
};
kbn.valueFormats.d =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.d =
(size, decimals, scaledDecimals) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -759,7 +759,7 @@ kbn.valueFormats.d = function(size, decimals, scaledDecimals) {
...
@@ -759,7 +759,7 @@ kbn.valueFormats.d = function(size, decimals, scaledDecimals) {
}
}
};
};
kbn.toDuration =
function(size, decimals, timeScale)
{
kbn.toDuration =
(size, decimals, timeScale) =>
{
if (size === null) {
if (size === null) {
return '';
return '';
}
}
...
@@ -784,7 +784,7 @@ kbn.toDuration = function(size, decimals, timeScale) {
...
@@ -784,7 +784,7 @@ kbn.toDuration = function(size, decimals, timeScale) {
// intervals_in_seconds uses seconds (duh), convert them to milliseconds here to minimize floating point errors
// intervals_in_seconds uses seconds (duh), convert them to milliseconds here to minimize floating point errors
size *=
size *=
kbn.intervals_in_seconds[
kbn.intervals_in_seconds[
units.find(
function(e)
{
units.find(
e =>
{
return e.long === timeScale;
return e.long === timeScale;
}).short
}).short
] * 1000;
] * 1000;
...
@@ -808,23 +808,23 @@ kbn.toDuration = function(size, decimals, timeScale) {
...
@@ -808,23 +808,23 @@ kbn.toDuration = function(size, decimals, timeScale) {
return strings.join('
,
');
return strings.join('
,
');
};
};
kbn.valueFormats.dtdurationms =
function(size, decimals)
{
kbn.valueFormats.dtdurationms =
(size, decimals) =>
{
return kbn.toDuration(size, decimals, '
millisecond
');
return kbn.toDuration(size, decimals, '
millisecond
');
};
};
kbn.valueFormats.dtdurations =
function(size, decimals)
{
kbn.valueFormats.dtdurations =
(size, decimals) =>
{
return kbn.toDuration(size, decimals, '
second
');
return kbn.toDuration(size, decimals, '
second
');
};
};
kbn.valueFormats.dthms =
function(size, decimals)
{
kbn.valueFormats.dthms =
(size, decimals) =>
{
return kbn.secondsToHhmmss(size);
return kbn.secondsToHhmmss(size);
};
};
kbn.valueFormats.timeticks =
function(size, decimals, scaledDecimals)
{
kbn.valueFormats.timeticks =
(size, decimals, scaledDecimals) =>
{
return kbn.valueFormats.s(size / 100, decimals, scaledDecimals);
return kbn.valueFormats.s(size / 100, decimals, scaledDecimals);
};
};
kbn.valueFormats.dateTimeAsIso =
function(epoch, isUtc)
{
kbn.valueFormats.dateTimeAsIso =
(epoch, isUtc) =>
{
const time = isUtc ? moment.utc(epoch) : moment(epoch);
const time = isUtc ? moment.utc(epoch) : moment(epoch);
if (moment().isSame(epoch, '
day
')) {
if (moment().isSame(epoch, '
day
')) {
...
@@ -833,7 +833,7 @@ kbn.valueFormats.dateTimeAsIso = function(epoch, isUtc) {
...
@@ -833,7 +833,7 @@ kbn.valueFormats.dateTimeAsIso = function(epoch, isUtc) {
return time.format('
YYYY
-
MM
-
DD
HH
:
mm
:
ss
');
return time.format('
YYYY
-
MM
-
DD
HH
:
mm
:
ss
');
};
};
kbn.valueFormats.dateTimeAsUS =
function(epoch, isUtc)
{
kbn.valueFormats.dateTimeAsUS =
(epoch, isUtc) =>
{
const time = isUtc ? moment.utc(epoch) : moment(epoch);
const time = isUtc ? moment.utc(epoch) : moment(epoch);
if (moment().isSame(epoch, '
day
')) {
if (moment().isSame(epoch, '
day
')) {
...
@@ -842,14 +842,14 @@ kbn.valueFormats.dateTimeAsUS = function(epoch, isUtc) {
...
@@ -842,14 +842,14 @@ kbn.valueFormats.dateTimeAsUS = function(epoch, isUtc) {
return time.format('
MM
/
DD
/
YYYY
h
:
mm
:
ss
a
');
return time.format('
MM
/
DD
/
YYYY
h
:
mm
:
ss
a
');
};
};
kbn.valueFormats.dateTimeFromNow =
function(epoch, isUtc)
{
kbn.valueFormats.dateTimeFromNow =
(epoch, isUtc) =>
{
const time = isUtc ? moment.utc(epoch) : moment(epoch);
const time = isUtc ? moment.utc(epoch) : moment(epoch);
return time.fromNow();
return time.fromNow();
};
};
///// FORMAT MENU /////
///// FORMAT MENU /////
kbn.getUnitFormats =
function()
{
kbn.getUnitFormats =
() =>
{
return [
return [
{
{
text: '
none
',
text: '
none
',
...
...
public/app/core/utils/outline.ts
View file @
00c0b71f
...
@@ -5,7 +5,7 @@ function outlineFixer() {
...
@@ -5,7 +5,7 @@ function outlineFixer() {
const
styleElement
=
d
.
createElement
(
'STYLE'
);
const
styleElement
=
d
.
createElement
(
'STYLE'
);
const
domEvents
=
'addEventListener'
in
d
;
const
domEvents
=
'addEventListener'
in
d
;
const
addEventListener
=
function
(
type
,
callback
)
{
const
addEventListener
=
(
type
,
callback
)
=>
{
// Basic cross-browser event handling
// Basic cross-browser event handling
if
(
domEvents
)
{
if
(
domEvents
)
{
d
.
addEventListener
(
type
,
callback
);
d
.
addEventListener
(
type
,
callback
);
...
@@ -14,7 +14,7 @@ function outlineFixer() {
...
@@ -14,7 +14,7 @@ function outlineFixer() {
}
}
};
};
const
setCss
=
function
(
cssText
)
{
const
setCss
=
cssText
=>
{
// Handle setting of <style> element contents in IE8
// Handle setting of <style> element contents in IE8
!!
styleElement
.
styleSheet
?
(
styleElement
.
styleSheet
.
cssText
=
cssText
)
:
(
styleElement
.
innerHTML
=
cssText
);
!!
styleElement
.
styleSheet
?
(
styleElement
.
styleSheet
.
cssText
=
cssText
)
:
(
styleElement
.
innerHTML
=
cssText
);
};
};
...
@@ -22,11 +22,11 @@ function outlineFixer() {
...
@@ -22,11 +22,11 @@ function outlineFixer() {
d
.
getElementsByTagName
(
'HEAD'
)[
0
].
appendChild
(
styleElement
);
d
.
getElementsByTagName
(
'HEAD'
)[
0
].
appendChild
(
styleElement
);
// Using mousedown instead of mouseover, so that previously focused elements don't lose focus ring on mouse move
// Using mousedown instead of mouseover, so that previously focused elements don't lose focus ring on mouse move
addEventListener
(
'mousedown'
,
function
()
{
addEventListener
(
'mousedown'
,
()
=>
{
setCss
(
':focus{outline:0 !important}::-moz-focus-inner{border:0;}'
);
setCss
(
':focus{outline:0 !important}::-moz-focus-inner{border:0;}'
);
});
});
addEventListener
(
'keydown'
,
function
()
{
addEventListener
(
'keydown'
,
()
=>
{
setCss
(
''
);
setCss
(
''
);
});
});
}
}
...
...
public/app/core/utils/rangeutil.ts
View file @
00c0b71f
...
@@ -61,7 +61,7 @@ const rangeOptions = [
...
@@ -61,7 +61,7 @@ const rangeOptions = [
const
absoluteFormat
=
'MMM D, YYYY HH:mm:ss'
;
const
absoluteFormat
=
'MMM D, YYYY HH:mm:ss'
;
const
rangeIndex
=
{};
const
rangeIndex
=
{};
_
.
each
(
rangeOptions
,
f
unction
(
frame
)
{
_
.
each
(
rangeOptions
,
f
rame
=>
{
rangeIndex
[
frame
.
from
+
' to '
+
frame
.
to
]
=
frame
;
rangeIndex
[
frame
.
from
+
' to '
+
frame
.
to
]
=
frame
;
});
});
...
...
public/app/core/utils/url.ts
View file @
00c0b71f
...
@@ -6,11 +6,11 @@ export function toUrlParams(a) {
...
@@ -6,11 +6,11 @@ export function toUrlParams(a) {
const
s
=
[];
const
s
=
[];
const
rbracket
=
/
\[\]
$/
;
const
rbracket
=
/
\[\]
$/
;
const
isArray
=
function
(
obj
)
{
const
isArray
=
obj
=>
{
return
Object
.
prototype
.
toString
.
call
(
obj
)
===
'[object Array]'
;
return
Object
.
prototype
.
toString
.
call
(
obj
)
===
'[object Array]'
;
};
};
const
add
=
function
(
k
,
v
)
{
const
add
=
(
k
,
v
)
=>
{
v
=
typeof
v
===
'function'
?
v
()
:
v
===
null
?
''
:
v
===
undefined
?
''
:
v
;
v
=
typeof
v
===
'function'
?
v
()
:
v
===
null
?
''
:
v
===
undefined
?
''
:
v
;
if
(
typeof
v
!==
'boolean'
)
{
if
(
typeof
v
!==
'boolean'
)
{
s
[
s
.
length
]
=
encodeURIComponent
(
k
)
+
'='
+
encodeURIComponent
(
v
);
s
[
s
.
length
]
=
encodeURIComponent
(
k
)
+
'='
+
encodeURIComponent
(
v
);
...
@@ -19,7 +19,7 @@ export function toUrlParams(a) {
...
@@ -19,7 +19,7 @@ export function toUrlParams(a) {
}
}
};
};
const
buildParams
=
function
(
prefix
,
obj
)
{
const
buildParams
=
(
prefix
,
obj
)
=>
{
let
i
,
len
,
key
;
let
i
,
len
,
key
;
if
(
prefix
)
{
if
(
prefix
)
{
...
...
public/app/features/dashboard/dashboard_migration.ts
View file @
00c0b71f
...
@@ -36,7 +36,7 @@ export class DashboardMigrator {
...
@@ -36,7 +36,7 @@ export class DashboardMigrator {
}
}
}
}
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
// rename panel type
// rename panel type
if
(
panel
.
type
===
'graphite'
)
{
if
(
panel
.
type
===
'graphite'
)
{
panel
.
type
=
'graph'
;
panel
.
type
=
'graph'
;
...
@@ -84,7 +84,7 @@ export class DashboardMigrator {
...
@@ -84,7 +84,7 @@ export class DashboardMigrator {
if
(
oldVersion
<
3
)
{
if
(
oldVersion
<
3
)
{
// ensure panel ids
// ensure panel ids
let
maxId
=
this
.
dashboard
.
getNextPanelId
();
let
maxId
=
this
.
dashboard
.
getNextPanelId
();
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
!
panel
.
id
)
{
if
(
!
panel
.
id
)
{
panel
.
id
=
maxId
;
panel
.
id
=
maxId
;
maxId
+=
1
;
maxId
+=
1
;
...
@@ -95,11 +95,11 @@ export class DashboardMigrator {
...
@@ -95,11 +95,11 @@ export class DashboardMigrator {
// schema version 4 changes
// schema version 4 changes
if
(
oldVersion
<
4
)
{
if
(
oldVersion
<
4
)
{
// move aliasYAxis changes
// move aliasYAxis changes
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
panel
.
type
!==
'graph'
)
{
if
(
panel
.
type
!==
'graph'
)
{
return
;
return
;
}
}
_
.
each
(
panel
.
aliasYAxis
,
function
(
value
,
key
)
{
_
.
each
(
panel
.
aliasYAxis
,
(
value
,
key
)
=>
{
panel
.
seriesOverrides
=
[{
alias
:
key
,
yaxis
:
value
}];
panel
.
seriesOverrides
=
[{
alias
:
key
,
yaxis
:
value
}];
});
});
delete
panel
.
aliasYAxis
;
delete
panel
.
aliasYAxis
;
...
@@ -150,15 +150,15 @@ export class DashboardMigrator {
...
@@ -150,15 +150,15 @@ export class DashboardMigrator {
}
}
if
(
oldVersion
<
8
)
{
if
(
oldVersion
<
8
)
{
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
_
.
each
(
panel
.
targets
,
function
(
target
)
{
_
.
each
(
panel
.
targets
,
target
=>
{
// update old influxdb query schema
// update old influxdb query schema
if
(
target
.
fields
&&
target
.
tags
&&
target
.
groupBy
)
{
if
(
target
.
fields
&&
target
.
tags
&&
target
.
groupBy
)
{
if
(
target
.
rawQuery
)
{
if
(
target
.
rawQuery
)
{
delete
target
.
fields
;
delete
target
.
fields
;
delete
target
.
fill
;
delete
target
.
fill
;
}
else
{
}
else
{
target
.
select
=
_
.
map
(
target
.
fields
,
f
unction
(
field
)
{
target
.
select
=
_
.
map
(
target
.
fields
,
f
ield
=>
{
const
parts
=
[];
const
parts
=
[];
parts
.
push
({
type
:
'field'
,
params
:
[
field
.
name
]
});
parts
.
push
({
type
:
'field'
,
params
:
[
field
.
name
]
});
parts
.
push
({
type
:
field
.
func
,
params
:
[]
});
parts
.
push
({
type
:
field
.
func
,
params
:
[]
});
...
@@ -171,7 +171,7 @@ export class DashboardMigrator {
...
@@ -171,7 +171,7 @@ export class DashboardMigrator {
return
parts
;
return
parts
;
});
});
delete
target
.
fields
;
delete
target
.
fields
;
_
.
each
(
target
.
groupBy
,
function
(
part
)
{
_
.
each
(
target
.
groupBy
,
part
=>
{
if
(
part
.
type
===
'time'
&&
part
.
interval
)
{
if
(
part
.
type
===
'time'
&&
part
.
interval
)
{
part
.
params
=
[
part
.
interval
];
part
.
params
=
[
part
.
interval
];
delete
part
.
interval
;
delete
part
.
interval
;
...
@@ -195,7 +195,7 @@ export class DashboardMigrator {
...
@@ -195,7 +195,7 @@ export class DashboardMigrator {
// schema version 9 changes
// schema version 9 changes
if
(
oldVersion
<
9
)
{
if
(
oldVersion
<
9
)
{
// move aliasYAxis changes
// move aliasYAxis changes
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
panel
.
type
!==
'singlestat'
&&
panel
.
thresholds
!==
''
)
{
if
(
panel
.
type
!==
'singlestat'
&&
panel
.
thresholds
!==
''
)
{
return
;
return
;
}
}
...
@@ -214,12 +214,12 @@ export class DashboardMigrator {
...
@@ -214,12 +214,12 @@ export class DashboardMigrator {
// schema version 10 changes
// schema version 10 changes
if
(
oldVersion
<
10
)
{
if
(
oldVersion
<
10
)
{
// move aliasYAxis changes
// move aliasYAxis changes
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
panel
.
type
!==
'table'
)
{
if
(
panel
.
type
!==
'table'
)
{
return
;
return
;
}
}
_
.
each
(
panel
.
styles
,
function
(
style
)
{
_
.
each
(
panel
.
styles
,
style
=>
{
if
(
style
.
thresholds
&&
style
.
thresholds
.
length
>=
3
)
{
if
(
style
.
thresholds
&&
style
.
thresholds
.
length
>=
3
)
{
const
k
=
style
.
thresholds
;
const
k
=
style
.
thresholds
;
k
.
shift
();
k
.
shift
();
...
@@ -231,7 +231,7 @@ export class DashboardMigrator {
...
@@ -231,7 +231,7 @@ export class DashboardMigrator {
if
(
oldVersion
<
12
)
{
if
(
oldVersion
<
12
)
{
// update template variables
// update template variables
_
.
each
(
this
.
dashboard
.
templating
.
list
,
function
(
templateVariable
)
{
_
.
each
(
this
.
dashboard
.
templating
.
list
,
templateVariable
=>
{
if
(
templateVariable
.
refresh
)
{
if
(
templateVariable
.
refresh
)
{
templateVariable
.
refresh
=
1
;
templateVariable
.
refresh
=
1
;
}
}
...
@@ -248,7 +248,7 @@ export class DashboardMigrator {
...
@@ -248,7 +248,7 @@ export class DashboardMigrator {
if
(
oldVersion
<
12
)
{
if
(
oldVersion
<
12
)
{
// update graph yaxes changes
// update graph yaxes changes
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
panel
.
type
!==
'graph'
)
{
if
(
panel
.
type
!==
'graph'
)
{
return
;
return
;
}
}
...
@@ -297,7 +297,7 @@ export class DashboardMigrator {
...
@@ -297,7 +297,7 @@ export class DashboardMigrator {
if
(
oldVersion
<
13
)
{
if
(
oldVersion
<
13
)
{
// update graph yaxes changes
// update graph yaxes changes
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
panel
=>
{
if
(
panel
.
type
!==
'graph'
)
{
if
(
panel
.
type
!==
'graph'
)
{
return
;
return
;
}
}
...
...
public/app/features/dashboard/dashboard_model.ts
View file @
00c0b71f
...
@@ -258,7 +258,7 @@ export class DashboardModel {
...
@@ -258,7 +258,7 @@ export class DashboardModel {
}
}
sortPanelsByGridPos
()
{
sortPanelsByGridPos
()
{
this
.
panels
.
sort
(
function
(
panelA
,
panelB
)
{
this
.
panels
.
sort
(
(
panelA
,
panelB
)
=>
{
if
(
panelA
.
gridPos
.
y
===
panelB
.
gridPos
.
y
)
{
if
(
panelA
.
gridPos
.
y
===
panelB
.
gridPos
.
y
)
{
return
panelA
.
gridPos
.
x
-
panelB
.
gridPos
.
x
;
return
panelA
.
gridPos
.
x
-
panelB
.
gridPos
.
x
;
}
else
{
}
else
{
...
@@ -775,8 +775,8 @@ export class DashboardModel {
...
@@ -775,8 +775,8 @@ export class DashboardModel {
getNextQueryLetter
(
panel
)
{
getNextQueryLetter
(
panel
)
{
const
letters
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
;
const
letters
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
;
return
_
.
find
(
letters
,
function
(
refId
)
{
return
_
.
find
(
letters
,
refId
=>
{
return
_
.
every
(
panel
.
targets
,
function
(
other
)
{
return
_
.
every
(
panel
.
targets
,
other
=>
{
return
other
.
refId
!==
refId
;
return
other
.
refId
!==
refId
;
});
});
});
});
...
...
public/app/features/panel/panel_ctrl.ts
View file @
00c0b71f
...
@@ -126,7 +126,7 @@ export class PanelCtrl {
...
@@ -126,7 +126,7 @@ export class PanelCtrl {
const
editorTab
=
{
title
,
directiveFn
};
const
editorTab
=
{
title
,
directiveFn
};
if
(
_
.
isString
(
directiveFn
))
{
if
(
_
.
isString
(
directiveFn
))
{
editorTab
.
directiveFn
=
function
()
{
editorTab
.
directiveFn
=
()
=>
{
return
{
templateUrl
:
directiveFn
};
return
{
templateUrl
:
directiveFn
};
};
};
}
}
...
...
public/app/plugins/datasource/graphite/add_graphite_func.ts
View file @
00c0b71f
...
@@ -24,7 +24,7 @@ export function graphiteAddFunc($compile) {
...
@@ -24,7 +24,7 @@ export function graphiteAddFunc($compile) {
$input
.
appendTo
(
elem
);
$input
.
appendTo
(
elem
);
$button
.
appendTo
(
elem
);
$button
.
appendTo
(
elem
);
ctrl
.
datasource
.
getFuncDefs
().
then
(
func
tion
(
funcDefs
)
{
ctrl
.
datasource
.
getFuncDefs
().
then
(
func
Defs
=>
{
const
allFunctions
=
_
.
map
(
funcDefs
,
'name'
).
sort
();
const
allFunctions
=
_
.
map
(
funcDefs
,
'name'
).
sort
();
$scope
.
functionMenu
=
createFunctionDropDownMenu
(
funcDefs
);
$scope
.
functionMenu
=
createFunctionDropDownMenu
(
funcDefs
);
...
@@ -34,12 +34,12 @@ export function graphiteAddFunc($compile) {
...
@@ -34,12 +34,12 @@ export function graphiteAddFunc($compile) {
source
:
allFunctions
,
source
:
allFunctions
,
minLength
:
1
,
minLength
:
1
,
items
:
10
,
items
:
10
,
updater
:
function
(
value
)
{
updater
:
value
=>
{
let
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
value
);
let
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
value
);
if
(
!
funcDef
)
{
if
(
!
funcDef
)
{
// try find close match
// try find close match
value
=
value
.
toLowerCase
();
value
=
value
.
toLowerCase
();
funcDef
=
_
.
find
(
allFunctions
,
func
tion
(
funcName
)
{
funcDef
=
_
.
find
(
allFunctions
,
func
Name
=>
{
return
funcName
.
toLowerCase
().
indexOf
(
value
)
===
0
;
return
funcName
.
toLowerCase
().
indexOf
(
value
)
===
0
;
});
});
...
@@ -48,7 +48,7 @@ export function graphiteAddFunc($compile) {
...
@@ -48,7 +48,7 @@ export function graphiteAddFunc($compile) {
}
}
}
}
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
ctrl
.
addFunction
(
funcDef
);
ctrl
.
addFunction
(
funcDef
);
});
});
...
@@ -57,20 +57,20 @@ export function graphiteAddFunc($compile) {
...
@@ -57,20 +57,20 @@ export function graphiteAddFunc($compile) {
},
},
});
});
$button
.
click
(
function
()
{
$button
.
click
(
()
=>
{
$button
.
hide
();
$button
.
hide
();
$input
.
show
();
$input
.
show
();
$input
.
focus
();
$input
.
focus
();
});
});
$input
.
keyup
(
function
()
{
$input
.
keyup
(
()
=>
{
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
});
});
$input
.
blur
(
function
()
{
$input
.
blur
(
()
=>
{
// clicking the function dropdown menu won't
// clicking the function dropdown menu won't
// work if you remove class at once
// work if you remove class at once
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
$input
.
val
(
''
);
$input
.
val
(
''
);
$input
.
hide
();
$input
.
hide
();
$button
.
show
();
$button
.
show
();
...
@@ -82,7 +82,7 @@ export function graphiteAddFunc($compile) {
...
@@ -82,7 +82,7 @@ export function graphiteAddFunc($compile) {
});
});
let
drop
;
let
drop
;
const
cleanUpDrop
=
function
()
{
const
cleanUpDrop
=
()
=>
{
if
(
drop
)
{
if
(
drop
)
{
drop
.
destroy
();
drop
.
destroy
();
drop
=
null
;
drop
=
null
;
...
@@ -121,7 +121,7 @@ export function graphiteAddFunc($compile) {
...
@@ -121,7 +121,7 @@ export function graphiteAddFunc($compile) {
});
});
}
}
})
})
.
on
(
'mouseout'
,
'ul.dropdown-menu li'
,
function
()
{
.
on
(
'mouseout'
,
'ul.dropdown-menu li'
,
()
=>
{
cleanUpDrop
();
cleanUpDrop
();
});
});
...
@@ -135,7 +135,7 @@ angular.module('grafana.directives').directive('graphiteAddFunc', graphiteAddFun
...
@@ -135,7 +135,7 @@ angular.module('grafana.directives').directive('graphiteAddFunc', graphiteAddFun
function
createFunctionDropDownMenu
(
funcDefs
)
{
function
createFunctionDropDownMenu
(
funcDefs
)
{
const
categories
=
{};
const
categories
=
{};
_
.
forEach
(
funcDefs
,
func
tion
(
funcDef
)
{
_
.
forEach
(
funcDefs
,
func
Def
=>
{
if
(
!
funcDef
.
category
)
{
if
(
!
funcDef
.
category
)
{
return
;
return
;
}
}
...
@@ -149,7 +149,7 @@ function createFunctionDropDownMenu(funcDefs) {
...
@@ -149,7 +149,7 @@ function createFunctionDropDownMenu(funcDefs) {
});
});
return
_
.
sortBy
(
return
_
.
sortBy
(
_
.
map
(
categories
,
function
(
submenu
,
category
)
{
_
.
map
(
categories
,
(
submenu
,
category
)
=>
{
return
{
return
{
text
:
category
,
text
:
category
,
submenu
:
_
.
sortBy
(
submenu
,
'text'
),
submenu
:
_
.
sortBy
(
submenu
,
'text'
),
...
...
public/app/plugins/datasource/graphite/datasource.ts
View file @
00c0b71f
...
@@ -16,7 +16,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -16,7 +16,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
this
.
funcDefs
=
null
;
this
.
funcDefs
=
null
;
this
.
funcDefsPromise
=
null
;
this
.
funcDefsPromise
=
null
;
this
.
getQueryOptionsInfo
=
function
()
{
this
.
getQueryOptionsInfo
=
()
=>
{
return
{
return
{
maxDataPoints
:
true
,
maxDataPoints
:
true
,
cacheTimeout
:
true
,
cacheTimeout
:
true
,
...
@@ -70,7 +70,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -70,7 +70,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
}
}
};
};
this
.
convertDataPointsToMs
=
function
(
result
)
{
this
.
convertDataPointsToMs
=
result
=>
{
if
(
!
result
||
!
result
.
data
)
{
if
(
!
result
||
!
result
.
data
)
{
return
[];
return
[];
}
}
...
@@ -83,7 +83,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -83,7 +83,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
return
result
;
return
result
;
};
};
this
.
parseTags
=
function
(
tagString
)
{
this
.
parseTags
=
tagString
=>
{
let
tags
=
[];
let
tags
=
[];
tags
=
tagString
.
split
(
','
);
tags
=
tagString
.
split
(
','
);
if
(
tags
.
length
===
1
)
{
if
(
tags
.
length
===
1
)
{
...
@@ -106,7 +106,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -106,7 +106,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
maxDataPoints
:
100
,
maxDataPoints
:
100
,
};
};
return
this
.
query
(
graphiteQuery
).
then
(
function
(
result
)
{
return
this
.
query
(
graphiteQuery
).
then
(
result
=>
{
const
list
=
[];
const
list
=
[];
for
(
let
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
...
@@ -175,11 +175,11 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -175,11 +175,11 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
}
}
};
};
this
.
targetContainsTemplate
=
function
(
target
)
{
this
.
targetContainsTemplate
=
target
=>
{
return
templateSrv
.
variableExists
(
target
.
target
);
return
templateSrv
.
variableExists
(
target
.
target
);
};
};
this
.
translateTime
=
function
(
date
,
roundUp
)
{
this
.
translateTime
=
(
date
,
roundUp
)
=>
{
if
(
_
.
isString
(
date
))
{
if
(
_
.
isString
(
date
))
{
if
(
date
===
'now'
)
{
if
(
date
===
'now'
)
{
return
'now'
;
return
'now'
;
...
@@ -467,7 +467,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -467,7 +467,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
targets
:
[{
target
:
'constantLine(100)'
}],
targets
:
[{
target
:
'constantLine(100)'
}],
maxDataPoints
:
300
,
maxDataPoints
:
300
,
};
};
return
this
.
query
(
query
).
then
(
function
()
{
return
this
.
query
(
query
).
then
(
()
=>
{
return
{
status
:
'success'
,
message
:
'Data source is working'
};
return
{
status
:
'success'
,
message
:
'Data source is working'
};
});
});
};
};
...
@@ -539,7 +539,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -539,7 +539,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
}
}
}
}
_
.
each
(
options
,
function
(
value
,
key
)
{
_
.
each
(
options
,
(
value
,
key
)
=>
{
if
(
_
.
indexOf
(
graphiteOptions
,
key
)
===
-
1
)
{
if
(
_
.
indexOf
(
graphiteOptions
,
key
)
===
-
1
)
{
return
;
return
;
}
}
...
...
public/app/plugins/datasource/graphite/func_editor.ts
View file @
00c0b71f
...
@@ -57,7 +57,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -57,7 +57,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
if
(
!
scheduledRelink
)
{
if
(
!
scheduledRelink
)
{
scheduledRelink
=
true
;
scheduledRelink
=
true
;
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
relink
();
relink
();
scheduledRelink
=
false
;
scheduledRelink
=
false
;
},
200
);
},
200
);
...
@@ -93,7 +93,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -93,7 +93,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
scheduledRelinkIfNeeded
();
scheduledRelinkIfNeeded
();
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
ctrl
.
targetChanged
();
ctrl
.
targetChanged
();
});
});
...
@@ -113,7 +113,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -113,7 +113,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
const
inputElem
=
this
;
const
inputElem
=
this
;
// happens long before the click event on the typeahead options
// happens long before the click event on the typeahead options
// need to have long delay because the blur
// need to have long delay because the blur
cancelBlur
=
setTimeout
(
function
()
{
cancelBlur
=
setTimeout
(
()
=>
{
switchToLink
(
inputElem
,
paramIndex
);
switchToLink
(
inputElem
,
paramIndex
);
},
200
);
},
200
);
}
}
...
@@ -135,7 +135,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -135,7 +135,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
let
options
=
paramDef
(
paramIndex
).
options
;
let
options
=
paramDef
(
paramIndex
).
options
;
if
(
paramDef
(
paramIndex
).
type
===
'int'
)
{
if
(
paramDef
(
paramIndex
).
type
===
'int'
)
{
options
=
_
.
map
(
options
,
function
(
val
)
{
options
=
_
.
map
(
options
,
val
=>
{
return
val
.
toString
();
return
val
.
toString
();
});
});
}
}
...
@@ -144,7 +144,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -144,7 +144,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
source
:
options
,
source
:
options
,
minLength
:
0
,
minLength
:
0
,
items
:
20
,
items
:
20
,
updater
:
function
(
value
)
{
updater
:
value
=>
{
$input
.
val
(
value
);
$input
.
val
(
value
);
switchToLink
(
$input
[
0
],
paramIndex
);
switchToLink
(
$input
[
0
],
paramIndex
);
return
value
;
return
value
;
...
@@ -185,7 +185,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -185,7 +185,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
defParams
.
push
(
_
.
assign
({},
lastParam
,
{
optional
:
true
}));
defParams
.
push
(
_
.
assign
({},
lastParam
,
{
optional
:
true
}));
}
}
_
.
each
(
defParams
,
function
(
param
,
index
)
{
_
.
each
(
defParams
,
(
param
,
index
)
=>
{
if
(
param
.
optional
&&
func
.
params
.
length
<
index
)
{
if
(
param
.
optional
&&
func
.
params
.
length
<
index
)
{
return
false
;
return
false
;
}
}
...
@@ -236,7 +236,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -236,7 +236,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
function
ifJustAddedFocusFirstParam
()
{
function
ifJustAddedFocusFirstParam
()
{
if
(
$scope
.
func
.
added
)
{
if
(
$scope
.
func
.
added
)
{
$scope
.
func
.
added
=
false
;
$scope
.
func
.
added
=
false
;
setTimeout
(
function
()
{
setTimeout
(
()
=>
{
elem
elem
.
find
(
'.graphite-func-param-link'
)
.
find
(
'.graphite-func-param-link'
)
.
first
()
.
first
()
...
@@ -250,18 +250,18 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -250,18 +250,18 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
}
}
function
registerFuncControlsActions
()
{
function
registerFuncControlsActions
()
{
$funcControls
.
click
(
function
(
e
)
{
$funcControls
.
click
(
e
=>
{
const
$target
=
$
(
e
.
target
);
const
$target
=
$
(
e
.
target
);
if
(
$target
.
hasClass
(
'fa-remove'
))
{
if
(
$target
.
hasClass
(
'fa-remove'
))
{
toggleFuncControls
();
toggleFuncControls
();
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
ctrl
.
removeFunction
(
$scope
.
func
);
ctrl
.
removeFunction
(
$scope
.
func
);
});
});
return
;
return
;
}
}
if
(
$target
.
hasClass
(
'fa-arrow-left'
))
{
if
(
$target
.
hasClass
(
'fa-arrow-left'
))
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
_
.
move
(
ctrl
.
queryModel
.
functions
,
$scope
.
$index
,
$scope
.
$index
-
1
);
_
.
move
(
ctrl
.
queryModel
.
functions
,
$scope
.
$index
,
$scope
.
$index
-
1
);
ctrl
.
targetChanged
();
ctrl
.
targetChanged
();
});
});
...
@@ -269,7 +269,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -269,7 +269,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
}
}
if
(
$target
.
hasClass
(
'fa-arrow-right'
))
{
if
(
$target
.
hasClass
(
'fa-arrow-right'
))
{
$scope
.
$apply
(
function
()
{
$scope
.
$apply
(
()
=>
{
_
.
move
(
ctrl
.
queryModel
.
functions
,
$scope
.
$index
,
$scope
.
$index
+
1
);
_
.
move
(
ctrl
.
queryModel
.
functions
,
$scope
.
$index
,
$scope
.
$index
+
1
);
ctrl
.
targetChanged
();
ctrl
.
targetChanged
();
});
});
...
...
public/app/plugins/datasource/graphite/gfunc.ts
View file @
00c0b71f
...
@@ -1058,10 +1058,10 @@ function getFuncDef(name, idx?) {
...
@@ -1058,10 +1058,10 @@ function getFuncDef(name, idx?) {
function
getFuncDefs
(
graphiteVersion
,
idx
?)
{
function
getFuncDefs
(
graphiteVersion
,
idx
?)
{
const
funcs
=
{};
const
funcs
=
{};
_
.
forEach
(
idx
||
index
,
func
tion
(
funcDef
)
{
_
.
forEach
(
idx
||
index
,
func
Def
=>
{
if
(
isVersionRelatedFunction
(
funcDef
,
graphiteVersion
))
{
if
(
isVersionRelatedFunction
(
funcDef
,
graphiteVersion
))
{
funcs
[
funcDef
.
name
]
=
_
.
assign
({},
funcDef
,
{
funcs
[
funcDef
.
name
]
=
_
.
assign
({},
funcDef
,
{
params
:
_
.
filter
(
funcDef
.
params
,
function
(
param
)
{
params
:
_
.
filter
(
funcDef
.
params
,
param
=>
{
return
isVersionRelatedFunction
(
param
,
graphiteVersion
);
return
isVersionRelatedFunction
(
param
,
graphiteVersion
);
}),
}),
});
});
...
...
public/app/plugins/datasource/opentsdb/specs/datasource.test.ts
View file @
00c0b71f
...
@@ -20,16 +20,16 @@ describe('opentsdb', () => {
...
@@ -20,16 +20,16 @@ describe('opentsdb', () => {
let
requestOptions
;
let
requestOptions
;
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
await
function
(
options
)
{
ctx
.
backendSrv
.
datasourceRequest
=
await
(
options
=>
{
requestOptions
=
options
;
requestOptions
=
options
;
return
Promise
.
resolve
({
return
Promise
.
resolve
({
data
:
[{
target
:
'prod1.count'
,
datapoints
:
[[
10
,
1
],
[
12
,
1
]]
}],
data
:
[{
target
:
'prod1.count'
,
datapoints
:
[[
10
,
1
],
[
12
,
1
]]
}],
});
});
};
}
)
;
});
});
it
(
'metrics() should generate api suggest query'
,
()
=>
{
it
(
'metrics() should generate api suggest query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'metrics(pew)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'metrics(pew)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
...
@@ -39,7 +39,7 @@ describe('opentsdb', () => {
...
@@ -39,7 +39,7 @@ describe('opentsdb', () => {
});
});
it
(
'tag_names(cpu) should generate lookup query'
,
()
=>
{
it
(
'tag_names(cpu) should generate lookup query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_names(cpu)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_names(cpu)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
...
@@ -47,7 +47,7 @@ describe('opentsdb', () => {
...
@@ -47,7 +47,7 @@ describe('opentsdb', () => {
});
});
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
...
@@ -55,7 +55,7 @@ describe('opentsdb', () => {
...
@@ -55,7 +55,7 @@ describe('opentsdb', () => {
});
});
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname, env=$env)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname, env=$env)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
...
@@ -63,7 +63,7 @@ describe('opentsdb', () => {
...
@@ -63,7 +63,7 @@ describe('opentsdb', () => {
});
});
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
it
(
'tag_values(cpu, test) should generate lookup query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname, env=$env, region=$region)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'tag_values(cpu, hostname, env=$env, region=$region)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/search/lookup'
);
...
@@ -71,7 +71,7 @@ describe('opentsdb', () => {
...
@@ -71,7 +71,7 @@ describe('opentsdb', () => {
});
});
it
(
'suggest_tagk() should generate api suggest query'
,
()
=>
{
it
(
'suggest_tagk() should generate api suggest query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'suggest_tagk(foo)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'suggest_tagk(foo)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
...
@@ -80,7 +80,7 @@ describe('opentsdb', () => {
...
@@ -80,7 +80,7 @@ describe('opentsdb', () => {
});
});
it
(
'suggest_tagv() should generate api suggest query'
,
()
=>
{
it
(
'suggest_tagv() should generate api suggest query'
,
()
=>
{
ctx
.
ctrl
.
metricFindQuery
(
'suggest_tagv(bar)'
).
then
(
function
(
data
)
{
ctx
.
ctrl
.
metricFindQuery
(
'suggest_tagv(bar)'
).
then
(
data
=>
{
results
=
data
;
results
=
data
;
});
});
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
expect
(
requestOptions
.
url
).
toBe
(
'/api/suggest'
);
...
...
public/app/stores/FolderStore/FolderStore.ts
View file @
00c0b71f
...
@@ -36,7 +36,7 @@ export const FolderStore = types
...
@@ -36,7 +36,7 @@ export const FolderStore = types
return
res
;
return
res
;
}),
}),
setTitle
:
function
(
originalTitle
:
string
,
title
:
string
)
{
setTitle
:
(
originalTitle
:
string
,
title
:
string
)
=>
{
self
.
folder
.
title
=
title
;
self
.
folder
.
title
=
title
;
self
.
folder
.
hasChanged
=
originalTitle
.
toLowerCase
()
!==
title
.
trim
().
toLowerCase
()
&&
title
.
trim
().
length
>
0
;
self
.
folder
.
hasChanged
=
originalTitle
.
toLowerCase
()
!==
title
.
trim
().
toLowerCase
()
&&
title
.
trim
().
length
>
0
;
},
},
...
...
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