1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #6352: Fix time schedule actions (#2845)

This commit is contained in:
Jorge Miguel Lobo Escalona 2023-11-28 16:38:42 +01:00 committed by GitHub
parent 25e3529f53
commit b448fa89a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -23,6 +23,7 @@ import {
PERIOD_TYPES,
REPEAT_VALUES,
SCHEDULE_TYPE,
SERVER_CONFIG,
T,
TEMPLATE_SCHEDULE_TYPE_STRING,
VM_ACTIONS_IN_CHARTER,
@ -67,13 +68,13 @@ const DAYS_OF_WEEK = [
T.Saturday,
]
const getNow = () => DateTime.now()
const getNow = () =>
SERVER_CONFIG?.currentTimeZone
? DateTime.now().setZone(SERVER_CONFIG.currentTimeZone)
: DateTime.now()
const getTomorrow = () => getNow().plus({ days: 1 })
const getTomorrowAtMidnight = () =>
getTomorrow().set({ hour: 12, minute: 0, second: 0 })
const getNextWeek = () => getNow().plus({ weeks: 1 })
const parseDateString = (_, originalValue) => {
@ -239,7 +240,7 @@ const TIME_FIELD = {
typeAction !== SCHEDULE_TYPE.RELATIVE ? schema.required() : schema
),
fieldProps: {
defaultValue: getTomorrowAtMidnight(),
defaultValue: getTomorrow(),
minDateTime: getNow(),
},
}

View File

@ -49,13 +49,21 @@ const ensuredScriptValue = (value) =>
const router = Router()
const defaultConfig = {
currentTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
}
router.get('*', async (req, res) => {
const remoteJWT = {}
const APP_CONFIG = {
[defaultApps.provision.name]: getProvisionConfig() || {},
[defaultApps.provision.name]:
{ ...defaultConfig, ...getProvisionConfig() } || defaultConfig,
[defaultApps.sunstone.name]:
getSunstoneConfig({ includeProtectedConfig: false }) || {},
{
...defaultConfig,
...getSunstoneConfig({ includeProtectedConfig: false }),
} || defaultConfig,
}
const appConfig = getFireedgeConfig()