move cronDays, cronHours to utils

This commit is contained in:
Girish Ramakrishnan
2025-10-07 14:37:53 +02:00
parent 491617e41c
commit 1a674a30ac
4 changed files with 27 additions and 36 deletions
+1 -16
View File
@@ -1,6 +1,7 @@
import { fetcher } from '@cloudron/pankow';
import { API_ORIGIN } from '../constants.js';
import { cronDays, cronHours } from '../utils.js';
function create() {
const accessToken = localStorage.token;
@@ -219,20 +220,6 @@ const backupRetentions = [
{ name: 'Forever', id: { keepWithinSecs: -1 }}
];
// values correspond to cron days
const cronDays = [
{ id: 0, name: 'Sunday' },
{ id: 1, name: 'Monday' },
{ id: 2, name: 'Tuesday' },
{ id: 3, name: 'Wednesday' },
{ id: 4, name: 'Thursday' },
{ id: 5, name: 'Friday' },
{ id: 6, name: 'Saturday' },
];
// generates 24h time sets (instead of american 12h) to avoid having to translate everything to locales eg. 12:00
const cronHours = Array.from({ length: 24 }).map(function (v, i) { return { id: i, name: (i < 10 ? '0' : '') + i + ':00' }; });
function prettyBackupSchedule(pattern) {
if (!pattern) return '';
@@ -267,8 +254,6 @@ function prettyBackupContents(contents) {
export default {
create,
backupRetentions,
cronDays,
cronHours,
prettyBackupSchedule,
prettyBackupRetention,
prettyBackupContents