Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit86c5c2d

Browse files
authored
fix: permissions checks start milestone (#11045)
1 parent345b349 commit86c5c2d

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

‎frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/ReleasePlanMilestone.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ interface IReleasePlanMilestoneProps {
105105
readonly?:boolean;
106106
automationSection?:React.ReactNode;
107107
previousMilestoneStatus?:MilestoneStatus;
108+
projectId?:string;
109+
environmentId?:string;
108110
}
109111

110112
exportconstReleasePlanMilestone=({
@@ -114,6 +116,8 @@ export const ReleasePlanMilestone = ({
114116
readonly,
115117
automationSection,
116118
previousMilestoneStatus,
119+
projectId,
120+
environmentId,
117121
}:IReleasePlanMilestoneProps)=>{
118122
const[expanded,setExpanded]=useState(false);
119123
consthasAutomation=Boolean(automationSection);
@@ -148,6 +152,8 @@ export const ReleasePlanMilestone = ({
148152
onStartMilestone={()=>
149153
onStartMilestone(milestone)
150154
}
155+
projectId={projectId}
156+
environmentId={environmentId}
151157
/>
152158
)}
153159
{status.type==='active'&&
@@ -197,6 +203,8 @@ export const ReleasePlanMilestone = ({
197203
onStartMilestone={()=>
198204
onStartMilestone(milestone)
199205
}
206+
projectId={projectId}
207+
environmentId={environmentId}
200208
/>
201209
)}
202210
{status.type==='active'&&

‎frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx‎

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import PlayCircleIcon from '@mui/icons-material/PlayCircle';
33
importPauseCircleIconfrom'@mui/icons-material/PauseCircle';
44
importTripOriginIconfrom'@mui/icons-material/TripOrigin';
55
import{useUiFlag}from'hooks/useUiFlag';
6+
import{useHasProjectEnvironmentAccess}from'hooks/useHasAccess';
7+
import{UPDATE_FEATURE_STRATEGY}from'component/providers/AccessProvider/permissions';
8+
import{TooltipResolver}from'component/common/TooltipResolver/TooltipResolver';
9+
import{formatAccessText}from'utils/formatAccessText';
610

711
exporttypeMilestoneProgressionStatus='paused'|'active';
812

@@ -24,7 +28,7 @@ const BaseStatusButton = styled('button')<{ disabled?: boolean }>(
2428
gap:theme.spacing(1),
2529
padding:0,
2630
paddingRight:theme.spacing(1),
27-
cursor:'pointer',
31+
cursor:disabled ?'default' :'pointer',
2832
fontSize:theme.fontSizes.smallerBody,
2933
lineHeight:theme.fontSizes.smallerBody,
3034
fontWeight:theme.fontWeight.medium,
@@ -37,9 +41,6 @@ const BaseStatusButton = styled('button')<{ disabled?: boolean }>(
3741
height:theme.spacing(3),
3842
width:theme.spacing(3),
3943
},
40-
...(disabled&&{
41-
pointerEvents:'none',
42-
}),
4344
}),
4445
);
4546

@@ -107,6 +108,8 @@ const CompletedStatusButton = styled(BaseStatusButton)(({ theme }) => ({
107108
interfaceIReleasePlanMilestoneStatusProps{
108109
status:MilestoneStatus;
109110
onStartMilestone:()=>void;
111+
projectId?:string;
112+
environmentId?:string;
110113
}
111114

112115
constgetStatusText=(
@@ -156,28 +159,51 @@ const getStatusButton = (
156159
exportconstReleasePlanMilestoneStatus=({
157160
status,
158161
onStartMilestone,
162+
projectId,
163+
environmentId,
159164
}:IReleasePlanMilestoneStatusProps)=>{
160165
constmilestoneProgressionsEnabled=useUiFlag('milestoneProgression');
166+
consthasAccess=
167+
projectId&&environmentId
168+
?useHasProjectEnvironmentAccess(
169+
UPDATE_FEATURE_STRATEGY,
170+
projectId,
171+
environmentId,
172+
)
173+
:true;
161174

162175
constStatusButton=getStatusButton(status,milestoneProgressionsEnabled);
163176
conststatusText=getStatusText(status,milestoneProgressionsEnabled);
164177
conststatusIcon=getStatusIcon(status);
165-
constdisabled=status.type==='active'||status.type==='paused';
178+
constisActionable=
179+
status.type==='not-started'||status.type==='completed';
180+
constdisabled=!isActionable||!hasAccess;
166181
constisScheduled=
167182
milestoneProgressionsEnabled&&
168183
status.type==='not-started'&&
169184
status.scheduledAt;
170185

171-
return(
172-
<StatusButton
173-
onClick={(e)=>{
174-
e.stopPropagation();
175-
onStartMilestone();
176-
}}
177-
disabled={disabled}
178-
>
186+
consthandleClick=(e:React.MouseEvent)=>{
187+
e.stopPropagation();
188+
if(!disabled){
189+
onStartMilestone();
190+
}
191+
};
192+
193+
constbutton=(
194+
<StatusButtononClick={handleClick}disabled={disabled}>
179195
{!isScheduled&&statusIcon}
180196
{statusText}
181197
</StatusButton>
182198
);
199+
200+
if(isActionable&&!hasAccess){
201+
return(
202+
<TooltipResolvertitle={formatAccessText(false)}arrow>
203+
{button}
204+
</TooltipResolver>
205+
);
206+
}else{
207+
returnbutton;
208+
}
183209
};

‎frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ export const ReleasePlanMilestoneItem = ({
195195
onStartMilestone={onStartMilestone}
196196
automationSection={automationSection}
197197
previousMilestoneStatus={previousMilestoneStatus}
198+
projectId={projectId}
199+
environmentId={environment}
198200
/>
199201
<ConditionallyRender
200202
condition={isNotLastMilestone}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp