2021-10-19 15:56:52 +02:00
|
|
|
/* eslint-disable @typescript-eslint/camelcase */
|
|
|
|
import { h, VNode } from "preact";
|
|
|
|
import { BackupReducerProps, AnastasisClientFrame } from "./index";
|
|
|
|
|
|
|
|
export function ReviewPoliciesScreen(props: BackupReducerProps): VNode {
|
|
|
|
const { reducer, backupState } = props;
|
|
|
|
const authMethods = backupState.authentication_methods!;
|
|
|
|
return (
|
|
|
|
<AnastasisClientFrame title="Backup: Review Recovery Policies">
|
|
|
|
{backupState.policies?.map((p, i) => {
|
|
|
|
const policyName = p.methods
|
|
|
|
.map((x, i) => authMethods[x.authentication_method].type)
|
|
|
|
.join(" + ");
|
|
|
|
return (
|
2021-10-19 20:24:55 +02:00
|
|
|
<div key={i} class="policy">
|
2021-10-19 15:56:52 +02:00
|
|
|
<h3>
|
|
|
|
Policy #{i + 1}: {policyName}
|
|
|
|
</h3>
|
|
|
|
Required Authentications:
|
|
|
|
<ul>
|
|
|
|
{p.methods.map((x, i) => {
|
|
|
|
const m = authMethods[x.authentication_method];
|
|
|
|
return (
|
|
|
|
<li key={i}>
|
|
|
|
{m.type} ({m.instructions}) at provider {x.provider}
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</ul>
|
|
|
|
<div>
|
|
|
|
<button
|
|
|
|
onClick={() => reducer.transition("delete_policy", { policy_index: i })}
|
|
|
|
>
|
|
|
|
Delete Policy
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</AnastasisClientFrame>
|
|
|
|
);
|
|
|
|
}
|