mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
remove some constraint accordion view props
This commit is contained in:
parent
d2521312b8
commit
9904dcea37
@ -114,11 +114,9 @@ export const ConstraintAccordionView = ({
|
||||
onEdit={onEdit}
|
||||
onDelete={onDelete}
|
||||
onUse={onUse}
|
||||
singleValue={singleValue}
|
||||
allowExpand={setExpandable}
|
||||
disabled={disabled}
|
||||
expanded={expanded}
|
||||
compact={compact}
|
||||
/>
|
||||
{renderAfter}
|
||||
</StyledWrapper>
|
||||
|
@ -1,25 +1,13 @@
|
||||
import type { IConstraint } from 'interfaces/strategy';
|
||||
import { ConstraintAccordionViewHeaderInfo } from './ConstraintAccordionViewHeaderInfo.tsx';
|
||||
import { styled } from '@mui/system';
|
||||
import useUnleashContext from 'hooks/api/getters/useUnleashContext/useUnleashContext';
|
||||
import { ConstraintAccordionViewActions } from '../../ConstraintAccordionViewActions/ConstraintAccordionViewActions.tsx';
|
||||
import { ConstraintAccordionEditActions } from '../../ConstraintAccordionEditActions/ConstraintAccordionEditActions.tsx';
|
||||
|
||||
interface IConstraintAccordionViewHeaderProps {
|
||||
constraint: IConstraint;
|
||||
onDelete?: () => void;
|
||||
onEdit?: () => void;
|
||||
onUse?: () => void;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
singleValue: boolean;
|
||||
expanded: boolean;
|
||||
allowExpand: (shouldExpand: boolean) => void;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
compact?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
@ -36,22 +24,11 @@ const StyledContainer = styled('div')(({ theme }) => ({
|
||||
|
||||
export const ConstraintAccordionViewHeader = ({
|
||||
constraint,
|
||||
onEdit,
|
||||
onDelete,
|
||||
onUse,
|
||||
singleValue,
|
||||
allowExpand,
|
||||
expanded,
|
||||
compact,
|
||||
disabled,
|
||||
}: IConstraintAccordionViewHeaderProps) => {
|
||||
const { context } = useUnleashContext();
|
||||
const { contextName } = constraint;
|
||||
|
||||
const disableEdit = !context
|
||||
.map((contextDefinition) => contextDefinition.name)
|
||||
.includes(contextName);
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
<ConstraintAccordionViewHeaderInfo
|
||||
@ -60,16 +37,7 @@ export const ConstraintAccordionViewHeader = ({
|
||||
expanded={expanded}
|
||||
disabled={disabled}
|
||||
/>
|
||||
{onUse ? (
|
||||
<ConstraintAccordionViewActions onUse={onUse} />
|
||||
) : (
|
||||
// @deprecated : remove onEdit and onDelete from current file together with NewConstraintAccordionList and addEditStrategy flag
|
||||
<ConstraintAccordionEditActions
|
||||
onEdit={onEdit}
|
||||
onDelete={onDelete}
|
||||
disableEdit={disableEdit}
|
||||
/>
|
||||
)}
|
||||
{onUse ? <ConstraintAccordionViewActions onUse={onUse} /> : null}
|
||||
</StyledContainer>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user