1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-18 15:47:57 +01:00

create pipe for replacing string in template (#12381)

This commit is contained in:
Brandon Treston 2024-12-16 10:07:46 -05:00 committed by GitHub
parent 6cea32839b
commit 32c2cba2e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 3 deletions

View File

@ -4,3 +4,4 @@ export * from "./manage-client-name-dialog.component";
export * from "./manage-client-subscription-dialog.component";
export * from "./no-clients.component";
export * from "./vnext-manage-clients.component";
export * from "./replace.pipe";

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: "replace",
standalone: true,
})
export class ReplacePipe implements PipeTransform {
transform(value: string, pattern: string, replacement: string): string {
return value.replace(pattern, replacement);
}
}

View File

@ -46,7 +46,7 @@
<span class="tw-text-muted">{{ row.remainingSeats }}</span>
</td>
<td bitCell class="tw-whitespace-nowrap">
<span class="tw-text-muted">{{ row.plan }}</span>
<span class="tw-text-muted">{{ row.plan | replace: " (Monthly)" : "" }}</span>
</td>
<td bitCell class="tw-text-right">
<button

View File

@ -37,6 +37,7 @@ import {
ManageClientSubscriptionDialogResultType,
openManageClientSubscriptionDialog,
} from "./manage-client-subscription-dialog.component";
import { ReplacePipe } from "./replace.pipe";
import { vNextNoClientsComponent } from "./vnext-no-clients.component";
@Component({
@ -48,6 +49,7 @@ import { vNextNoClientsComponent } from "./vnext-no-clients.component";
HeaderModule,
SharedOrganizationModule,
vNextNoClientsComponent,
ReplacePipe,
],
})
export class vNextManageClientsComponent {
@ -115,8 +117,6 @@ export class vNextManageClientsComponent {
const clients = (await this.billingApiService.getProviderClientOrganizations(this.providerId))
.data;
clients.forEach((client) => (client.plan = client.plan?.replace(" (Monthly)", "")));
this.dataSource.data = clients;
this.plans = (await this.billingApiService.getPlans()).data;