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