-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ejs
93 lines (92 loc) · 2.92 KB
/
index.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!doctype html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="MongoDB Backup Restore">
<meta name="author" content="Ravi Roshan, https://github.com/raviroshanmehta">
<title>MongoDB Backup Restore</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.table-striped{
text-align: center;
}
</style>
</head>
<body class="d-flex flex-column h-100">
<!-- Begin page content -->
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">MongoDB Backup Restore</h1>
<p style="float: right;">
<a href="/backup">New Backup</a>
|
<a href="/remove/all" onclick="return confirm('Are you sure ?')">Remove All</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Backup Time</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<% if(files && files.length > 0) { %>
<% for (let i=0; i < files.length; i++) { %>
<tr>
<th scope="row"><%- i+1 %></th>
<td>
<% const match = files[i].match(/\d+/); %>
<% if (match) { %>
<% const timestamp = parseInt(match[0], 10); %>
<% const date = new Date(timestamp); %>
<%= date.toLocaleString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: true // Display time in 12-hour format with AM/PM
}) %>
<% } else { %>
<%- files[i] %>
<% } %>
</td>
<td>
<a href="/download/<%- files[i] %>">Download</a>
<a href="/restore/<%- files[i] %>" onclick="return confirm('Are you sure ?')">Restore</a>
<a href="/remove/<%- files[i] %>" onclick="return confirm('Are you sure ?')">Remove</a>
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>
</div>
</main>
<footer class="footer mt-auto py-3 bg-light">
<div class="container">
<span class="text-muted">
<p class="lead">Change MongoURI at config.yaml to get started. </p>
<p>Check <a href="https://github.com/raviroshanmehta/mongo-backup-restore">Read Me</a> for more details and features.</p>
</span>
</div>
</footer>
</body>
</html>