diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/components/policy_form/steps/step_logistics.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/components/policy_form/steps/step_logistics.tsx index 2206d6de341c8..111b46d596e56 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/components/policy_form/steps/step_logistics.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/components/policy_form/steps/step_logistics.tsx @@ -347,7 +347,7 @@ export const PolicyStepLogistics: React.FunctionComponent = ({ onChange={e => { updatePolicy( { - snapshotName: e.target.value.toLowerCase(), + snapshotName: e.target.value, }, { managedRepository, diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/services/validation/validate_policy.ts b/x-pack/legacy/plugins/snapshot_restore/public/app/services/validation/validate_policy.ts index 7d44979e697a7..0720994ca7669 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/services/validation/validate_policy.ts +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/services/validation/validate_policy.ts @@ -15,6 +15,16 @@ const isStringEmpty = (str: string | null): boolean => { return str ? !Boolean(str.trim()) : true; }; +// strExcludeDate is the concat results of the SnapshotName ...{...}>... without the date +// This way we can check only the SnapshotName portion for lowercasing +// For example: would give strExcludeDate = + +const isSnapshotNameNotLowerCase = (str: string): boolean => { + const strExcludeDate = + str.substring(0, str.search('{')) + str.substring(str.search('}>') + 1, str.length); + return strExcludeDate !== strExcludeDate.toLowerCase() ? true : false; +}; + export const validatePolicy = ( policy: SlmPolicyPayload, validationHelperData: { @@ -61,6 +71,14 @@ export const validatePolicy = ( ); } + if (isSnapshotNameNotLowerCase(snapshotName)) { + validation.errors.snapshotName.push( + i18n.translate('xpack.snapshotRestore.policyValidation.snapshotNameLowerCaseErrorMessage', { + defaultMessage: 'Snapshot name needs to be lowercase.', + }) + ); + } + if (isStringEmpty(schedule)) { validation.errors.schedule.push( i18n.translate('xpack.snapshotRestore.policyValidation.scheduleRequiredErrorMessage', { diff --git a/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/webhook_action.js b/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/webhook_action.js index 6f496dd9ee138..3225653acbb3d 100644 --- a/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/webhook_action.js +++ b/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/webhook_action.js @@ -25,6 +25,7 @@ export class WebhookAction extends BaseAction { this.username = get(props, 'username'); this.password = get(props, 'password'); this.contentType = get(props, 'contentType'); + this.fullPath = `${this.host}:${this.port}${this.path ? '/' + this.path : ''}`; }