Skip to content

A free open source IT asset/license management system

Added blades

snipea086f135b01a
diff --git a/resources/views/blade/sync-adapter-form.blade.php b/resources/views/blade/sync-adapter-form.blade.php
new file mode 100644
index 0000000000..ec1743f94f
--- /dev/null
+++ b/resources/views/blade/sync-adapter-form.blade.php
@@ -0,0 +1,299 @@
+{{-- Shared form frame for a sync-adapter settings tab. The
+ adapter_credentials partial drops its schema-driven credential
+ inputs into the default slot. The URL row, active/heartbeat
+ toggles, and mapping fieldset stay here because they're identical
+ across every adapter regardless of credential shape.
+
+ Called from resources/views/settings/adapters/adapter_credentials.blade.php
+ which passes the hydrated adapter through the `adapter` prop
+ and puts the credential inputs in the default slot. --}}
+@props(['adapter'])
+
+@php
+ $slug = $adapter->name();
+ $urlField = $slug.'_url';
+ $activeField = $slug.'_active';
+ $locked = config('app.lock_passwords') === true;
+@endphp
+<x-form
+ :id="'adapter-form-' . $slug"
+ :route="route('settings.adapters.save', $slug)"
+ data-sync-url="{{ route('settings.adapters.sync', $slug) }}"
+ data-enabled="{{ $adapter->isEnabled() ? '1' : '0' }}"
+>
+ <x-demo-callout/>
+
+ {{-- Rename field. Slug is immutable because SyncAdapterConfig
+ keys off it; label is free to change so admins can rename
+ after creation (e.g. "Fleet" -> "Production Fleet" once
+ they add a second staging instance). --}}
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_add_label_label')"
+ name="label"
+ input_div_class="col-md-8"
+ :help_text="trans('admin/settings/general.sync_adapter_add_label_help')"
+ required
+ >
+ <x-slot:input>
+ <x-input.text
+ name="label"
+ :value="old('label', $adapter->label())"
+ :disabled="$locked"
+ required
+ />
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.checkbox-row
+ :name="$activeField"
+ :checked="$adapter->isActive()"
+ :label="trans('admin/settings/general.sync_adapter_active_label')"
+ :help_text="trans('admin/settings/general.sync_adapter_active_help')"
+ :disabled="$locked"
+ />
+
+ <x-form.checkbox-row
+ :name="$slug . '_log_heartbeats'"
+ :checked="$adapter->logsHeartbeats()"
+ :label="trans('admin/settings/general.sync_adapter_log_heartbeats_label')"
+ :help_text="trans('admin/settings/general.sync_adapter_log_heartbeats_help')"
+ :disabled="$locked"
+ />
+
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_base_url')"
+ :name="$urlField"
+ input_div_class="col-md-8"
+ :help_text="trans('admin/settings/general.sync_adapter_base_url_help', ['type' => $adapter::typeLabel()])"
+ required
+ >
+ <x-slot:input>
+ <x-input.text
+ type="url"
+ :name="$urlField"
+ :value="old($urlField, $adapter->getUrl())"
+ :disabled="$locked"
+ :placeholder="$adapter->baseUrlPlaceholder()"
+ input_icon="link"
+ input_group_addon="right"
+ required
+ />
+ </x-slot:input>
+ </x-form.row>
+
+ {{ $slot }}
+
+ {{-- Default category for AssetModels auto-created from this
+ adapter. Vendors don't send Snipe-IT's category concept but
+ every AssetModel needs one. --}}
+ <x-input.category-select
+ :name="$slug . '_default_category_id'"
+ :label="trans('admin/settings/general.sync_adapter_default_category')"
+ :selected="$adapter->defaultCategoryId()"
+ categoryType="asset"
+ :help_text="trans('admin/settings/general.sync_adapter_default_category_help')"
+ required
+ />
+
+ {{-- Default status label for auto-created assets. Required so
+ admins have to consciously pick a workflow bucket for
+ discovered devices instead of Snipe-IT defaulting to
+ something surprising. --}}
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_default_status')"
+ :name="$slug . '_default_status_id'"
+ input_div_class="col-md-7"
+ :help_text="trans('admin/settings/general.sync_adapter_default_status_help')"
+ required
+ >
+ <x-slot:input>
+ <x-input.select
+ :name="$slug . '_default_status_id'"
+ :id="$slug . '_default_status_id'"
+ :options="\App\Models\Statuslabel::orderBy('name')->pluck('name', 'id')->all()"
+ :selected="$adapter->defaultStatusId()"
+ :includeEmpty="true"
+ style="width: 100%"
+ :disabled="$locked"
+ required
+ />
+ </x-slot:input>
+ <x-slot:after_input>
+ @can('create', \App\Models\Statuslabel::class)
+ <a
+ href="{{ route('modal.show', ['type' => 'statuslabel']) }}"
+ data-toggle="modal"
+ data-target="#createModal"
+ data-select="{{ $slug . '_default_status_id' }}"
+ class="btn btn-sm btn-theme"
+ >{{ trans('button.new') }}</a>
+ @endcan
+ </x-slot:after_input>
+ </x-form.row>
+
+ {{-- Asset tag pattern. Optional. Grouped with the mapping-related
+ options below rather than the required identity fields above
+ so the required section stays contiguous. --}}
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_asset_tag_pattern')"
+ :name="$slug . '_asset_tag_pattern'"
+ input_div_class="col-md-8"
+ help_html="{!! trans('admin/settings/general.sync_adapter_asset_tag_pattern_help') !!}"
+ >
+ <x-slot:input>
+ <x-input.text
+ :name="$slug . '_asset_tag_pattern'"
+ :value="old($slug . '_asset_tag_pattern', $adapter->assetTagPattern())"
+ :disabled="$locked"
+ placeholder="{{ $adapter->name() }}-{serial}"
+ />
+ </x-slot:input>
+ </x-form.row>
+
+ {{-- User assignment via sync. Strategy 'none' disables the
+ lookup entirely. When set, the vendor's user email or
+ username on each record is matched against Snipe-IT users
+ and the asset checks out to the matched user. --}}
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_user_match_strategy')"
+ :name="$slug . '_user_match_strategy'"
+ input_div_class="col-md-8"
+ help_html="{!! trans('admin/settings/general.sync_adapter_user_match_strategy_help') !!}"
+ >
+ <x-slot:input>
+ {{-- Select2 for visual consistency with the other pickers on
+ this page, but the option pool is a fixed 3-value enum
+ so the built-in search box is hidden via
+ data-minimum-results-for-search. --}}
+ <select
+ name="{{ $slug }}_user_match_strategy"
+ class="select2 form-control"
+ style="width: 100%"
+ data-minimum-results-for-search="Infinity"
+ @disabled($locked)
+ >
+ @foreach ([
+ 'none' => trans('admin/settings/general.sync_adapter_user_match_none'),
+ 'email' => trans('admin/settings/general.sync_adapter_user_match_email'),
+ 'username' => trans('admin/settings/general.sync_adapter_user_match_username'),
+ ] as $value => $label)
+ <option value="{{ $value }}" @selected($adapter->userMatchStrategy() === $value)>{{ $label }}</option>
+ @endforeach
+ </select>
+ </x-slot:input>
+ </x-form.row>
+
+ {{-- Suppress the checkout notification email on sync-driven
+ assignments. Default is suppress so admins don't inbox-spam
+ users every time a scheduled sync re-confirms the same
+ assignment. --}}
+ <x-form.checkbox-row
+ :name="$slug . '_suppress_notifications'"
+ :checked="$adapter->suppressesNotifications()"
+ :label="trans('admin/settings/general.sync_adapter_suppress_notifications_label')"
+ :disabled="$locked"
+ />
+
+ {{-- Opt-in: check the asset in when the vendor reports no
+ assigned user. Default off because a single missed sync
+ cycle (device offline, empty field on a fresh enrollment)
+ would flap the assignment. --}}
+ <x-form.checkbox-row
+ :name="$slug . '_checkin_on_null_user'"
+ :checked="$adapter->checksInOnNullUser()"
+ :label="trans('admin/settings/general.sync_adapter_checkin_on_null_user_label')"
+ :help_text="trans('admin/settings/general.sync_adapter_checkin_on_null_user_help')"
+ :disabled="$locked"
+ />
+
+ @if ($adapter->supportsGroupScoping() && $adapter->isEnabled())
+ @php
+ $cachedGroups = $adapter->cachedGroups();
+ $groupMappings = $adapter->groupMappings();
+ @endphp
+ <fieldset>
+ <x-form.legend icon="tip" help_text="{{ trans('admin/settings/general.sync_adapter_group_mapping_intro', ['label' => $adapter->vendorGroupLabel()]) }}">
+ {{ trans('admin/settings/general.sync_adapter_group_mapping_title', ['label' => $adapter->vendorGroupLabel()]) }}
+ </x-form.legend>
+
+ @if (empty($cachedGroups))
+ <div class="form-group">
+ <div class="col-md-8 col-md-offset-3">
+ <p class="help-block">
+ {{ trans('admin/settings/general.sync_adapter_group_mapping_empty', ['label' => strtolower($adapter->vendorGroupLabel())]) }}
+ </p>
+ </div>
+ </div>
+ @else
+ @foreach ($cachedGroups as $group)
+ <x-input.company-select
+ :name="$slug . '_group_mapping[' . $group['id'] . ']'"
+ :label="$group['label']"
+ :selected="$groupMappings[$group['id']] ?? null"
+ hideNewButton
+ />
+ @endforeach
+ @endif
+ </fieldset>
+ @endif
+
+ {{-- Per-field target mapping. --}}
+ <fieldset>
+ <x-form.legend icon="tip" help_text="{{ trans('admin/settings/general.sync_adapter_mapping_section_intro') }}">
+ {{ trans('admin/settings/general.sync_adapter_mapping_section_title', ['type' => $adapter::typeLabel()]) }}
+ </x-form.legend>
+
+
+ @foreach (\App\SyncAdapters\Support\MappingTargets::FIELDS as $mappingField)
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_field_' . $mappingField)"
+ :name="$slug . '_mapping_' . $mappingField"
+ input_div_class="col-md-8"
+ >
+ <x-slot:input>
+ <x-input.select
+ :name="$slug . '_mapping[' . $mappingField . ']'"
+ :options="\App\SyncAdapters\Support\MappingTargets::options($mappingField)"
+ :selected="$adapter->mappingFor($mappingField)"
+ style="width: 100%"
+ :disabled="$locked"
+ />
+ </x-slot:input>
+ </x-form.row>
+ @endforeach
+
+ @php
+ $extraFields = $adapter->extraFields();
+ @endphp
+
+ @if (! empty($extraFields))
+ <x-form.legend icon="tip" help_text="{{ trans('admin/settings/general.sync_adapter_extra_fields_section_intro') }}">
+ {{ trans('admin/settings/general.sync_adapter_extra_fields_section_title', ['type' => $adapter::typeLabel()]) }}
+ </x-form.legend>
+
+ @foreach ($extraFields as $extraKey => $extraEntry)
+ @php
+ // Entry can be a plain label string or an array
+ // with label + type. Normalize to both.
+ $extraLabel = is_array($extraEntry) ? $extraEntry['label'] : $extraEntry;
+ $extraType = (is_array($extraEntry) && isset($extraEntry['type'])) ? $extraEntry['type'] : 'text';
+ @endphp
+ <x-form.row
+ :label="$extraLabel"
+ :name="$slug . '_mapping_' . $extraKey"
+ input_div_class="col-md-8"
+ >
+ <x-slot:input>
+ <x-input.select
+ :name="$slug . '_mapping[' . $extraKey . ']'"
+ :options="\App\SyncAdapters\Support\MappingTargets::optionsForExtra($extraType)"
+ :selected="$adapter->mappingFor($extraKey)"
+ style="width: 100%"
+ :disabled="$locked"
+ />
+ </x-slot:input>
+ </x-form.row>
+ @endforeach
+ @endif
+ </fieldset>
+</x-form>
diff --git a/resources/views/blade/sync-adapter-panel.blade.php b/resources/views/blade/sync-adapter-panel.blade.php
new file mode 100644
index 0000000000..91d4b8518c
--- /dev/null
+++ b/resources/views/blade/sync-adapter-panel.blade.php
@@ -0,0 +1,53 @@
+{{-- "Last sync + Sync Now button + CLI note" panel. Rendered as a sibling of the config-form shell
+ rather than nested inside it because HTML disallows nested form
+ elements and the sync trigger POSTs to a different route than
+ the config save. Every auth-shape partial under
+ resources/views/settings/adapters/ picks up the sync UI by
+ rendering this component alongside the config-form shell. --}}
+@props(['adapter'])
+
+@php
+ $slug = $adapter->name();
+ $locked = config('app.lock_passwords') === true;
+ $canSync = $adapter->isEnabled() && ! $locked;
+@endphp
+
+<div class="sync-adapter-panel form-horizontal">
+ <x-form.static :label="trans('admin/settings/general.sync_adapter_last_synced_label')">
+ @if ($adapter->lastSyncedAt())
+ {{ $adapter->lastSyncedAt()->diffForHumans() }}. {{ $adapter->lastSyncResult() }}
+ @else
+ {{ trans('admin/settings/general.sync_adapter_never_synced') }}
+ @endif
+ </x-form.static>
+
+ <div class="form-group">
+ <div class="col-md-8 col-md-offset-3">
+ {{-- Inline form so the Sync Now click POSTs to the sync route
+ without submitting the config form (which posts to save).
+ Sibling of the config form since HTML disallows nested
+ form elements. --}}
+ <form
+ method="POST"
+ action="{{ route('settings.adapters.sync', $slug) }}"
+ style="display: inline;"
+ >
+ @csrf
+ <button
+ type="submit"
+ class="btn btn-primary"
+ @disabled(! $canSync)
+ >
+ <x-icon type="sync"/>
+ {{ trans('admin/settings/general.sync_adapter_sync_now') }}
+ </button>
+ </form>
+
+ <p class="help-block" style="margin-top: 10px;">
+ {!! trans('admin/settings/general.sync_adapter_large_fleet_note', [
+ 'command' => '<code>php artisan snipeit:sync-inventory '.e($slug).'</code>',
+ ]) !!}
+ </p>
+ </div>
+ </div>
+</div>
diff --git a/resources/views/settings/adapters/adapter_credentials.blade.php b/resources/views/settings/adapters/adapter_credentials.blade.php
new file mode 100644
index 0000000000..7851418834
--- /dev/null
+++ b/resources/views/settings/adapters/adapter_credentials.blade.php
@@ -0,0 +1,82 @@
+{{-- The one settings partial every ConfigurableAdapter uses.
+ Iterates the adapter's credentialSchema() and renders each
+ declared field as either plain text or a password (with show/hide
+ toggle) based on its `secret` flag. Everything ELSE on the form
+ (URL, active toggle, heartbeat toggle, per-field mapping) lives in
+ the shared form-shell component.
+
+ Field names AND ids are prefixed with the instance slug so each
+ adapter's form has fully unique DOM identifiers. Without the
+ prefix every tab-pane renders the same input id and browsers
+ link them, causing typed values to visually propagate across
+ tabs. --}}
+@php
+ $slug = $adapter->name();
+ $locked = config('app.lock_passwords') === true;
+@endphp
+
+@if ($adapter->supportsGroupScoping() && $adapter->isEnabled())
+ {{-- Refresh-groups action lives outside the config form because
+ it POSTs to a different route (settings.adapters.refresh_groups)
+ and HTML disallows nested form elements. Rendering it above
+ the config form makes it visually close to the mapping table
+ it populates. --}}
+ <form
+ method="POST"
+ action="{{ route('settings.adapters.refresh_groups', $adapter->name()) }}"
+ style="margin-bottom: 15px; text-align: right;"
+ >
+ @csrf
+ <button
+ type="submit"
+ class="btn btn-default btn-sm"
+ @disabled($locked || ! $adapter->isEnabled())
+ >
+ <x-icon type="sync" />
+ {{ trans('admin/settings/general.sync_adapter_refresh_groups', ['label' => $adapter->vendorGroupLabel()]) }}
+ </button>
+ </form>
+@endif
+
+<x-sync-adapter-form :adapter="$adapter">
+ @foreach ($adapter->credentialSchema() as $field)
+ @php
+ $fieldName = $slug.'_'.$field['key'];
+ $isSecret = $field['secret'] ?? false;
+ $isRequired = $field['required'] ?? true;
+ $storedValue = $adapter->credentialForDisplay($field['key']);
+ @endphp
+ <x-form.row
+ :label="$field['label']"
+ :name="$fieldName"
+ input_div_class="col-md-8"
+ :help_text="$field['help'] ?? null"
+ :required="$isRequired"
+ >
+ <x-slot:input>
+ @if ($locked)
+ <x-input.text
+ :name="$fieldName"
+ value="XXXXXXXXXXXXXXXXXXXXXXX"
+ disabled
+ />
+ @elseif ($isSecret)
+ <x-input.password
+ :name="$fieldName"
+ :value="old($fieldName, $storedValue)"
+ :required="$isRequired"
+ ignoreAutofill
+ />
+ @else
+ <x-input.text
+ :name="$fieldName"
+ :value="old($fieldName, $storedValue)"
+ :required="$isRequired"
+ />
+ @endif
+ </x-slot:input>
+ </x-form.row>
+ @endforeach
+</x-sync-adapter-form>
+
+<x-sync-adapter-panel :adapter="$adapter" />
diff --git a/resources/views/settings/adapters/index.blade.php b/resources/views/settings/adapters/index.blade.php
new file mode 100644
index 0000000000..2c0bd63632
--- /dev/null
+++ b/resources/views/settings/adapters/index.blade.php
@@ -0,0 +1,202 @@
+@extends('layouts/default')
+
+@section('title')
+ {{ trans('admin/settings/general.sync_adapters_title') }}
+ @parent
+@stop
+
+@section('content')
+
+ <x-container class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
+
+ <x-box>
+ <x-slot:header>
+ <i class="fa-solid fa-network-wired" aria-hidden="true"></i>
+ {{ trans('admin/settings/general.sync_adapters_title') }}
+ </x-slot:header>
+
+ {{-- Company filter. Reloads the page with ?company=blah so only
+ adapters scoped to the picked company show in the tab
+ list. 'shared' filters to adapters with no company_id
+ (built-ins available to all). --}}
+ <x-slot:header_right>
+ <form method="GET" action="{{ route('settings.adapters.index') }}" style="display: inline-block;">
+ <select
+ name="company"
+ class="select2"
+ style="width: 220px"
+ onchange="this.form.submit()"
+ aria-label="{{ trans('admin/settings/general.sync_adapter_company_filter_label') }}"
+ >
+ <option value="">{{ trans('admin/settings/general.sync_adapter_company_filter_all') }}</option>
+ <option value="shared" @selected($selectedCompany === 'shared')>{{ trans('admin/settings/general.sync_adapter_company_filter_shared') }}</option>
+ @foreach ($companies as $companyId => $companyName)
+ <option value="{{ $companyId }}" @selected((string) $selectedCompany === (string) $companyId)>{{ $companyName }}</option>
+ @endforeach
+ </select>
+ </form>
+ </x-slot:header_right>
+
+ <div class="sync-adapters-tabs">
+ <div class="adapter-tab-list">
+ <ul class="nav nav-pills nav-stacked" role="tablist">
+ @foreach ($adapters as $adapter)
+ <li role="presentation" @class(['active' => $selected?->name() === $adapter->name()])>
+ <a
+ href="#adapter-pane-{{ $adapter->name() }}"
+ role="tab"
+ data-toggle="tab"
+ data-adapter-name="{{ $adapter->name() }}"
+ data-adapter-destroy-url="{{ route('settings.adapters.destroy', $adapter->name()) }}"
+ data-adapter-built-in="{{ $adapter->isBuiltIn() ? '1' : '0' }}"
+ >{{ $adapter->label() }}</a>
+ </li>
+ @endforeach
+
+ {{-- Add-adapter tab. Not a real tab-pane;
+ clicking it opens the modal instead. --}}
+ <li role="presentation">
+ <a
+ href="#"
+ data-toggle="modal"
+ data-target="#add-adapter-modal"
+ >
+ <x-icon type="create"/>
+ {{ trans('admin/settings/general.sync_adapter_add_button') }}
+ </a>
+ </li>
+ </ul>
+ </div>
+ <div class="adapter-tab-content">
+ <div class="tab-content">
+ @foreach ($adapters as $adapter)
+ <div
+ role="tabpanel"
+ id="adapter-pane-{{ $adapter->name() }}"
+ @class(['tab-pane fade', 'active in' => $selected?->name() === $adapter->name()])
+ >
+ @include($adapter->settingsView(), ['adapter' => $adapter])
+ </div>
+ @endforeach
+ </div>
+ </div>
+ </div>
+
+ <x-slot:customfooter>
+ <div class="box-footer">
+ <div class="row">
+ <div class="text-left col-md-6">
+ <button
+ id="adapter-delete-trigger"
+ type="button"
+ class="btn btn-danger delete-asset"
+ data-toggle="modal"
+ data-target="#dataConfirmModal"
+ data-href="{{ $selected ? route('settings.adapters.destroy', $selected->name()) : '' }}"
+ data-title="{{ trans('admin/settings/general.sync_adapter_delete_button') }}"
+ data-content="{{ trans('admin/settings/general.sync_adapter_delete_confirm') }}"
+ data-icon="fa fa-trash"
+ style="{{ $selected && ! $selected->isBuiltIn() ? '' : 'display: none;' }}"
+ onclick="return false;"
+ @disabled(config('app.lock_passwords') === true)
+ >
+ <x-icon type="delete"/>
+ {{ trans('admin/settings/general.sync_adapter_delete_button') }}
+ </button>
+ </div>
+ <div class="text-right col-md-6">
+ <x-button.submit
+ id="adapter-save-button"
+ class="btn-success"
+ form="adapter-form-{{ $selected?->name() }}"
+ :disabled="config('app.lock_passwords') === true"
+ />
+ </div>
+ </div>
+ </div>
+ </x-slot:customfooter>
+ </x-box>
+
+ </x-container>
+
+ {{-- Add-adapter modal. Users add additional instances of the shipped
+ adapter types (a second Fleet install, another Kandji tenant,
+ etc.) or Generic REST once/if that adapter lands. --}}
+ <x-modals
+ id="add-adapter-modal"
+ :title="trans('admin/settings/general.sync_adapter_add_modal_title')"
+ :action="route('settings.adapters.create')"
+ >
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_add_type_label')"
+ name="adapter_type"
+ input_div_class="col-md-8"
+ >
+ <x-slot:input>
+ <x-input.select name="adapter_type" :options="$adapterTypes" style="width: 100%" required/>
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.row
+ :label="trans('admin/settings/general.sync_adapter_add_label_label')"
+ name="label"
+ input_div_class="col-md-8"
+ :help_text="trans('admin/settings/general.sync_adapter_add_label_help')"
+ >
+ <x-slot:input>
+ <x-input.text name="label" required/>
+ </x-slot:input>
+ </x-form.row>
+
+ {{-- Pre-select the currently-filtered company so admins clicking
+ "Add adapter" while viewing a specific company get that
+ company already selected. The 'shared' filter sentinel and
+ absent values leave the modal's company field empty. --}}
+ <x-input.company-select
+ name="company_id"
+ id="modal_adapter_company_id_select"
+ :label="trans('admin/settings/general.sync_adapter_add_company_label')"
+ :selected="is_numeric($selectedCompany) ? (int) $selectedCompany : null"
+ hideNewButton
+ />
+ </x-modals>
+
+ <script>
+ // Point Save + Sync Now at the newly-active tab's form when the
+ // user switches adapters. Sync Now lives per-pane in
+ // the sync-adapter-panel component, so it needs no cross-tab
+ // wiring here.
+ document.addEventListener('DOMContentLoaded', function () {
+ var saveBtn = document.getElementById('adapter-save-button');
+ var deleteTrigger = document.getElementById('adapter-delete-trigger');
+
+ document.querySelectorAll('.sync-adapters-tabs a[data-toggle="tab"]').forEach(function (tabLink) {
+ $(tabLink).on('shown.bs.tab', function (e) {
+ var name = e.target.getAttribute('data-adapter-name');
+ var destroyUrl = e.target.getAttribute('data-adapter-destroy-url');
+ var builtIn = e.target.getAttribute('data-adapter-built-in') === '1';
+
+ saveBtn.setAttribute('form', 'adapter-form-' + name);
+
+ if (builtIn) {
+ deleteTrigger.style.display = 'none';
+ }
+ else {
+ deleteTrigger.style.display = '';
+ deleteTrigger.setAttribute('data-href', destroyUrl);
+ }
+
+ // Sync the ?adapter= query param with the visible
+ // tab so refresh + bookmark land the admin back on
+ // the same adapter. Uses replaceState (not pushState)
+ // so browser back doesn't fill history with one
+ // entry per tab click.
+ var url = new URL(window.location.href);
+ url.searchParams.set('adapter', name);
+ window.history.replaceState(null, '', url.toString());
+ });
+ });
+ });
+ </script>
+
+@stop