mirror of
https://github.com/bitwarden/browser
synced 2026-02-22 20:34:04 +00:00
* PM-28183 implemented new sends filter and search design * PM-28183 resolved table issue fallout from merge conflict * PM-28183 resolved browser paste url issue * PM-28183 put new feature behind feature flag * PM-28183 resolved feature flag * PM-28183 resolved type-safe approach pr comment * PM-28183 resolved DesktopSendUIRefresh feature flag is enabled. pr comment * PM-28183 restored SendUIRefresh * PM-28183 resolved query parameter subscription pr comment * PM-28183 resolved pr comment re enum like objects * PM-28183 resolved remove enum like objects pr comment * PM-28183 resolved pr comment re defining filteredSends member variable * PM-28183 resolved pr comment re Code Duplication in syncCompleted Handler * PM-28183 resolved pr comment re Floating Promise * PM-28183 restored feature flag * PM-28183 resolved pr comment re Dual Binding Pattern * PM28183 resolved options cell button pr comment * PM 28183 resolved pr comment re Incorrect CSS Class - Breaking Layout * PM 28183 resolved pr comment re uery Param Update Causes Redundant Filter Application * PM-28183 resolved lint issues * PM 28183 resolved lint issues * PM-28183 resolved type issue with import * PM-28183 resolved import in failling test * chore: rerun web build * PM-28183 resolved build issues * PM-28183 resolved build issues * PM-28183 resolved lint issues
106 lines
3.4 KiB
TypeScript
106 lines
3.4 KiB
TypeScript
// FIXME: Update this file to be type safe and remove this and next line
|
|
// @ts-strict-ignore
|
|
import { CommonModule } from "@angular/common";
|
|
import { Component, Input } from "@angular/core";
|
|
import { RouterLink } from "@angular/router";
|
|
import { firstValueFrom } from "rxjs";
|
|
|
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
|
import { SendType } from "@bitwarden/common/tools/send/types/send-type";
|
|
import {
|
|
BadgeModule,
|
|
ButtonModule,
|
|
DialogService,
|
|
IconButtonModule,
|
|
ItemModule,
|
|
SectionComponent,
|
|
SectionHeaderComponent,
|
|
ToastService,
|
|
TypographyModule,
|
|
} from "@bitwarden/components";
|
|
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
|
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
|
@Component({
|
|
imports: [
|
|
CommonModule,
|
|
ItemModule,
|
|
ButtonModule,
|
|
BadgeModule,
|
|
IconButtonModule,
|
|
SectionComponent,
|
|
TypographyModule,
|
|
JslibModule,
|
|
SectionHeaderComponent,
|
|
RouterLink,
|
|
],
|
|
selector: "app-send-list-items-container",
|
|
templateUrl: "send-list-items-container.component.html",
|
|
})
|
|
export class SendListItemsContainerComponent {
|
|
sendType = SendType;
|
|
/**
|
|
* The list of sends to display.
|
|
*/
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
|
|
// eslint-disable-next-line @angular-eslint/prefer-signals
|
|
@Input()
|
|
sends: SendView[] = [];
|
|
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
|
|
// eslint-disable-next-line @angular-eslint/prefer-signals
|
|
@Input()
|
|
headerText: string;
|
|
|
|
constructor(
|
|
protected dialogService: DialogService,
|
|
protected environmentService: EnvironmentService,
|
|
protected i18nService: I18nService,
|
|
protected logService: LogService,
|
|
protected platformUtilsService: PlatformUtilsService,
|
|
protected sendApiService: SendApiService,
|
|
protected toastService: ToastService,
|
|
) {}
|
|
|
|
async deleteSend(s: SendView): Promise<boolean> {
|
|
const confirmed = await this.dialogService.openSimpleDialog({
|
|
title: { key: "deleteSend" },
|
|
content: { key: "deleteSendPermanentConfirmation" },
|
|
type: "warning",
|
|
});
|
|
|
|
if (!confirmed) {
|
|
return false;
|
|
}
|
|
|
|
await this.sendApiService.delete(s.id);
|
|
|
|
try {
|
|
this.toastService.showToast({
|
|
variant: "success",
|
|
title: null,
|
|
message: this.i18nService.t("deletedSend"),
|
|
});
|
|
} catch (e) {
|
|
this.logService.error(e);
|
|
}
|
|
}
|
|
|
|
async copySendLink(send: SendView) {
|
|
const env = await firstValueFrom(this.environmentService.environment$);
|
|
const link = env.getSendUrl() + send.accessId + "/" + send.urlB64Key;
|
|
this.platformUtilsService.copyToClipboard(link);
|
|
this.toastService.showToast({
|
|
variant: "success",
|
|
title: null,
|
|
message: this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
|
});
|
|
}
|
|
}
|