From 437d918cf795516142d5f7c6f0f385b2d4716bfa Mon Sep 17 00:00:00 2001 From: Wesley Hartford Date: Mon, 10 Dec 2018 12:04:16 -0800 Subject: [PATCH] Fix textarea and validation on destination page The destination configuration page did not previously support a textarea input as was supported on most other pages. The validation of string inputs was not being performed. This commit addresses both of those issues and corrects the validation expressions for the AWS and S3 destination plugins so that they continue to function. The SFTP destination plugin does not have any string validation. The Kubernetes plugin does not work at all as far as I can tell; there will be another PR in the coming days to address that. --- lemur/plugins/lemur_aws/plugin.py | 7 +++---- .../angular/destinations/destination/destination.tpl.html | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lemur/plugins/lemur_aws/plugin.py b/lemur/plugins/lemur_aws/plugin.py index c563eac8..1c2607a5 100644 --- a/lemur/plugins/lemur_aws/plugin.py +++ b/lemur/plugins/lemur_aws/plugin.py @@ -163,7 +163,7 @@ class AWSDestinationPlugin(DestinationPlugin): 'name': 'accountNumber', 'type': 'str', 'required': True, - 'validation': '/^[0-9]{12,12}$/', + 'validation': '[0-9]{12}', 'helpMessage': 'Must be a valid AWS account number!', }, { @@ -279,14 +279,14 @@ class S3DestinationPlugin(ExportDestinationPlugin): 'name': 'bucket', 'type': 'str', 'required': True, - 'validation': '/^$|\s+/', + 'validation': '[0-9a-z.-]{3,63}', 'helpMessage': 'Must be a valid S3 bucket name!', }, { 'name': 'accountNumber', 'type': 'str', 'required': True, - 'validation': '/^[0-9]{12,12}$/', + 'validation': '[0-9]{12}', 'helpMessage': 'A valid AWS account number with permission to access S3', }, { @@ -308,7 +308,6 @@ class S3DestinationPlugin(ExportDestinationPlugin): 'name': 'prefix', 'type': 'str', 'required': False, - 'validation': '/^$|\s+/', 'helpMessage': 'Must be a valid S3 object prefix!', } ] diff --git a/lemur/static/app/angular/destinations/destination/destination.tpl.html b/lemur/static/app/angular/destinations/destination/destination.tpl.html index 1d240dbb..f2771b49 100644 --- a/lemur/static/app/angular/destinations/destination/destination.tpl.html +++ b/lemur/static/app/angular/destinations/destination/destination.tpl.html @@ -47,7 +47,9 @@ - + +
+

{{ item.helpMessage }}