Skip to content

Commit f1081ee

Browse files
ksfikasclaude
andcommitted
Source form: the button says 'Fill in General first' when what is missing is on an earlier tab, and shows an arrow instead of a plus for a next step
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 7385e50 commit f1081ee

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎providerharvest_service/templates/_macros.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
<svg width="{{ size }}" height="{{ size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7"/><path d="M3 4v4h4"/><path d="M12 8v4l3 2"/></svg>
5656
{% elif name == "download" %}
5757
<svg width="{{ size }}" height="{{ size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v11m0 0-4-4m4 4 4-4"/><path d="M4 18v1a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-1"/></svg>
58+
{% elif name == "arrow-right" %}
59+
<svg width="{{ size }}" height="{{ size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14m0 0-6-6m6 6-6 6"/></svg>
5860
{% elif name == "arrow-left" %}
5961
<svg width="{{ size }}" height="{{ size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5m0 0 6-6m-6 6 6 6"/></svg>
6062
{% elif name == "push" %}

‎providerharvest_service/templates/provider/source_form.html‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ <h1>{{ "Edit source" if editing else "Register a new source" }}</h1>
425425

426426
<div class="form-actions" style="display:flex; gap:0.6rem; align-items:center;">
427427
<a class="btn btn-secondary" id="back-btn" href="/provider/sources">{{ macros.icon("arrow-left", 16) }} Back</a>
428-
<button type="submit" id="submit-btn">{{ macros.icon(("check" if editing else "plus"), 16) }} <span id="submit-label">{{ "Save changes" if editing else "Register source" }}</span></button>
428+
<button type="submit" id="submit-btn"><span id="submit-icon">{{ macros.icon(("check" if editing else "plus"), 16) }}</span><span id="submit-icon-next" hidden>{{ macros.icon("arrow-right", 16) }}</span> <span id="submit-label">{{ "Save changes" if editing else "Register source" }}</span></button>
429429
</div>
430430
</form>
431431
</div>
@@ -553,7 +553,11 @@ <h1>{{ "Edit source" if editing else "Register a new source" }}</h1>
553553
target = (later.length ? later[0] : elsewhere[0])[1];
554554
}
555555
button.dataset.next = target;
556-
document.getElementById('submit-label').textContent = target ? 'Next: ' + TAB_LABELS[target] : 'Register source';
556+
// forward: "Next: Connection"; when what is missing is on an earlier tab, say so instead of calling it "next"
557+
var backwards = target && TAB_ORDER.indexOf(target) < TAB_ORDER.indexOf(activeTab);
558+
document.getElementById('submit-label').textContent = !target ? 'Register source' : (backwards ? 'Fill in ' + TAB_LABELS[target] + ' first' : 'Next: ' + TAB_LABELS[target]);
559+
document.getElementById('submit-icon').hidden = !!target;
560+
document.getElementById('submit-icon-next').hidden = !target;
557561
button.disabled = here.length > 0;
558562
}
559563
document.getElementById('submit-btn').addEventListener('click', function (event) {

‎tests/test_source_form_tabs.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_delivery_connector_endpoint_and_schedule_come_in_that_order_on_the_conn
7676
def test_a_new_source_is_registered_step_by_step_and_an_edit_is_just_saved(client, _isolated_db):
7777
new_page = client.get("/provider/sources/new").text
7878
assert "var WIZARD = true;" in new_page and 'id="submit-btn"' in new_page and 'id="submit-label">Register source<' in new_page
79-
assert "'Next: ' + TAB_LABELS[target]" in new_page and "Still needed here" not in new_page and 'id="submit-hint"' not in new_page
79+
assert "'Next: ' + TAB_LABELS[target]" in new_page and "'Fill in ' + TAB_LABELS[target] + ' first'" in new_page and "Still needed here" not in new_page and 'id="submit-hint"' not in new_page
8080
client.post("/provider/sources/new", data={
8181
"name": "wiz", "title": "Wiz", "kind": "pull", "transport_type": "http", "endpoint_url": "https://registry.example.gr/api/", "frequency": "DAILY",
8282
"auth_type": "api_key", "api_key": "k",

0 commit comments

Comments
 (0)