Skip to content

Commit

Permalink
Release 5.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
APiankouski authored Dec 20, 2024
2 parents 0ddc53f + 3be5f51 commit a538392
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ shadowJar {
include(dependency("org.apache.httpcomponents:httpclient-cache:.*"))
include(dependency("org.apache.httpcomponents:httpcore:.*"))
include(dependency("org.apache.httpcomponents:httpcore-nio:.*"))
include(dependency("org.apache.httpcomponents:httpcore-mime:.*"))
include(dependency("org.apache.httpcomponents:httpmime:.*"))
include(dependency("org.glassfish.jersey.core:jersey-server:.*"))
include(dependency("org.glassfish.jersey.core:jersey-common:.*"))
include(dependency("jakarta.ws.rs:jakarta.ws.rs-api:.*"))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useEffect } from 'react';
import { LABELS } from '../constans';
import { LABELS } from '../constants';
import { btsJiraCloudUrl } from '../utils';

export const IntegrationFormFields = (props) => {
const { initialize, disabled, initialData, updateMetaData, ...extensionProps } = props;
const {
components: { FieldErrorHint, FieldElement, FieldText, FieldTextFlex },
validators: { requiredField, btsUrl, btsProjectKey, btsIntegrationName, email },
validators: { requiredField, btsProjectKey, btsIntegrationName, email },
constants: { SECRET_FIELDS_KEY },
} = extensionProps;

Expand Down Expand Up @@ -33,7 +34,7 @@ export const IntegrationFormFields = (props) => {
<FieldElement
name="url"
label={LABELS.URL}
validate={btsUrl}
validate={btsJiraCloudUrl}
disabled={disabled}
isRequired
dataAutomationId="linkToBTSField"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { LABELS } from '../constans';
import { LABELS } from '../constants';

export const IntegrationSettings = (props) => {
const { data, goToPreviousPage, onUpdate, isGlobal, ...extensionProps } = props;
Expand Down
19 changes: 19 additions & 0 deletions ui/src/components/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const regex = (regexStr) => (value) => RegExp(regexStr).test(value);
const trimValue = (value) => (typeof value === 'string' ? value.trim() : value);
const isEmpty = (value) => {
const trimmedValue = trimValue(value);
return trimmedValue === '' || trimmedValue === undefined || trimmedValue === null;
};
const isNotEmpty = (value) => !isEmpty(value);
const composeValidators = (validators) => (value) =>
validators.every((validator) => validator(value));

const jiraCloudUrl = composeValidators([
isNotEmpty,
regex(/https:\/\/[^?]*.atlassian.(net|com)\/.*/),
]);

const bindMessageToValidator = (validator, errorMessage) => (value) =>
!validator(value) ? errorMessage : undefined;

export const btsJiraCloudUrl = bindMessageToValidator(jiraCloudUrl, 'btsUrlHint');

0 comments on commit a538392

Please sign in to comment.