Browse Source

Merge "Allows creation of resources without forcing the creation of children"

changes/61/775561/2 7.0.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
08ba87ee6b
12 changed files with 584 additions and 420 deletions
  1. +9
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.controller.js
  2. +17
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.controller.spec.js
  3. +215
    -194
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html
  4. +2
    -1
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html
  5. +4
    -1
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js
  6. +10
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.controller.js
  7. +24
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.controller.spec.js
  8. +142
    -121
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.html
  9. +11
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.controller.js
  10. +22
    -2
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.controller.spec.js
  11. +121
    -101
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.html
  12. +7
    -0
      releasenotes/notes/allows-creation-of-single-resources-9ec5fe87acc7c93c.yaml

+ 9
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.controller.js View File

@ -39,6 +39,7 @@
function ListenerDetailsController($scope, gettext) {
var ctrl = this;
ctrl.protocolChange = protocolChange;
ctrl.createChange = createChange;
// Error text for invalid fields
ctrl.portNumberError = gettext('The port must be a number between 1 and 65535.');
@ -71,6 +72,14 @@
}
}
function createChange() {
if ($scope.model.context.create_listener === false) {
// Disabling listener form disables pool form and monitor form
$scope.model.context.create_pool = false;
$scope.model.context.create_monitor = false;
}
}
function listenerPortExists(port) {
return $scope.model.listenerPorts.some(function(element) {
return element === port;


+ 17
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.controller.spec.js View File

@ -36,6 +36,11 @@
};
scope = {
model: {
context: {
create_listener: true,
create_pool: true,
create_monitor: true
},
listenerPorts: [80],
members: [{port: ''}, {port: ''}],
spec: {
@ -118,6 +123,18 @@
});
});
it('should update create_pool and create_monitor flags', function() {
scope.model.context.create_listener = true;
ctrl.createChange();
expect(scope.model.context.create_pool).toBe(true);
expect(scope.model.context.create_monitor).toBe(true);
scope.model.context.create_listener = false;
ctrl.createChange();
expect(scope.model.context.create_pool).toBe(false);
expect(scope.model.context.create_monitor).toBe(false);
});
});
});
})();

+ 215
- 194
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html View File

