Merge pull request #2218 from wfhartford/destination-tpl-fix

Fix textarea and validation on destination page
This commit is contained in:
Curtis 2018-12-18 12:34:26 -08:00 committed by GitHub
commit 9e8804dddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -163,7 +163,7 @@ class AWSDestinationPlugin(DestinationPlugin):
'name': 'accountNumber', 'name': 'accountNumber',
'type': 'str', 'type': 'str',
'required': True, 'required': True,
'validation': '/^[0-9]{12,12}$/', 'validation': '[0-9]{12}',
'helpMessage': 'Must be a valid AWS account number!', 'helpMessage': 'Must be a valid AWS account number!',
}, },
{ {
@ -279,14 +279,14 @@ class S3DestinationPlugin(ExportDestinationPlugin):
'name': 'bucket', 'name': 'bucket',
'type': 'str', 'type': 'str',
'required': True, 'required': True,
'validation': '/^$|\s+/', 'validation': '[0-9a-z.-]{3,63}',
'helpMessage': 'Must be a valid S3 bucket name!', 'helpMessage': 'Must be a valid S3 bucket name!',
}, },
{ {
'name': 'accountNumber', 'name': 'accountNumber',
'type': 'str', 'type': 'str',
'required': True, 'required': True,
'validation': '/^[0-9]{12,12}$/', 'validation': '[0-9]{12}',
'helpMessage': 'A valid AWS account number with permission to access S3', 'helpMessage': 'A valid AWS account number with permission to access S3',
}, },
{ {
@ -308,7 +308,6 @@ class S3DestinationPlugin(ExportDestinationPlugin):
'name': 'prefix', 'name': 'prefix',
'type': 'str', 'type': 'str',
'required': False, 'required': False,
'validation': '/^$|\s+/',
'helpMessage': 'Must be a valid S3 object prefix!', 'helpMessage': 'Must be a valid S3 object prefix!',
} }
] ]

View File

@ -47,7 +47,9 @@
<select name="sub" ng-if="item.type == 'select'" class="form-control" ng-options="i for i in item.available" <select name="sub" ng-if="item.type == 'select'" class="form-control" ng-options="i for i in item.available"
ng-model="item.value"></select> ng-model="item.value"></select>
<input name="sub" ng-if="item.type == 'bool'" class="form-control" type="checkbox" ng-model="item.value"> <input name="sub" ng-if="item.type == 'bool'" class="form-control" type="checkbox" ng-model="item.value">
<input name="sub" ng-if="item.type == 'str'" type="text" class="form-control" ng-model="item.value"/> <input name="sub" ng-if="item.type == 'str'" type="text" class="form-control" ng-model="item.value" ng-pattern="item.validation"/>
<textarea name="sub" ng-if="item.type == 'textarea'" class="form-control"
ng-model="item.value" ng-pattern="item.validation"></textarea>
<div ng-if="item.type == 'export-plugin'"> <div ng-if="item.type == 'export-plugin'">
<form name="exportForm" class="form-horizontal" role="form" novalidate> <form name="exportForm" class="form-horizontal" role="form" novalidate>
<select class="form-control" ng-model="item.value" <select class="form-control" ng-model="item.value"
@ -69,6 +71,8 @@
ng-model="item.value"> ng-model="item.value">
<input name="sub" ng-if="item.type == 'str'" type="text" class="form-control" <input name="sub" ng-if="item.type == 'str'" type="text" class="form-control"
ng-model="item.value" ng-pattern="item.validation"/> ng-model="item.value" ng-pattern="item.validation"/>
<textarea name="sub" ng-if="item.type == 'textarea'" class="form-control"
ng-model="item.value" ng-pattern="item.validation"></textarea>
<p ng-show="subForm.sub.$invalid && !subForm.sub.$pristine" <p ng-show="subForm.sub.$invalid && !subForm.sub.$pristine"
class="help-block">{{ item.helpMessage }}</p> class="help-block">{{ item.helpMessage }}</p>
</div> </div>