diff --git a/frontend/web/components/base/forms/Button.tsx b/frontend/web/components/base/forms/Button.tsx index 306070be37be..282bb21c87bb 100644 --- a/frontend/web/components/base/forms/Button.tsx +++ b/frontend/web/components/base/forms/Button.tsx @@ -56,13 +56,13 @@ export const Button: FC = ({ const hasPlan = feature ? Utils.getPlansPermission(feature) : true return href || !hasPlan ? ( - {!!iconLeft && ( + {!!iconLeft && !!hasPlan && ( = ({ width={iconSize} /> )} - {children} +
+ {children} + {!hasPlan && } +
{!!iconRight && ( { - this.setState({ segmentsChanged: false }) + const saveFeatureSegments = saveFeatureWithValidation( + (schedule) => { + this.setState({ segmentsChanged: false }) - if (is4Eyes && isVersioned && !identity) { - openModal2( - this.props.changeRequest - ? 'Update Change Request' - : 'New Change Request', - { - closeModal2() - this.save( - ( - projectId, - environmentId, - flag, - projectFlag, - environmentFlag, - segmentOverrides, - ) => { - createChangeRequest( + if ((is4Eyes || schedule) && isVersioned && !identity) { + openModal2( + this.props.changeRequest + ? 'Update Change Request' + : schedule + ? 'Schedule Segment Overrides Update' + : 'New Change Request', + { + closeModal2() + this.save( + ( projectId, environmentId, flag, projectFlag, environmentFlag, segmentOverrides, - { - approvals, - description, - featureStateId: - this.props.changeRequest && - this.props.changeRequest.feature_states[0].id, - id: - this.props.changeRequest && - this.props.changeRequest.id, - live_from, - multivariate_options: this.props - .multivariate_options - ? this.props.multivariate_options.map((v) => { - const matching = - this.state.multivariate_options.find( - (m) => - m.id === - v.multivariate_feature_option, - ) - return { - ...v, - percentage_allocation: - matching.default_percentage_allocation, - } - }) - : this.state.multivariate_options, - title, - }, - !is4Eyes, - 'SEGMENT', - ) - }, - ) - }} - />, - ) - } else { - this.save(editFeatureSegments, isSaving) - } - }) + ) => { + createChangeRequest( + projectId, + environmentId, + flag, + projectFlag, + environmentFlag, + segmentOverrides, + { + approvals, + description, + featureStateId: + this.props.changeRequest && + this.props.changeRequest.feature_states[0] + .id, + id: + this.props.changeRequest && + this.props.changeRequest.id, + live_from, + multivariate_options: this.props + .multivariate_options + ? this.props.multivariate_options.map( + (v) => { + const matching = + this.state.multivariate_options.find( + (m) => + m.id === + v.multivariate_feature_option, + ) + return { + ...v, + percentage_allocation: + matching.default_percentage_allocation, + } + }, + ) + : this.state.multivariate_options, + title, + }, + !is4Eyes, + 'SEGMENT', + ) + }, + ) + }} + />, + ) + } else { + this.save(editFeatureSegments, isSaving) + } + }, + ) const onCreateFeature = saveFeatureWithValidation(() => { this.save(createFlag, isSaving) @@ -1485,24 +1492,58 @@ const CreateFlag = class extends Component { Constants.environmentPermissions( 'Manage segment overrides', ), - , + <> + {!is4Eyes && + isVersioned && ( + <> + + + )} + + , ) }}