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

Commitdc5f69e

Browse files
authored
fix: show error message for incompatible parameters (#18365)
resolvescoder/preview#148If there are any immutable params with diagnostics on the workspaceparameters page, display this error dialog.<img width="838" alt="Screenshot 2025-06-13 at 18 06 36"src="https://github.com/user-attachments/assets/47a9ad04-7969-4567-a5fc-39301c5f830c"/>
1 parent9a432b8 commitdc5f69e

File tree

2 files changed

+66
-14
lines changed

2 files changed

+66
-14
lines changed

‎site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,18 @@ export const CreateWorkspacePageViewExperimental: FC<
596596
constcurrentParameterValueIndex=
597597
form.values.rich_parameter_values?.findIndex(
598598
(p)=>p.name===parameter.name,
599-
)??-1;
599+
);
600600
constparameterFieldIndex=
601-
currentParameterValueIndex!==-1
601+
currentParameterValueIndex!==undefined
602602
?currentParameterValueIndex
603603
:index;
604+
// Get the form value by parameter name to ensure correct value mapping
605+
constformValue=
606+
currentParameterValueIndex!==undefined
607+
?form.values?.rich_parameter_values?.[
608+
currentParameterValueIndex
609+
]?.value||""
610+
:"";
604611
constparameterField=`rich_parameter_values.${parameterFieldIndex}`;
605612
constisPresetParameter=presetParameterNames.includes(
606613
parameter.name,
@@ -622,14 +629,6 @@ export const CreateWorkspacePageViewExperimental: FC<
622629
returnnull;
623630
}
624631

625-
// Get the form value by parameter name to ensure correct value mapping
626-
constformValue=
627-
currentParameterValueIndex!==-1
628-
?form.values?.rich_parameter_values?.[
629-
currentParameterValueIndex
630-
]?.value||""
631-
:"";
632-
633632
return(
634633
<DynamicParameter
635634
key={parameter.name}

‎site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx‎

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ export const WorkspaceParametersPageViewExperimental: FC<
123123
setFieldValue:form.setFieldValue,
124124
});
125125

126+
consthasIncompatibleParameters=parameters.some((parameter)=>{
127+
if(!parameter.mutable&&parameter.diagnostics.length>0){
128+
returntrue;
129+
}
130+
returnfalse;
131+
});
132+
126133
return(
127134
<>
128135
{disabled&&(
@@ -132,6 +139,38 @@ export const WorkspaceParametersPageViewExperimental: FC<
132139
</Alert>
133140
)}
134141

142+
{hasIncompatibleParameters&&(
143+
<Alertseverity="error">
144+
<pclassName="text-lg leading-tight font-bold m-0">
145+
Workspace update blocked
146+
</p>
147+
<pclassName="mb-0">
148+
The new template version includes parameter changes that are
149+
incompatible with this workspace's existing parameter values. This
150+
may be caused by:
151+
</p>
152+
<ulclassName="mb-0 pl-4 space-y-1">
153+
<li>
154+
New<strong>required</strong> parameters that cannot be provided
155+
after workspace creation
156+
</li>
157+
<li>
158+
Changes to<strong>valid options or validations</strong> for
159+
existing parameters
160+
</li>
161+
<li>Logic changes that conflict with previously selected values</li>
162+
</ul>
163+
<pclassName="mb-0">
164+
Please contact the<strong>template administrator</strong> to review
165+
the changes and ensure compatibility for existing workspaces.
166+
</p>
167+
<pclassName="mb-0">
168+
Consider supplying defaults for new parameters or validating
169+
conditional logic against prior workspace states.
170+
</p>
171+
</Alert>
172+
)}
173+
135174
{diagnostics&&diagnostics.length>0&&(
136175
<divclassName="flex flex-col gap-4 mb-8">
137176
{diagnostics.map((diagnostic,index)=>(
@@ -182,7 +221,23 @@ export const WorkspaceParametersPageViewExperimental: FC<
182221
</p>
183222
</hgroup>
184223
{standardParameters.map((parameter,index)=>{
185-
constparameterField=`rich_parameter_values.${index}`;
224+
constcurrentParameterValueIndex=
225+
form.values.rich_parameter_values?.findIndex(
226+
(p)=>p.name===parameter.name,
227+
);
228+
constparameterFieldIndex=
229+
currentParameterValueIndex!==undefined
230+
?currentParameterValueIndex
231+
:index;
232+
// Get the form value by parameter name to ensure correct value mapping
233+
constformValue=
234+
currentParameterValueIndex!==undefined
235+
?form.values?.rich_parameter_values?.[
236+
currentParameterValueIndex
237+
]?.value||""
238+
:"";
239+
240+
constparameterField=`rich_parameter_values.${parameterFieldIndex}`;
186241
constisDisabled=
187242
disabled||
188243
parameter.styling?.disabled||
@@ -198,9 +253,7 @@ export const WorkspaceParametersPageViewExperimental: FC<
198253
}
199254
autofill={false}
200255
disabled={isDisabled}
201-
value={
202-
form.values?.rich_parameter_values?.[index]?.value||""
203-
}
256+
value={formValue}
204257
/>
205258
);
206259
})}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp