mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
fix: viewers should be allowed to see strategy config (#645)
fixes #644
This commit is contained in:
parent
8dddb285b6
commit
9c3e300448
@ -148,6 +148,17 @@ const FeatureStrategyAccordionBody: React.FC<
|
|||||||
const { parameters } = strategy;
|
const { parameters } = strategy;
|
||||||
const ON = uiConfig.flags[C];
|
const ON = uiConfig.flags[C];
|
||||||
|
|
||||||
|
const editable = hasAccess(
|
||||||
|
UPDATE_FEATURE_STRATEGY,
|
||||||
|
projectId,
|
||||||
|
activeEnvironment.name
|
||||||
|
) ||
|
||||||
|
hasAccess(
|
||||||
|
CREATE_FEATURE_STRATEGY,
|
||||||
|
projectId,
|
||||||
|
activeEnvironment.name
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.accordionContainer}>
|
<div className={styles.accordionContainer}>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
@ -193,28 +204,12 @@ const FeatureStrategyAccordionBody: React.FC<
|
|||||||
/>
|
/>
|
||||||
</Dialogue>
|
</Dialogue>
|
||||||
|
|
||||||
<ConditionallyRender
|
<Type
|
||||||
condition={
|
parameters={parameters}
|
||||||
hasAccess(
|
updateParameter={updateParameters}
|
||||||
UPDATE_FEATURE_STRATEGY,
|
strategyDefinition={definition}
|
||||||
projectId,
|
context={context}
|
||||||
activeEnvironment.name
|
editable={editable}
|
||||||
) ||
|
|
||||||
hasAccess(
|
|
||||||
CREATE_FEATURE_STRATEGY,
|
|
||||||
projectId,
|
|
||||||
activeEnvironment.name
|
|
||||||
)
|
|
||||||
}
|
|
||||||
show={
|
|
||||||
<Type
|
|
||||||
parameters={parameters}
|
|
||||||
updateParameter={updateParameters}
|
|
||||||
strategyDefinition={definition}
|
|
||||||
context={context}
|
|
||||||
editable
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
@ -22,12 +22,14 @@ interface IFlexibleStrategyProps {
|
|||||||
parameters: IParameter;
|
parameters: IParameter;
|
||||||
updateParameter: (field: string, value: any) => void;
|
updateParameter: (field: string, value: any) => void;
|
||||||
context: any;
|
context: any;
|
||||||
|
editable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlexibleStrategy = ({
|
const FlexibleStrategy = ({
|
||||||
updateParameter,
|
updateParameter,
|
||||||
parameters,
|
parameters,
|
||||||
context,
|
context,
|
||||||
|
editable=true
|
||||||
}: IFlexibleStrategyProps) => {
|
}: IFlexibleStrategyProps) => {
|
||||||
const onUpdate =
|
const onUpdate =
|
||||||
(field: string) =>
|
(field: string) =>
|
||||||
@ -66,6 +68,7 @@ const FlexibleStrategy = ({
|
|||||||
<RolloutSlider
|
<RolloutSlider
|
||||||
name="Rollout"
|
name="Rollout"
|
||||||
value={1 * rollout}
|
value={1 * rollout}
|
||||||
|
disabled={!editable}
|
||||||
onChange={updateRollout}
|
onChange={updateRollout}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -96,6 +99,7 @@ const FlexibleStrategy = ({
|
|||||||
label="Stickiness"
|
label="Stickiness"
|
||||||
options={stickinessOptions}
|
options={stickinessOptions}
|
||||||
value={stickiness}
|
value={stickiness}
|
||||||
|
disabled={!editable}
|
||||||
data-test={FLEXIBLE_STRATEGY_STICKINESS_ID}
|
data-test={FLEXIBLE_STRATEGY_STICKINESS_ID}
|
||||||
onChange={e =>
|
onChange={e =>
|
||||||
onUpdate('stickiness')(e, e.target.value as number)
|
onUpdate('stickiness')(e, e.target.value as number)
|
||||||
@ -126,6 +130,7 @@ const FlexibleStrategy = ({
|
|||||||
<Input
|
<Input
|
||||||
label="groupId"
|
label="groupId"
|
||||||
value={groupId || ''}
|
value={groupId || ''}
|
||||||
|
disabled={!editable}
|
||||||
onChange={e => onUpdate('groupId')(e, e.target.value)}
|
onChange={e => onUpdate('groupId')(e, e.target.value)}
|
||||||
data-test={FLEXIBLE_STRATEGY_GROUP_ID}
|
data-test={FLEXIBLE_STRATEGY_GROUP_ID}
|
||||||
/>
|
/>
|
||||||
|
@ -66,6 +66,7 @@ const GeneralStrategy = ({
|
|||||||
<RolloutSlider
|
<RolloutSlider
|
||||||
name={name}
|
name={name}
|
||||||
onChange={onChangePercentage.bind(this, name)}
|
onChange={onChangePercentage.bind(this, name)}
|
||||||
|
disabled={!editable}
|
||||||
value={1 * value}
|
value={1 * value}
|
||||||
minLabel="off"
|
minLabel="off"
|
||||||
maxLabel="on"
|
maxLabel="on"
|
||||||
@ -107,6 +108,7 @@ const GeneralStrategy = ({
|
|||||||
size="small"
|
size="small"
|
||||||
required={required}
|
required={required}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
|
disabled={!editable}
|
||||||
name={name}
|
name={name}
|
||||||
label={name}
|
label={name}
|
||||||
onChange={onChangeTextField.bind(this, name)}
|
onChange={onChangeTextField.bind(this, name)}
|
||||||
@ -148,6 +150,7 @@ const GeneralStrategy = ({
|
|||||||
size="small"
|
size="small"
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
required={required}
|
required={required}
|
||||||
|
disabled={!editable}
|
||||||
name={name}
|
name={name}
|
||||||
label={name}
|
label={name}
|
||||||
onChange={onChangeTextField.bind(this, name)}
|
onChange={onChangeTextField.bind(this, name)}
|
||||||
|
Loading…
Reference in New Issue
Block a user