{% extends "base.html" %} {% from "_integration_extras.html" import integration_record, claude_handoff, claude_handoff_body with context %} {% block title %}Google · NEXXVU{% endblock %} {% macro test_box(service, label) -%}
Test {{ label }}

{% if test_key %}Runs in this browser with the saved key, exactly as the Portal uses it.{% else %}Save the key and switch Google on (first tab) to test.{% endif %}

{%- endmacro %} {% block content %}

Settings

Google

Google services NEXXVU uses in your browser: the homepage map, address suggestions while you type, and turning addresses into map coordinates. One browser key serves all three; each tab explains how to set its service up and tests it.

All settings
{% include "_settings_navigation.html" %}
{% if notice %}
{{ notice }}
{% endif %} {% if error %}{% endif %} {% if not admin %}

Only Portal administrators manage the Google settings.

{% else %}{% set m = maps %}{% set host = portal_host or 'your-portal.example.com' %}

Google services

{% if tab == 'key' %}

{% if m.enabled %}On NEXXVU uses Google in the browser.{% elif m.configured %}Off A key is saved; switch Google on below.{% else %}Not set up Enter a Google API key below.{% endif %}

{% if m.configured %}
Key
{{ m.key_hint }}
{% if m.updated_at %}
Changed
{{ m.updated_at|replace('T',' ')|replace('Z',' UTC') }}{% if m.updated_by %} by {{ m.updated_by }}{% endif %}
{% endif %}
{% endif %}

While Google is on, only the pages that use it (the homepage, a device's Location and rack, and these tests) allow Google's scripts and send this Portal's address - not the page - to Google, so the key restriction can be checked. Every other page stays as strict as before.

{% if m.configured %}{% endif %}
{% set way = 'claude' if request.query_params.get('way') == 'claude' else 'diy' %}

How to create the key (once)

{% if way == 'diy' %}
  1. Open console.cloud.google.com with the Google account that pays for your Google services, and choose (or create) a project, for example NEXXVU Portal. Google needs a billing account on the project; the free monthly allowance covers a typical Portal.
  2. APIs & Services › Library: enable Maps JavaScript API, Places API (New) and Geocoding API (each has its own tab here with what it does).
  3. APIs & Services › Credentials › Create credentials › API key. Name it, for example NEXXVU {{ host }}.
  4. Under Application restrictions choose Websites and add https://{{ host }}/*. Only pages of this Portal can then use the key.
  5. Under API restrictions choose Restrict key and tick exactly the three APIs above.
  6. Copy the key (it starts with AIza), paste it above, tick Use Google and save. Then run the test on each tab.

The key works in the browser, so signed-in users can see it, as on every website with a Google map: the website and API restrictions are what protect it. NEXXVU never shows it back here (only its last four characters) and never logs it. A full guide is in the NEXXVU documentation (Google integration).

{% else %}
{{ claude_handoff_body(handoff_text) }}
{% endif %}
{% if request.query_params.get('record_saved') %}
Record saved.
{% endif %}{% if request.query_params.get('record_error') %}{% endif %} {{ integration_record(record, 'google') }} {% elif tab == 'maps' %}

Maps JavaScript API

Draws the homepage map: every device as a coloured dot (green online, yellow needs attention, red offline) at its address, with search and filters.

  1. Google Cloud › APIs & Services › Library › Maps JavaScript API › Enable.
  2. Credentials › your key › API restrictions: tick Maps JavaScript API.
  3. Websites restriction: https://{{ host }}/*.

Errors you may see: RefererNotAllowedMapError - the website restriction does not include this Portal's address; ApiNotActivatedMapError - the API is not enabled; InvalidKeyMapError - the key was mistyped or deleted.

{{ test_box('maps', 'the map') }} {% elif tab == 'places' %}

Places API (New) - address suggestions

Suggests the street address while you type on a device's Identity › Location and rack; picking a suggestion fills in the city, province or state, postal code, country, latitude and longitude, and marks the address "Confirmed by Google".

  1. Library › Places API (New) › Enable. (The older "Places API" is not used; Google no longer offers it to new projects.)
  2. Credentials › your key › API restrictions: tick Places API (New).
  3. Run the test below; then type an address on a device's Location and rack.

Errors you may see: PERMISSION_DENIED or API_KEY_SERVICE_BLOCKED - the API is not enabled or not ticked in the key's API restrictions; REQUEST_DENIED - the website restriction does not include this Portal's address.

{{ test_box('places', 'address suggestions') }} {% elif tab == 'geocoding' %}

Geocoding API - address to coordinates

Places a device on the homepage map when only its address is known (no coordinates): the address of its location, or its own address typed by hand. Each address is looked up once and remembered in your browser.

  1. Library › Geocoding API › Enable.
  2. Credentials › your key › API restrictions: tick Geocoding API.
  3. Run the test below; then open the homepage.

Errors you may see: REQUEST_DENIED - the API is not enabled or not allowed by the key; ZERO_RESULTS - Google does not know that address (check the spelling, or pick it from the suggestions instead).

{{ test_box('geocoding', 'address to coordinates') }} {% endif %} {% endif %}
{% endblock %} {% block scripts %}{% if test_key %}{% endif %}{% endblock %}