hasLoaded spinners

This commit is contained in:
Kyle Spearrin 2018-12-11 15:16:45 -05:00
parent 4a0b4de322
commit dc1ffafdf3
4 changed files with 20 additions and 8 deletions

View File

@ -1,8 +1,13 @@
<div class="page-header"> <div class="page-header">
<h1>{{'reusedPasswordsReport' | i18n}}</h1> <h1>
{{'reusedPasswordsReport' | i18n}}
<small *ngIf="hasLoaded && loading">
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i>
</small>
</h1>
</div> </div>
<p>{{'reusedPasswordsReportDesc' | i18n}}</p> <p>{{'reusedPasswordsReportDesc' | i18n}}</p>
<div *ngIf="loading"> <div *ngIf="!hasLoaded && loading">
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i> <i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i>
</div> </div>
<div class="mt-4" *ngIf="!loading"> <div class="mt-4" *ngIf="!loading">

View File

@ -32,7 +32,7 @@ export class ReusedPasswordsReportComponent implements OnInit {
constructor(private ciphersService: CipherService, private componentFactoryResolver: ComponentFactoryResolver) { } constructor(private ciphersService: CipherService, private componentFactoryResolver: ComponentFactoryResolver) { }
async ngOnInit() { async ngOnInit() {
this.load(); await this.load();
this.hasLoaded = true; this.hasLoaded = true;
} }
@ -52,8 +52,9 @@ export class ReusedPasswordsReportComponent implements OnInit {
this.passwordUseMap.set(c.login.password, 1); this.passwordUseMap.set(c.login.password, 1);
} }
}); });
this.ciphers = ciphersWithPasswords.filter((c) => const reusedPasswordCiphers = ciphersWithPasswords.filter((c) =>
this.passwordUseMap.has(c.login.password) && this.passwordUseMap.get(c.login.password) > 1); this.passwordUseMap.has(c.login.password) && this.passwordUseMap.get(c.login.password) > 1);
this.ciphers = reusedPasswordCiphers;
this.loading = false; this.loading = false;
} }

View File

@ -1,8 +1,13 @@
<div class="page-header"> <div class="page-header">
<h1>{{'unsecuredWebsitesReport' | i18n}}</h1> <h1>
{{'unsecuredWebsitesReport' | i18n}}
<small *ngIf="hasLoaded && loading">
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i>
</small>
</h1>
</div> </div>
<p>{{'unsecuredWebsitesReportDesc' | i18n}}</p> <p>{{'unsecuredWebsitesReportDesc' | i18n}}</p>
<div *ngIf="loading"> <div *ngIf="!hasLoaded && loading">
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i> <i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}"></i>
</div> </div>
<div class="mt-4" *ngIf="!loading"> <div class="mt-4" *ngIf="!loading">

View File

@ -31,19 +31,20 @@ export class UnsecuredWebsitesReportComponent implements OnInit {
constructor(private ciphersService: CipherService, private componentFactoryResolver: ComponentFactoryResolver) { } constructor(private ciphersService: CipherService, private componentFactoryResolver: ComponentFactoryResolver) { }
async ngOnInit() { async ngOnInit() {
this.load(); await this.load();
this.hasLoaded = true; this.hasLoaded = true;
} }
async load() { async load() {
this.loading = true; this.loading = true;
const allCiphers = await this.ciphersService.getAllDecrypted(); const allCiphers = await this.ciphersService.getAllDecrypted();
this.ciphers = allCiphers.filter((c) => { const unsecuredCiphers = allCiphers.filter((c) => {
if (c.type !== CipherType.Login || !c.login.hasUris) { if (c.type !== CipherType.Login || !c.login.hasUris) {
return false; return false;
} }
return c.login.uris.find((u) => u.uri.indexOf('http://') === 0) != null; return c.login.uris.find((u) => u.uri.indexOf('http://') === 0) != null;
}); });
this.ciphers = unsecuredCiphers;
this.loading = false; this.loading = false;
} }