@ -1,256 +1,277 @@
<div ng-controller="ListenerDetailsController as ctrl">
<p translate>Provide the details for the listener.</p>
<div class="row">
<div class="row" ng-if="model.context.resource !== 'listener' && !model.context.id">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="name">Name</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.listener.name">
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="description">Description</label>
<input name="description" id="description" type="text" class="form-control"
ng-model="model.spec.listener.description">
<label class="control-label required" translate>Create Listener</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.context.create_listener"
ng-change="ctrl.createChange()"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div ng-if="model.context.create_listener">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Protocol</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="protocol" id="protocol"
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>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="name">Name</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.listener.name">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required"
ng-class="{ 'has-error': listenerDetailsForm.port.$invalid && listenerDetailsForm.port.$dirty }">
<label class="control-label" for="port">
<translate>Port</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="port" id="port" type="number" class="form-control"
ng-model="model.spec.listener.protocol_port" ng-pattern="/^\d+$/" min="1" max="65535"
ng-required="true" ng-disabled="model.context.id"
validate-unique="model.listenerPorts">
<span class="help-block" ng-show="(listenerDetailsForm.port.$error.number || listenerDetailsForm.port.$error.required) && listenerDetailsForm.port.$dirty">
{$ ::ctrl.portNumberError $}
</span>
<span class="help-block" ng-show="!(listenerDetailsForm.port.$error.number || listenerDetailsForm.port.$error.required) && listenerDetailsForm.port.$error.unique && listenerDetailsForm.port.$dirty">
{$ ::ctrl.portUniqueError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="description">Description</label>
<input name="description" id="description" type="text" class="form-control"
ng-model="model.spec.listener.description">
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="model.spec.listener.protocol !== 'UDP' && model.spec.listener.protocol !== 'SCTP'">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Client Data Timeout</translate>
</label>
<input name="timeout_client_data" id="timeout_client_data" type="number" class="form-control"
ng-model="model.spec.listener.timeout_client_data" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_client_data.$error.number && listenerDetailsForm.timeout_client_data.$dirty">
{$ ::ctrl.timeoutError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Protocol</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="protocol" id="protocol"
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>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>TCP Inspect Timeout</translate>
</label>
<input name="timeout_tcp_inspect" id="timeout_tcp_inspect" type="number" class="form-control"
ng-model="model.spec.listener.timeout_tcp_inspect" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_tcp_inspect.$error.number && listenerDetailsForm.timeout_tcp_inspect.$dirty">
{$ ::ctrl.timeoutError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required"
ng-class="{ 'has-error': listenerDetailsForm.port.$invalid && listenerDetailsForm.port.$dirty }">
<label class="control-label" for="port">
<translate>Port</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="port" id="port" type="number" class="form-control"
ng-model="model.spec.listener.protocol_port" ng-pattern="/^\d+$/" min="1" max="65535"
ng-required="true" ng-disabled="model.context.id"
validate-unique="model.listenerPorts">
<span class="help-block" ng-show="(listenerDetailsForm.port.$error.number || listenerDetailsForm.port.$error.required) && listenerDetailsForm.port.$dirty">
{$ ::ctrl.portNumberError $}
</span>
<span class="help-block" ng-show="!(listenerDetailsForm.port.$error.number || listenerDetailsForm.port.$error.required) && listenerDetailsForm.port.$error.unique && listenerDetailsForm.port.$dirty">
{$ ::ctrl.portUniqueError $}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="model.spec.listener.protocol !== 'UDP' && model.spec.listener.protocol !== 'SCTP'">
<div class="row" ng-if="model.spec.listener.protocol !== 'UDP' && model.spec.listener.protocol !== 'SCTP'">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Member Connect Timeout</translate>
</label>
<input name="timeout_member_connect" id="timeout_member_connect" type="number" class="form-control"
ng-model="model.spec.listener.timeout_member_connect" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_member_connect.$error.number && listenerDetailsForm.timeout_member_connect.$dirty">
{$ ::ctrl.timeoutError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Client Data Timeout</translate>
</label>
<input name="timeout_client_data" id="timeout_client_data" type="number" class="form-control"
ng-model="model.spec.listener.timeout_client_data" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_client_data.$error.number && listenerDetailsForm.timeout_client_data.$dirty">
{$ ::ctrl.timeoutError $}
</span>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Member Data Timeout</translate>
</label>
<input name="timeout_member_data" id="timeout_member_data" type="number" class="form-control"
ng-model="model.spec.listener.timeout_member_data" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_member_data.$error.number && listenerDetailsForm.timeout_member_data.$dirty">
{$ ::ctrl.timeoutError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>TCP Inspect Timeout</translate>
</label>
<input name="timeout_tcp_inspect" id="timeout_tcp_inspect" type="number" class="form-control"
ng-model="model.spec.listener.timeout_tcp_inspect" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_tcp_inspect.$error.number && listenerDetailsForm.timeout_tcp_inspect.$dirty">
{$ ::ctrl.timeoutError $}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row" ng-if="model.spec.listener.protocol !== 'UDP' && model.spec.listener.protocol !== 'SCTP'">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required"
ng-class="{ 'has-error': listenerDetailsForm.connection_limit.$invalid && listenerDetailsForm.connection_limit.$dirty }">
<label class="control-label" for="connection_limit">
<translate>Connection Limit</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="connection_limit" id="connection_limit" type="number" class="form-control"
ng-model="model.spec.listener.connection_limit" ng-pattern="/^-?\d+$/" min="-1"
ng-required="true">
<span class="help-block" ng-show="(listenerDetailsForm.connection_limit.$error.number || listenerDetailsForm.connection_limit.$error.required) && listenerDetailsForm.connection_limit.$dirty">
{$ ::ctrl.connectionLimitError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Member Connect Timeout</translate>
</label>
<input name="timeout_member_connect" id="timeout_member_connect" type="number" class="form-control"
ng-model="model.spec.listener.timeout_member_connect" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_member_connect.$error.number && listenerDetailsForm.timeout_member_connect.$dirty">
{$ ::ctrl.timeoutError $}
</span>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.context.id">
<div class="form-group">
<label class="control-label">
<translate>Default Pool ID</translate>
</label>
<select class="form-control" name="default_pool_id" id="default_pool_id"
ng-model="model.spec.listener.default_pool_id">
<option value="">None</option>
<option ng-repeat="pool_id in model.spec.availablePools" value="{$ pool_id.substring(0, 36) $}">
{$ pool_id $}
</option>
</select>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Member Data Timeout</translate>
</label>
<input name="timeout_member_data" id="timeout_member_data" type="number" class="form-control"
ng-model="model.spec.listener.timeout_member_data" ng-pattern="/^\d+$/" min="0" max="31536000000">
<span class="help-block" ng-show="listenerDetailsForm.timeout_member_data.$error.number && listenerDetailsForm.timeout_member_data.$dirty">
{$ ::ctrl.timeoutError $}
</span>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label" for="allowed_cidrs">
<translate>Allowed Cidrs</translate>
</label>
<textarea ng-model="model.spec.listener.allowed_cidrs" ng-trim="false" ng-list="&#10;"
rows="2" placeholder="0.0.0.0/0" id="allowed_cidrs" name="allowed_cidrs" class="form-control">
</textarea>
</div>
</div>
</div>
<div class="row" ng-if="model.spec.listener.protocol === 'TERMINATED_HTTPS'">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group"
ng-class="{ 'has-error': listenerDetailsForm.tls_ciphers.$invalid && listenerDetailsForm.tls_ciphers.$dirty }">
<label translate class="control-label" for="tls_ciphers">TLS Cipher String</label>
<textarea name="tls_ciphers" id="tls_ciphers" class="form-control"
ng-model="model.spec.listener.tls_ciphers" ng-pattern="/^([A-Z0-9_-]+:)*[A-Z0-9_-]+$/">
</textarea>
<span class="help-block" ng-show="listenerDetailsForm.tls_ciphers.$invalid && listenerDetailsForm.tls_ciphers.$dirty">
{$ ::ctrl.tls_ciphersError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required"
ng-class="{ 'has-error': listenerDetailsForm.connection_limit.$invalid && listenerDetailsForm.connection_limit.$dirty }">
<label class="control-label" for="connection_limit">
<translate>Connection Limit</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="connection_limit" id="connection_limit" type="number" class="form-control"
ng-model="model.spec.listener.connection_limit" ng-pattern="/^-?\d+$/" min="-1"
ng-required="true">
<span class="help-block" ng-show="(listenerDetailsForm.connection_limit.$error.number || listenerDetailsForm.connection_limit.$error.required) && listenerDetailsForm.connection_limit.$dirty">
{$ ::ctrl.connectionLimitError $}
</span>
</div>
</div>
</div>
</div>
<h4 translate ng-if="model.spec.listener.protocol === 'HTTP' || model.spec.listener.protocol === 'TERMINATED_HTTPS'">Insert Headers</h4>
<div class="row form-group" ng-if="model.spec.listener.protocol === 'HTTP' || model.spec.listener.protocol === 'TERMINATED_HTTPS'">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_for"
ng-model="model.spec.listener.insert_headers['X-Forwarded-For']">
<label for="x_forwarded_for">
<span translate>X-Forwarded-For</span>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.context.id">
<div class="form-group">
<label class="control-label">
<translate>Default Pool ID</translate>
</label>
<select class="form-control" name="default_pool_id" id="default_pool_id"
ng-model="model.spec.listener.default_pool_id">
<option value="">None</option>
<option ng-repeat="pool_id in model.spec.availablePools" value="{$ pool_id.substring(0, 36) $}">
{$ pool_id $}
</option>
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_port"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Port']">
<label for="x_forwarded_port">
<span translate>X-Forwarded-Port</span>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label" for="allowed_cidrs">
<translate>Allowed Cidrs</translate>
</label>
<textarea ng-model="model.spec.listener.allowed_cidrs" ng-trim="false" ng-list="&#10;"
rows="2" placeholder="0.0.0.0/0" id="allowed_cidrs" name="allowed_cidrs" class="form-control">
</textarea>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_proto"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Proto']">
<label for="x_forwarded_proto">
<span translate>X-Forwarded-Proto</span>
</label>
<div class="row" ng-if="model.spec.listener.protocol === 'TERMINATED_HTTPS'">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group"
ng-class="{ 'has-error': listenerDetailsForm.tls_ciphers.$invalid && listenerDetailsForm.tls_ciphers.$dirty }">
<label translate class="control-label" for="tls_ciphers">TLS Cipher String</label>
<textarea name="tls_ciphers" id="tls_ciphers" class="form-control"
ng-model="model.spec.listener.tls_ciphers" ng-pattern="/^([A-Z0-9_-]+:)*[A-Z0-9_-]+$/">
</textarea>
<span class="help-block" ng-show="listenerDetailsForm.tls_ciphers.$invalid && listenerDetailsForm.tls_ciphers.$dirty">
{$ ::ctrl.tls_ciphersError $}
</span>
</div>
</div>
</div>
</div>
<h4 translate ng-if="model.spec.listener.protocol === 'HTTP' || model.spec.listener.protocol === 'TERMINATED_HTTPS'">Insert Headers</h4>
<div class="row form-group" ng-if="model.spec.listener.protocol === 'HTTP' || model.spec.listener.protocol === 'TERMINATED_HTTPS'">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_for"
ng-model="model.spec.listener.insert_headers['X-Forwarded-For']">
<label for="x_forwarded_for">
<span translate>X-Forwarded-For</span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_port"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Port']">
<label for="x_forwarded_port">
<span translate>X-Forwarded-Port</span>
</label>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.listener.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_proto"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Proto']">
<label for="x_forwarded_proto">
<span translate>X-Forwarded-Proto</span>
</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.listener.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

+ 2
- 1
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html View File

@ -1,4 +1,5 @@
<div ng-controller="MemberDetailsController as ctrl">
<div ng-controller="MemberDetailsController as ctrl"
ng-if="model.context.create_pool || model.context.id">
<p translate>Add members to the load balancer pool.</p>
<transfer-table tr-model="ctrl.tableData"
limits="::ctrl.tableLimits"


+ 4
- 1
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js View File

@ -137,7 +137,10 @@
model.context = {
resource: resource,
id: id,
submit: null
submit: null,
create_listener: true,
create_pool: true,
create_monitor: true
};
model.certificates = [];


+ 10
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.controller.js View File

@ -55,6 +55,16 @@
}
});
ctrl.createChange = createChange;
function createChange() {
if ($scope.model.context.create_monitor) {
// Enabling pool form enables listener form and pool form
$scope.model.context.create_listener = true;
$scope.model.context.create_pool = true;
}
}
// Error text for invalid fields
/* eslint-disable max-len */
ctrl.intervalError = gettext('The health check interval must be greater than or equal to the timeout.');


+ 24
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.controller.spec.js View File

@ -73,6 +73,30 @@
to: 1
});
});
it('should update create_pool and create_monitor flags', function() {
scope.model = {
context: {
create_listener: false,
create_pool: false,
create_monitor: true
}
};
ctrl.createChange();
expect(scope.model.context.create_listener).toBe(true);
expect(scope.model.context.create_pool).toBe(true);
scope.model = {
context: {
create_listener: false,
create_pool: false,
create_monitor: false
}
};
ctrl.createChange();
expect(scope.model.context.create_listener).toBe(false);
expect(scope.model.context.create_pool).toBe(false);
});
});
});
})();

