+
+ {isEdit ? "Edit" : "Create"} policy
+
+ {subTitleText}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ this.setState({ showCreateRepoFlyout: true });
+ }}
+ closeFlyout={() => {
+ this.setState({ showCreateRepoFlyout: false });
+ }}
+ createRepo={this.createRepo}
+ snapshotManagementService={this.props.snapshotManagementService}
+ repoError={repoError}
+ />
+
+
+
+
+
+ {
+ this.setState({ creationScheduleFrequencyType: e.target.value });
+ }}
+ showTimezone={true}
+ timezone={_.get(policy, "creation.schedule.cron.timezone")}
+ onChangeTimezone={(timezone: string) => {
+ this.setState({ policy: this.setPolicyHelper("creation.schedule.cron.timezone", timezone) });
+ }}
+ timezoneError={timezoneError}
+ cronExpression={_.get(policy, "creation.schedule.cron.expression", "")}
+ onCronExpressionChange={(expression: string) => {
+ this.setState({ policy: this.setPolicyHelper("creation.schedule.cron.expression", expression) });
+ }}
+ />
+
+
+
+
+
+ {
+ this.setState({ deleteConditionEnabled: id === "retention_enabled" });
+ }}
+ />
+
+ {deleteConditionEnabled ? (
+ <>
+
+
+
+
+ {
+ this.setState({ maxAgeNum: parseInt(e.target.value) });
+ }}
+ />
+
+
+ {
+ this.setState({ maxAgeUnit: e.target.value });
+ }}
+ />
+
+
+
+
+
+
+ Number of snapshots retained
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deletion schedule
+
+ Delete snapshots that are outside the retention period
+
+
+
+ {
+ this.setState({ deletionScheduleEnabled: !deletionScheduleEnabled });
+ }}
+ />
+
+ {deletionScheduleEnabled ? (
+ {
+ this.setState({ deletionScheduleFrequencyType: e.target.value });
+ }}
+ timezone={undefined}
+ cronExpression={_.get(policy, "deletion.schedule.cron.expression", "")}
+ onCronExpressionChange={(expression: string) => {
+ this.setState({ policy: this.setPolicyHelper("deletion.schedule.cron.expression", expression) });
+ }}
+ />
+ ) : null}
+ {" "}
+ >
+ ) : null}
+
+
+
+
+
+
+ Notify on snapshot activities
+
+
+ ) => {
+ this.setState({ policy: this.setPolicyHelper("notification.conditions.creation", e.target.checked) });
+ }}
+ />
+
+
+
+ ) => {
+ this.setState({ policy: this.setPolicyHelper("notification.conditions.deletion", e.target.checked) });
+ }}
+ />
+
+
+
+ ) => {
+ this.setState({ policy: this.setPolicyHelper("notification.conditions.failure", e.target.checked) });
+ }}
+ />
+
+ {showNotificationChannel ? (
+
+ ) : null}
+
+
+
+
+ {/* Advanced settings */}
+
+
+
+ {
+ this.setState({ advancedSettingsOpen: !this.state.advancedSettingsOpen });
+ }}
+ aria-label="drop down icon"
+ />
+
+
+
+
+ Advanced settings - optional
+
+
+
+
+
+ {advancedSettingsOpen && (
+ <>
+
+
+
+
+
+ Snapshot naming settings
+
+ Customize the naming format of snapshots.
+
+
+
+
+ {
+ this.setState({ policy: this.setPolicyHelper("snapshot_config.date_format", e.target.value) });
+ }}
+ />
+
+
+
+
+ `${tz} (${moment.tz(tz).format("Z")})`}
+ selectedOptions={[{ label: _.get(policy, "snapshot_config.date_format_timezone") ?? "" }]}
+ onChange={(options) => {
+ const timezone = _.first(options)?.label;
+ this.setState({ policy: this.setPolicyHelper("snapshot_config.date_format_timezone", timezone) });
+ }}
+ />
+
+ >
+ )}
+
+
+
+
+
+
+ Cancel
+
+
+
+
+ {isEdit ? "Update" : "Create"}
+
+
+
+
+ );
+ }
+
+ populatePolicyToState = (policy: SMPolicy) => {
+ const maxAge = policy.deletion?.condition?.max_age;
+ if (maxAge) {
+ this.setState({
+ maxAgeNum: parseInt(maxAge.substring(0, maxAge.length - 1)),
+ maxAgeUnit: maxAge[maxAge.length - 1],
+ });
+ }
+ };
+
+ onChangeMaxCount = (e: ChangeEvent