mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 08:06:08 +08:00
1446596089
This commit converts the Backups page in the admin interface to follow our new admin interface guidelines. As part of this work, I've also made `AdminPageHeader` and `AdminPageSubheader` components that can be reused on any admin page for consistency, that handle the title and action buttons and also breadcrumbs. Also renamed `AdminPluginFilteredSiteSettings` to `AdminFilteredSiteSettings` since it can be used generally to show a subset of filtered site settings, not only settings for a plugin. Not sure if it's ideal to have to define a new route for this for every config area, but not sure how else to do it right now.
70 lines
1.8 KiB
Ruby
70 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class AdminBackups < PageObjects::Pages::Base
|
|
def visit_page
|
|
page.visit "/admin/backups"
|
|
self
|
|
end
|
|
|
|
def click_tab(tab_name)
|
|
case tab_name
|
|
when "settings"
|
|
find(".admin-backups-tabs__settings").click
|
|
when "files"
|
|
find(".admin-backups-tabs__files").click
|
|
when "logs"
|
|
find(".admin-backups-tabs__logs").click
|
|
end
|
|
end
|
|
|
|
def has_backup_listed?(filename)
|
|
page.has_css?(backup_row_selector(filename))
|
|
end
|
|
|
|
def has_no_backup_listed?(filename)
|
|
page.has_no_css?(backup_row_selector(filename))
|
|
end
|
|
|
|
def open_upload_backup_modal
|
|
find(".admin-backups__start").click
|
|
end
|
|
|
|
def download_backup(filename)
|
|
find_backup_row(filename).find(row_button_selector("download")).click
|
|
end
|
|
|
|
def expand_backup_row_menu(filename)
|
|
find_backup_row(filename).find(".backup-item-menu-trigger").click
|
|
end
|
|
|
|
def delete_backup(filename)
|
|
expand_backup_row_menu(filename)
|
|
find(".backup-item-menu-content").find(row_button_selector("delete")).click
|
|
end
|
|
|
|
def restore_backup(filename)
|
|
expand_backup_row_menu(filename)
|
|
find(".backup-item-menu-content").find(row_button_selector("restore")).click
|
|
end
|
|
|
|
def find_backup_row(filename)
|
|
find(backup_row_selector(filename))
|
|
end
|
|
|
|
def backup_row_selector(filename)
|
|
".admin-backups-list .backup-item-row[data-backup-filename='#{filename}']"
|
|
end
|
|
|
|
def row_button_selector(button_name)
|
|
".backup-item-row__#{button_name}"
|
|
end
|
|
|
|
def toggle_read_only
|
|
find(".admin-backups__toggle-read-only").click
|
|
end
|
|
end
|
|
end
|
|
end
|