{#- The 1-click connect control of one AI client: the Integrations page draws it, and the connect/disconnect endpoints answer a click with it. One template for both, so the answer to a click keeps what the page shows (it used to drop "Active in: ...", drawn only here). `c` is a client entry: key, short_label, connected, locations, status_error. -#} {% macro connect_ctrl(c, note="", is_error=False) %}
{% if is_error %}
Error
{% elif c.connected %}
Connected
{% else %} {% endif %} {% if c.locations and not is_error %}
Active in: {% for w in c.locations %}{{ 'all projects' if w in ('user', 'global') else w }}{% if not loop.last %}; {% endif %}{% endfor %}
{% endif %} {% if note %}
{{ note }}
{% endif %} {% if c.status_error %}
{{ c.status_error }}
{% endif %}
{% endmacro %}