remote_instance_form.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {% extends "base.html" %}
  2. {% block title %}{{ 'Éditer' if inst else 'Nouvelle instance' }}{% endblock %}
  3. {% block content %}
  4. <div class="max-w-lg">
  5. <h1 class="text-xl font-bold text-gray-900 mb-6">
  6. {{ 'Éditer « ' + inst.name + ' »' if inst else 'Nouvelle instance distante' }}
  7. </h1>
  8. <form method="post"
  9. action="{{ url_for('remote_instance_edit', inst_id=inst.id) if inst else url_for('remote_instance_new') }}"
  10. class="space-y-6">
  11. <div class="bg-white rounded-xl border border-gray-200 p-6 space-y-4">
  12. <div>
  13. <label class="block text-sm font-medium text-gray-700 mb-1">Nom</label>
  14. <input type="text" name="name" required
  15. value="{{ inst.name if inst else '' }}"
  16. placeholder="ex: jerry, tom, serveur-2"
  17. class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
  18. <p class="text-xs text-gray-400 mt-1">Identifiant court pour affichage.</p>
  19. </div>
  20. <div>
  21. <label class="block text-sm font-medium text-gray-700 mb-1">URL de l'instance</label>
  22. <input type="url" name="url" required
  23. value="{{ inst.url if inst else '' }}"
  24. placeholder="https://mon-serveur.domaine.fr/backupmanager"
  25. class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500">
  26. <p class="text-xs text-gray-400 mt-1">
  27. URL complète avec le sous-chemin si applicable.
  28. L'API sera contactée sur <code class="bg-gray-100 px-1 rounded">/api/v1/</code>.
  29. </p>
  30. </div>
  31. <div>
  32. <label class="block text-sm font-medium text-gray-700 mb-1">Token API</label>
  33. <input type="text" name="api_key" required
  34. value="{{ inst.api_key if inst else '' }}"
  35. placeholder="ex: a3f8c2d1..."
  36. class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500">
  37. <p class="text-xs text-gray-400 mt-1">
  38. Valeur du header <code class="bg-gray-100 px-1 rounded">X-BackupManager-Key</code>
  39. configurée sur l'instance distante (visible dans sa config YunoHost).
  40. </p>
  41. </div>
  42. </div>
  43. <div class="flex gap-3">
  44. <button type="submit"
  45. class="bg-blue-600 hover:bg-blue-700 text-white px-5 py-2 rounded-lg font-medium text-sm transition">
  46. {{ 'Enregistrer' if inst else 'Ajouter l\'instance' }}
  47. </button>
  48. <a href="{{ url_for('remote_instances_list') }}"
  49. class="bg-white hover:bg-gray-50 text-gray-700 border border-gray-300 px-5 py-2 rounded-lg font-medium text-sm transition">
  50. Annuler
  51. </a>
  52. </div>
  53. </form>
  54. </div>
  55. {% endblock %}