Skip to content

Commit

Permalink
[frontend/backend] Chaining injects conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimfacion committed Oct 12, 2024
1 parent 64d6865 commit fedc15f
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ const InjectForm = ({
}) => {
const classes = useStyles();
const { t } = useFormatter();

const breakpointAndOr = /&&|\|\|/gm;
const breakpointValue = /==/gm;
const typeFromName = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-(.*)-Success/mg;

const capitalize = (text) => {
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
};

const [parents, setParents] = useState(
injects.filter((currentInject) => values.inject_depends_on !== null
&& values.inject_depends_on[currentInject.inject_id] !== undefined)
Expand All @@ -44,9 +53,6 @@ const InjectForm = ({
);

const getConditionContentParent = (injectDependsOn) => {
const breakpointAndOr = /&&|\|\|/gm;
const breakpointValue = /==/gm;
const typeFromName = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-(.*)-Success/mg;
const conditions = [];
for (const dependency in injectDependsOn) {
if (Object.hasOwn(injectDependsOn, dependency)) {
Expand All @@ -71,9 +77,6 @@ const InjectForm = ({
};

const getConditionContentChildren = (injectDependsTo) => {
const breakpointAndOr = /&&|\|\|/gm;
const breakpointValue = /==/gm;
const typeFromName = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-(.*)-Success/mg;
const conditions = [];
for (const children in injectDependsTo) {
if (Object.hasOwn(injectDependsTo, children)) {
Expand Down Expand Up @@ -392,10 +395,6 @@ const InjectForm = ({
);
};

const capitalize = (text) => {
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
};

const getAvailableExpectations = (inject) => {
if (inject.inject_content !== null && inject.inject_content !== undefined) {
const expectations = inject.inject_content.expectations.map((expectation) => (expectation.expectation_type === 'MANUAL' ? expectation.expectation_name : capitalize(expectation.expectation_type)));
Expand Down

0 comments on commit fedc15f

Please sign in to comment.