Say when a flow has no global input to take a field from
"From global inputs" was offered on every bindable field, so on a flow that declares none it led to an empty picker and a form that could not be saved - a dead end with nothing explaining it. The choice stays visible, because it is what tells you the possibility exists, but it is disabled and says "(none declared)", and the value field it replaces is hidden while it is selected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
eef5dfb3ed
commit
8a57d74fb9
|
|
@ -587,7 +587,14 @@
|
|||
<option value="static">Static value</option>
|
||||
<option value="input">Workflow input</option>
|
||||
@if (canTakeGlobalInput()) {
|
||||
<option value="global">From global inputs</option>
|
||||
<!--
|
||||
Kept in place and disabled when the flow declares none, rather than hidden: the same
|
||||
reasoning as the Use default button below, where an option that appears and disappears
|
||||
is one nobody discovers. Selecting it used to lead to a mode that could not be completed.
|
||||
-->
|
||||
<option value="global" [disabled]="!localEditorGlobalInputs.length">
|
||||
From global inputs{{ localEditorGlobalInputs.length ? '' : ' (none declared)' }}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
@if (localEditorUseInput) {
|
||||
|
|
@ -620,6 +627,12 @@
|
|||
}
|
||||
</div>
|
||||
}
|
||||
<!--
|
||||
Hidden in global mode: the value there is the ${{global.x}} the picker above writes, so a
|
||||
second control for the same field could only contradict it - a model picker reading
|
||||
"Select model..." next to a source that says the model comes from a global input.
|
||||
-->
|
||||
@if (!localEditorFromGlobal) {
|
||||
<div class="llm-modal-field">
|
||||
<label>{{ localEditorLabel }}</label>
|
||||
<div class="llm-modal-control-row">
|
||||
|
|
@ -691,6 +704,7 @@
|
|||
<small class="llm-modal-tip">{{ localEditorTip }}</small>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="llm-modal-actions">
|
||||
<button type="button" class="llm-btn llm-btn-ghost" (pointerdown)="$event.stopPropagation()" (click)="closeSimpleParamEditor($event)">Cancel</button>
|
||||
<button type="button" class="llm-btn llm-btn-primary" [disabled]="!canSaveLocalEditor()" (pointerdown)="$event.stopPropagation()" (click)="saveSimpleParamEditor($event)">Save</button>
|
||||
|
|
|
|||
|
|
@ -674,6 +674,44 @@ describe('GenericNodeComponent', () => {
|
|||
expect(component.localEditorTip).toBe('Leave empty to take it from a node input.');
|
||||
});
|
||||
|
||||
it('knows the choice is unusable when the flow declares no global', async () => {
|
||||
const component = fixture.componentInstance as any;
|
||||
withGlobals([]);
|
||||
await openModelEditor(component);
|
||||
|
||||
// Selecting it used to lead to a mode nothing could complete: an empty picker, a hidden
|
||||
// value, and a Save that stays disabled. The option is left in the list and disabled off
|
||||
// this, so the capability stays discoverable.
|
||||
expect(component.canTakeGlobalInput()).toBe(true);
|
||||
expect(component.localEditorGlobalInputs).toEqual([]);
|
||||
});
|
||||
|
||||
it('knows it is usable as soon as the flow has one', async () => {
|
||||
const component = fixture.componentInstance as any;
|
||||
withGlobals([{ name: 'modelName', type: 'TEXT', multiple: false }]);
|
||||
await openModelEditor(component);
|
||||
|
||||
expect(component.canTakeGlobalInput()).toBe(true);
|
||||
expect(component.localEditorGlobalInputs.map((input: any) => input.name)).toEqual(['modelName']);
|
||||
});
|
||||
|
||||
it('cannot be saved from global mode until a global is picked', async () => {
|
||||
const component = fixture.componentInstance as any;
|
||||
withGlobals([{ name: 'modelName', type: 'TEXT', multiple: false }]);
|
||||
await openModelEditor(component);
|
||||
|
||||
component.onLocalEditorSourceModeChange('global');
|
||||
// Entering the mode starts from nothing chosen, and the value control is hidden there: the
|
||||
// reference the picker writes *is* the value, so there is nothing else to fill in.
|
||||
expect(component.localEditorFromGlobal).toBe(true);
|
||||
expect(component.localEditorValue).toBe('');
|
||||
expect(component.canSaveLocalEditor()).toBe(false);
|
||||
|
||||
component.onLocalEditorGlobalInputChange('modelName');
|
||||
expect(component.localEditorValue).toBe('${{global.modelName}}');
|
||||
expect(component.canSaveLocalEditor()).toBe(true);
|
||||
});
|
||||
|
||||
it('labels a global with its type and multiplicity', () => {
|
||||
const component = fixture.componentInstance as any;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue