move cronDays, cronHours to utils
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user