add: 添加每月最后一天调度
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
// the top-nav active state in sync, and re-renders chrome strings when
|
||||
// the locale changes.
|
||||
|
||||
import { onRoute } from "./state.js?v=recurring-jobs-5";
|
||||
import { t, currentLocale, setLocale, onLocale } from "./i18n.js?v=recurring-jobs-5";
|
||||
import { renderRemotes } from "./views/remotes.js?v=recurring-jobs-5";
|
||||
import { renderBrowse } from "./views/browser.js?v=recurring-jobs-5";
|
||||
import { renderJobs, renderNewJob, stopJobPolling } from "./views/jobs.js?v=recurring-jobs-5";
|
||||
import { onRoute } from "./state.js?v=monthly-last-day-1";
|
||||
import { t, currentLocale, setLocale, onLocale } from "./i18n.js?v=monthly-last-day-1";
|
||||
import { renderRemotes } from "./views/remotes.js?v=monthly-last-day-1";
|
||||
import { renderBrowse } from "./views/browser.js?v=monthly-last-day-1";
|
||||
import { renderJobs, renderNewJob, stopJobPolling } from "./views/jobs.js?v=monthly-last-day-1";
|
||||
import {
|
||||
renderConfigureNew,
|
||||
renderConfigureEdit,
|
||||
} from "./views/configure.js?v=recurring-jobs-5";
|
||||
} from "./views/configure.js?v=monthly-last-day-1";
|
||||
|
||||
const views = {
|
||||
remotes: renderRemotes,
|
||||
|
||||
@@ -184,9 +184,11 @@ const STRINGS = {
|
||||
"jobs.weekday_saturday": "Saturday",
|
||||
"jobs.weekday_sunday": "Sunday",
|
||||
"jobs.monthday": (n) => `Day ${n}`,
|
||||
"jobs.monthday_last": "Last day",
|
||||
"jobs.schedule_label_daily": (time) => `Every day at ${time}`,
|
||||
"jobs.schedule_label_weekly": (day, time) => `Every ${day} at ${time}`,
|
||||
"jobs.schedule_label_monthly": (day, time) => `Day ${day} of every month at ${time}`,
|
||||
"jobs.schedule_label_monthly_last": (time) => `Last day of every month at ${time}`,
|
||||
"jobs.local_option": "Local filesystem",
|
||||
"jobs.local_path_help": "For Local filesystem, enter a path visible inside the rclone process, such as /data/source in this Docker setup. For remotes, enter a path inside the selected remote.",
|
||||
"jobs.source_remote": "Source location",
|
||||
@@ -398,9 +400,11 @@ const STRINGS = {
|
||||
"jobs.weekday_saturday": "星期六",
|
||||
"jobs.weekday_sunday": "星期日",
|
||||
"jobs.monthday": (n) => `${n} 号`,
|
||||
"jobs.monthday_last": "最后一天",
|
||||
"jobs.schedule_label_daily": (time) => `每天 ${time}`,
|
||||
"jobs.schedule_label_weekly": (day, time) => `每周${day.replace(/^星期/, "")} ${time}`,
|
||||
"jobs.schedule_label_monthly": (day, time) => `每月 ${day} 号 ${time}`,
|
||||
"jobs.schedule_label_monthly_last": (time) => `每月最后一天 ${time}`,
|
||||
"jobs.local_option": "本地文件系统",
|
||||
"jobs.local_path_help": "选择本地文件系统时填写 rclone 进程内可见的路径;当前 Docker 编排里通常是 /data/source。选择远程存储时填写该远程内的路径。",
|
||||
"jobs.source_remote": "源位置",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// views/browser.js — file/folder listing with breadcrumbs, mkdir, upload, delete, rename.
|
||||
|
||||
import { post, uploadFile, downloadURL } from "../rc.js";
|
||||
import { toast, formatBytes, formatTime } from "../state.js?v=recurring-jobs-5";
|
||||
import { t } from "../i18n.js?v=recurring-jobs-5";
|
||||
import { toast, formatBytes, formatTime } from "../state.js?v=monthly-last-day-1";
|
||||
import { t } from "../i18n.js?v=monthly-last-day-1";
|
||||
|
||||
export async function renderBrowse({ remote, path }) {
|
||||
const app = document.getElementById("app");
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
// and disabled submit — user must run `rclone config` in a terminal.
|
||||
|
||||
import { post } from "../rc.js";
|
||||
import { getState, setState, toast } from "../state.js?v=recurring-jobs-5";
|
||||
import { t } from "../i18n.js?v=recurring-jobs-5";
|
||||
import { getState, setState, toast } from "../state.js?v=monthly-last-day-1";
|
||||
import { t } from "../i18n.js?v=monthly-last-day-1";
|
||||
|
||||
// --- Route entrypoints ---
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
formatBytes,
|
||||
formatSpeed,
|
||||
formatDuration,
|
||||
} from "../state.js?v=recurring-jobs-5";
|
||||
import { t } from "../i18n.js?v=recurring-jobs-5";
|
||||
} from "../state.js?v=monthly-last-day-1";
|
||||
import { t } from "../i18n.js?v=monthly-last-day-1";
|
||||
import {
|
||||
createRecurringJob,
|
||||
deleteRecurringJob,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
listRecurringJobs,
|
||||
runRecurringJobNow,
|
||||
stopRecurringJob,
|
||||
} from "../jobs_api.js?v=recurring-jobs-5";
|
||||
} from "../jobs_api.js?v=monthly-last-day-1";
|
||||
|
||||
let pollTimer = null;
|
||||
const WEBGUI_JOB_GROUP_PREFIX = "webgui/transfer";
|
||||
@@ -276,10 +276,12 @@ function renderWeekdayOptions() {
|
||||
}
|
||||
|
||||
function renderMonthdayOptions() {
|
||||
return Array.from({ length: 31 }, (_, index) => {
|
||||
const lastDay = `<option value="0">${t("jobs.monthday_last")}</option>`;
|
||||
const numberedDays = Array.from({ length: 31 }, (_, index) => {
|
||||
const day = index + 1;
|
||||
return `<option value="${day}">${t("jobs.monthday", day)}</option>`;
|
||||
}).join("");
|
||||
return lastDay + numberedDays;
|
||||
}
|
||||
|
||||
function buildTransferBody(action, src, dst) {
|
||||
@@ -322,7 +324,7 @@ function readRecurringSchedule(form) {
|
||||
}
|
||||
if (scheduleKind === "monthly") {
|
||||
schedule.scheduleMonthday = Number(form.elements.scheduleMonthday.value);
|
||||
if (!Number.isInteger(schedule.scheduleMonthday) || schedule.scheduleMonthday < 1 || schedule.scheduleMonthday > 31) {
|
||||
if (!Number.isInteger(schedule.scheduleMonthday) || schedule.scheduleMonthday < 0 || schedule.scheduleMonthday > 31) {
|
||||
throw new Error(t("error.no_schedule_selected"));
|
||||
}
|
||||
}
|
||||
@@ -764,6 +766,9 @@ function formatSchedule(job) {
|
||||
case "weekly":
|
||||
return t("jobs.schedule_label_weekly", weekdayName(job.scheduleWeekday), time);
|
||||
case "monthly":
|
||||
if (Number(job.scheduleMonthday) === 0) {
|
||||
return t("jobs.schedule_label_monthly_last", time);
|
||||
}
|
||||
return t("jobs.schedule_label_monthly", job.scheduleMonthday, time);
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// views/remotes.js — connector-tile grid of configured remotes with CRUD.
|
||||
|
||||
import { post } from "../rc.js";
|
||||
import { getState, setState, toast } from "../state.js?v=recurring-jobs-5";
|
||||
import { t } from "../i18n.js?v=recurring-jobs-5";
|
||||
import { getState, setState, toast } from "../state.js?v=monthly-last-day-1";
|
||||
import { t } from "../i18n.js?v=monthly-last-day-1";
|
||||
|
||||
export async function renderRemotes() {
|
||||
const app = document.getElementById("app");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
|
||||
<link rel="stylesheet" href="/assets/styles/tokens.css">
|
||||
<link rel="stylesheet" href="/assets/styles/base.css">
|
||||
<link rel="stylesheet" href="/assets/styles/components.css?v=recurring-jobs-5">
|
||||
<link rel="stylesheet" href="/assets/styles/components.css?v=monthly-last-day-1">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top-nav">
|
||||
@@ -80,6 +80,6 @@
|
||||
<div id="toast-stack" class="toast-stack"></div>
|
||||
<div id="modal-root"></div>
|
||||
|
||||
<script type="module" src="/assets/js/app.js?v=recurring-jobs-5"></script>
|
||||
<script type="module" src="/assets/js/app.js?v=monthly-last-day-1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user