Removed hard-coded email validation for healthcheck fix value. (#5557)

Made validation for healthchcls more flexible, supporting none, email and regex.

Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
This commit is contained in:
Andy Butland
2021-06-02 04:54:11 +02:00
committed by GitHub
parent 57f7776848
commit cd53d7a294
7 changed files with 53 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
(function () {
"use strict";
function HealthCheckController($scope, healthCheckResource) {
function HealthCheckController(healthCheckResource) {
var SUCCESS = 0;
var WARNING = 1;
var ERROR = 2;
@@ -19,6 +19,7 @@
vm.checkAllInGroup = checkAllInGroup;
vm.openGroup = openGroup;
vm.setViewState = setViewState;
vm.parseRegex = parseRegex;
// Get a (grouped) list of all health checks
healthCheckResource.getAllChecks()
@@ -131,6 +132,10 @@
}
}
}
function parseRegex(regexAsString) {
return new RegExp(regexAsString);
}
}
angular.module("umbraco").controller("Umbraco.Dashboard.HealthCheckController", HealthCheckController);

View File

@@ -133,7 +133,12 @@
<div ng-if="action.valueRequired">
<div><label class="bold">Set new value:</label></div>
<input name="providedValue" type="text" ng-model="action.providedValue" required val-email />
<div ng-switch on="action.providedValueValidation">
<input ng-switch-when="email" name="providedValue" type="text" ng-model="action.providedValue" required val-email />
<input ng-switch-when="regex" name="providedValue" type="text" ng-model="action.providedValue" required ng-pattern="vm.parseRegex(action.providedValueValidationRegex)" />
<input ng-switch-default name="providedValue" type="text" ng-model="action.providedValue" required />
</div>
</div>
<umb-button type="button"