You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/plugins/kubernetes/ts/namespace.ts

24 lines
818 B

9 years ago
/// <reference path="kubernetesPlugin.ts"/>
module Kubernetes {
export var NamespaceController = controller("NamespaceController", ["$scope", "WatcherService", ($scope, watcher:WatcherService) => {
$scope.watcher = watcher;
$scope.namespaceObjects = watcher.getObjects('namespaces');
$scope.namespace = watcher.getNamespace();
$scope.namespaces = [];
$scope.$watch('namespace', (newValue, oldValue) => {
if (newValue !== oldValue) {
watcher.setNamespace(newValue);
}
});
$scope.$watch('watcher.getNamespace()', (newValue, oldValue) => {
if (newValue !== oldValue) {
$scope.namespace = newValue;
}
});
$scope.$watchCollection('namespaceObjects', (namespaceObjects) => {
$scope.namespaces = _.map(namespaceObjects, (namespace:any) => namespace.metadata.name);
})
}]);
}