<% content_for :title, t(".off_site_backup") %>

<%= t(".off_site_backup") %>

<%= t(".every_night_after_the_verified_html", offsite_backups_kept: (Setting.integer("offsite_backups_kept")), link: (link_to t(".settings"), edit_admin_settings_path, class: "link")) %>

<%= t(".google_drive") %>

<% if @connection.connected? %>

<%= t(".connected") %> <%= t(".by_on_html", account_email: @connection.account_email, display_name: @connection.connected_by&.display_name, to_date: (fmt_date(@connection.connected_at&.to_date))) %> <%= t(".folder_html", folder: (OffsiteConnection::ROOT_FOLDER)) %>

<%= t(".uploaded_files_copied_of_html", files_copied: @files_copied, files_total: @files_total) %>

<%= button_to t(".back_up_now"), backup_now_admin_offsite_backup_path, class: "btn-primary" %> <%= button_to t(".test_restore"), restore_test_admin_offsite_backup_path, class: "btn-secondary", title: t(".download_the_newest_database_copy") %> <%= button_to t(".disconnect"), admin_offsite_backup_path, method: :delete, class: "btn-secondary", form: { data: { turbo_confirm: t(".stop_copying_backups_to_the", account_email: @connection.account_email) } } %>
<% elsif @connection.configured? %>

<%= t(".the_oauth_client_is_saved") %>

<%= link_to t(".connect_google_drive"), connect_admin_offsite_backup_path, class: "btn-primary self-start", data: { turbo: false } %> <% else %>

<%= t(".not_set_up_follow_the") %>

<% end %> <%= form_with model: @connection, url: admin_offsite_backup_path, method: :patch, class: "space-y-3 border-t border-slate-100 pt-3" do |f| %> <%= f.field :client_id, label: t(".oauth_client_id"), placeholder: "1234567890-abc.apps.googleusercontent.com" %> <%= f.field :client_secret, as: :password, label: t(".oauth_client_secret"), value: nil, placeholder: (@connection.client_secret.present? ? t(".saved_leave_blank_to_keep") : nil), autocomplete: "off" %> <%= f.submit t(".save_client"), class: "btn-secondary" %> <% end %>

<%= t(".setting_up_google_once") %>

  1. <%= t(".open_the_google_cloud_console_html") %>
  2. <%= t(".enable_the_google_drive_api_html") %>
  3. <%= t(".under_google_auth_platform_branding_html") %>
  4. <%= t(".under_clients_create_an_oauth_html") %> <%= @connection.redirect_uri %> <%= t(".it_must_be_the_address_html") %>
  5. <%= t(".paste_the_client_id_and_html") %>

<%= t(".restoring_see_html", link: (link_to t(".help_administration"), help_page_path("administration", anchor: "restoring-from-google-drive"), class: "link")) %>

<%= t(".recent_runs") %>

<% if @runs.any? %> <% else %><%= empty_state t(".none_yet") %><% end %>