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

57 lines
2.2 KiB

/// <reference path="../../includes.ts"/>
/// <reference path="kubernetesHelpers.ts"/>
/// <reference path="kubernetesPlugin.ts"/>
module Kubernetes {
export var BuildConfigController = controller("BuildConfigController",
["$scope", "KubernetesModel", "KubernetesState", "KubernetesSchema", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL",
($scope, KubernetesModel:Kubernetes.KubernetesModelService, KubernetesState, KubernetesSchema,
$templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL) => {
$scope.kubernetes = KubernetesState;
$scope.model = KubernetesModel;
$scope.id = $routeParams["id"];
$scope.schema = KubernetesSchema;
$scope.config = KubernetesSchema.definitions.os_build_BuildConfig;
Kubernetes.initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL);
$scope.breadcrumbConfig = Developer.createProjectBreadcrumbs($scope.id);
$scope.subTabConfig = Developer.createProjectSubNavBars($scope.id);
$scope.$on('kubernetesModelUpdated', function () {
updateData();
});
$scope.$on('$routeUpdate', ($event) => {
updateData();
});
updateData();
function updateData() {
$scope.item = null;
if ($scope.id) {
var url = buildConfigRestUrl($scope.id);
$http.get(url).
success(function (data, status, headers, config) {
if (data) {
$scope.entity = data;
var sortedBuilds = null;
enrichBuildConfig(data, sortedBuilds);
$scope.model.setProject($scope.entity);
}
$scope.fetched = true;
Core.$apply($scope);
}).
error(function (data, status, headers, config) {
log.warn("Failed to load " + url + " " + data + " " + status);
});
} else {
$scope.fetched = true;
Core.$apply($scope);
}
}
}]);
}