add a spike for letting folks create new build configs
This commit is contained in:
parent
8de6af6362
commit
1014e5bf03
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference path="d.ts/includes.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerEnrichers.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,9 +1,17 @@
|
|||
<div ng-controller="Kubernetes.BuildConfigController">
|
||||
<div ng-controller="Kubernetes.BuildConfigEditController">
|
||||
<div class="row">
|
||||
<div hawtio-breadcrumbs></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div hawtio-tabs></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<span class="pull-right"> </span>
|
||||
<a class="btn btn-default pull-right"
|
||||
href="{{baseUri}}/kubernetes/buildConfigs"><i class="fa fa-list"></i></a>
|
||||
href="{{baseUri}}/kubernetes/buildConfigs"><i class="fa fa-list"></i></a>
|
||||
<button class="btn btn-primary pull-right"
|
||||
title="Saves changes to this build configuration"
|
||||
ng-click="save()">
|
||||
|
|
@ -19,7 +27,27 @@
|
|||
</div>
|
||||
</div>
|
||||
<div ng-show="fetched">
|
||||
<div hawtio-form-2="config" entity="entity"></div>
|
||||
|
||||
<form ng-disabled="config.mode == 0" class="form-horizontal">
|
||||
<fieldset>
|
||||
<legend ng-show="config.label || config.description" ng-hide="config.hideLegend"
|
||||
class="ng-binding"></legend>
|
||||
<div class="row">
|
||||
<div class="clearfix col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Name</label>
|
||||
<input ntype="text" class="form-control" placeholder="project name" ng-model="entity.metadata.name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
<!--
|
||||
<div hawtio-form-2="config" entity="entity"></div>
|
||||
-->
|
||||
<div hawtio-form-2="specConfig" entity="spec"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,28 +5,62 @@
|
|||
module Kubernetes {
|
||||
|
||||
export var BuildConfigEditController = controller("BuildConfigEditController",
|
||||
["$scope", "KubernetesModel", "KubernetesState", "KubernetesSchema", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL",
|
||||
["$scope", "KubernetesModel", "KubernetesState", "KubernetesSchema", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "K8SClientFactory",
|
||||
($scope, KubernetesModel:Kubernetes.KubernetesModelService, KubernetesState, KubernetesSchema,
|
||||
$templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL) => {
|
||||
$templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, K8SClientFactory) => {
|
||||
|
||||
$scope.kubernetes = KubernetesState;
|
||||
$scope.model = KubernetesModel;
|
||||
$scope.id = $routeParams["id"];
|
||||
$scope.schema = KubernetesSchema;
|
||||
$scope.config = KubernetesSchema.definitions.os_build_BuildConfig;
|
||||
$scope.specConfig = KubernetesSchema.definitions.os_build_BuildConfigSpec;
|
||||
|
||||
Kubernetes.initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL);
|
||||
|
||||
$scope.buildConfigClient = K8SClientFactory.create("buildconfigs", $scope.namespace);
|
||||
|
||||
/*
|
||||
$scope.$on('kubernetesModelUpdated', function () {
|
||||
updateData();
|
||||
});
|
||||
|
||||
*/
|
||||
$scope.$on('$routeUpdate', ($event) => {
|
||||
updateData();
|
||||
});
|
||||
|
||||
$scope.save = () => {
|
||||
log.info("Saving!");
|
||||
|
||||
|
||||
var entity = $scope.entity;
|
||||
var spec = (entity || {}).spec || {};
|
||||
|
||||
// TODO update the jenkins job name!
|
||||
|
||||
// lets delete lots of cruft
|
||||
var strategy = spec.strategy || {};
|
||||
delete strategy["dockerStrategy"];
|
||||
delete strategy["sourceStrategy"];
|
||||
|
||||
delete spec["revision"];
|
||||
delete spec["output"];
|
||||
delete spec["resources"];
|
||||
|
||||
log.info(angular.toJson(entity, true));
|
||||
|
||||
$scope.buildConfigClient.put(entity, (obj) => {
|
||||
log.info("build config created!");
|
||||
})
|
||||
};
|
||||
|
||||
updateData();
|
||||
|
||||
|
||||
var jenkinsUrl = Developer.jenkinsLink();
|
||||
var jobName = "";
|
||||
|
||||
function updateData() {
|
||||
$scope.item = null;
|
||||
if ($scope.id) {
|
||||
|
|
@ -36,6 +70,7 @@ module Kubernetes {
|
|||
if (data) {
|
||||
$scope.entity = data;
|
||||
}
|
||||
$scope.spec = ($scope.entity || {}).spec || {};
|
||||
$scope.fetched = true;
|
||||
Core.$apply($scope);
|
||||
}).
|
||||
|
|
@ -45,38 +80,40 @@ module Kubernetes {
|
|||
} else {
|
||||
$scope.fetched = true;
|
||||
|
||||
// TODO default to the right registry URL...
|
||||
var defaultRegistry = "172.30.17.189:5000";
|
||||
|
||||
$scope.entity = {
|
||||
"apiVersion": "v1",
|
||||
"kind": "BuildConfig",
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"labels": {
|
||||
"name": ""
|
||||
}
|
||||
},
|
||||
"parameters": {
|
||||
"output": {
|
||||
"imageTag": "",
|
||||
"registry": defaultRegistry
|
||||
},
|
||||
"spec": {
|
||||
"source": {
|
||||
"git": {
|
||||
"uri": ""
|
||||
},
|
||||
"type": "Git"
|
||||
},
|
||||
"strategy": {
|
||||
"stiStrategy": {
|
||||
"builderImage": "fabric8/base-sti"
|
||||
},
|
||||
"type": "STI"
|
||||
"type": "Custom",
|
||||
"customStrategy": {
|
||||
"from": {
|
||||
"kind": "DockerImage",
|
||||
"name": "fabric8/openshift-s2i-jenkins-trigger"
|
||||
},
|
||||
"env": [
|
||||
{
|
||||
"name": "BASE_URI",
|
||||
"value": jenkinsUrl
|
||||
},
|
||||
{
|
||||
"name": "JOB_NAME",
|
||||
"value": jobName
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"triggers": []
|
||||
}
|
||||
};
|
||||
$scope.spec = $scope.entity.spec;
|
||||
Core.$apply($scope);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ module Kubernetes {
|
|||
.when(UrlHelpers.join(context, 'deploymentConfigs/:id'), route('deploymentConfig.html', true))
|
||||
.when(UrlHelpers.join(context, 'imageRepositories'), route('imageRepositories.html', false))
|
||||
});
|
||||
|
||||
angular.forEach([context, "/workspaces/:workspace", "/workspaces/:workspace/projects/:project"], (context) => {
|
||||
$routeProvider
|
||||
.when(UrlHelpers.join(context, 'buildConfigEdit'), route('buildConfigEdit.html', true))
|
||||
.when(UrlHelpers.join(context, 'buildConfigEdit/:id'), route('buildConfigEdit.html', true))
|
||||
});
|
||||
}]);
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue