| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>ArduPilot Overlay Manager</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
- <style>
- html, body { height: 100%; }
- body {
- display: flex;
- flex-direction: column;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
- background-color: #f4f6f9;
- }
- .content-wrapper { flex: 1 0 auto; }
- .navbar-brand { font-size: 25px; }
- .card { border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border: none;}
- .table-light { background-color: #f8f9fa; }
- footer { flex-shrink: 0; }
- .profile-list-item.active {
- background-color: #0d6efd;
- border-color: #0d6efd;
- color: white;
- }
- .profile-list-item.active .text-muted, .profile-list-item.active .text-secondary {
- color: rgba(255,255,255,0.8) !important;
- }
- .dropdown-item i { width: 20px; text-align: center; }
- </style>
- </head>
- <body>
- <div class="content-wrapper">
- <nav class="navbar navbar-dark bg-dark shadow-sm py-2">
- <div class="container-fluid px-4">
- <div class="d-flex align-items-center">
- <a class="navbar-brand d-flex align-items-center" href="/">
- <img src="/static/images/ardupilot_logo.png" alt="ArduPilot" height="24" class="d-inline-block align-text-top me-2">
- <span class="text-white">Overlay Manager</span>
- </a>
- </div>
- <div class="ms-auto d-flex align-items-center">
- <a href="javascript:void(0);" onclick="window.location.href = window.location.protocol + '//' + window.location.hostname;" class="btn btn-outline-light">
- <i class="bi bi-arrow-left me-2"></i>Back to Main App
- </a>
- </div>
- </div>
- </nav>
- <div class="container-fluid px-4 mt-4">
- {% if success_msg %}
- <div class="alert alert-success alert-dismissible fade show shadow-sm" role="alert">
- <i class="bi bi-check-circle-fill me-2"></i>{{ success_msg }}
- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
- </div>
- {% endif %}
-
- {% if error_msg %}
- <div class="alert alert-danger alert-dismissible fade show shadow-sm" role="alert">
- <i class="bi bi-exclamation-triangle-fill me-2"></i>{{ error_msg }}
- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
- </div>
- {% endif %}
- <div class="row g-4">
- <div class="col-md-3">
- <div class="card mb-4">
- <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
- <h6 class="mb-0 fw-bold text-dark"><i class="bi bi-diagram-3-fill me-2 text-primary"></i>Overlay Profiles</h6>
- </div>
- <div class="list-group list-group-flush">
- {% for p in profiles %}
- <div class="list-group-item d-flex justify-content-between align-items-center profile-list-item {% if p.is_active %}active{% endif %}">
- <form action="/patch-manager/profile/activate" method="post" class="m-0 p-0 flex-grow-1 cursor-pointer" style="cursor: pointer;">
- <input type="hidden" name="profile_id" value="{{ p.id }}">
- <div onclick="this.parentNode.submit();" class="w-100 fw-bold">
- {{ p.name }}
- {% if p.is_readonly %}
- <i class="bi bi-shield-lock-fill ms-1" title="Read-Only System Profile"></i>
- {% elif p.is_locked %}
- <i class="bi bi-lock-fill text-warning ms-1" title="User Locked"></i>
- {% endif %}
- {% if p.is_active %}<i class="bi bi-check-circle-fill ms-2"></i>{% endif %}
- </div>
- </form>
-
- <div class="dropdown">
- <button class="btn btn-sm btn-link p-0 text-decoration-none {% if p.is_active %}text-white{% else %}text-secondary{% endif %}" type="button" data-bs-toggle="dropdown" aria-expanded="false" title="Profile Options">
- <i class="bi bi-three-dots-vertical fs-5"></i>
- </button>
- <ul class="dropdown-menu shadow-sm dropdown-menu-end">
- {% if p.is_locked %}
- <li>
- <a class="dropdown-item" href="javascript:void(0)" onclick="openUnlockModal({{ p.id }}, '{{ p.name|escape }}')">
- <i class="bi bi-unlock-fill me-2 text-warning"></i>Unlock Profile
- </a>
- </li>
- {% elif not p.is_readonly %}
- <li>
- <a class="dropdown-item" href="javascript:void(0)" onclick="openRenameModal({{ p.id }}, '{{ p.name|escape }}')">
- <i class="bi bi-pencil-square me-2 text-primary"></i>Rename Profile
- </a>
- </li>
- <li>
- <a class="dropdown-item" href="javascript:void(0)" onclick="openLockModal({{ p.id }}, '{{ p.name|escape }}')">
- <i class="bi bi-lock-fill me-2 text-warning"></i>Lock Profile
- </a>
- </li>
- {% endif %}
-
- <li>
- <form action="/patch-manager/profile/duplicate" method="post" class="m-0 p-0">
- <input type="hidden" name="profile_id" value="{{ p.id }}">
- <button type="submit" class="dropdown-item"><i class="bi bi-copy me-2 text-success"></i>Clone Profile</button>
- </form>
- </li>
-
- {% if not p.is_active and not p.is_readonly and not p.is_locked %}
- <li><hr class="dropdown-divider"></li>
- <li>
- <form action="/patch-manager/profile/delete" method="post" class="m-0 p-0" onsubmit="return confirm('Delete this profile completely?');">
- <input type="hidden" name="profile_id" value="{{ p.id }}">
- <button type="submit" class="dropdown-item text-danger"><i class="bi bi-trash me-2"></i>Delete Profile</button>
- </form>
- </li>
- {% endif %}
- </ul>
- </div>
-
- </div>
- {% endfor %}
- </div>
- <div class="card-footer bg-light p-3">
- <form action="/patch-manager/profile/create" method="post" class="input-group">
- <input type="text" class="form-control form-control-sm" name="name" placeholder="New profile name..." required>
- <button class="btn btn-primary btn-sm" type="submit"><i class="bi bi-plus"></i> Add</button>
- </form>
- </div>
- </div>
- {% if is_compiling %}
- <div class="card bg-danger text-white shadow border-0">
- <div class="card-body text-center p-4">
- <div class="spinner-border text-light mb-3" role="status" style="width: 3rem; height: 3rem;">
- <span class="visually-hidden">Loading...</span>
- </div>
- <h5 class="fw-bold">Build in Progress</h5>
- <p class="small text-white-75 mb-0">Another user is currently compiling. Deployment is locked to prevent overwriting files. Please wait.</p>
- </div>
- </div>
- {% else %}
- <div class="card bg-dark text-white shadow">
- <div class="card-body text-center p-4">
- <i class="bi bi-rocket-takeoff-fill display-4 text-warning mb-3 d-block"></i>
- <h5 class="fw-bold">Ready to Compile?</h5>
- <p class="small text-white-50">Pushing to the builder will wipe the staging directory and write the currently active profile.</p>
- <form action="/patch-manager/deploy" method="post" onsubmit="return confirm('This will deploy {{ active_profile.name }} to the builder. Are you sure?');">
- <button type="submit" class="btn btn-warning fw-bold w-100 py-2 fs-5">
- DEPLOY TO BUILDER
- </button>
- </form>
- </div>
- </div>
- {% endif %}
- </div>
- <div class="col-md-9">
- <div class="card shadow-sm border-0 mb-4">
- <div class="card-header bg-white py-3">
- <h6 class="card-title mb-0 fw-bold text-dark"><i class="bi bi-card-text text-warning me-2"></i>Profile Notes & Annotations</h6>
- </div>
- <div class="card-body p-3 bg-light">
- <form action="/patch-manager/profile/annotate" method="post" class="d-flex flex-column gap-2">
- <input type="hidden" name="profile_id" value="{{ active_profile.id }}">
- <textarea class="form-control" name="description" rows="3" {% if active_profile.is_readonly or active_profile.is_locked %}disabled{% endif %} placeholder="Add notes about this loadout (e.g., 'Aggressive PID tune, experimental VTX settings')">{{ active_profile.description }}</textarea>
- {% if not active_profile.is_readonly and not active_profile.is_locked %}
- <div class="text-end">
- <button type="submit" class="btn btn-warning btn-sm fw-bold"><i class="bi bi-save me-1"></i> Save Notes</button>
- </div>
- {% endif %}
- </form>
- </div>
- </div>
-
- <div class="card shadow-sm border-0 mb-4">
- <div class="card-header bg-white py-3">
- <h6 class="card-title mb-0 fw-bold text-dark"><i class="bi bi-cloud-arrow-up text-success me-2"></i>Upload File to Profile</h6>
- </div>
-
- {% if active_profile.is_readonly or active_profile.is_locked %}
- <div class="card-body p-4 bg-light text-center text-muted">
- <i class="bi bi-lock-fill fs-3 d-block mb-2"></i>
- {% if active_profile.is_readonly %}
- <p class="mb-0">This is a locked, unmodified base profile. You cannot upload files here.<br><strong>Clone this profile</strong> from the menu on the left to start making changes.</p>
- {% else %}
- <p class="mb-0">This profile is locked by a user. You cannot upload files here.<br><strong>Unlock this profile</strong> from the menu on the left if you know the password, or <strong>Clone this profile</strong> to make your own copy and start making changes.</p>
- {% endif %}
- </div>
- {% else %}
- <div class="card-body p-3 bg-light">
- <form action="/patch-manager/file/upload" method="post" enctype="multipart/form-data" class="row g-3 align-items-end">
- <input type="hidden" name="profile_id" value="{{ active_profile.id }}">
-
- <div class="col-md-4">
- <label class="form-label small fw-bold text-muted mb-1">1. Select File</label>
- <input class="form-control form-control-sm" type="file" name="file" required>
- </div>
-
- <div class="col-md-3">
- <label class="form-label small fw-bold text-muted mb-1">2. Existing Folder</label>
- <select class="form-select form-select-sm" name="existing_path" onchange="document.getElementById('new_path').value=''">
- <option value="">/ (Root Directory)</option>
- {% for d in dirs %}
- <option value="{{ d }}">{{ d }}</option>
- {% endfor %}
- </select>
- </div>
-
- <div class="col-md-3">
- <label class="form-label small fw-bold text-muted mb-1">...Or Create New Folder</label>
- <input type="text" class="form-control form-control-sm font-monospace" name="new_path" id="new_path" placeholder="e.g. libraries/AP_HAL" oninput="document.getElementsByName('existing_path')[0].value=''">
- </div>
-
- <div class="col-md-2">
- <button type="submit" class="btn btn-success btn-sm fw-bold w-100"><i class="bi bi-upload me-1"></i> Upload</button>
- </div>
- </form>
- </div>
- {% endif %}
- </div>
- <div class="card mb-5 border-0 shadow-sm">
- <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center border-bottom-0">
- <h5 class="card-title mb-0 fw-bold text-dark">
- <i class="bi bi-folder2-open me-2 text-info"></i>Files for: <span class="text-primary">{{ active_profile.name }}</span>
- </h5>
- </div>
- <div class="card-body p-0">
- <div class="table-responsive">
- <table class="table table-hover align-middle mb-0">
- <thead class="table-light">
- <tr>
- <th class="ps-4 py-3">Target Path</th>
- <th class="text-end pe-4 py-3">Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for file in files %}
- <tr>
- <td class="ps-4 font-monospace text-dark" style="font-size: 0.95rem;">
- <i class="bi bi-file-code me-2 text-secondary"></i>{{ file.filepath }}
- </td>
- <td class="text-end pe-4">
- <a href="/patch-manager/download?file_id={{ file.id }}" class="btn btn-sm btn-outline-info me-2" title="Download">
- <i class="bi bi-download"></i>
- </a>
-
- {% if not active_profile.is_readonly and not active_profile.is_locked %}
- <a href="/patch-manager/edit?file_id={{ file.id }}" class="btn btn-sm btn-outline-primary me-2">
- <i class="bi bi-pencil me-1"></i> Edit
- </a>
- <form action="/patch-manager/file/delete" method="post" class="d-inline" onsubmit="return confirm('Remove this file from the profile?');">
- <input type="hidden" name="file_id" value="{{ file.id }}">
- <button type="submit" class="btn btn-sm btn-outline-danger">
- <i class="bi bi-trash"></i>
- </button>
- </form>
- {% endif %}
- </td>
- </tr>
- {% else %}
- <tr>
- <td colspan="2" class="text-center py-5 text-muted">
- <i class="bi bi-inbox fs-1 d-block mb-3 text-black-50"></i>
- <h5>This profile is empty.</h5>
- <p>Deploying this profile will result in a clean, vanilla build.<br>Upload a file above to start creating overlays.</p>
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="renameModal" tabindex="-1" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <form action="/patch-manager/profile/rename" method="post">
- <div class="modal-header bg-light">
- <h5 class="modal-title fw-bold text-dark"><i class="bi bi-pencil-square me-2"></i>Rename Profile</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body p-4">
- <input type="hidden" name="profile_id" id="rename-profile-id">
- <div class="mb-3">
- <label class="form-label text-muted small fw-bold">Profile Name</label>
- <input type="text" class="form-control" name="new_name" id="rename-new-name" required>
- </div>
- </div>
- <div class="modal-footer bg-light d-flex justify-content-between">
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
- <button type="submit" class="btn btn-primary fw-bold"><i class="bi bi-check-lg me-1"></i>Save Name</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="modal fade" id="lockModal" tabindex="-1" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <form action="/patch-manager/profile/lock" method="post">
- <div class="modal-header bg-light">
- <h5 class="modal-title fw-bold text-dark"><i class="bi bi-lock-fill me-2 text-warning"></i>Lock Profile</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body p-4">
- <input type="hidden" name="profile_id" id="lock-profile-id">
- <p>Locking <strong id="lock-profile-name"></strong> will prevent it from being edited or deleted until the password is provided.</p>
- <div class="mb-3">
- <label class="form-label text-muted small fw-bold">Set Password</label>
- <input type="password" class="form-control" name="password" required>
- </div>
- </div>
- <div class="modal-footer bg-light d-flex justify-content-between">
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
- <button type="submit" class="btn btn-warning fw-bold text-dark"><i class="bi bi-lock-fill me-1"></i>Lock Profile</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="modal fade" id="unlockModal" tabindex="-1" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <form action="/patch-manager/profile/unlock" method="post">
- <div class="modal-header bg-light">
- <h5 class="modal-title fw-bold text-dark"><i class="bi bi-unlock-fill me-2 text-warning"></i>Unlock Profile</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body p-4">
- <input type="hidden" name="profile_id" id="unlock-profile-id">
- <p>Enter the password to unlock <strong id="unlock-profile-name"></strong>.</p>
- <div class="mb-3">
- <label class="form-label text-muted small fw-bold">Password</label>
- <input type="password" class="form-control" name="password" required>
- </div>
- </div>
- <div class="modal-footer bg-light d-flex justify-content-between">
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
- <button type="submit" class="btn btn-warning fw-bold text-dark"><i class="bi bi-unlock-fill me-1"></i>Unlock Profile</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <footer class="py-3 bg-dark text-white-50 mt-auto">
- <div class="container-fluid px-4 d-flex justify-content-between">
- <div>
- <span class="mx-2">Credits:
- <a href="https://github.com/ArduPilot/CustomBuild/graphs/contributors" style="text-decoration: underline; color: white;">See Contributors</a>
- </span>|
- <span class="mx-2">Source:
- <a href="https://git.equalmass.com/Equalmass/ArdupilotCustomFirmwareBuilder" style="text-decoration: underline; color: white;">Ardupilot/CustomBuild</a>
- </span>
- </div>
- <span>ArduPilot Overlay Manager</span>
- </div>
- </footer>
-
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
- <script>
- function openRenameModal(profileId, profileName) {
- document.getElementById('rename-profile-id').value = profileId;
- document.getElementById('rename-new-name').value = profileName;
- new bootstrap.Modal(document.getElementById('renameModal')).show();
- }
- function openLockModal(profileId, profileName) {
- document.getElementById('lock-profile-id').value = profileId;
- document.getElementById('lock-profile-name').innerText = profileName;
- new bootstrap.Modal(document.getElementById('lockModal')).show();
- }
- function openUnlockModal(profileId, profileName) {
- document.getElementById('unlock-profile-id').value = profileId;
- document.getElementById('unlock-profile-name').innerText = profileName;
- new bootstrap.Modal(document.getElementById('unlockModal')).show();
- }
- </script>
- </body>
- </html>
|