Make workflow enforce all required fields
This makes the load balancer workflow force all required fields to be valid before allowing the user to submit. This means that when creating a new load balancer a listener, pool, and health monitor are also required. Partially-Implements: blueprint horizon-lbaas-v2-ui Change-Id: I7f48c691c653ea8d94f99367730b0771c7ce4485
This commit is contained in:
parent
1b7b60ddb5
commit
b19efdeef3
|
@ -10,7 +10,7 @@
|
|||
help-text="::ctrl.tableHelp">
|
||||
|
||||
<!-- Allocated-->
|
||||
<allocated validate-number-min="model.context.id ? 1 : 0" ng-model="ctrl.tableData.allocated.length">
|
||||
<allocated validate-number-min="1" ng-model="ctrl.tableData.allocated.length">
|
||||
<table st-table="ctrl.tableData.displayedAllocated"
|
||||
st-safe-src="ctrl.tableData.allocated" hz-table
|
||||
class="table-striped table-rsp table-detail modern form-group">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h1 translate>Listener Details Help</h1>
|
||||
|
||||
<p translate>To create a listener, the port and protocol must be provided. If either of these properties are not provided, only the load balancer will be created.</p>
|
||||
<p translate>A listener represents a listening endpoint for a load balancer. A single load balancer can have multiple listeners.</p>
|
||||
<p translate><strong>NOTE:</strong> The TERMINATED_HTTPS protocol is only available if the key-manager service is enabled and you have authority to list certificate containers and secrets.</p>
|
|
@ -38,8 +38,9 @@
|
|||
popover-placement="top" popover-append-to-body="true"
|
||||
popover-trigger="hover"></span>
|
||||
<select class="form-control input-sm" name="listener-protocol" id="listener-protocol"
|
||||
ng-model="model.spec.listener.protocol" ng-required="model.context.resource === 'listener'"
|
||||
ng-change="ctrl.protocolChange(model.spec.listener.protocol)" ng-disabled="model.context.id">
|
||||
ng-model="model.spec.listener.protocol" ng-required="true"
|
||||
ng-change="ctrl.protocolChange(model.spec.listener.protocol)"
|
||||
ng-disabled="model.context.id">
|
||||
<option ng-repeat="protocol in model.listenerProtocols" value="{$ protocol $}"
|
||||
ng-disabled="protocol==='TERMINATED_HTTPS' && model.certificatesError">{$ protocol $}</option>
|
||||
</select>
|
||||
|
@ -58,8 +59,7 @@
|
|||
<input name="listener-port" id="listener-port"
|
||||
type="number" class="form-control input-sm"
|
||||
ng-model="model.spec.listener.port" ng-pattern="/^\d+$/" min="1" max="65535"
|
||||
ng-required="model.context.resource === 'listener'"
|
||||
ng-disabled="model.context.id">
|
||||
ng-required="true" ng-disabled="model.context.id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1 translate>Load Balancer Details Help</h1>
|
||||
|
||||
<p translate>Provide the details for the load balancer. A subnet is required. The subnet is the network on which to allocate the load balancer's IP address. If an IP address is provided it must be a well-formed IPv4 or IPv6 address. The system will attempt to assign the provided IP address to the load balancer.</p>
|
||||
<p translate>The subnet is the network on which to allocate the load balancer's IP address. If an IP address is provided it must be a well-formed IPv4 or IPv6 address. The system will attempt to assign the provided IP address to the load balancer.</p>
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
class="form-field">
|
||||
<select name="{$ ::row.id $}-subnet" class="form-control input-sm"
|
||||
ng-options="subnet.name for subnet in model.subnets"
|
||||
ng-model="row.subnet"
|
||||
ng-model="row.subnet" ng-required="true"
|
||||
ng-disabled="model.context.id && row.allocatedMember">
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -264,7 +264,7 @@
|
|||
finalSpec.loadbalancer.subnet = finalSpec.loadbalancer.subnet.id;
|
||||
}
|
||||
|
||||
// Cannot edit the subnet
|
||||
// Cannot edit the IP or subnet
|
||||
if (context.resource === 'loadbalancer' && context.id) {
|
||||
delete finalSpec.subnet;
|
||||
delete finalSpec.ip;
|
||||
|
@ -275,10 +275,6 @@
|
|||
if (!finalSpec.listener.protocol || !finalSpec.listener.port) {
|
||||
// Listener requires protocol and port
|
||||
delete finalSpec.listener;
|
||||
} else if (finalSpec.listener.protocol === 'TERMINATED_HTTPS' &&
|
||||
finalSpec.certificates.length === 0) {
|
||||
// TERMINATED_HTTPS requires certificates
|
||||
delete finalSpec.listener;
|
||||
} else if (finalSpec.listener.protocol !== 'TERMINATED_HTTPS') {
|
||||
// Remove certificate containers if not using TERMINATED_HTTPS
|
||||
delete finalSpec.certificates;
|
||||
|
@ -292,10 +288,9 @@
|
|||
}
|
||||
|
||||
function cleanFinalSpecPool(finalSpec) {
|
||||
var resource = model.context.resource;
|
||||
|
||||
// Pool requires method and also the listener
|
||||
if (resource !== 'pool' && !finalSpec.listener || !finalSpec.pool.method) {
|
||||
// Pool requires method
|
||||
if (!finalSpec.pool.method) {
|
||||
delete finalSpec.pool;
|
||||
} else {
|
||||
// The pool protocol must be HTTP if the listener protocol is TERMINATED_HTTPS and
|
||||
|
@ -306,10 +301,7 @@
|
|||
}
|
||||
|
||||
function cleanFinalSpecMembers(finalSpec) {
|
||||
|
||||
// Members require a pool, address, subnet, and port but the wizard requires the address,
|
||||
// subnet, and port so we can assume those exist here.
|
||||
if (!finalSpec.pool || finalSpec.members.length === 0) {
|
||||
if (finalSpec.members.length === 0) {
|
||||
delete finalSpec.members;
|
||||
return;
|
||||
}
|
||||
|
@ -343,16 +335,16 @@
|
|||
|
||||
function cleanFinalSpecMonitor(finalSpec) {
|
||||
|
||||
// Monitor requires a pool, interval, retry count, and timeout
|
||||
if (!finalSpec.pool ||
|
||||
!angular.isNumber(finalSpec.monitor.interval) ||
|
||||
// Monitor requires an interval, retry count, and timeout
|
||||
if (!angular.isNumber(finalSpec.monitor.interval) ||
|
||||
!angular.isNumber(finalSpec.monitor.retry) ||
|
||||
!angular.isNumber(finalSpec.monitor.timeout)) {
|
||||
delete finalSpec.monitor;
|
||||
return;
|
||||
}
|
||||
|
||||
// Only include necessary monitor properties
|
||||
if (finalSpec.monitor && finalSpec.monitor.type !== 'HTTP') {
|
||||
if (finalSpec.monitor.type !== 'HTTP') {
|
||||
delete finalSpec.monitor.method;
|
||||
delete finalSpec.monitor.status;
|
||||
delete finalSpec.monitor.path;
|
||||
|
|
|
@ -912,19 +912,6 @@
|
|||
expect(finalSpec.pool).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should delete listener if using TERMINATED_HTTPS but no certificates', function() {
|
||||
model.spec.loadbalancer.ip = '1.2.3.4';
|
||||
model.spec.loadbalancer.subnet = model.subnets[0];
|
||||
model.spec.listener.protocol = 'TERMINATED_HTTPS';
|
||||
model.spec.listener.port = 443;
|
||||
model.spec.certificates = [];
|
||||
|
||||
var finalSpec = model.submit();
|
||||
|
||||
expect(finalSpec.loadbalancer).toBeDefined();
|
||||
expect(finalSpec.listener).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should delete certificates if not using TERMINATED_HTTPS', function() {
|
||||
model.spec.loadbalancer.ip = '1.2.3.4';
|
||||
model.spec.loadbalancer.subnet = model.subnets[0];
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1 translate>Monitor Help</h1>
|
||||
|
||||
<p translate>When adding a load balancer, you can also specify a health check monitor to use to determine the health of your instances. Health checks routinely run against each instance within a target load balancer and the result of the health check is used to determine if the instance receives new connections.</p>
|
||||
<p translate>The health monitor is used to determine the health of your pool members. Health checks routinely run against each member within the pool and the result of the health check is used to determine if the member receives new connections.</p>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
id="monitor-type"
|
||||
ng-options="type for type in model.monitorTypes"
|
||||
ng-model="model.spec.monitor.type"
|
||||
ng-disabled="model.context.id">
|
||||
ng-disabled="model.context.id" ng-required="true">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -38,7 +38,9 @@
|
|||
popover-trigger="hover"></span>
|
||||
<input name="monitor-interval" id="monitor-interval"
|
||||
type="number" class="form-control input-sm"
|
||||
ng-model="model.spec.monitor.interval" ng-pattern="/^\d+$/" ng-min="model.spec.monitor.timeout">
|
||||
ng-model="model.spec.monitor.interval" ng-pattern="/^\d+$/"
|
||||
ng-min="model.spec.monitor.timeout"
|
||||
ng-required="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -57,7 +59,8 @@
|
|||
popover-trigger="hover"></span>
|
||||
<input name="monitor-retry" id="monitor-retry"
|
||||
type="number" class="form-control input-sm"
|
||||
ng-model="model.spec.monitor.retry" ng-pattern="/^\d+$/" min="1" max="10">
|
||||
ng-model="model.spec.monitor.retry" ng-pattern="/^\d+$/" min="1" max="10"
|
||||
ng-required="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -72,7 +75,8 @@
|
|||
popover-trigger="hover"></span>
|
||||
<input name="monitor-timeout" id="monitor-timeout"
|
||||
type="number" class="form-control input-sm"
|
||||
ng-model="model.spec.monitor.timeout" ng-pattern="/^\d+$/" min="0">
|
||||
ng-model="model.spec.monitor.timeout" ng-pattern="/^\d+$/" min="0"
|
||||
ng-required="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1 translate>Pool Details Help</h1>
|
||||
|
||||
<p translate>To create a pool, the protocol and method must be provided. If either of these properties are not provided then the pool will not be created.</p>
|
||||
<p translate>A pool represents a group of members over which the load balancing will be applied.</p>
|
||||
|
|
|
@ -32,11 +32,10 @@
|
|||
<div class="col-sm-6 col-md-3">
|
||||
<div class="form-field required pool-method">
|
||||
<label translate class="on-top" for="pool-method">Method</label>
|
||||
<select class="form-control input-sm" name="pool-method"
|
||||
id="pool-method"
|
||||
<select class="form-control input-sm" name="pool-method" id="pool-method"
|
||||
ng-options="method for method in model.methods"
|
||||
ng-model="model.spec.pool.method"
|
||||
ng-disabled="model.context.id">
|
||||
ng-disabled="model.context.id" ng-required="true">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue