mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
Compare commits
9 Commits
fix/filter
...
feature/cl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
283f295481 | ||
|
|
749ead5863 | ||
|
|
8d369bcf84 | ||
|
|
aa7fb1befb | ||
|
|
43ca31e0ae | ||
|
|
0dfc8c5a0b | ||
|
|
c1801dfc61 | ||
|
|
59a53740a4 | ||
|
|
dd2c2b9720 |
2
jslib
2
jslib
Submodule jslib updated: 3cb94623e2...3bf25edd3e
@@ -122,20 +122,17 @@ export abstract class BaseEventsComponent {
|
||||
const userId = r.actingUserId == null ? r.userId : r.actingUserId;
|
||||
const eventInfo = await this.eventService.getEventInfo(r);
|
||||
const user = this.getUserName(r, userId);
|
||||
const userName = user != null ? user.name : this.i18nService.t("unknown");
|
||||
|
||||
return new EventView({
|
||||
message: eventInfo.message,
|
||||
humanReadableMessage: eventInfo.humanReadableMessage,
|
||||
appIcon: eventInfo.appIcon,
|
||||
appName: eventInfo.appName,
|
||||
userId: userId,
|
||||
userName: r.installationId != null ? `Installation: ${r.installationId}` : userName,
|
||||
userName: user != null ? user.name : this.i18nService.t("unknown"),
|
||||
userEmail: user != null ? user.email : "",
|
||||
date: r.date,
|
||||
ip: r.ipAddress,
|
||||
type: r.type,
|
||||
installationId: r.installationId,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="container footer text-muted">
|
||||
<div class="row">
|
||||
<div class="col">© {{ year }} Bitwarden Inc.</div>
|
||||
<div class="col">© {{ year }}, Bitwarden Inc.</div>
|
||||
<div class="col text-center"></div>
|
||||
<div class="col text-right">
|
||||
{{ "versionNumber" | i18n: version }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<router-outlet></router-outlet>
|
||||
<div class="container my-5 text-muted text-center">
|
||||
© {{ year }} Bitwarden Inc. <br />
|
||||
© {{ year }}, Bitwarden Inc. <br />
|
||||
{{ "versionNumber" | i18n: version }}
|
||||
</div>
|
||||
|
||||
@@ -53,7 +53,13 @@ import localeZhTw from "@angular/common/locales/zh-Hant";
|
||||
import { NgModule } from "@angular/core";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { RouterModule } from "@angular/router";
|
||||
import { BadgeModule, ButtonModule, CalloutModule, MenuModule } from "@bitwarden/components";
|
||||
import {
|
||||
BadgeModule,
|
||||
ButtonModule,
|
||||
CalloutModule,
|
||||
FormFieldModule,
|
||||
MenuModule,
|
||||
} from "@bitwarden/components";
|
||||
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
||||
import { ToastrModule } from "ngx-toastr";
|
||||
|
||||
@@ -126,6 +132,7 @@ registerLocaleData(localeZhTw, "zh-TW");
|
||||
BadgeModule,
|
||||
ButtonModule,
|
||||
MenuModule,
|
||||
FormFieldModule,
|
||||
],
|
||||
exports: [
|
||||
CommonModule,
|
||||
@@ -136,6 +143,7 @@ registerLocaleData(localeZhTw, "zh-TW");
|
||||
ReactiveFormsModule,
|
||||
RouterModule,
|
||||
BadgeModule,
|
||||
FormFieldModule,
|
||||
ButtonModule,
|
||||
CalloutModule,
|
||||
ToastrModule,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
</button>
|
||||
<h3 class="filter-title"> {{ collectionsGrouping.name | i18n }}</h3>
|
||||
<h3 class="filter-title">{{ collectionsGrouping.name | i18n }}</h3>
|
||||
</div>
|
||||
<ul id="collection-filters" *ngIf="!isCollapsed(collectionsGrouping)" class="filter-options">
|
||||
<ng-template #recursiveCollections let-collections>
|
||||
@@ -51,7 +51,7 @@
|
||||
class="bwi bwi-collection bwi-fw"
|
||||
aria-hidden="true"
|
||||
></i
|
||||
> {{ c.node.name }}
|
||||
>{{ c.node.name }}
|
||||
</button>
|
||||
</span>
|
||||
<ul
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
}"
|
||||
></i>
|
||||
</button>
|
||||
<h3 class="filter-title"> {{ "folders" | i18n }}</h3>
|
||||
<h3 class="filter-title">
|
||||
{{ "folders" | i18n }}
|
||||
</h3>
|
||||
<button
|
||||
class="text-muted ml-auto add-button"
|
||||
(click)="addFolder()"
|
||||
@@ -54,7 +56,7 @@
|
||||
</button>
|
||||
<button class="filter-button" (click)="applyFilter(f.node)">
|
||||
<i *ngIf="f.children.length === 0" class="bwi bwi-fw bwi-folder" aria-hidden="true"></i
|
||||
> {{ f.node.name }}
|
||||
>{{ f.node.name }}
|
||||
</button>
|
||||
<button
|
||||
class="edit-button"
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
}"
|
||||
></i>
|
||||
</button>
|
||||
<h3> {{ "types" | i18n }}</h3>
|
||||
<h3>
|
||||
{{ "types" | i18n }}
|
||||
</h3>
|
||||
</div>
|
||||
<ul id="type-filters" *ngIf="!isCollapsed" class="filter-options">
|
||||
<li
|
||||
@@ -24,14 +26,14 @@
|
||||
>
|
||||
<span class="filter-buttons">
|
||||
<button class="filter-button" (click)="applyFilter(cipherTypeEnum.Login)">
|
||||
<i class="bwi bwi-fw bwi-globe" aria-hidden="true"></i> {{ "typeLogin" | i18n }}
|
||||
<i class="bwi bwi-fw bwi-globe" aria-hidden="true"></i>{{ "typeLogin" | i18n }}
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
<li class="filter-option" [ngClass]="{ active: activeFilter.cipherType === cipherTypeEnum.Card }">
|
||||
<span class="filter-buttons">
|
||||
<button class="filter-button" (click)="applyFilter(cipherTypeEnum.Card)">
|
||||
<i class="bwi bwi-fw bwi-credit-card" aria-hidden="true"></i> {{ "typeCard" | i18n }}
|
||||
<i class="bwi bwi-fw bwi-credit-card" aria-hidden="true"></i>{{ "typeCard" | i18n }}
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
@@ -41,7 +43,7 @@
|
||||
>
|
||||
<span class="filter-buttons">
|
||||
<button class="filter-button" (click)="applyFilter(cipherTypeEnum.Identity)">
|
||||
<i class="bwi bwi-fw bwi-id-card" aria-hidden="true"></i> {{ "typeIdentity" | i18n }}
|
||||
<i class="bwi bwi-fw bwi-id-card" aria-hidden="true"></i>{{ "typeIdentity" | i18n }}
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
@@ -51,9 +53,7 @@
|
||||
>
|
||||
<span class="filter-buttons">
|
||||
<button class="filter-button" (click)="applyFilter(cipherTypeEnum.SecureNote)">
|
||||
<i class="bwi bwi-fw bwi-sticky-note" aria-hidden="true"></i> {{
|
||||
"typeSecureNote" | i18n
|
||||
}}
|
||||
<i class="bwi bwi-fw bwi-sticky-note" aria-hidden="true"></i>{{ "typeSecureNote" | i18n }}
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
@@ -27,4 +27,18 @@ export class VaultFilterComponent extends BaseVaultFilterComponent {
|
||||
searchTextChanged() {
|
||||
this.onSearchTextChanged.emit(this.searchText);
|
||||
}
|
||||
|
||||
// This method exists because the vault component gets its data mixed up during the initial sync on first login. It looks for data before the sync is complete.
|
||||
// It should be removed as soon as doing so makes sense.
|
||||
async reloadOrganizations() {
|
||||
this.organizations = await this.vaultFilterService.buildOrganizations();
|
||||
this.activePersonalOwnershipPolicy =
|
||||
await this.vaultFilterService.checkForPersonalOwnershipPolicy();
|
||||
this.activeSingleOrganizationPolicy =
|
||||
await this.vaultFilterService.checkForSingleOrganizationPolicy();
|
||||
}
|
||||
|
||||
async initCollections() {
|
||||
return await this.vaultFilterService.buildCollections(this.organization?.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { NgModule } from "@angular/core";
|
||||
|
||||
import { VaultFilterService } from "jslib-angular/modules/vault-filter/vault-filter.service";
|
||||
import { CipherService } from "jslib-common/abstractions/cipher.service";
|
||||
import { CollectionService } from "jslib-common/abstractions/collection.service";
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { SharedModule } from "../shared.module";
|
||||
|
||||
@@ -24,6 +30,19 @@ import { VaultFilterComponent } from "./vault-filter.component";
|
||||
TypeFilterComponent,
|
||||
],
|
||||
exports: [VaultFilterComponent],
|
||||
providers: [VaultFilterService],
|
||||
providers: [
|
||||
{
|
||||
provide: VaultFilterService,
|
||||
useClass: VaultFilterService,
|
||||
deps: [
|
||||
StateService,
|
||||
OrganizationService,
|
||||
FolderService,
|
||||
CipherService,
|
||||
CollectionService,
|
||||
PolicyService,
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class VaultFilterModule {}
|
||||
|
||||
3
src/app/modules/vault-filter/vault-filter.service.ts
Normal file
3
src/app/modules/vault-filter/vault-filter.service.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { VaultFilterService as BaseVaultFilterService } from "jslib-angular/modules/vault-filter/vault-filter.service";
|
||||
|
||||
export class VaultFilterService extends BaseVaultFilterService {}
|
||||
@@ -98,7 +98,6 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
|
||||
this.vaultFilterComponent.reloadCollectionsAndFolders(
|
||||
new VaultFilter({
|
||||
selectedOrganizationId: this.organization.id,
|
||||
useAdminCollections: this.organization.canEditAnyCollection,
|
||||
} as Partial<VaultFilter>)
|
||||
),
|
||||
this.ciphersComponent.refresh(),
|
||||
@@ -111,10 +110,7 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
await this.vaultFilterComponent.reloadCollectionsAndFolders(
|
||||
new VaultFilter({
|
||||
selectedOrganizationId: this.organization.id,
|
||||
useAdminCollections: this.organization.canEditAnyCollection,
|
||||
} as Partial<VaultFilter>)
|
||||
new VaultFilter({ selectedOrganizationId: this.organization.id } as Partial<VaultFilter>)
|
||||
);
|
||||
await this.ciphersComponent.reload();
|
||||
|
||||
|
||||
@@ -14,62 +14,50 @@
|
||||
#form
|
||||
(ngSubmit)="submit()"
|
||||
[appApiAction]="formPromise"
|
||||
ngNativeValidate
|
||||
[formGroup]="formData"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="name">{{ "organizationName" | i18n }}</label>
|
||||
<input
|
||||
id="name"
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="Name"
|
||||
[(ngModel)]="org.name"
|
||||
[disabled]="selfHosted"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="billingEmail">{{ "billingEmail" | i18n }}</label>
|
||||
<input
|
||||
id="billingEmail"
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="BillingEmail"
|
||||
[(ngModel)]="org.billingEmail"
|
||||
[disabled]="selfHosted || !canManageBilling"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="businessName">{{ "businessName" | i18n }}</label>
|
||||
<input
|
||||
id="businessName"
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="BusinessName"
|
||||
[(ngModel)]="org.businessName"
|
||||
[disabled]="selfHosted || !canManageBilling"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="identifier">{{ "identifier" | i18n }}</label>
|
||||
<input
|
||||
id="identifier"
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="Identifier"
|
||||
[(ngModel)]="org.identifier"
|
||||
/>
|
||||
</div>
|
||||
<bit-form-field>
|
||||
<bit-label>{{ "organizationName" | i18n }}</bit-label>
|
||||
<input bitInput type="text" formControlName="name" />
|
||||
</bit-form-field>
|
||||
|
||||
<bit-form-field>
|
||||
<bit-label>{{ "billingEmail" | i18n }}</bit-label>
|
||||
<input bitInput type="email" formControlName="billingEmail" />
|
||||
</bit-form-field>
|
||||
|
||||
<bit-form-field>
|
||||
<bit-label>{{ "businessName" | i18n }}</bit-label>
|
||||
<input bitInput type="text" formControlName="businessName" />
|
||||
</bit-form-field>
|
||||
|
||||
<bit-form-field>
|
||||
<bit-label>{{ "identifier" | i18n }}</bit-label>
|
||||
<input bitInput type="text" formControlName="identifier" />
|
||||
</bit-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<app-avatar data="{{ org.name }}" dynamic="true" size="75" fontSize="35"></app-avatar>
|
||||
<app-avatar
|
||||
[data]="formData.get('name').value"
|
||||
dynamic="true"
|
||||
size="75"
|
||||
fontSize="35"
|
||||
></app-avatar>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
|
||||
<button
|
||||
type="submit"
|
||||
bit-button
|
||||
buttonType="primary"
|
||||
class="btn-submit"
|
||||
[disabled]="form.loading"
|
||||
>
|
||||
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
||||
<span>{{ "save" | i18n }}</span>
|
||||
</button>
|
||||
<bit-error-summary *ngIf="showErrorSummary" [formGroup]="formData"></bit-error-summary>
|
||||
</form>
|
||||
<ng-container *ngIf="canUseApi">
|
||||
<div class="secondary-header border-0 mb-0">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, ViewChild, ViewContainerRef } from "@angular/core";
|
||||
import { FormBuilder, Validators } from "@angular/forms";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
import { ModalService } from "jslib-angular/services/modal.service";
|
||||
@@ -41,10 +42,19 @@ export class AccountComponent {
|
||||
org: OrganizationResponse;
|
||||
formPromise: Promise<any>;
|
||||
taxFormPromise: Promise<any>;
|
||||
showErrorSummary = false;
|
||||
|
||||
private organizationId: string;
|
||||
|
||||
formData = this.formBuilder.group({
|
||||
name: ["", [Validators.required]],
|
||||
billingEmail: ["", [Validators.required, Validators.email]],
|
||||
businessName: [],
|
||||
identifier: [],
|
||||
});
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private modalService: ModalService,
|
||||
private apiService: ApiService,
|
||||
private i18nService: I18nService,
|
||||
@@ -60,6 +70,12 @@ export class AccountComponent {
|
||||
async ngOnInit() {
|
||||
this.selfHosted = this.platformUtilsService.isSelfHost();
|
||||
|
||||
if (this.selfHosted) {
|
||||
this.formData.disable();
|
||||
} else {
|
||||
this.formData.enable();
|
||||
}
|
||||
|
||||
this.route.parent.parent.params.subscribe(async (params) => {
|
||||
this.organizationId = params.organizationId;
|
||||
this.canManageBilling = (
|
||||
@@ -68,6 +84,13 @@ export class AccountComponent {
|
||||
try {
|
||||
this.org = await this.apiService.getOrganization(this.organizationId);
|
||||
this.canUseApi = this.org.useApi;
|
||||
|
||||
this.formData.setValue({
|
||||
name: this.org.name,
|
||||
billingEmail: this.org.billingEmail,
|
||||
businessName: this.org.businessName,
|
||||
identifier: this.org.identifier,
|
||||
});
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
@@ -76,12 +99,19 @@ export class AccountComponent {
|
||||
}
|
||||
|
||||
async submit() {
|
||||
this.formData.markAllAsTouched();
|
||||
this.showErrorSummary = true;
|
||||
|
||||
if (!this.formData.valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const request = new OrganizationUpdateRequest();
|
||||
request.name = this.org.name;
|
||||
request.businessName = this.org.businessName;
|
||||
request.billingEmail = this.org.billingEmail;
|
||||
request.identifier = this.org.identifier;
|
||||
request.name = this.formData.get("name").value;
|
||||
request.businessName = this.formData.get("businessName").value;
|
||||
request.billingEmail = this.formData.get("billingEmail").value;
|
||||
request.identifier = this.formData.get("identifier").value;
|
||||
|
||||
// Backfill pub/priv key if necessary
|
||||
if (!this.org.hasPublicAndPrivateKeys) {
|
||||
|
||||
@@ -307,9 +307,6 @@ export class EventService {
|
||||
case EventType.Organization_DisabledKeyConnector:
|
||||
msg = humanReadableMsg = this.i18nService.t("disabledKeyConnector");
|
||||
break;
|
||||
case EventType.Organization_SponsorshipsSynced:
|
||||
msg = humanReadableMsg = this.i18nService.t("sponsorshipsSynced");
|
||||
break;
|
||||
// Policies
|
||||
case EventType.Policy_Updated: {
|
||||
msg = this.i18nService.t("modifiedPolicyId", this.formatPolicyId(ev));
|
||||
|
||||
@@ -5041,9 +5041,6 @@
|
||||
"message": "Last Sync",
|
||||
"Description": "Used as a prefix to indicate the last time a sync occured. Example \"Last sync 1968-11-16 00:00:00\""
|
||||
},
|
||||
"sponsorshipsSynced": {
|
||||
"message": "Self-hosted sponsorships synced."
|
||||
},
|
||||
"billingManagedByProvider": {
|
||||
"message": "Managed by $PROVIDER$",
|
||||
"placeholders": {
|
||||
@@ -5069,5 +5066,20 @@
|
||||
},
|
||||
"apiAccessToken": {
|
||||
"message": "API Access Token"
|
||||
},
|
||||
"inputRequired": {
|
||||
"message": "Input is required."
|
||||
},
|
||||
"inputEmail": {
|
||||
"message": "Input is not an email-address."
|
||||
},
|
||||
"fieldsNeedAttention": {
|
||||
"message": "$COUNT$ field(s) above need your attention.",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"content": "$1",
|
||||
"example": "4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user