gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fix #7062


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix #7062
Date: Fri, 12 Nov 2021 17:26:17 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 162e17cf fix #7062
162e17cf is described below

commit 162e17cf3d5d968fbdb9edaa21565f076306409c
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Nov 12 13:26:05 2021 -0300

    fix #7062
---
 .../src/pages/home/ReviewPoliciesScreen.tsx        | 44 +++++++++++++++++++---
 .../src/pages/home/SecretEditorScreen.tsx          |  1 -
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx 
b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
index 3b3b441e..0ed08e03 100644
--- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
@@ -1,13 +1,16 @@
 import { AuthenticationProviderStatusOk } from "anastasis-core";
 import { h, VNode } from "preact";
 import { useState } from "preact/hooks";
+import { AsyncButton } from "../../components/AsyncButton";
 import { useAnastasisContext } from "../../context/anastasis";
 import { authMethods, KnownAuthMethods } from "./authMethod";
+import { ConfirmModal } from "./ConfirmModal";
 import { EditPoliciesScreen } from "./EditPoliciesScreen";
 import { AnastasisClientFrame } from "./index";
 
 export function ReviewPoliciesScreen(): VNode {
   const [editingPolicy, setEditingPolicy] = useState<number | undefined>();
+  const [confirmReset, setConfirmReset] = useState(false);
   const reducer = useAnastasisContext();
   if (!reducer) {
     return <div>no reducer in context</div>;
@@ -23,8 +26,8 @@ export function ReviewPoliciesScreen(): VNode {
     reducer.currentReducerState.authentication_methods ?? [];
   const policies = reducer.currentReducerState.policies ?? [];
 
-  const providers = reducer.currentReducerState.authentication_providers ?? {}
-  
+  const providers = reducer.currentReducerState.authentication_providers ?? {};
+
   if (editingPolicy !== undefined) {
     return (
       <EditPoliciesScreen
@@ -40,6 +43,14 @@ export function ReviewPoliciesScreen(): VNode {
       />
     );
   }
+  async function resetPolicies(): Promise<void> {
+    if (!reducer) return Promise.resolve();
+    return reducer.runTransaction(async (tx) => {
+      await tx.transition("back", {});
+      await tx.transition("next", {});
+      setConfirmReset(false);
+    });
+  }
 
   const errors = policies.length < 1 ? "Need more policies" : undefined;
   return (
@@ -60,9 +71,13 @@ export function ReviewPoliciesScreen(): VNode {
           methods.
         </p>
       )}
-      <div class="block" style={{ justifyContent: "flex-end" }}>
+      <div class="block">
+        <AsyncButton class="button" onClick={async () => 
setConfirmReset(true)}>
+          Reset policies
+        </AsyncButton>
         <button
           class="button is-success"
+          style={{ marginLeft: 10 }}
           onClick={() => setEditingPolicy(policies.length)}
         >
           Add new policy
@@ -98,7 +113,9 @@ export function ReviewPoliciesScreen(): VNode {
               </h3>
               {!methods.length && <p>No auth method found</p>}
               {methods.map((m, i) => {
-                const p = providers[m.provider] as 
AuthenticationProviderStatusOk
+                const p = providers[
+                  m.provider
+                ] as AuthenticationProviderStatusOk;
                 return (
                   <p
                     key={i}
@@ -110,7 +127,9 @@ export function ReviewPoliciesScreen(): VNode {
                     </span>
                     <span>
                       {m.instructions} recovery provided by{" "}
-                      <a href={m.provider} target="_blank" rel="noreferrer" 
>{p.business_name}</a>
+                      <a href={m.provider} target="_blank" rel="noreferrer">
+                        {p.business_name}
+                      </a>
                     </span>
                   </p>
                 );
@@ -143,6 +162,21 @@ export function ReviewPoliciesScreen(): VNode {
           </div>
         );
       })}
+      {confirmReset && (
+        <ConfirmModal
+          active
+          onCancel={() => setConfirmReset(false)}
+          description="Do you want to reset the policies to default state?"
+          label="Reset policies"
+          cancelLabel="Cancel"
+          onConfirm={resetPolicies}
+        >
+          <p>
+            All policies will be recalculated based on the authentication
+            providers configured and any change that you did will be lost
+          </p>
+        </ConfirmModal>
+      )}
     </AnastasisClientFrame>
   );
 }
diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx 
b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
index be8135ef..3fe088c4 100644
--- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/camelcase */
 import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
 import { h, VNode } from "preact";
 import { useState } from "preact/hooks";

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]