Skip to content

Commit d65342e

Browse files
authored
Migrate List Backups to .units-table (hestiacp#3619)
* Fix string not translated * Migrate List Backup table to .units-table * Refine .units-table alignment of items
1 parent 95bf510 commit d65342e

File tree

3 files changed

+106
-63
lines changed

3 files changed

+106
-63
lines changed

web/css/src/themes/default.css

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,12 @@
867867

868868
& .units-table-cell {
869869
font-weight: bold;
870-
padding: 15px;
870+
padding: 14px 15px;
871+
872+
/* Checkbox cell */
873+
&:nth-child(1) {
874+
line-height: 1.1;
875+
}
871876
}
872877
}
873878
}
@@ -962,18 +967,26 @@
962967
display: table-cell;
963968
padding: 10px 15px;
964969

970+
/* Checkbox cell */
971+
&:nth-child(1) {
972+
vertical-align: bottom;
973+
}
974+
975+
/* Row heading cell */
965976
&:nth-child(2) {
966977
font-size: 0.8rem;
967978
}
968979

969-
&:not(:nth-child(2)) {
980+
/* Metadata cells */
981+
&:not(:nth-child(1), :nth-child(2)) {
970982
text-align: center;
971983
}
972984
}
973985
}
974986

975987
.units-table-row-actions {
976988
display: flex;
989+
flex-wrap: wrap;
977990
padding-top: 5px;
978991
padding-bottom: 5px;
979992

web/templates/pages/list_backup.php

Lines changed: 90 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,18 @@
3535
<!-- End toolbar -->
3636

3737
<div class="container">
38-
<div class="units js-units-container">
39-
<div class="header units-header">
40-
<div class="l-unit__col l-unit__col--right">
41-
<div>
42-
<div class="clearfix l-unit__stat-col--left super-compact">
43-
<input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
44-
</div>
45-
<div class="clearfix l-unit__stat-col--left wide-4"><b><?= _("File Name") ?></b></div>
46-
<div class="clearfix l-unit__stat-col--left compact-4 u-text-right"><b>&nbsp;</b></div>
47-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Date") ?></b></div>
48-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Size") ?></b></div>
49-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Type") ?></b></div>
50-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Runtime") ?></b></div>
51-
</div>
38+
39+
<div class="units-table js-units-container">
40+
<div class="units-table-header">
41+
<div class="units-table-cell">
42+
<input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
5243
</div>
44+
<div class="units-table-cell"><?= _("File Name") ?></div>
45+
<div class="units-table-cell"></div>
46+
<div class="units-table-cell"><?= _("Date") ?></div>
47+
<div class="units-table-cell"><?= _("Size") ?></div>
48+
<div class="units-table-cell"><?= _("Type") ?></div>
49+
<div class="units-table-cell"><?= _("Runtime") ?></div>
5350
</div>
5451

5552
<!-- Begin user backup list item loop -->
@@ -69,58 +66,91 @@
6966
if (!empty($data[$key]['DB'])) $db = _('Yes');
7067
if (!empty($data[$key]['CRON'])) $cron = _('Yes');
7168
if (!empty($data[$key]['UDIR'])) $udir = _('Yes');
72-
?>
73-
<div class="l-unit animate__animated animate__fadeIn js-unit">
74-
<div class="l-unit__col l-unit__col--right">
69+
?>
70+
<div class="units-table-row animate__animated animate__fadeIn js-unit">
71+
<div class="units-table-cell">
7572
<div>
76-
<div class="clearfix l-unit__stat-col--left super-compact">
77-
<input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="backup[]" value="<?= $key ?>" <?= $display_mode ?>>
78-
</div>
79-
<div class="clearfix l-unit__stat-col--left wide-4 truncate">
80-
<b>
81-
<?php if ($read_only === "true") { ?>
82-
<?= $key ?>
83-
<?php } else { ?>
84-
<a href="/list/backup/?backup=<?= $key ?>&token=<?= $_SESSION["token"] ?>" title="<?= _("Restore") ?>"><?= $key ?></a>
85-
<?php } ?>
86-
</b>
87-
</div>
88-
<!-- START QUICK ACTION TOOLBAR AREA -->
89-
<div class="clearfix l-unit__stat-col--left compact-4 u-text-right">
90-
<div class="l-unit-toolbar__col l-unit-toolbar__col--right u-noselect">
91-
<div class="actions-panel clearfix">
92-
<?php if ($_SESSION["userContext"] === "admin" && $_SESSION["look"] === "admin" && $read_only === "true") { ?>
93-
<!-- Restrict ability to restore or delete backups when impersonating 'admin' account -->
94-
&nbsp;
95-
<?php } else { ?>
96-
<div class="actions-panel__col actions-panel__download shortcut-d" data-key-action="href"><a href="/download/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Download") ?>"><i class="fas fa-file-arrow-down icon-lightblue icon-dim"></i></a></div>
97-
<?php if ($read_only !== 'true') {?>
98-
<div class="actions-panel__col actions-panel__list shortcut-enter" data-key-action="href"><a href="/list/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Restore") ?>"><i class="fas fa-arrow-rotate-left icon-green icon-dim"></i></a></div>
99-
<div class="actions-panel__col actions-panel__delete shortcut-delete" data-key-action="js">
100-
<a
101-
class="data-controls js-confirm-action"
102-
href="/delete/backup/?backup=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
103-
data-confirm-title="<?= _("Delete") ?>"
104-
data-confirm-message="<?= sprintf(_("Are you sure you want to delete backup %s?"), $key) ?>"
105-
>
106-
<i class="fas fa-trash icon-red icon-dim"></i>
107-
</a>
108-
</div>
109-
<?php } ?>
110-
<?php } ?>
111-
</div>
112-
</div>
113-
</div>
114-
<!-- END QUICK ACTION TOOLBAR AREA -->
115-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= translate_date($data[$key]["DATE"]) ?></b></div>
116-
<div class="clearfix l-unit__stat-col--left u-text-center"><b><?= humanize_usage_size($data[$key]["SIZE"]) ?></b> <span class="u-text-small"><?= humanize_usage_measure($data[$key]["SIZE"]) ?></span></div>
117-
<div class="clearfix l-unit__stat-col--left u-text-center"><?= $data[$key]["TYPE"] ?></div>
118-
<div class="clearfix l-unit__stat-col--left u-text-center"><?= humanize_time($data[$key]["RUNTIME"]) ?></div>
73+
<input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="backup[]" value="<?= $key ?>" <?= $display_mode ?>>
74+
<label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
11975
</div>
12076
</div>
77+
<div class="units-table-cell u-text-bold">
78+
<span class="u-hide-desktop"><?= _("File Name") ?>:</span>
79+
<?php if ($read_only === "true") { ?>
80+
<?= $key ?>
81+
<?php } else { ?>
82+
<a href="/list/backup/?backup=<?= $key ?>&token=<?= $_SESSION["token"] ?>" title="<?= _("Restore") ?>">
83+
<?= $key ?>
84+
</a>
85+
<?php } ?>
86+
</div>
87+
<div class="units-table-cell">
88+
<?php if (!($_SESSION["userContext"] === "admin" && $_SESSION["look"] === "admin" && $read_only === "true")) { ?>
89+
<ul class="units-table-row-actions">
90+
<li class="units-table-row-action shortcut-d" data-key-action="href">
91+
<a
92+
class="units-table-row-action-link"
93+
href="/download/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>"
94+
title="<?= _("Download") ?>"
95+
>
96+
<i class="fas fa-file-arrow-down icon-lightblue"></i>
97+
<span class="u-hide-desktop"><?= _("Download") ?></span>
98+
</a>
99+
</li>
100+
<?php if ($read_only !== 'true') { ?>
101+
<li class="units-table-row-action shortcut-enter" data-key-action="href">
102+
<a
103+
class="units-table-row-action-link data-controls"
104+
href="/list/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>"
105+
title="<?= _("Restore") ?>"
106+
>
107+
<i class="fas fa-arrow-rotate-left icon-green"></i>
108+
<span class="u-hide-desktop"><?= _("Restore") ?></span>
109+
</a>
110+
</li>
111+
<li class="units-table-row-action shortcut-delete" data-key-action="js">
112+
<a
113+
class="units-table-row-action-link data-controls js-confirm-action"
114+
href="/delete/backup/?backup=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
115+
title="<?= _("Delete") ?>"
116+
data-confirm-title="<?= _("Delete") ?>"
117+
data-confirm-message="<?= sprintf(_("Are you sure you want to delete backup %s?"), $key) ?>"
118+
>
119+
<i class="fas fa-trash icon-red"></i>
120+
<span class="u-hide-desktop"><?= _("Delete") ?></span>
121+
</a>
122+
</li>
123+
<?php } ?>
124+
</ul>
125+
<?php } ?>
126+
</div>
127+
<div class="units-table-cell">
128+
<span class="u-hide-desktop u-text-bold"><?= _("Date") ?>:</span>
129+
<span class="u-text-bold">
130+
<?= translate_date($data[$key]["DATE"]) ?>
131+
</span>
132+
</div>
133+
<div class="units-table-cell">
134+
<span class="u-hide-desktop u-text-bold"><?= _("Size") ?>:</span>
135+
<span class="u-text-bold">
136+
<?= humanize_usage_size($data[$key]["SIZE"]) ?>
137+
</span>
138+
<span class="u-text-small">
139+
<?= humanize_usage_measure($data[$key]["SIZE"]) ?>
140+
</span>
141+
</div>
142+
<div class="units-table-cell">
143+
<span class="u-hide-desktop u-text-bold"><?= _("Type") ?>:</span>
144+
<?= $data[$key]["TYPE"] ?>
145+
</div>
146+
<div class="units-table-cell">
147+
<span class="u-hide-desktop u-text-bold"><?= _("Runtime") ?>:</span>
148+
<?= humanize_time($data[$key]["RUNTIME"]) ?>
149+
</div>
121150
</div>
122151
<?php } ?>
123152
</div>
153+
124154
</div>
125155

126156
<footer class="app-footer">

web/templates/pages/list_cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
</div>
112112
</div>
113113
<div class="units-table-cell u-text-bold">
114-
<span class="u-hide-desktop">Command:</span>
114+
<span class="u-hide-desktop"><?= _("Command") ?>:</span>
115115
<?php if ($read_only === "true" || $data[$key]["SUSPENDED"] == "yes") { ?>
116116
<?= htmlspecialchars($data[$key]["CMD"], ENT_NOQUOTES) ?>
117117
<?php } else { ?>

0 commit comments

Comments
 (0)