kubernetes/www/master/js/app.directive.js
Patrick Reilly 716d98c39e initial commit of chrome only of new replacement web ui
remove node modules

make new data file for web ui

initial commit of dashboard

switch back to non SSL request

move port splitting to common place; add to node resource location

Signed-off-by: Patrick Reilly <patrick@kismatic.io>

various path fixes

make svg path relative

work around missing mime type

Signed-off-by: Patrick Reilly <patrick@kismatic.io>

fix paths

fix karma path

remove bad protractor test
2015-04-21 07:24:06 -07:00

57 lines
2.1 KiB
JavaScript

app.directive('includeReplace',
function() {
'use strict';
return {
require: 'ngInclude',
restrict: 'A', /* optional */
link: function(scope, el, attrs) { el.replaceWith(el.children()); }
};
})
.directive('compile',
function($compile) {
'use strict';
return function(scope, element, attrs) {
scope.$watch(function(scope) { return scope.$eval(attrs.compile); },
function(value) {
element.html(value);
$compile(element.contents())(scope);
});
};
})
.directive("kubernetesUiMenu",
function() {
'use strict';
return {
templateUrl: "views/partials/kubernetes-ui-menu.tmpl.html"
};
})
.directive('menuToggle', function() {
'use strict';
return {
scope: {section: '='},
templateUrl: 'views/partials/menu-toggle.tmpl.html',
link: function($scope, $element) {
var controller = $element.parent().controller();
$scope.isOpen = function() { return controller.isOpen($scope.section); };
$scope.toggle = function() { controller.toggleOpen($scope.section); };
var parentNode = $element[0].parentNode.parentNode.parentNode;
if (parentNode.classList.contains('parent-list-item')) {
var heading = parentNode.querySelector('h2');
$element[0].firstChild.setAttribute('aria-describedby', heading.id);
}
}
};
});
app.filter('startFrom',
function() {
'use strict';
return function(input, start) { return input.slice(start); };
})
.filter('nospace', function() {
'use strict';
return function(value) { return (!value) ? '' : value.replace(/ /g, ''); };
});