diff --git a/src/PolicyEditor/EffectiveListValue.jsx b/src/PolicyEditor/EffectiveListValue.jsx new file mode 100644 index 0000000..0a9cd70 --- /dev/null +++ b/src/PolicyEditor/EffectiveListValue.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import Form from 'react-bootstrap/Form'; +import { getDeepStateProperty } from '../deepstate'; +import { EffectiveValueColumn } from "./EffectiveValueColumn"; + +export function EffectiveListValue(component, policyField) { + const dsp = getDeepStateProperty(component, "resolved.definition." + policyField, undefined); + + return + + + + {component.PolicyDefinitionPoint(dsp)} + + + ; +} diff --git a/src/PolicyEditor/EffectiveTimesOfDayValue.jsx b/src/PolicyEditor/EffectiveTimesOfDayValue.jsx new file mode 100644 index 0000000..cef915a --- /dev/null +++ b/src/PolicyEditor/EffectiveTimesOfDayValue.jsx @@ -0,0 +1,16 @@ +import React from 'react'; +import Form from 'react-bootstrap/Form'; +import { getDeepStateProperty } from '../deepstate'; +import { EffectiveValueColumn } from "./EffectiveValueColumn"; +import { TimesOfDayList } from '../forms/TimesOfDayList'; + +export function EffectiveTimesOfDayValue(component, policyField) { + return + + {TimesOfDayList(component, "resolved.effective." + policyField)} + + {component.PolicyDefinitionPoint(getDeepStateProperty(component, "resolved.definition." + policyField, undefined))} + + + ; +} diff --git a/src/PolicyEditor/UpcomingSnapshotTimes.jsx b/src/PolicyEditor/UpcomingSnapshotTimes.jsx index 2437db2..b528589 100644 --- a/src/PolicyEditor/UpcomingSnapshotTimes.jsx +++ b/src/PolicyEditor/UpcomingSnapshotTimes.jsx @@ -2,7 +2,17 @@ import moment from 'moment'; import React from 'react'; import { LabelColumn } from './LabelColumn'; -export function UpcomingSnapshotTimes(times) { +export function UpcomingSnapshotTimes(resolved) { + if (!resolved) { + return null; + } + + if (resolved.schedulingError) { + return

{resolved.schedulingError}

; + } + + const times = resolved.upcomingSnapshotTimes; + if (!times) { return ; } diff --git a/src/PolicyEditor/index.jsx b/src/PolicyEditor/index.jsx index 56644cf..5f2d1b6 100644 --- a/src/PolicyEditor/index.jsx +++ b/src/PolicyEditor/index.jsx @@ -19,7 +19,9 @@ import { LabelColumn } from './LabelColumn'; import { ValueColumn } from './ValueColumn'; import { WideValueColumn } from './WideValueColumn'; import { EffectiveValue } from './EffectiveValue'; +import { EffectiveListValue } from './EffectiveListValue'; import { EffectiveTextAreaValue } from './EffectiveTextAreaValue'; +import { EffectiveTimesOfDayValue } from './EffectiveTimesOfDayValue'; import { EffectiveBooleanValue } from './EffectiveBooleanValue'; import { EffectiveValueColumn } from './EffectiveValueColumn'; import { UpcomingSnapshotTimes } from './UpcomingSnapshotTimes'; @@ -102,6 +104,7 @@ export class PolicyEditor extends Component { }).then(result => { this.setState({ resolved: result.data }); }).catch(error => { + this.setState({ resolvedError: error }); }); } catch (e) { @@ -421,7 +424,17 @@ export class PolicyEditor extends Component { {TimesOfDayList(this, "policy.scheduling.timeOfDay")} - {EffectiveBooleanValue(this, "scheduling.manual")} + {EffectiveTimesOfDayValue(this, "scheduling.timeOfDay")} + + + Snapshot schedules using UNIX crontab syntax (one per line): +

minute hour day month weekday #comment
+ + See supported format details.} /> + + {StringList(this, "policy.scheduling.cron")} + + {EffectiveListValue(this, "scheduling.cron")}
@@ -435,7 +448,7 @@ export class PolicyEditor extends Component { - {UpcomingSnapshotTimes(this.state?.resolved?.upcomingSnapshotTimes)} + {UpcomingSnapshotTimes(this.state?.resolved)}