mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Add a copy button to browser ext about dialog (#13465)
Add a copy button to browser extension about dialog for quickly copying the version number now that we have 3 different values we'd like to collect.
This commit is contained in:
@@ -176,6 +176,10 @@
|
|||||||
"copyNotes": {
|
"copyNotes": {
|
||||||
"message": "Copy notes"
|
"message": "Copy notes"
|
||||||
},
|
},
|
||||||
|
"copy": {
|
||||||
|
"message": "Copy",
|
||||||
|
"description": "Copy to clipboard"
|
||||||
|
},
|
||||||
"fill":{
|
"fill":{
|
||||||
"message": "Fill",
|
"message": "Fill",
|
||||||
"description": "This string is used on the vault page to indicate autofilling. Horizontal space is limited in the interface here so try and keep translations as concise as possible."
|
"description": "This string is used on the vault page to indicate autofilling. Horizontal space is limited in the interface here so try and keep translations as concise as possible."
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
<div bitDialogTitle>Bitwarden</div>
|
<div bitDialogTitle>Bitwarden</div>
|
||||||
<div bitDialogContent>
|
<div bitDialogContent>
|
||||||
<p>© Bitwarden Inc. 2015-{{ year }}</p>
|
<p>© Bitwarden Inc. 2015-{{ year }}</p>
|
||||||
<p class="user-select">{{ "version" | i18n }}: {{ version$ | async }}</p>
|
|
||||||
<p class="user-select">SDK: {{ sdkVersion$ | async }}</p>
|
<div #version class="user-select">
|
||||||
|
<p>{{ "version" | i18n }}: {{ version$ | async }}</p>
|
||||||
|
<p>SDK: {{ sdkVersion$ | async }}</p>
|
||||||
<ng-container *ngIf="data$ | async as data">
|
<ng-container *ngIf="data$ | async as data">
|
||||||
<p *ngIf="data.isCloud">
|
<p *ngIf="data.isCloud">
|
||||||
{{ "serverVersion" | i18n }}: {{ data.serverConfig?.version }}
|
{{ "serverVersion" | i18n }}: {{ data.serverConfig?.version }}
|
||||||
@@ -17,7 +19,7 @@
|
|||||||
|
|
||||||
<ng-container *ngIf="!data.isCloud">
|
<ng-container *ngIf="!data.isCloud">
|
||||||
<ng-container *ngIf="data.serverConfig.server">
|
<ng-container *ngIf="data.serverConfig.server">
|
||||||
<p class="user-select">
|
<p>
|
||||||
{{ "serverVersion" | i18n }} <small>({{ "thirdParty" | i18n }})</small>:
|
{{ "serverVersion" | i18n }} <small>({{ "thirdParty" | i18n }})</small>:
|
||||||
{{ data.serverConfig?.version }}
|
{{ data.serverConfig?.version }}
|
||||||
<span *ngIf="!data.serverConfig.isValid()">
|
<span *ngIf="!data.serverConfig.isValid()">
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<p class="user-select" *ngIf="!data.serverConfig.server">
|
<p *ngIf="!data.serverConfig.server">
|
||||||
{{ "serverVersion" | i18n }} <small>({{ "selfHostedServer" | i18n }})</small>:
|
{{ "serverVersion" | i18n }} <small>({{ "selfHostedServer" | i18n }})</small>:
|
||||||
{{ data.serverConfig?.version }}
|
{{ data.serverConfig?.version }}
|
||||||
<span *ngIf="!data.serverConfig.isValid()">
|
<span *ngIf="!data.serverConfig.isValid()">
|
||||||
@@ -39,9 +41,13 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div bitDialogFooter>
|
<div bitDialogFooter>
|
||||||
<button bitButton bitDialogClose buttonType="primary" type="button">
|
<button bitButton bitDialogClose buttonType="primary" type="button">
|
||||||
{{ "close" | i18n }}
|
{{ "close" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
|
<button bitButton type="button" (click)="copyVersion()">
|
||||||
|
{{ "copy" | i18n }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</bit-simple-dialog>
|
</bit-simple-dialog>
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
|
import { DialogRef } from "@angular/cdk/dialog";
|
||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component } from "@angular/core";
|
import { Component, ElementRef, ViewChild } from "@angular/core";
|
||||||
import { Observable, combineLatest, defer, map } from "rxjs";
|
import { Observable, combineLatest, defer, map } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
||||||
import { ButtonModule, DialogModule } from "@bitwarden/components";
|
import { ButtonModule, DialogModule, ToastService, TypographyModule } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "about-dialog.component.html",
|
templateUrl: "about-dialog.component.html",
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, JslibModule, DialogModule, ButtonModule],
|
imports: [CommonModule, JslibModule, DialogModule, ButtonModule, TypographyModule],
|
||||||
})
|
})
|
||||||
export class AboutDialogComponent {
|
export class AboutDialogComponent {
|
||||||
|
@ViewChild("version") protected version!: ElementRef;
|
||||||
|
|
||||||
protected year = new Date().getFullYear();
|
protected year = new Date().getFullYear();
|
||||||
protected version$: Observable<string>;
|
protected version$: Observable<string>;
|
||||||
|
|
||||||
@@ -26,11 +30,23 @@ export class AboutDialogComponent {
|
|||||||
protected sdkVersion$ = this.sdkService.version$;
|
protected sdkVersion$ = this.sdkService.version$;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private dialogRef: DialogRef,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
private environmentService: EnvironmentService,
|
private environmentService: EnvironmentService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private toastService: ToastService,
|
||||||
|
private i18nService: I18nService,
|
||||||
private sdkService: SdkService,
|
private sdkService: SdkService,
|
||||||
) {
|
) {
|
||||||
this.version$ = defer(() => this.platformUtilsService.getApplicationVersion());
|
this.version$ = defer(() => this.platformUtilsService.getApplicationVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected copyVersion() {
|
||||||
|
this.platformUtilsService.copyToClipboard(this.version.nativeElement.innerText);
|
||||||
|
this.toastService.showToast({
|
||||||
|
message: this.i18nService.t("copySuccessful"),
|
||||||
|
variant: "success",
|
||||||
|
});
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user