1
0
mirror of https://github.com/bitwarden/web synced 2025-12-22 19:23:42 +00:00

[End User Vault Refresh] Vault - remove Org and Provider cards (#1529)

This commit is contained in:
Thomas Rittson
2022-03-23 06:32:13 +10:00
committed by GitHub
parent 9b742ed0d7
commit f8ff75aa1b
6 changed files with 141 additions and 245 deletions

View File

@@ -1,29 +1,5 @@
<ng-container *ngIf="vault"> <app-navbar></app-navbar>
<p *ngIf="!loaded" class="text-muted"> <div class="container page-content">
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span class="sr-only">{{ "loading" | i18n }}</span>
</p>
<ng-container *ngIf="loaded">
<ul class="bwi-ul card-ul carets" *ngIf="providers && providers.length">
<li *ngFor="let p of providers">
<a [routerLink]="['/providers', p.id]" class="text-body">
<i class="bwi bwi-li bwi-caret-right" aria-hidden="true"></i> {{ p.name }}
<ng-container *ngIf="!p.enabled">
<i
class="bwi bwi-exclamation-triangle text-danger"
title="{{ 'providerIsDisabled' | i18n }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ "providerIsDisabled" | i18n }}</span>
</ng-container>
</a>
</li>
</ul>
</ng-container>
</ng-container>
<ng-container *ngIf="!vault">
<app-navbar></app-navbar>
<div class="container page-content">
<div class="page-header d-flex"> <div class="page-header d-flex">
<h1>{{ "providers" | i18n }}</h1> <h1>{{ "providers" | i18n }}</h1>
</div> </div>
@@ -53,6 +29,5 @@
</tbody> </tbody>
</table> </table>
</ng-container> </ng-container>
</div> </div>
<app-footer></app-footer> <app-footer></app-footer>
</ng-container>

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { I18nService } from "jslib-common/abstractions/i18n.service"; import { I18nService } from "jslib-common/abstractions/i18n.service";
import { ProviderService } from "jslib-common/abstractions/provider.service"; import { ProviderService } from "jslib-common/abstractions/provider.service";
@@ -10,8 +10,6 @@ import { Provider } from "jslib-common/models/domain/provider";
templateUrl: "providers.component.html", templateUrl: "providers.component.html",
}) })
export class ProvidersComponent implements OnInit { export class ProvidersComponent implements OnInit {
@Input() vault = false;
providers: Provider[]; providers: Provider[];
loaded = false; loaded = false;
actionPromise: Promise<any>; actionPromise: Promise<any>;

View File

@@ -1,33 +1,4 @@
<ng-container *ngIf="vault"> <div class="page-header d-flex">
<p *ngIf="!loaded" class="text-muted">
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span class="sr-only">{{ "loading" | i18n }}</span>
</p>
<ng-container *ngIf="loaded">
<ul class="bwi-ul card-ul carets" *ngIf="organizations && organizations.length">
<li *ngFor="let o of organizations">
<a [routerLink]="['/organizations', o.id]" class="text-body">
<i class="bwi bwi-li bwi-caret-right" aria-hidden="true"></i> {{ o.name }}
<ng-container *ngIf="!o.enabled">
<i
class="bwi bwi-exclamation-triangle text-danger"
title="{{ 'organizationIsDisabled' | i18n }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ "organizationIsDisabled" | i18n }}</span>
</ng-container>
</a>
</li>
</ul>
<p *ngIf="!organizations || !organizations.length">{{ "noOrganizationsList" | i18n }}</p>
</ng-container>
<a href="#" routerLink="/settings/create-organization" class="btn btn-block btn-outline-primary">
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
{{ "newOrganization" | i18n }}
</a>
</ng-container>
<ng-container *ngIf="!vault">
<div class="page-header d-flex">
<h1> <h1>
{{ "organizations" | i18n }} {{ "organizations" | i18n }}
<small [appApiAction]="actionPromise" #action> <small [appApiAction]="actionPromise" #action>
@@ -50,16 +21,16 @@
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i> <i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
{{ "newOrganization" | i18n }} {{ "newOrganization" | i18n }}
</a> </a>
</div> </div>
<ng-container *ngIf="!loaded"> <ng-container *ngIf="!loaded">
<i <i
class="bwi bwi-spinner bwi-spin text-muted" class="bwi bwi-spinner bwi-spin text-muted"
title="{{ 'loading' | i18n }}" title="{{ 'loading' | i18n }}"
aria-hidden="true" aria-hidden="true"
></i> ></i>
<span class="sr-only">{{ "loading" | i18n }}</span> <span class="sr-only">{{ "loading" | i18n }}</span>
</ng-container> </ng-container>
<ng-container *ngIf="loaded"> <ng-container *ngIf="loaded">
<ng-container *ngIf="!organizations || !organizations.length"> <ng-container *ngIf="!organizations || !organizations.length">
<p>{{ "noOrganizationsList" | i18n }}</p> <p>{{ "noOrganizationsList" | i18n }}</p>
<a href="#" routerLink="/settings/create-organization" class="btn btn-outline-primary"> <a href="#" routerLink="/settings/create-organization" class="btn btn-outline-primary">
@@ -151,5 +122,4 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</ng-container>
</ng-container> </ng-container>

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ApiService } from "jslib-common/abstractions/api.service"; import { ApiService } from "jslib-common/abstractions/api.service";
import { CryptoService } from "jslib-common/abstractions/crypto.service"; import { CryptoService } from "jslib-common/abstractions/crypto.service";
@@ -19,8 +19,6 @@ import { OrganizationUserResetPasswordEnrollmentRequest } from "jslib-common/mod
templateUrl: "organizations.component.html", templateUrl: "organizations.component.html",
}) })
export class OrganizationsComponent implements OnInit { export class OrganizationsComponent implements OnInit {
@Input() vault = false;
organizations: Organization[]; organizations: Organization[];
policies: Policy[]; policies: Policy[];
loaded = false; loaded = false;
@@ -38,11 +36,9 @@ export class OrganizationsComponent implements OnInit {
) {} ) {}
async ngOnInit() { async ngOnInit() {
if (!this.vault) {
await this.syncService.fullSync(true); await this.syncService.fullSync(true);
await this.load(); await this.load();
} }
}
async load() { async load() {
const orgs = await this.organizationService.getAll(); const orgs = await this.organizationService.getAll();

View File

@@ -97,40 +97,6 @@
</a> </a>
</div> </div>
</div> </div>
<div class="card mb-4">
<div class="card-header d-flex">
{{ "organizations" | i18n }}
<a
class="ml-auto"
href="https://bitwarden.com/help/about-organizations/"
target="_blank"
rel="noopener"
appA11yTitle="{{ 'learnMore' | i18n }}"
>
<i class="bwi bwi-question-circle" aria-hidden="true"></i>
</a>
</div>
<div class="card-body">
<app-organizations [vault]="true"></app-organizations>
</div>
</div>
<div class="card mt-4" *ngIf="showProviders">
<div class="card-header d-flex">
{{ "providers" | i18n }}
<a
class="ml-auto"
href="https://bitwarden.com/help/providers/"
target="_blank"
rel="noopener"
appA11yTitle="{{ 'learnMore' | i18n }}"
>
<i class="bwi bwi-question-circle" aria-hidden="true"></i>
</a>
</div>
<div class="card-body">
<app-providers vault="true"></app-providers>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -17,14 +17,12 @@ import { I18nService } from "jslib-common/abstractions/i18n.service";
import { MessagingService } from "jslib-common/abstractions/messaging.service"; import { MessagingService } from "jslib-common/abstractions/messaging.service";
import { OrganizationService } from "jslib-common/abstractions/organization.service"; import { OrganizationService } from "jslib-common/abstractions/organization.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service"; import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { ProviderService } from "jslib-common/abstractions/provider.service";
import { StateService } from "jslib-common/abstractions/state.service"; import { StateService } from "jslib-common/abstractions/state.service";
import { SyncService } from "jslib-common/abstractions/sync.service"; import { SyncService } from "jslib-common/abstractions/sync.service";
import { TokenService } from "jslib-common/abstractions/token.service"; import { TokenService } from "jslib-common/abstractions/token.service";
import { CipherType } from "jslib-common/enums/cipherType"; import { CipherType } from "jslib-common/enums/cipherType";
import { CipherView } from "jslib-common/models/view/cipherView"; import { CipherView } from "jslib-common/models/view/cipherView";
import { OrganizationsComponent } from "../settings/organizations.component";
import { UpdateKeyComponent } from "../settings/update-key.component"; import { UpdateKeyComponent } from "../settings/update-key.component";
import { AddEditComponent } from "./add-edit.component"; import { AddEditComponent } from "./add-edit.component";
@@ -44,8 +42,6 @@ const BroadcasterSubscriptionId = "VaultComponent";
export class VaultComponent implements OnInit, OnDestroy { export class VaultComponent implements OnInit, OnDestroy {
@ViewChild(GroupingsComponent, { static: true }) groupingsComponent: GroupingsComponent; @ViewChild(GroupingsComponent, { static: true }) groupingsComponent: GroupingsComponent;
@ViewChild(CiphersComponent, { static: true }) ciphersComponent: CiphersComponent; @ViewChild(CiphersComponent, { static: true }) ciphersComponent: CiphersComponent;
@ViewChild(OrganizationsComponent, { static: true })
organizationsComponent: OrganizationsComponent;
@ViewChild("attachments", { read: ViewContainerRef, static: true }) @ViewChild("attachments", { read: ViewContainerRef, static: true })
attachmentsModalRef: ViewContainerRef; attachmentsModalRef: ViewContainerRef;
@ViewChild("folderAddEdit", { read: ViewContainerRef, static: true }) @ViewChild("folderAddEdit", { read: ViewContainerRef, static: true })
@@ -66,7 +62,6 @@ export class VaultComponent implements OnInit, OnDestroy {
showBrowserOutdated = false; showBrowserOutdated = false;
showUpdateKey = false; showUpdateKey = false;
showPremiumCallout = false; showPremiumCallout = false;
showProviders = false;
deleted = false; deleted = false;
trashCleanupWarning: string = null; trashCleanupWarning: string = null;
@@ -84,8 +79,7 @@ export class VaultComponent implements OnInit, OnDestroy {
private broadcasterService: BroadcasterService, private broadcasterService: BroadcasterService,
private ngZone: NgZone, private ngZone: NgZone,
private stateService: StateService, private stateService: StateService,
private organizationService: OrganizationService, private organizationService: OrganizationService
private providerService: ProviderService
) {} ) {}
async ngOnInit() { async ngOnInit() {
@@ -104,9 +98,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.showPremiumCallout = this.showPremiumCallout =
!this.showVerifyEmail && !canAccessPremium && !this.platformUtilsService.isSelfHost(); !this.showVerifyEmail && !canAccessPremium && !this.platformUtilsService.isSelfHost();
this.showProviders = (await this.providerService.getAll()).length > 0; await this.groupingsComponent.load();
await Promise.all([this.groupingsComponent.load(), this.organizationsComponent.load()]);
this.showUpdateKey = !(await this.cryptoService.hasEncKey()); this.showUpdateKey = !(await this.cryptoService.hasEncKey());
if (params == null) { if (params == null) {
@@ -143,7 +135,6 @@ export class VaultComponent implements OnInit, OnDestroy {
if (message.successfully) { if (message.successfully) {
await Promise.all([ await Promise.all([
this.groupingsComponent.load(), this.groupingsComponent.load(),
this.organizationsComponent.load(),
this.ciphersComponent.load(this.ciphersComponent.filter), this.ciphersComponent.load(this.ciphersComponent.filter),
]); ]);
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();