mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-10 09:33:08 +01:00
Initial Backups support
This commit is contained in:
@@ -841,7 +841,8 @@ class AdminPlugin extends Plugin
|
||||
{
|
||||
$event['tools'] = array_merge($event['tools'], [
|
||||
$this->grav['language']->translate('PLUGIN_ADMIN.DIRECT_INSTALL'),
|
||||
$this->grav['language']->translate('PLUGIN_ADMIN.SCHEDULER')
|
||||
$this->grav['language']->translate('PLUGIN_ADMIN.SCHEDULER'),
|
||||
$this->grav['language']->translate('PLUGIN_ADMIN.BACKUPS')
|
||||
]);
|
||||
|
||||
return $event;
|
||||
@@ -859,8 +860,8 @@ class AdminPlugin extends Plugin
|
||||
case 'tools/scheduler':
|
||||
$e['type'] = 'config/scheduler';
|
||||
break;
|
||||
case 'tools/backup':
|
||||
$e['type'] = 'config/backup';
|
||||
case 'tools/backups':
|
||||
$e['type'] = 'config/backups';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ PLUGIN_ADMIN:
|
||||
DAYS: "Days"
|
||||
UPDATE: "Update"
|
||||
BACKUP: "Backup"
|
||||
BACKUPS: "Backups"
|
||||
BACKUPS_HISTORY: "Backups History"
|
||||
BACKUPS_CONFIG: "Backups Configuration"
|
||||
STATISTICS: "Statistics"
|
||||
TODAY: "Today"
|
||||
WEEK: "Week"
|
||||
|
||||
2
themes/grav/css-compiled/template.css
vendored
2
themes/grav/css-compiled/template.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -675,6 +675,11 @@ textarea.frontmatter {
|
||||
}
|
||||
}
|
||||
|
||||
[data-grav-field="cron"] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cron-install {
|
||||
|
||||
margin: 1rem;
|
||||
@@ -691,9 +696,10 @@ textarea.frontmatter {
|
||||
}
|
||||
}
|
||||
|
||||
.cron-status {
|
||||
.cron-status, .backups-history {
|
||||
|
||||
margin-bottom: 4rem;
|
||||
|
||||
.cron-at code {
|
||||
font-size: 120%;
|
||||
padding: 2px 10px;
|
||||
@@ -709,7 +715,7 @@ textarea.frontmatter {
|
||||
}
|
||||
}
|
||||
|
||||
form .cron-job-list {
|
||||
form .cron-job-list, form .backups-list {
|
||||
li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{% set tab_title = (tab_title_string|tu == tab_title_string ? config_slug|capitalize : tab_title_string|tu) %}
|
||||
{% set title = "PLUGIN_ADMIN.CONFIGURATION"|tu ~ ": " ~ tab_title %}
|
||||
|
||||
{% set config_ignores = ['scheduler', 'backup'] %}
|
||||
{% set config_ignores = ['scheduler', 'backups'] %}
|
||||
|
||||
{% if not isInfo %}
|
||||
{% set data = admin.data('config/' ~ config_slug) %}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{% set backups = [] %}
|
||||
|
||||
<table class="backups-history">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="flex:3;">Name</th>
|
||||
<th style="flex:3;">Type</th>
|
||||
<th>Status</th>
|
||||
<th>State</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for backup in backups %}
|
||||
<tr>
|
||||
<td style="flex:3;overflow:hidden;"><kbd>{{ backup.name }}</kbd></td>
|
||||
<td style="flex:3;">{{ backup.type }}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="button-bar">
|
||||
<a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
|
||||
<button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
|
||||
</div>
|
||||
<h1><i class="fa fa-fw fa-life-saver"></i> {{ "PLUGIN_ADMIN.BACKUPS"|tu }}</h1>
|
||||
|
||||
13
themes/grav/templates/partials/tools-backups.html.twig
Normal file
13
themes/grav/templates/partials/tools-backups.html.twig
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="scheduler-content">
|
||||
|
||||
{% set data = admin.data('config/backups') %}
|
||||
|
||||
{% if authorize(['admin.configuration_scheduler', 'admin.super']) %}
|
||||
|
||||
{% include 'partials/blueprints.html.twig' with { blueprints: data.blueprints, data: data } %}
|
||||
|
||||
{% include 'partials/modal-changes-detected.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user