1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-06 18:57:56 +01:00

loaded state for orgs

This commit is contained in:
Kyle Spearrin 2018-06-11 10:26:02 -04:00
parent a0ac8ec9c2
commit 5bd9a9a81d
2 changed files with 20 additions and 15 deletions

View File

@ -1,9 +1,14 @@
<p *ngIf="!loaded" class="text-muted">
<i class="fa fa-spinner fa-spin"></i>
</p>
<ng-container *ngIf="loaded">
<ul class="fa-ul card-ul carets"> <ul class="fa-ul card-ul carets">
<li *ngFor="let o of organizations"> <li *ngFor="let o of organizations">
<a href="#" class="text-body" appStopClick appBlurClick (click)="selectOrganization(o)"> <a href="#" class="text-body" appStopClick appBlurClick (click)="selectOrganization(o)">
<i class="fa-li fa fa-caret-right"></i> {{o.name}}</a> <i class="fa-li fa fa-caret-right"></i> {{o.name}}</a>
</li> </li>
</ul> </ul>
</ng-container>
<button (click)="newOrganization()" class="btn btn-block btn-outline-primary"> <button (click)="newOrganization()" class="btn btn-block btn-outline-primary">
<i class="fa fa-plus fa-fw"></i> <i class="fa fa-plus fa-fw"></i>
{{'newOrganization' | i18n}} {{'newOrganization' | i18n}}

View File

@ -4,28 +4,28 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { UserService } from 'jslib/abstractions/user.service'; import { UserService } from 'jslib/abstractions/user.service';
import { Organization } from 'jslib/models/domain/organization';
@Component({ @Component({
selector: 'app-vault-organizations', selector: 'app-vault-organizations',
templateUrl: 'organizations.component.html', templateUrl: 'organizations.component.html',
}) })
export class OrganizationsComponent { export class OrganizationsComponent {
@Output() onOrganizationClicked = new EventEmitter<any>(); @Output() onOrganizationClicked = new EventEmitter<Organization>();
organizations: any; organizations: Organization[];
loaded: boolean = false;
constructor(private userService: UserService, private analytics: Angulartics2, constructor(private userService: UserService) {
private toasterService: ToasterService) {
} }
async load() { async load() {
this.organizations = await this.userService.getAllOrganizations(); this.organizations = await this.userService.getAllOrganizations();
this.loaded = true;
} }
selectOrganization(o: any) { selectOrganization(o: Organization) {
this.onOrganizationClicked.emit(0); this.onOrganizationClicked.emit(o);
} }
} }