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
387ec89b
Commit
387ec89b
authored
Aug 06, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more angular 1.3 upgrade changes
parent
60dd6849
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
94 deletions
+145
-94
src/app/controllers/search.js
+1
-1
src/app/partials/dashLoader.html
+0
-1
src/vendor/angular/bindonce.js
+144
-92
No files found.
src/app/controllers/search.js
View file @
387ec89b
...
@@ -95,7 +95,7 @@ function (angular, _, config, $) {
...
@@ -95,7 +95,7 @@ function (angular, _, config, $) {
$scope
.
openSearch
=
function
(
evt
)
{
$scope
.
openSearch
=
function
(
evt
)
{
if
(
evt
)
{
if
(
evt
)
{
$element
.
find
(
'.dropdown-toggle'
).
dropdown
(
'toggle'
);
$element
.
next
().
find
(
'.dropdown-toggle'
).
dropdown
(
'toggle'
);
}
}
$scope
.
giveSearchFocus
=
$scope
.
giveSearchFocus
+
1
;
$scope
.
giveSearchFocus
=
$scope
.
giveSearchFocus
+
1
;
...
...
src/app/partials/dashLoader.html
View file @
387ec89b
...
@@ -56,7 +56,6 @@
...
@@ -56,7 +56,6 @@
</li>
</li>
<li
class=
"dropdown grafana-menu-load"
ng-controller=
"SearchCtrl"
ng-init=
"init()"
ng-include=
"'app/partials/search.html'"
>
<li
class=
"dropdown grafana-menu-load"
ng-controller=
"SearchCtrl"
ng-init=
"init()"
ng-include=
"'app/partials/search.html'"
>
</li>
</li>
<li
class=
"grafana-menu-home"
><a
bs-tooltip=
"'Goto saved default'"
data-placement=
"bottom"
href=
'#/'
><i
class=
'icon-home'
></i></a></li>
<li
class=
"grafana-menu-home"
><a
bs-tooltip=
"'Goto saved default'"
data-placement=
"bottom"
href=
'#/'
><i
class=
'icon-home'
></i></a></li>
...
...
src/vendor/angular/bindonce.js
View file @
387ec89b
'use strict'
;
(
function
()
{
/**
"use strict"
;
/**
* Bindonce - Zero watches binding for AngularJs
* Bindonce - Zero watches binding for AngularJs
* @version v0.2.1 - 2013-05-07
* @version v0.3.1
* @link https://github.com/Pasvaz/bindonce
* @link https://github.com/Pasvaz/bindonce
* @author Pasquale Vazzana <pasqualevazzana@gmail.com>
* @author Pasquale Vazzana <pasqualevazzana@gmail.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
*/
angular
.
module
(
'pasvaz.bindonce'
,
[])
var
bindonceModule
=
angular
.
module
(
'pasvaz.bindonce'
,
[]);
.
directive
(
'bindonce'
,
function
()
bindonceModule
.
directive
(
'bindonce'
,
function
()
{
{
var
toBoolean
=
function
(
value
)
var
toBoolean
=
function
(
value
)
{
{
if
(
value
&&
value
.
length
!==
0
)
if
(
value
&&
value
.
length
!==
0
)
{
{
var
v
=
angular
.
lowercase
(
""
+
value
);
var
v
=
angular
.
lowercase
(
""
+
value
);
value
=
!
(
v
==
'f'
||
v
==
'0'
||
v
==
'false'
||
v
==
'no'
||
v
==
'n'
||
v
==
'[]'
);
value
=
!
(
v
===
'f'
||
v
===
'0'
||
v
===
'false'
||
v
===
'no'
||
v
===
'n'
||
v
=
==
'[]'
);
}
}
else
else
{
{
value
=
false
;
value
=
false
;
}
}
return
value
;
return
value
;
}
};
var
msie
=
parseInt
((
/msie
(\d
+
)
/
.
exec
(
angular
.
lowercase
(
navigator
.
userAgent
))
||
[])[
1
],
10
);
var
msie
=
parseInt
((
/msie
(\d
+
)
/
.
exec
(
angular
.
lowercase
(
navigator
.
userAgent
))
||
[])[
1
],
10
);
if
(
isNaN
(
msie
))
if
(
isNaN
(
msie
))
...
@@ -34,20 +35,20 @@
...
@@ -34,20 +35,20 @@
var
bindonceDirective
=
var
bindonceDirective
=
{
{
restrict
:
"AM"
,
restrict
:
"AM"
,
controller
:
[
'$scope'
,
'$element'
,
'$attrs'
,
'$interpolate'
,
function
(
$scope
,
$element
,
$attrs
,
$interpolate
)
controller
:
[
'$scope'
,
'$element'
,
'$attrs'
,
'$interpolate'
,
function
(
$scope
,
$element
,
$attrs
,
$interpolate
)
{
{
var
showHideBinder
=
function
(
elm
,
attr
,
value
)
var
showHideBinder
=
function
(
elm
,
attr
,
value
)
{
{
var
show
=
(
attr
==
'show'
)
?
''
:
'none'
;
var
show
=
(
attr
=
==
'show'
)
?
''
:
'none'
;
var
hide
=
(
attr
==
'hide'
)
?
''
:
'none'
;
var
hide
=
(
attr
=
==
'hide'
)
?
''
:
'none'
;
elm
.
css
(
'display'
,
toBoolean
(
value
)
?
show
:
hide
);
elm
.
css
(
'display'
,
toBoolean
(
value
)
?
show
:
hide
);
}
};
var
classBinder
=
function
(
elm
,
value
)
var
classBinder
=
function
(
elm
,
value
)
{
{
if
(
angular
.
isObject
(
value
)
&&
!
angular
.
isArray
(
value
))
if
(
angular
.
isObject
(
value
)
&&
!
angular
.
isArray
(
value
))
{
{
var
results
=
[];
var
results
=
[];
angular
.
forEach
(
value
,
function
(
value
,
index
)
angular
.
forEach
(
value
,
function
(
value
,
index
)
{
{
if
(
value
)
results
.
push
(
index
);
if
(
value
)
results
.
push
(
index
);
});
});
...
@@ -57,17 +58,31 @@
...
@@ -57,17 +58,31 @@
{
{
elm
.
addClass
(
angular
.
isArray
(
value
)
?
value
.
join
(
' '
)
:
value
);
elm
.
addClass
(
angular
.
isArray
(
value
)
?
value
.
join
(
' '
)
:
value
);
}
}
}
};
var
transclude
=
function
(
transcluder
,
scope
)
{
transcluder
.
transclude
(
scope
,
function
(
clone
)
{
var
parent
=
transcluder
.
element
.
parent
();
var
afterNode
=
transcluder
.
element
&&
transcluder
.
element
[
transcluder
.
element
.
length
-
1
];
var
parentNode
=
parent
&&
parent
[
0
]
||
afterNode
&&
afterNode
.
parentNode
;
var
afterNextSibling
=
(
afterNode
&&
afterNode
.
nextSibling
)
||
null
;
angular
.
forEach
(
clone
,
function
(
node
)
{
parentNode
.
insertBefore
(
node
,
afterNextSibling
);
});
});
};
var
ctrl
=
var
ctrl
=
{
{
watcherRemover
:
undefined
,
watcherRemover
:
undefined
,
binders
:
[],
binders
:
[],
group
:
$attrs
.
boName
,
group
:
$attrs
.
boName
,
element
:
$element
,
element
:
$element
,
ran
:
false
,
ran
:
false
,
addBinder
:
function
(
binder
)
addBinder
:
function
(
binder
)
{
{
this
.
binders
.
push
(
binder
);
this
.
binders
.
push
(
binder
);
...
@@ -80,52 +95,80 @@
...
@@ -80,52 +95,80 @@
}
}
},
},
setupWatcher
:
function
(
bindonceValue
)
setupWatcher
:
function
(
bindonceValue
)
{
{
var
that
=
this
;
var
that
=
this
;
this
.
watcherRemover
=
$scope
.
$watch
(
bindonceValue
,
function
(
newValue
)
this
.
watcherRemover
=
$scope
.
$watch
(
bindonceValue
,
function
(
newValue
)
{
{
if
(
newValue
==
undefined
)
return
;
if
(
newValue
=
==
undefined
)
return
;
that
.
removeWatcher
();
that
.
removeWatcher
();
that
.
runBinders
(
);
that
.
checkBindonce
(
newValue
);
},
true
);
},
true
);
},
},
removeWatcher
:
function
()
checkBindonce
:
function
(
value
)
{
var
that
=
this
,
promise
=
(
value
.
$promise
)
?
value
.
$promise
.
then
:
value
.
then
;
// since Angular 1.2 promises are no longer
// undefined until they don't get resolved
if
(
typeof
promise
===
'function'
)
{
promise
(
function
()
{
that
.
runBinders
();
});
}
else
{
that
.
runBinders
();
}
},
removeWatcher
:
function
()
{
{
if
(
this
.
watcherRemover
!
=
undefined
)
if
(
this
.
watcherRemover
!=
=
undefined
)
{
{
this
.
watcherRemover
();
this
.
watcherRemover
();
this
.
watcherRemover
=
undefined
;
this
.
watcherRemover
=
undefined
;
}
}
},
},
runBinders
:
function
()
runBinders
:
function
()
{
{
var
i
,
max
;
while
(
this
.
binders
.
length
>
0
)
for
(
i
=
0
,
max
=
this
.
binders
.
length
;
i
<
max
;
i
++
)
{
{
var
binder
=
this
.
binders
[
i
]
;
var
binder
=
this
.
binders
.
shift
()
;
if
(
this
.
group
&&
this
.
group
!=
binder
.
group
)
continue
;
if
(
this
.
group
&&
this
.
group
!=
binder
.
group
)
continue
;
var
value
=
binder
.
scope
.
$eval
((
binder
.
interpolate
)
?
$interpolate
(
binder
.
value
)
:
binder
.
value
);
var
value
=
binder
.
scope
.
$eval
((
binder
.
interpolate
)
?
$interpolate
(
binder
.
value
)
:
binder
.
value
);
switch
(
binder
.
attr
)
switch
(
binder
.
attr
)
{
{
case
'i
f'
:
case
'boI
f'
:
if
(
toBoolean
(
value
))
if
(
toBoolean
(
value
))
{
{
binder
.
transclude
(
binder
.
scope
.
$new
(),
function
(
clone
)
transclude
(
binder
,
binder
.
scope
.
$new
());
}
break
;
case
'boSwitch'
:
var
selectedTranscludes
,
switchCtrl
=
binder
.
controller
[
0
];
if
((
selectedTranscludes
=
switchCtrl
.
cases
[
'!'
+
value
]
||
switchCtrl
.
cases
[
'?'
]))
{
{
var
parent
=
binder
.
element
.
parent
();
binder
.
scope
.
$eval
(
binder
.
attrs
.
change
);
var
afterNode
=
binder
.
element
&&
binder
.
element
[
binder
.
element
.
length
-
1
];
angular
.
forEach
(
selectedTranscludes
,
function
(
selectedTransclude
)
var
parentNode
=
parent
&&
parent
[
0
]
||
afterNode
&&
afterNode
.
parentNode
;
var
afterNextSibling
=
(
afterNode
&&
afterNode
.
nextSibling
)
||
null
;
angular
.
forEach
(
clone
,
function
(
node
)
{
{
parentNode
.
insertBefore
(
node
,
afterNextSibling
);
transclude
(
selectedTransclude
,
binder
.
scope
.
$new
());
});
});
});
}
}
break
;
break
;
case
'boSwitchWhen'
:
var
ctrl
=
binder
.
controller
[
0
];
ctrl
.
cases
[
'!'
+
binder
.
attrs
.
boSwitchWhen
]
=
(
ctrl
.
cases
[
'!'
+
binder
.
attrs
.
boSwitchWhen
]
||
[]);
ctrl
.
cases
[
'!'
+
binder
.
attrs
.
boSwitchWhen
].
push
({
transclude
:
binder
.
transclude
,
element
:
binder
.
element
});
break
;
case
'boSwitchDefault'
:
var
ctrl
=
binder
.
controller
[
0
];
ctrl
.
cases
[
'?'
]
=
(
ctrl
.
cases
[
'?'
]
||
[]);
ctrl
.
cases
[
'?'
].
push
({
transclude
:
binder
.
transclude
,
element
:
binder
.
element
});
break
;
case
'hide'
:
case
'hide'
:
case
'show'
:
case
'show'
:
showHideBinder
(
binder
.
element
,
binder
.
attr
,
value
);
showHideBinder
(
binder
.
element
,
binder
.
attr
,
value
);
...
@@ -145,8 +188,9 @@
...
@@ -145,8 +188,9 @@
case
'src'
:
case
'src'
:
binder
.
element
.
attr
(
binder
.
attr
,
value
);
binder
.
element
.
attr
(
binder
.
attr
,
value
);
if
(
msie
)
binder
.
element
.
prop
(
'src'
,
value
);
if
(
msie
)
binder
.
element
.
prop
(
'src'
,
value
);
break
;
case
'attr'
:
case
'attr'
:
angular
.
forEach
(
binder
.
attrs
,
function
(
attrValue
,
attrKey
)
angular
.
forEach
(
binder
.
attrs
,
function
(
attrValue
,
attrKey
)
{
{
var
newAttr
,
newValue
;
var
newAttr
,
newValue
;
if
(
attrKey
.
match
(
/^boAttr./
)
&&
binder
.
attrs
[
attrKey
])
if
(
attrKey
.
match
(
/^boAttr./
)
&&
binder
.
attrs
[
attrKey
])
...
@@ -167,19 +211,18 @@
...
@@ -167,19 +211,18 @@
}
}
}
}
this
.
ran
=
true
;
this
.
ran
=
true
;
this
.
binders
=
[];
}
}
}
};
return
ctrl
;
return
ctrl
;
}],
}],
link
:
function
(
scope
,
elm
,
attrs
,
bindonceController
)
link
:
function
(
scope
,
elm
,
attrs
,
bindonceController
)
{
{
var
value
=
(
attrs
.
bindonce
)
?
scope
.
$eval
(
attrs
.
bindonce
)
:
true
;
var
value
=
attrs
.
bindonce
&&
scope
.
$eval
(
attrs
.
bindonce
)
;
if
(
value
!
=
undefined
)
if
(
value
!=
=
undefined
)
{
{
bindonceController
.
runBinders
(
);
bindonceController
.
checkBindonce
(
value
);
}
}
else
else
{
{
...
@@ -190,80 +233,89 @@
...
@@ -190,80 +233,89 @@
};
};
return
bindonceDirective
;
return
bindonceDirective
;
});
});
angular
.
forEach
(
[
{
directiveName
:
'boShow'
,
attribute
:
'show'
},
{
directiveName
:
'boHide'
,
attribute
:
'hide'
},
{
directiveName
:
'boClass'
,
attribute
:
'class'
},
{
directiveName
:
'boText'
,
attribute
:
'text'
},
{
directiveName
:
'boBind'
,
attribute
:
'text'
},
{
directiveName
:
'boHtml'
,
attribute
:
'html'
},
{
directiveName
:
'boSrcI'
,
attribute
:
'src'
,
interpolate
:
true
},
{
directiveName
:
'boSrc'
,
attribute
:
'src'
},
{
directiveName
:
'boHrefI'
,
attribute
:
'href'
,
interpolate
:
true
},
{
directiveName
:
'boHref'
,
attribute
:
'href'
},
{
directiveName
:
'boAlt'
,
attribute
:
'alt'
},
{
directiveName
:
'boTitle'
,
attribute
:
'title'
},
{
directiveName
:
'boId'
,
attribute
:
'id'
},
{
directiveName
:
'boStyle'
,
attribute
:
'style'
},
{
directiveName
:
'boValue'
,
attribute
:
'value'
},
{
directiveName
:
'boAttr'
,
attribute
:
'attr'
},
angular
.
forEach
(
{
directiveName
:
'boIf'
,
transclude
:
'element'
,
terminal
:
true
,
priority
:
1000
},
[
{
directiveName
:
'boSwitch'
,
require
:
'boSwitch'
,
controller
:
function
()
{
this
.
cases
=
{};
}
},
{
directiveName
:
'boShow'
,
attribute
:
'show'
},
{
directiveName
:
'boSwitchWhen'
,
transclude
:
'element'
,
priority
:
800
,
require
:
'^boSwitch'
},
{
directiveName
:
'boIf'
,
attribute
:
'if'
,
transclude
:
'element'
,
terminal
:
true
,
priority
:
1000
},
{
directiveName
:
'boSwitchDefault'
,
transclude
:
'element'
,
priority
:
800
,
require
:
'^boSwitch'
}
{
directiveName
:
'boHide'
,
attribute
:
'hide'
},
],
{
directiveName
:
'boClass'
,
attribute
:
'class'
},
function
(
boDirective
)
{
directiveName
:
'boText'
,
attribute
:
'text'
},
{
{
directiveName
:
'boHtml'
,
attribute
:
'html'
},
{
directiveName
:
'boSrcI'
,
attribute
:
'src'
,
interpolate
:
true
},
{
directiveName
:
'boSrc'
,
attribute
:
'src'
},
{
directiveName
:
'boHrefI'
,
attribute
:
'href'
,
interpolate
:
true
},
{
directiveName
:
'boHref'
,
attribute
:
'href'
},
{
directiveName
:
'boAlt'
,
attribute
:
'alt'
},
{
directiveName
:
'boTitle'
,
attribute
:
'title'
},
{
directiveName
:
'boId'
,
attribute
:
'id'
},
{
directiveName
:
'boStyle'
,
attribute
:
'style'
},
{
directiveName
:
'boValue'
,
attribute
:
'value'
},
{
directiveName
:
'boAttr'
,
attribute
:
'attr'
}
],
function
(
boDirective
)
{
var
childPriority
=
200
;
var
childPriority
=
200
;
return
angular
.
module
(
'pasvaz.bindonce'
).
directive
(
boDirective
.
directiveName
,
function
()
return
bindonceModule
.
directive
(
boDirective
.
directiveName
,
function
()
{
{
var
bindonceDirective
=
var
bindonceDirective
=
{
{
priority
:
boDirective
.
priority
||
childPriority
,
priority
:
boDirective
.
priority
||
childPriority
,
transclude
:
boDirective
.
transclude
||
false
,
transclude
:
boDirective
.
transclude
||
false
,
terminal
:
boDirective
.
terminal
||
false
,
terminal
:
boDirective
.
terminal
||
false
,
require
:
'^bindonce'
,
require
:
[
'^bindonce'
].
concat
(
boDirective
.
require
||
[]),
controller
:
boDirective
.
controller
,
compile
:
function
(
tElement
,
tAttrs
,
transclude
)
compile
:
function
(
tElement
,
tAttrs
,
transclude
)
{
{
return
function
(
scope
,
elm
,
attrs
,
bindonceController
)
return
function
(
scope
,
elm
,
attrs
,
controllers
)
{
{
var
bindonceController
=
controllers
[
0
];
var
name
=
attrs
.
boParent
;
var
name
=
attrs
.
boParent
;
if
(
name
&&
bindonceController
.
group
!
=
name
)
if
(
name
&&
bindonceController
.
group
!=
=
name
)
{
{
var
element
=
bindonceController
.
element
.
parent
();
var
element
=
bindonceController
.
element
.
parent
();
bindonceController
=
undefined
;
bindonceController
=
undefined
;
var
parentValue
;
var
parentValue
;
while
(
element
[
0
].
nodeType
!
=
9
&&
element
.
length
)
while
(
element
[
0
].
nodeType
!=
=
9
&&
element
.
length
)
{
{
if
((
parentValue
=
element
.
data
(
'$bindonceController'
))
if
((
parentValue
=
element
.
data
(
'$bindonceController'
))
&&
parentValue
.
group
==
name
)
&&
parentValue
.
group
=
==
name
)
{
{
bindonceController
=
parentValue
bindonceController
=
parentValue
;
break
;
break
;
}
}
element
=
element
.
parent
();
element
=
element
.
parent
();
}
}
if
(
!
bindonceController
)
if
(
!
bindonceController
)
{
{
thro
w
Error
(
"No bindonce controller: "
+
name
);
throw
ne
w
Error
(
"No bindonce controller: "
+
name
);
}
}
}
}
bindonceController
.
addBinder
(
bindonceController
.
addBinder
(
{
{
element
:
elm
,
element
:
elm
,
attr
:
boDirective
.
attribute
,
attr
:
boDirective
.
attribute
||
boDirective
.
directiveName
,
attrs
:
attrs
,
attrs
:
attrs
,
value
:
attrs
[
boDirective
.
directiveName
],
value
:
attrs
[
boDirective
.
directiveName
],
interpolate
:
boDirective
.
interpolate
,
interpolate
:
boDirective
.
interpolate
,
group
:
name
,
group
:
name
,
transclude
:
transclude
,
transclude
:
transclude
,
scope
:
scope
controller
:
controllers
.
slice
(
1
),
scope
:
scope
});
});
};
}
}
}
};
}
return
bindonceDirective
;
return
bindonceDirective
;
});
});
});
})
\ No newline at end of file
})();
\ No newline at end of file
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