+ 142
- 121
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/monitor/monitor.html View File

@ -1,156 +1,177 @@
<div ng-controller="MonitorDetailsController as ctrl">
<p translate>Provide the details for the health monitor.</p>
<div class="row">
<div class="row" ng-if="model.context.resource !== 'monitor' && !model.context.id">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label" for="name">
<translate>Name</translate>
</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.monitor.name">
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required">
<label class="control-label" for="type">
<translate>Type</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="type" id="type"
ng-options="type for type in model.monitorTypes"
ng-model="model.spec.monitor.type"
ng-disabled="model.context.id" ng-required="true">
</select>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty }">
<label class="control-label" for="retry_down">
<translate>Max Retries Down</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="retry_down" id="retry_down" type="number" class="form-control"
ng-model="model.spec.monitor.max_retries_down" ng-pattern="/^\d+$/" min="1" max="10"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty">
{$ ::ctrl.retryDownError $}
</span>
<label class="control-label required" translate>Create Health Monitor</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.context.create_monitor"
ng-change="ctrl.createChange()"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.interval.$invalid && monitorDetailsForm.interval.$dirty }">
<label class="control-label" for="interval">
<translate>Delay (sec)</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="interval" id="interval" type="number" class="form-control"
ng-model="model.spec.monitor.delay" ng-pattern="/^\d+$/"
ng-min="model.spec.monitor.timeout" ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.interval.$invalid && monitorDetailsForm.interval.$dirty">
{$ ::ctrl.intervalError $}
</span>
<div ng-if="model.context.create_monitor">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group">
<label class="control-label" for="name">
<translate>Name</translate>
</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.monitor.name">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.retry.$invalid && monitorDetailsForm.retry.$dirty }">
<label class="control-label" for="retry">
<translate>Max Retries</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="retry" id="retry" type="number" class="form-control"
ng-model="model.spec.monitor.max_retries" ng-pattern="/^\d+$/" min="1" max="10"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.retry.$invalid && monitorDetailsForm.retry.$dirty">
{$ ::ctrl.retryError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required">
<label class="control-label" for="type">
<translate>Type</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="type" id="type"
ng-options="type for type in model.monitorTypes"
ng-model="model.spec.monitor.type"
ng-disabled="model.context.id" ng-required="true">
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.timeout.$invalid && monitorDetailsForm.timeout.$dirty }">
<label class="control-label" for="timeout">
<translate>Timeout (sec)</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="timeout" id="timeout" type="number" class="form-control"
ng-model="model.spec.monitor.timeout" ng-pattern="/^\d+$/" min="0"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.timeout.$invalid && monitorDetailsForm.timeout.$dirty">
{$ ::ctrl.timeoutError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty }">
<label class="control-label" for="retry_down">
<translate>Max Retries Down</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="retry_down" id="retry_down" type="number" class="form-control"
ng-model="model.spec.monitor.max_retries_down" ng-pattern="/^\d+$/" min="1" max="10"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty">
{$ ::ctrl.retryDownError $}
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.interval.$invalid && monitorDetailsForm.interval.$dirty }">
<label class="control-label" for="interval">
<translate>Delay (sec)</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="interval" id="interval" type="number" class="form-control"
ng-model="model.spec.monitor.delay" ng-pattern="/^\d+$/"
ng-min="model.spec.monitor.timeout" ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.interval.$invalid && monitorDetailsForm.interval.$dirty">
{$ ::ctrl.intervalError $}
</span>
</div>
</div>
<div class="row" ng-if="model.spec.monitor.type === 'HTTP' || model.spec.monitor.type === 'HTTPS'">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.retry.$invalid && monitorDetailsForm.retry.$dirty }">
<label class="control-label" for="retry">
<translate>Max Retries</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="retry" id="retry" type="number" class="form-control"
ng-model="model.spec.monitor.max_retries" ng-pattern="/^\d+$/" min="1" max="10"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.retry.$invalid && monitorDetailsForm.retry.$dirty">
{$ ::ctrl.retryError $}
</span>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group">
<label translate class="control-label" for="method">HTTP Method</label>
<select class="form-control" name="method" id="method"
ng-options="method for method in model.monitorMethods"
ng-model="model.spec.monitor.http_method">
</select>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.timeout.$invalid && monitorDetailsForm.timeout.$dirty }">
<label class="control-label" for="timeout">
<translate>Timeout (sec)</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="timeout" id="timeout" type="number" class="form-control"
ng-model="model.spec.monitor.timeout" ng-pattern="/^\d+$/" min="0"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.timeout.$invalid && monitorDetailsForm.timeout.$dirty">
{$ ::ctrl.timeoutError $}
</span>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group"
ng-class="{ 'has-error': monitorDetailsForm.status.$invalid && monitorDetailsForm.status.$dirty }">
<label translate class="control-label" for="status">Expected Codes</label>
<input name="status" id="status" type="text" class="form-control"
ng-model="model.spec.monitor.expected_codes" ng-pattern="::ctrl.statusPattern">
<span class="help-block" ng-show="monitorDetailsForm.status.$invalid && monitorDetailsForm.status.$dirty">
{$ ::ctrl.statusError $}
</span>
<div class="row" ng-if="model.spec.monitor.type === 'HTTP' || model.spec.monitor.type === 'HTTPS'">
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group">
<label translate class="control-label" for="method">HTTP Method</label>
<select class="form-control" name="method" id="method"
ng-options="method for method in model.monitorMethods"
ng-model="model.spec.monitor.http_method">
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group"
ng-class="{ 'has-error': monitorDetailsForm.path.$invalid && monitorDetailsForm.path.$dirty }">
<label translate class="control-label" for="path">URL Path</label>
<input name="path" id="path" type="text" class="form-control"
ng-model="model.spec.monitor.url_path" ng-pattern="::ctrl.urlPathPattern">
<span class="help-block" ng-show="monitorDetailsForm.path.$invalid && monitorDetailsForm.path.$dirty">
{$ ::ctrl.pathError $}
</span>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group"
ng-class="{ 'has-error': monitorDetailsForm.status.$invalid && monitorDetailsForm.status.$dirty }">
<label translate class="control-label" for="status">Expected Codes</label>
<input name="status" id="status" type="text" class="form-control"
ng-model="model.spec.monitor.expected_codes" ng-pattern="::ctrl.statusPattern">
<span class="help-block" ng-show="monitorDetailsForm.status.$invalid && monitorDetailsForm.status.$dirty">
{$ ::ctrl.statusError $}
</span>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group"
ng-class="{ 'has-error': monitorDetailsForm.path.$invalid && monitorDetailsForm.path.$dirty }">
<label translate class="control-label" for="path">URL Path</label>
<input name="path" id="path" type="text" class="form-control"
ng-model="model.spec.monitor.url_path" ng-pattern="::ctrl.urlPathPattern">
<span class="help-block" ng-show="monitorDetailsForm.path.$invalid && monitorDetailsForm.path.$dirty">
{$ ::ctrl.pathError $}
</span>
</div>
</div>
<div class="row">
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.monitor.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.monitor.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

