1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

[PM-12324] Add HTML ids to Bitwarden Portal for automated testing (#4789)

* Adding ids to org page in admin portal.

Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
This commit is contained in:
Jared McCannon 2024-09-19 10:57:42 -05:00 committed by GitHub
parent 63f57c3d5b
commit 03bd47e390
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 64 additions and 60 deletions

View File

@ -1,73 +1,73 @@
@model OrganizationViewModel
<dl class="row">
<dt class="col-sm-4 col-lg-3">Id</dt>
<dd class="col-sm-8 col-lg-9"><code>@Model.Organization.Id</code></dd>
<dd id="org-id" class="col-sm-8 col-lg-9"><code>@Model.Organization.Id</code></dd>
<dt class="col-sm-4 col-lg-3">Plan</dt>
<dd class="col-sm-8 col-lg-9">@Model.Organization.Plan</dd>
<dd id="org-plan" class="col-sm-8 col-lg-9">@Model.Organization.Plan</dd>
<dt class="col-sm-4 col-lg-3">Expires</dt>
<dd class="col-sm-8 col-lg-9">@(Model.Organization.ExpirationDate?.ToString() ?? "-")</dd>
<dd id="org-expiration-date" class="col-sm-8 col-lg-9">@(Model.Organization.ExpirationDate?.ToString() ?? "-")</dd>
<dt class="col-sm-4 col-lg-3">Users</dt>
<dd class="col-sm-8 col-lg-9">
<dd id="org-user-seats" class="col-sm-8 col-lg-9">
@Model.OccupiedSeatCount / @(Model.Organization.Seats?.ToString() ?? "-")
(<span title="Invited">@Model.UserInvitedCount</span> /
<span title="Accepted">@Model.UserAcceptedCount</span> /
<span title="Confirmed">@Model.UserConfirmedCount</span>)
(<span id="org-invited-users" title="Invited">@Model.UserInvitedCount</span> /
<span id="org-accepted-users" title="Accepted">@Model.UserAcceptedCount</span> /
<span id="org-confirmed-users" title="Confirmed">@Model.UserConfirmedCount</span>)
</dd>
<dt class="col-sm-4 col-lg-3">Owners</dt>
<dd class="col-sm-8 col-lg-9">@(string.IsNullOrWhiteSpace(Model.Owners) ? "None" : Model.Owners)</dd>
<dd id="org-owner" class="col-sm-8 col-lg-9">@(string.IsNullOrWhiteSpace(Model.Owners) ? "None" : Model.Owners)</dd>
<dt class="col-sm-4 col-lg-3">Admins</dt>
<dd class="col-sm-8 col-lg-9">@(string.IsNullOrWhiteSpace(Model.Admins) ? "None" : Model.Admins)</dd>
<dd id="org-admins" class="col-sm-8 col-lg-9">@(string.IsNullOrWhiteSpace(Model.Admins) ? "None" : Model.Admins)</dd>
<dt class="col-sm-4 col-lg-3">Using 2FA</dt>
<dd class="col-sm-8 col-lg-9">@(Model.Organization.TwoFactorIsEnabled() ? "Yes" : "No")</dd>
<dd id="org-2fa" class="col-sm-8 col-lg-9">@(Model.Organization.TwoFactorIsEnabled() ? "Yes" : "No")</dd>
<dt class="col-sm-4 col-lg-3">Groups</dt>
<dd class="col-sm-8 col-lg-9">@Model.GroupCount</dd>
<dd id="org-group-count" class="col-sm-8 col-lg-9">@Model.GroupCount</dd>
<dt class="col-sm-4 col-lg-3">Policies</dt>
<dd class="col-sm-8 col-lg-9">@Model.PolicyCount</dd>
<dd id="org-policy-count" class="col-sm-8 col-lg-9">@Model.PolicyCount</dd>
<dt class="col-sm-4 col-lg-3">Public/Private Keys</dt>
<dd class="col-sm-8 col-lg-9">@(Model.HasPublicPrivateKeys ? "Yes" : "No")</dd>
<dd id="org-has-keys" class="col-sm-8 col-lg-9">@(Model.HasPublicPrivateKeys ? "Yes" : "No")</dd>
<dt class="col-sm-4 col-lg-3">Created</dt>
<dd class="col-sm-8 col-lg-9">@Model.Organization.CreationDate.ToString()</dd>
<dd id="org-creation-date" class="col-sm-8 col-lg-9">@Model.Organization.CreationDate.ToString()</dd>
<dt class="col-sm-4 col-lg-3">Modified</dt>
<dd class="col-sm-8 col-lg-9">@Model.Organization.RevisionDate.ToString()</dd>
<dd id="org-modified-date" class="col-sm-8 col-lg-9">@Model.Organization.RevisionDate.ToString()</dd>
</dl>
<h2>Password Manager</h2>
<dl class="row">
<dt class="col-sm-4 col-lg-3">Items</dt>
<dd class="col-sm-8 col-lg-9">@Model.CipherCount</dd>
<dd id="pm-item-count" class="col-sm-8 col-lg-9">@Model.CipherCount</dd>
<dt class="col-sm-4 col-lg-3">Collections</dt>
<dd class="col-sm-8 col-lg-9">@Model.CollectionCount</dd>
<dd id="pm-collection-count" class="col-sm-8 col-lg-9">@Model.CollectionCount</dd>
<dt class="col-sm-4 col-lg-3">Administrators manage all collections</dt>
<dd class="col-sm-8 col-lg-9">@(Model.Organization.AllowAdminAccessToAllCollectionItems ? "On" : "Off")</dd>
<dd id="pm-manage-collections" class="col-sm-8 col-lg-9">@(Model.Organization.AllowAdminAccessToAllCollectionItems ? "On" : "Off")</dd>
<dt class="col-sm-4 col-lg-3">Limit collection creation to administrators</dt>
<dd class="col-sm-8 col-lg-9">@(Model.Organization.LimitCollectionCreationDeletion ? "On" : "Off")</dd>
<dd id="pm-collection-creation" class="col-sm-8 col-lg-9">@(Model.Organization.LimitCollectionCreationDeletion ? "On" : "Off")</dd>
</dl>
<h2>Secrets Manager</h2>
<dl class="row">
<dt class="col-sm-4 col-lg-3">Secrets</dt>
<dd class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.SecretsCount: "N/A")</dd>
<dd id="sm-secret-count" class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.SecretsCount: "N/A")</dd>
<dt class="col-sm-4 col-lg-3">Projects</dt>
<dd class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.ProjectsCount: "N/A")</dd>
<dd id="sm-project-count" class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.ProjectsCount: "N/A")</dd>
<dt class="col-sm-4 col-lg-3">Machine Accounts</dt>
<dd class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.ServiceAccountsCount: "N/A")</dd>
<dd id="sm-machine-account" class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.ServiceAccountsCount: "N/A")</dd>
<dt class="col-sm-4 col-lg-3">Secrets Manager Seats</dt>
<dd class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.OccupiedSmSeatsCount: "N/A" )</dd>
<dd id="sm-seat-count" class="col-sm-8 col-lg-9">@(Model.UseSecretsManager ? Model.OccupiedSmSeatsCount: "N/A" )</dd>
</dl>

