Skip to content

Commit

Permalink
chore: move rules forms
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Phelps <[email protected]>
  • Loading branch information
markphelps committed Feb 5, 2025
1 parent 78f73a7 commit abe5c55
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions ui/src/app/flags/rules/Rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ButtonWithPlus, TextButton } from '~/components/Button';
import Loading from '~/components/Loading';
import Modal from '~/components/Modal';
import DeletePanel from '~/components/panels/DeletePanel';
import RuleForm from '~/components/rules/forms/RuleForm';
import RuleForm from '~/components/rules/RuleForm';
import Rule from '~/components/rules/Rule';
import SortableRule from '~/components/rules/SortableRule';
import Slideover from '~/components/Slideover';
Expand All @@ -36,7 +36,7 @@ import {
IVariant,
toFilterableVariant
} from '~/types/Variant';
import SingleDistributionFormInput from '~/components/rules/forms/SingleDistributionForm';
import SingleDistributionFormInput from '~/components/rules/SingleDistributionForm';
import { FlagFormContext } from '~/components/flags/FlagFormContext';
import { v4 as uuid } from 'uuid';
import { selectCurrentEnvironment } from '~/app/environments/environmentsApi';
Expand Down Expand Up @@ -285,6 +285,7 @@ export default function Rules({ flag, rules, variants }: RulesProps) {
flag={flag}
rule={rule}
segments={segments}
variants={variants}
onDelete={() => {
setActiveRule(null);
setDeletingRule(rule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FilterableSegment, ISegment, segmentOperators } from '~/types/Segment';
import { FilterableVariant, IVariant } from '~/types/Variant';
import { cls } from '~/utils/helpers';
import { distTypes } from './RuleForm';
import SingleDistributionFormInput from '~/components/rules/forms/SingleDistributionForm';
import SingleDistributionFormInput from './SingleDistributionForm';
import { IDistribution } from '~/types/Distribution';

type QuickEditRuleFormProps = {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/rules/Rule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IFlag } from '~/types/Flag';
import { ISegment } from '~/types/Segment';
import { cls } from '~/utils/helpers';
import Dropdown from '~/components/Dropdown';
import QuickEditRuleForm from './forms/QuickEditRuleForm';
import QuickEditRuleForm from './QuickEditRuleForm';
import { IRule } from '~/types/Rule';
import { IVariant } from '~/types/Variant';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { Dialog } from '@headlessui/react';
import { XMarkIcon } from '@heroicons/react/24/outline';
import { FieldArray, Form, Formik } from 'formik';
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { Link } from 'react-router';
import * as Yup from 'yup';
import { selectCurrentNamespace } from '~/app/namespaces/namespacesApi';
import { Button } from '~/components/Button';
import SegmentsPicker from '~/components/forms/SegmentsPicker';
import Loading from '~/components/Loading';
Expand Down
6 changes: 4 additions & 2 deletions ui/src/components/rules/SortableRule.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { useSortable } from '@dnd-kit/sortable';
import { IEvaluatable } from '~/types/Evaluatable';
import { IFlag } from '~/types/Flag';
import { ISegment } from '~/types/Segment';
import Rule from './Rule';
import { IRule } from '~/types/Rule';
import { IVariant } from '~/types/Variant';

type SortableRuleProps = {
flag: IFlag;
rule: IRule;
segments: ISegment[];
variants: IVariant[];
onSuccess: () => void;
onDelete: () => void;
};

export default function SortableRule(props: SortableRuleProps) {
const { flag, rule, segments, onSuccess, onDelete } = props;
const { flag, rule, segments, variants, onSuccess, onDelete } = props;
const {
isDragging,
attributes,
Expand Down Expand Up @@ -46,6 +47,7 @@ export default function SortableRule(props: SortableRuleProps) {
flag={flag}
rule={rule}
segments={segments}
variants={variants}
onSuccess={onSuccess}
onDelete={onDelete}
/>
Expand Down

0 comments on commit abe5c55

Please sign in to comment.