gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 419/459: remove tables, remove spinner, fix authorizations


From: gnunet
Subject: [reclaim-ui] 419/459: remove tables, remove spinner, fix authorizations page
Date: Fri, 11 Jun 2021 23:28:31 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.

commit 83266d908f5388004555e60855a48e6c7c32cf9e
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Jan 6 12:14:48 2021 +0900

    remove tables, remove spinner, fix authorizations page
---
 .../edit-authorizations.component.html             | 85 ++++++++++------------
 .../edit-authorizations.component.ts               |  6 +-
 src/app/edit-identity/edit-identity.component.html | 15 ++--
 src/app/edit-identity/edit-identity.component.ts   | 12 ---
 src/locales/de/messages.json                       |  1 +
 src/locales/en/messages.json                       |  1 +
 6 files changed, 50 insertions(+), 70 deletions(-)

diff --git a/src/app/edit-authorizations/edit-authorizations.component.html 
b/src/app/edit-authorizations/edit-authorizations.component.html
index 6a6d6a0..fa502c6 100644
--- a/src/app/edit-authorizations/edit-authorizations.component.html
+++ b/src/app/edit-authorizations/edit-authorizations.component.html
@@ -6,53 +6,46 @@
     </div>
   </div>
   <div class="card-body">
+    <div class="alert alert-secondary" *ngIf="tickets.length == 0">
+      {{ getMessage("edit_authorizations_html@noAuthorizations") }}
+    </div>
     <!-- Authorized entities -->
-    <div style="margin-top: 1.5em;">
-      <table class="table pb-1">
-        <thead style="border-top-style: hidden">
-          <tr>
-            <th scope="col">
-              <h6 class="card-subtitle mb-2">
-                {{getMessage("edit_authorizations_html@authEntity")}}
-              </h6>
-            </th>
-            <th scope="col">
-              <h6 class="card-subtitle mb-2">
-                {{getMessage("edit_authorizations_html@sharedAttributes")}}
-              </h6>
-            </th>
-            <th scope="col"></th>
-          </tr>
-        </thead>
-        <tbody>
-          <tr *ngFor="let ticket of tickets">
-            <td>
-              <div style="min-width: 15em">
-                {{getAudienceName(ticket)}}
-              </div>
-            </td>
-            <td>
-              <div style="min-width: 15em">
-                {{ticketAttributeMapper[ticket.audience]}}
-              </div>
-            </td>
-            <td>
-              <button class="btn btn-primary" *ngIf="showConfirmRevoke != 
ticket" (click)="confirmRevoke(ticket)">
-                <span class="fa fa-unlink"></span> {{getMessage("Revoke")}}
-              </button>
-              <div class="alert alert-danger fade show" 
*ngIf="showConfirmRevoke == ticket">
-                
{{getMessage("edit_authorizations_html@revokeVerifikation")}}<br/><br/>
-                <button class="btn btn-primary m-2" 
(click)="revokeTicket(ticket)">
-                  <span class="fa fa-check"></span> {{getMessage("Yes")}}
-                </button>
-                <button class="btn btn-primary m-2" 
(click)="hideConfirmRevoke()">
-                  <span class="fa fa-times"></span> {{getMessage("No")}}
-                </button>
-              </div>
-            </td>
-          </tr>
-        </tbody>
-      </table>
+    <div class="table mt-1" *ngIf="tickets.length > 0">
+      <div class="row">
+        <div class="col-sm underline">
+          {{getMessage("edit_authorizations_html@authEntity")}}
+        </div>
+        <div class="col-sm underline">
+          {{getMessage("edit_authorizations_html@sharedAttributes")}}
+        </div>
+        <div class="col-sm"></div>
+      </div>
+      <div class="row" *ngFor="let ticket of tickets">
+        <div class="col-sm">
+          {{getAudienceName(ticket)}}
+        </div>
+        <div class="col-sm">
+          <ul>
+            <li *ngFor="let desc of ticketAttributeMapper[ticket.audience]">
+              {{desc}}
+            </li>
+          </ul>
+        </div>
+        <div class="col-sm">
+          <button class="btn btn-primary" *ngIf="showConfirmRevoke != ticket" 
(click)="confirmRevoke(ticket)">
+            <span class="fa fa-unlink"></span> {{getMessage("Revoke")}}
+          </button>
+          <div class="alert alert-danger fade show" *ngIf="showConfirmRevoke 
== ticket">
+            
{{getMessage("edit_authorizations_html@revokeVerifikation")}}<br/><br/>
+            <button class="btn btn-primary m-2" (click)="revokeTicket(ticket)">
+              <span class="fa fa-check"></span> {{getMessage("Yes")}}
+            </button>
+            <button class="btn btn-primary m-2" (click)="hideConfirmRevoke()">
+              <span class="fa fa-times"></span> {{getMessage("No")}}
+            </button>
+          </div>
+        </div>
+      </div>
     </div>
     <!-- Edit card buttons -->
     <div>
