mengw15 commented on code in PR #8846:
URL: https://github.com/apache/texera/pull/8846#discussion_r4305518589
##########
frontend/src/app/workspace/component/ui-udf-parameters/ui-udf-parameters.component.ts:
##########
@@ -79,13 +96,45 @@ export class UiUdfParametersComponent extends
FieldArrayType<FormlyFieldConfig>
super();
}
- get workflowModificationEnabled(): boolean {
- return this.workflowActionService.checkWorkflowModificationEnabled();
+ /** Whether this is a Form View card rather than the operator property
panel; see columnsInView. */
+ get onFormView(): boolean {
+ return renderedInFormView(this.field ?? {});
+ }
+
+ /**
+ * Whether the table takes a new parameter here. On the operator property
panel that is the
+ * canvas's rule, as it always was: the workflow may be modified (write
access, no run in flight).
+ * On a Form View card it is the card's own rule: the card is not a
reader's, which the form marks
+ * on the field itself (props.disabled, its one lock on a card; see
renderedReadOnly). A writer's
+ * card is editable in and out of edit mode, as every value on it is (adding
a parameter is adding
+ * a row). The canvas's flag is not the card's rule: the Form View holds it
off outside edit mode,
+ * against structural edits through its page, and that hid the button on a
card whose values could
+ * still be edited. The mark decides rather than the table's own control,
which does not answer the
+ * question: formly disables the leaf controls under a disabled field, not
the array itself, so a
+ * reader's table with no parameters yet reads as enabled (a reader's table
with rows reads as
+ * disabled only because every row's controls are).
+ */
+ get editable(): boolean {
+ if (!this.onFormView) {
+ return this.workflowActionService.checkWorkflowModificationEnabled();
+ }
+ return !renderedReadOnly(this.field);
Review Comment:
The flag this replaces was holding two gates on a Form View card, and only
one of them was the bug. `checkWorkflowModificationEnabled()` is clamped on
this page to `mayUnlock()` — `authoring && canEdit && !isRunning` — so for a
writer the button was hidden both outside edit mode and while a run was in
flight. `!renderedReadOnly(field)` is `props.disabled !== true`, which the form
sets only for a reader, so both gates go.
Dropping the edit-mode one is the fix. Dropping `!isRunning` means a
writer's card now offers Add parameter during a run, and it inserts a
`self.UiParameter(...)` declaration into that UDF's code — which the operator
property panel and the canvas code editor both refuse while a run is in flight,
through that same flag.
The description reads this as the Form View's existing property ("a writer's
cards stay editable while a run is in flight, so a card offers Add parameter
then as well"). That holds for the values, which were always editable here; for
this button it is new — on main the flag hid it during a run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]