Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEAMFOUR-483 - Added validation to HCE Registration form #393

Merged
merged 4 commits into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/app/view/hce-registration/hce-registration.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<div class="hce-registration">
<div class="modal-body">
<form name="hceRegistrationForm">
<div class="form-group" focusable-input
ng-class="{'has-error': addClusterFormCtrl.addClusterForm.url.$invalid && addClusterFormCtrl.addClusterForm.url.$dirty}">
ng-class="{'has-error': hceRegistrationForm.url.$invalid && hceRegistrationForm.url.$dirty}">
<label class="control-label" translate>Code Engine Endpoint</label>
<input type="text" name="url" class="form-control" ng-model="detailViewCtrl.context.data.url"
required />
required
ng-pattern="/^http(s)?://(.)+$/"
helion-unique items="detailViewCtrl.context.options.instances"
ignore-case/>
</div>
<div class="form-group" focusable-input>
<label class="control-label" translate>Code Engine Name</label>
<input type="text" class="form-control" ng-model="detailViewCtrl.context.data.name" required/>
</div>
</div>
</form>

<div class="modal-footer">
Expand All @@ -20,8 +21,8 @@
{{ 'Cancel' }}
</button>
<button class="btn btn-primary"
ng-click="$close();">
ng-disabled="hceRegistrationForm.$invalid" ng-click="$close();">
{{ 'Register' }}
</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function () {
(function() {
'use strict';

angular
Expand Down Expand Up @@ -61,8 +61,8 @@
this.credentialsFormOpen = false;
this.warningMsg = gettext('Authentication failed, please try reconnect.');
this.detailView = detailView;

// TODO(woodnt): There must be a more reproducable/general way of doing this. https://jira.hpcloud.net/browse/TEAMFOUR-626
this.currentEndpoints = [];
// TODO woodnt: There must be a more reproducable/general way of doing this.
Copy link
Contributor

@woodm1979 woodm1979 Jun 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, folks wanted me to add Jira tickets to all of our TODOs. So if you could put that back, I think it'd be better.
:-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Matt, my IDE probably reformatted the comment. I've put that back.

this.cfModel = modelManager.retrieve('cloud-foundry.model.application');

$scope.$watchCollection(function () {
Expand All @@ -78,7 +78,17 @@
});
});

this.userCnsiModel.list().then(function () {
$scope.$watchCollection(function() {
return that.serviceInstances;
}, function(newCnsis) {
that.currentEndpoints = _.map(newCnsis,
function(c) {
var endpoint = c.api_endpoint;
return endpoint.Scheme + '://' + endpoint.Host;
});
});

this.userCnsiModel.list().then(function() {
angular.extend(that.serviceInstances, that.userCnsiModel.serviceInstances);
that.cnsiModel.list();
});
Expand Down Expand Up @@ -183,6 +193,7 @@
// This code is shamelessly copied from app/view/cluster-registration/cluster-registration.directive.js
// I take that back, it was EXTREMELY SHAMEFUL.
// -- woodnt

var that = this;
var data = { name: '', url: '' };
this.detailView(
Expand All @@ -191,7 +202,10 @@
title: gettext('Register Code Engine Endpoint')
},
{
data: data
data: data,
options: {
instances: this.currentEndpoints
}
}
).result.then(function () {
return that.serviceInstanceApi.createHCE(data.url, data.name).then(function () {
Expand Down