+ 11
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.controller.js View File

@ -38,6 +38,17 @@
function PoolDetailsController($scope, gettext) {
var ctrl = this;
ctrl.createChange = createChange;
function createChange() {
if ($scope.model.context.create_pool) {
// Enabling pool form enables listener form
$scope.model.context.create_listener = true;
} else {
// Disabling pool form disables monitor form
$scope.model.context.create_monitor = false;
}
}
// Error text for invalid fields
ctrl.tls_ciphersError = gettext('The cipher string must conform to OpenSSL syntax.');


+ 22
- 2
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.controller.spec.js View File

@ -24,8 +24,16 @@
describe('PoolDetailsController', function() {
var ctrl, scope;
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
beforeEach(inject(function($controller) {
scope = {
model: {
context: {
create_listener: true,
create_pool: true,
create_monitor: true
}
}
};
ctrl = $controller('PoolDetailsController', {
$scope: scope
});
@ -35,6 +43,18 @@
expect(ctrl.tls_ciphersError).toBeDefined();
});
it('should update create_listener and create_monitor flags', function() {
scope.model.context.create_pool = true;
ctrl.createChange();
expect(scope.model.context.create_listener).toBe(true);
expect(scope.model.context.create_monitor).toBe(true);
scope.model.context.create_pool = false;
ctrl.createChange();
expect(scope.model.context.create_listener).toBe(true);
expect(scope.model.context.create_monitor).toBe(false);
});
});
});
})();