View File

@ -11,8 +11,8 @@
}
<dl class="row">
<dt class="col-sm-4 col-lg-3">Account @(Model.BillingInfo.Balance <= 0 ? "Credit" : "Balance")</dt>
<dd class="col-sm-8 col-lg-9">@Math.Abs(Model.BillingInfo.Balance).ToString("C")</dd>
<dt id="billing-account-credit-balance" class="col-sm-4 col-lg-3">Account @(Model.BillingInfo.Balance <= 0 ? "Credit" : "Balance")</dt>
<dd id="billing-account-credit-balance-value" class="col-sm-8 col-lg-9">@Math.Abs(Model.BillingInfo.Balance).ToString("C")</dd>
<dt class="col-sm-4 col-lg-3">Invoices</dt>
<dd class="col-sm-8 col-lg-9">
@ -20,24 +20,26 @@
{
<table class="table">
<tbody>
@foreach(var invoice in Model.BillingHistoryInfo.Invoices)
{
<tr>
<td>@invoice.Date</td>
<td><a target="_blank" rel="noreferrer" href="@invoice.Url" title="View Invoice">@invoice.Number</a>
@{ var invoiceIndex = 0; }
@foreach (var invoice in Model.BillingHistoryInfo.Invoices)
{
<tr>
<td id="invoice-@(invoiceIndex)-date">@invoice.Date</td>
<td><a id="invoice-@(invoiceIndex)-url" target="_blank" rel="noreferrer" href="@invoice.Url" title="View Invoice">@invoice.Number</a>
</td>
<td id="invoice-@(invoiceIndex)-amount">@invoice.Amount.ToString("C")</td>
<td id="invoice-@(invoiceIndex)-paid">@(invoice.Paid ? "Paid" : "Unpaid")</td>
@if (canDownloadInvoice)
{
<td>
<a id="invoice-@(invoiceIndex)-pdf-url" target="_blank" rel="noreferrer" href="@invoice.PdfUrl" title="Download Invoice">
<i class="fa fa-file-pdf-o"></i>
</a>
</td>
<td>@invoice.Amount.ToString("C")</td>
<td>@(invoice.Paid ? "Paid" : "Unpaid")</td>
@if (canDownloadInvoice)
{
<td>
<a target="_blank" rel="noreferrer" href="@invoice.PdfUrl" title="Download Invoice">
<i class="fa fa-file-pdf-o"></i>
</a>
</td>
}
</tr>
}
}
</tr>
invoiceIndex++;
}
</tbody>
</table>
}
@ -53,23 +55,25 @@
{
<table class="table">
<tbody>
@foreach(var transaction in Model.BillingHistoryInfo.Transactions)
{
<tr>
<td>@transaction.CreatedDate</td>
<td>@transaction.Type.ToString()</td>
<td>@transaction.PaymentMethodType.ToString()</td>
<td>@transaction.Details</td>
<td>@transaction.Amount.ToString("C")</td>
@if (canManageTransactions)
{
<td>
<a title="Edit Transaction" asp-controller="Tools" asp-action="EditTransaction"
asp-route-id="@transaction.Id"><i class="fa fa-edit"></i></a>
</td>
}
</tr>
}
@{ var transactionIndex = 0; }
@foreach (var transaction in Model.BillingHistoryInfo.Transactions)
{
<tr>
<td id="transaction-@(transactionIndex)-created-date">@transaction.CreatedDate</td>
<td id="transaction-@(transactionIndex)-type">@transaction.Type.ToString()</td>
<td id="transaction-@(transactionIndex)-payment-method">@transaction.PaymentMethodType.ToString()</td>
<td id="transaction-@(transactionIndex)-details">@transaction.Details</td>
<td id="transaction-@(transactionIndex)-amount">@transaction.Amount.ToString("C")</td>
@if (canManageTransactions)
{
<td>
<a id="transaction-@(transactionIndex)-edit-link" title="Edit Transaction" asp-controller="Tools" asp-action="EditTransaction"
asp-route-id="@transaction.Id"><i class="fa fa-edit"></i></a>
</td>
}
</tr>
transactionIndex++;
}
</tbody>
</table>
}
@ -79,7 +83,7 @@
}
@if (canManageTransactions)
{
<a asp-action="CreateTransaction" asp-controller="Tools" asp-route-organizationId="@Model.OrganizationId"
<a id="transaction-create-transaction-link" asp-action="CreateTransaction" asp-controller="Tools" asp-route-organizationId="@Model.OrganizationId"
asp-route-userId="@Model.UserId" class="btn btn-sm btn-outline-primary">
<i class="fa fa-plus"></i> New Transaction
</a>