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/replicationController.ts

58 lines
1.7 KiB

9 years ago
/// <reference path="../../includes.ts"/>
/// <reference path="kubernetesHelpers.ts"/>
/// <reference path="kubernetesPlugin.ts"/>
module Kubernetes {
export var ReplicationControllerController = controller("ReplicationControllerController",
["$scope", "KubernetesModel", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL",
($scope, KubernetesModel: Kubernetes.KubernetesModelService, KubernetesState,
$templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL) => {
$scope.kubernetes = KubernetesState;
$scope.model = KubernetesModel;
$scope.rawModel = null
Kubernetes.initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL);
$scope.itemConfig = {
properties: {
'^\\/labels$': {
template: $templateCache.get('labelTemplate.html')
}
}
};
$scope.$on('kubernetesModelUpdated', () => {
updateData();
});
$scope.$on('$routeUpdate', ($event) => {
updateData();
});
$scope.$watch('model.pods', (newValue, oldValue) => {
updateData();
}, true);
$scope.flipRaw = () => {
$scope.rawMode = !$scope.rawMode;
Core.$apply($scope);
};
updateData();
function updateData() {
if ($scope.dirty) {
return;
}
$scope.id = $routeParams["id"];
$scope.item = $scope.model.getReplicationController(KubernetesState.selectedNamespace, $scope.id);
if ($scope.item) {
$scope.rawModel = toRawYaml($scope.item);
}
Core.$apply($scope);
}
}]);
}