diff --git a/src/app/edit-authorizations/edit-authorizations.component.ts 
b/src/app/edit-authorizations/edit-authorizations.component.ts
index 0c1aa26..5afe0c8 100644
--- a/src/app/edit-authorizations/edit-authorizations.component.ts
+++ b/src/app/edit-authorizations/edit-authorizations.component.ts
@@ -6,6 +6,7 @@ import { ReclaimService } from '../reclaim.service';
 import { ActivatedRoute } from '@angular/router';
 import { IdentityService } from '../identity.service';
 import { GnsService } from '../gns.service';
+import { OpenIdService } from '../open-id.service';
 import { NamestoreService } from '../namestore.service';
 import { LanguageService } from '../language.service';
 
@@ -27,6 +28,7 @@ export class EditAuthorizationsComponent implements OnInit {
               private activatedRoute: ActivatedRoute,
               private identityService: IdentityService,
               private gnsService: GnsService,
+              private oidcService: OpenIdService,
               private namestoreService: NamestoreService,
               private languageService: LanguageService,) { }
 
@@ -86,11 +88,11 @@ export class EditAuthorizationsComponent implements OnInit {
       names = names.filter(name => name.record_name === 
ticket.rnd.toLowerCase());
       for (let i = 0; i < names.length; i++) {
         names[i].data.forEach(record => {
-          if (record.record_type === 'RECLAIM_ATTR_REF') {
+          if (record.record_type === 'RECLAIM_ATTRIBUTE_REF') {
             this.attributes
               .filter(attr => attr.id === record.value)
               .map(attr => {
-                this.ticketAttributeMapper[ticket.audience].push(attr.name);
+                
this.ticketAttributeMapper[ticket.audience].push(this.oidcService.getClaimDescription(attr));
               });
           }
         });
diff --git a/src/app/edit-identity/edit-identity.component.html 
b/src/app/edit-identity/edit-identity.component.html
index e6b8306..cfa6d3f 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -14,7 +14,7 @@
     </div>
   </div>
 
-  <div class="card-body" *ngIf="importInProgress && 
attributesToOverwriteOnImport.length > 0">
+  <div class="card-body" *ngIf="attributesToOverwriteOnImport.length > 0">
     <div class="alert alert-warning">{{ 
getMessage("edit_identity_html@importOverwriteInfo") }}</div>
     <div class="table">
       <div class="row">
@@ -65,12 +65,7 @@
       <span class="fa fa-download"></span> {{getMessage("import") }}
     </button>
   </div>
-  <div class="text-center card-body" *ngIf="importInProgress && 
attributesToOverwriteOnImport.length == 0">
-    <div class="text-center fa fa-4x">
-      <i *ngIf="attributesToOverwriteOnImport.length == 0" class="fa 
fa-spinner fa-spin"></i>
-    </div>
-  </div>
-  <div *ngIf="validImportEmail && !importInProgress" class="col-sm alert 
alert-primary alert-dismissible show my-2" role="alert" >
+  <div *ngIf="validImportEmail" class="col-sm alert alert-primary 
alert-dismissible show my-2" role="alert" >
     {{getMessage("edit_identity_html@importInfo", {ISSUERNAME: 
getImportIssuerName()})}}<br/>
     
<i>{{getMessage("Note")}}</i>{{getMessage("edit_credentials_html@linkAccountInfo2")}}
     <br/>
@@ -83,7 +78,7 @@
   </div>
 
   <!-- Attribute table -->
-  <div class="card-body" *ngIf="!importInProgress">
+  <div class="card-body">
     <div>
       <h3 class="mb-2"> {{getMessage("edit_identity_html@addAttributes")}}</h3>
       <p *ngIf="getMissingClaims().length > 0"> 
{{getMessage("edit_identity_html@addRequestedMissingClaim")}} <span 
(click)="showMissingInfo = !showMissingInfo" class="fa 
fa-question-circle"></span></p>
@@ -193,8 +188,8 @@
               </div>
             </div>
           </div>
-          <p class="mb-2"> 
{{getMessage("edit_identity_html@addCustomClaim")}}</p>
-          <div class="table pb-1">
+          <p class="mb-2" *ngIf="getMissingClaims().length == 0"> 
{{getMessage("edit_identity_html@addCustomClaim")}}</p>
+          <div class="table pb-1" *ngIf="getMissingClaims().length == 0">
             <!-- Add custom attribute -->
 
             <div class="row mb-3"
diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index d47d9ce..331e968 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -55,7 +55,6 @@ export class EditIdentityComponent implements OnInit {
   attributesToImport: Attribute[] = [];
   attributesToOverwriteOnImport: any[] = [];
   validImportEmail: boolean = false;
-  importInProgress: boolean = false;
   scopes: Scope[];
   newCredential: Credential;
 
@@ -83,7 +82,6 @@ export class EditIdentityComponent implements OnInit {
     this.newCredential = new Credential('', '', '', 'JWT', '', 0, []);
     this.loadImportScopesFromLocalStorage()
     this.loadImportIdProviderFromLocalStorage();
-    this.importInProgress = true;
     let oidcState = localStorage.getItem('oidcRequestState');
     if (oidcState) {
       this.oidcService.loadState(oidcState);
@@ -597,7 +595,6 @@ export class EditIdentityComponent implements OnInit {
   tryImportCredential() {
     if (this.importIdProvider.url === '') {
       console.log("No ID provider flow to pick up from...")
-      this.importInProgress = false;
       return;
     }
     const loginOptions: LoginOptions = {
@@ -607,7 +604,6 @@ export class EditIdentityComponent implements OnInit {
     if (!localStorage.getItem("credentialCode")){
       this.oauthService.loadDiscoveryDocumentAndTryLogin().then(success => {
         if (!success || (null == this.oauthService.getIdToken())) {
-          this.importInProgress = false;
           return;
         }
         console.log("Login successful: "+this.oauthService.getIdToken());
@@ -618,7 +614,6 @@ export class EditIdentityComponent implements OnInit {
     } else {
       
this.oauthService.loadDiscoveryDocumentAndTryLogin(loginOptions).then(success 
=> {
         if (!success || (null == this.oauthService.getIdToken())) {
-          this.importInProgress = false;
           return;
         }
         console.log("Login successful: "+this.oauthService.getIdToken());
@@ -638,7 +633,6 @@ export class EditIdentityComponent implements OnInit {
     localStorage.removeItem('emailForCredential');
     localStorage.removeItem('credentialCode');
     localStorage.removeItem('oidcRequestState');
-    this.importInProgress = false;
     this.oauthService.logOut();
     this.updateAttributes();
   }
@@ -669,7 +663,6 @@ export class EditIdentityComponent implements OnInit {
         localStorage.removeItem('emailForCredential');
         localStorage.removeItem('credentialCode');
         localStorage.removeItem('oidcRequestState');
-        this.importInProgress = false;
         this.oauthService.logOut();
         this.updateAttributes();
       })
@@ -706,7 +699,6 @@ export class EditIdentityComponent implements OnInit {
   }
 
   importAttributesFromCredential() {
-    this.importInProgress = true;
     this.reclaimService.addCredential(this.identity, 
this.newCredential).subscribe(res => {
       console.log("Stored credential");
       this.reclaimService.getCredentials(this.identity).subscribe(creds => {
@@ -721,7 +713,6 @@ export class EditIdentityComponent implements OnInit {
           }
           if (null == cred) {
             console.log("ERROR: credential was not added!");
-            this.importInProgress = false;
             return;
           }
           console.log("Trying to import " + cred.attributes.length + " 
attributes");
@@ -768,7 +759,6 @@ export class EditIdentityComponent implements OnInit {
 
   private validateEmailForImport() {
     var emailAddr = localStorage.getItem('emailForCredential');
-    this.importInProgress = false;
     if ((undefined === emailAddr) || (null == emailAddr)) {
       for (let attr of this.attributes) {
         if (attr.name !== 'email') {
@@ -789,7 +779,6 @@ export class EditIdentityComponent implements OnInit {
       this.validImportEmail = false;
       return;
     }
-    this.importInProgress = true;
     this.discoverIdProvider(emailAddr);
   }
 
@@ -813,7 +802,6 @@ export class EditIdentityComponent implements OnInit {
                                              this.tryImportCredential();
     },
     error => {
-      this.importInProgress = false;
       this.validImportEmail = false;
       console.log (error);
     });
diff --git a/src/locales/de/messages.json b/src/locales/de/messages.json
index 8bd7978..8157ad6 100644
--- a/src/locales/de/messages.json
+++ b/src/locales/de/messages.json
@@ -33,6 +33,7 @@
     "authorization_request_html@cancelRequest": "Verifikation abbrechen",
     "authorization_request_html@requestCancelled": "Anfrage abgebrochen",
     "edit_authorizations_html@manageAuths": "Autorisierungen verwalten für",
+    "edit_authorizations_html@noAuthorizations": "Du hast noch keine 
Autorisierungen gegeben.",
     "edit_authorizations_html@authEntity": "Autorisierte Partei:",
     "edit_authorizations_html@sharedAttributes": "Geteilte Attribute:",
     "edit_authorizations_html@revokeVerifikation": "Willst du diese 
Autorisierung wirklich aufheben?",
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 5e348cf..48924d1 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -33,6 +33,7 @@
     "authorization_request_html@cancelRequest": "Cancel verification request",
     "authorization_request_html@requestCancelled": "Request cancelled",
     "edit_authorizations_html@manageAuths": "Manage authorizations for",
+    "edit_authorizations_html@noAuthorizations": "You have not yet given any 
authorizations.",
     "edit_authorizations_html@authEntity": "Authorized Entity:",
     "edit_authorizations_html@sharedAttributes": "Shared attributes:",
     "edit_authorizations_html@revokeVerifikation": "Do you really want to 
revoke this authorization?",

-- 
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]