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:
parent
6cea32839b
commit
32c2cba2e7
@ -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";
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user