mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
PM-13404 sort fix (#14195)
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
<th bitCell bitSortable="organizationId" *ngIf="!isAdminConsoleActive">
|
<th bitCell bitSortable="organizationId" *ngIf="!isAdminConsoleActive">
|
||||||
{{ "owner" | i18n }}
|
{{ "owner" | i18n }}
|
||||||
</th>
|
</th>
|
||||||
<th bitCell class="tw-text-right" bitSortable="score" default>
|
<th bitCell class="tw-text-right" bitSortable="scoreKey" default>
|
||||||
{{ "weakness" | i18n }}
|
{{ "weakness" | i18n }}
|
||||||
</th>
|
</th>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/se
|
|||||||
|
|
||||||
import { CipherReportComponent } from "./cipher-report.component";
|
import { CipherReportComponent } from "./cipher-report.component";
|
||||||
|
|
||||||
type ReportScore = { label: string; badgeVariant: BadgeVariant };
|
type ReportScore = { label: string; badgeVariant: BadgeVariant; sortOrder: number };
|
||||||
type ReportResult = CipherView & { score: number; reportValue: ReportScore };
|
type ReportResult = CipherView & { score: number; reportValue: ReportScore; scoreKey: number };
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-weak-passwords-report",
|
selector: "app-weak-passwords-report",
|
||||||
@@ -110,7 +110,12 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
|
|||||||
|
|
||||||
if (result.score != null && result.score <= 2) {
|
if (result.score != null && result.score <= 2) {
|
||||||
const scoreValue = this.scoreKey(result.score);
|
const scoreValue = this.scoreKey(result.score);
|
||||||
const row = { ...ciph, score: result.score, reportValue: scoreValue } as ReportResult;
|
const row = {
|
||||||
|
...ciph,
|
||||||
|
score: result.score,
|
||||||
|
reportValue: scoreValue,
|
||||||
|
scoreKey: scoreValue.sortOrder,
|
||||||
|
} as ReportResult;
|
||||||
this.weakPasswordCiphers.push(row);
|
this.weakPasswordCiphers.push(row);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -129,13 +134,13 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
|
|||||||
private scoreKey(score: number): ReportScore {
|
private scoreKey(score: number): ReportScore {
|
||||||
switch (score) {
|
switch (score) {
|
||||||
case 4:
|
case 4:
|
||||||
return { label: "strong", badgeVariant: "success" };
|
return { label: "strong", badgeVariant: "success", sortOrder: 1 };
|
||||||
case 3:
|
case 3:
|
||||||
return { label: "good", badgeVariant: "primary" };
|
return { label: "good", badgeVariant: "primary", sortOrder: 2 };
|
||||||
case 2:
|
case 2:
|
||||||
return { label: "weak", badgeVariant: "warning" };
|
return { label: "weak", badgeVariant: "warning", sortOrder: 3 };
|
||||||
default:
|
default:
|
||||||
return { label: "veryWeak", badgeVariant: "danger" };
|
return { label: "veryWeak", badgeVariant: "danger", sortOrder: 4 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user