+ 121
- 101
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/pool/pool.html View File

@ -1,140 +1,160 @@
<div ng-controller="PoolDetailsController as ctrl">
<p translate>Provide the details for the pool.</p>
<div class="row">
<div class="row" ng-if="model.context.resource !== 'pool' && !model.context.id">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="name">Name</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.pool.name">
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="description">Description</label>
<input name="description" id="description" type="text" class="form-control"
ng-model="model.spec.pool.description">
<label class="control-label required" translate>Create Pool</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.context.create_pool"
ng-change="ctrl.createChange()"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div ng-if="model.context.create_pool">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="method">
<translate>Algorithm</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="method" id="method"
ng-options="method for method in model.methods"
ng-model="model.spec.pool.lb_algorithm"
ng-required="true">
</select>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="name">Name</label>
<input name="name" id="name" type="text" class="form-control"
ng-model="model.spec.pool.name">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.context.id || (model.spec.parentResourceId === null)">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Protocol</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="protocol" id="protocol"
ng-model="model.spec.pool.protocol" ng-required="true"
ng-disabled="model.context.id">
<option ng-repeat="protocol in model.poolProtocols" value="{$ protocol $}">
{$ protocol $}
</option>
</select>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label translate class="control-label" for="description">Description</label>
<input name="description" id="description" type="text" class="form-control"
ng-model="model.spec.pool.description">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group required">
<label class="control-label" for="method">
<translate>Algorithm</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="method" id="method"
ng-options="method for method in model.methods"
ng-model="model.spec.pool.lb_algorithm"
ng-required="true">
</select>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label" for="type">
<translate>Session Persistence</translate>
</label>
<select class="form-control" name="type" id="type"
ng-model="model.spec.pool.session_persistence.type">
<option value="">None</option>
<option ng-repeat="type in model.types"
ng-disabled="(model.spec.listener.protocol === 'UDP' || model.spec.listener.protocol === 'SCTP') && type !== 'SOURCE_IP'"
value="{$ type $}">
{$ type $}
</option>
</select>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.context.id || (model.spec.parentResourceId === null)">
<div class="form-group required">
<label class="control-label" for="protocol">
<translate>Protocol</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="protocol" id="protocol"
ng-model="model.spec.pool.protocol" ng-required="true"
ng-disabled="model.context.id">
<option ng-repeat="protocol in model.poolProtocols" value="{$ protocol $}">
{$ protocol $}
</option>
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.spec.pool.session_persistence.type === 'APP_COOKIE'">
<div class="form-group">
<label translate class="control-label" for="cookie_name">Cookie Name</label>
<input name="cookie_name" id="cookie_name" type="text" class="form-control"
ng-model="model.spec.pool.session_persistence.cookie_name">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label" for="type">
<translate>Session Persistence</translate>
</label>
<select class="form-control" name="type" id="type"
ng-model="model.spec.pool.session_persistence.type">
<option value="">None</option>
<option ng-repeat="type in model.types"
ng-disabled="model.spec.listener.protocol === 'UDP' && type !== 'SOURCE_IP'"
value="{$ type $}">
{$ type $}
</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.spec.pool.session_persistence.type === 'APP_COOKIE'">
<div class="form-group">
<label translate class="control-label" for="cookie_name">Cookie Name</label>
<input name="cookie_name" id="cookie_name" type="text" class="form-control"
ng-model="model.spec.pool.session_persistence.cookie_name">
</div>
</div>
<div class="row">
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>TLS Enabled</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.pool.tls_enabled"
uib-btn-radio="option.value">{$ ::option.label $}</label>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>TLS Enabled</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.pool.tls_enabled"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="model.spec.pool.tls_enabled">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group"
ng-class="{ 'has-error': poolDetailsForm.tls_ciphers.$invalid && poolDetailsForm.tls_ciphers.$dirty }">
<label translate class="control-label" for="tls_ciphers">TLS Cipher String</label>
<textarea name="tls_ciphers" id="tls_ciphers" class="form-control"
ng-model="model.spec.pool.tls_ciphers" ng-pattern="/^([A-Z0-9_-]+:)*[A-Z0-9_-]+$/">
</textarea>
<span class="help-block" ng-show="poolDetailsForm.tls_ciphers.$invalid && poolDetailsForm.tls_ciphers.$dirty">
{$ ::ctrl.tls_ciphersError $}
</span>
</div>
</div>
</div>
<div class="row" ng-if="model.spec.pool.tls_enabled">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group"
ng-class="{ 'has-error': poolDetailsForm.tls_ciphers.$invalid && poolDetailsForm.tls_ciphers.$dirty }">
<label translate class="control-label" for="tls_ciphers">TLS Cipher String</label>
<textarea name="tls_ciphers" id="tls_ciphers" class="form-control"
ng-model="model.spec.pool.tls_ciphers" ng-pattern="/^([A-Z0-9_-]+:)*[A-Z0-9_-]+$/">
</textarea>
<span class="help-block" ng-show="poolDetailsForm.tls_ciphers.$invalid && poolDetailsForm.tls_ciphers.$dirty">
{$ ::ctrl.tls_ciphersError $}
</span>
</div>
</div>
<div class="row">
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.pool.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<label class="control-label required" translate>Admin State Up</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-default"
ng-repeat="option in model.yesNoOptions"
ng-model="model.spec.pool.admin_state_up"
uib-btn-radio="option.value">{$ ::option.label $}</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

+ 7
- 0
releasenotes/notes/allows-creation-of-single-resources-9ec5fe87acc7c93c.yaml View File

@ -0,0 +1,7 @@
---
fixes:
- |
Allows the creation of single resources (i.e Load Balancer) without
enforcing the creation of children resources (Listeners, Pools, Health
monitors). A switch has been added in the children resource wizards to
avoid resource creation.

Loading…
Cancel
Save