mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 10:13:31 +00:00
* Added sorting to vault, name, permission and group Added default sorting * Fixed import * reverted test on template * Only add sorting functionality to admin console * changed code order * Fixed leftover test for sortingn * Fixed reference * sort permissions by ascending order * Fixed bug where a collection had multiple groups and sorting alphbatically didn't happen correctly all the time * Fixed bug whne creating a new cipher item * Introduced fnFactory to create a sort function with direction provided * Used new sort function to make collections always remain at the top and ciphers below * extracted logic to always sort collections at the top Added similar sorting to sortBygroup * removed org vault check * remove unused service * Sort only collections * Got rid of sortFn factory in favour of passing the direction as an optional parameter * Removed tenary * get cipher permissions * Use all collections to filter collection ids * Fixed ascending and descending issues * Added functionality to default sort in descending order * default sort permissions in descending order * Refactored setActive to not pass direction as a paramater
155 lines
5.8 KiB
HTML
155 lines
5.8 KiB
HTML
<cdk-virtual-scroll-viewport [itemSize]="RowHeight" scrollWindow class="tw-pb-8">
|
|
<bit-table [dataSource]="dataSource" layout="fixed">
|
|
<ng-container header>
|
|
<tr>
|
|
<th bitCell class="tw-w-24 tw-whitespace-nowrap" colspan="2">
|
|
<input
|
|
class="tw-mr-2"
|
|
type="checkbox"
|
|
bitCheckbox
|
|
id="checkAll"
|
|
[disabled]="disabled || isEmpty"
|
|
(change)="$event ? toggleAll() : null"
|
|
[checked]="selection.hasValue() && isAllSelected"
|
|
/>
|
|
<label class="tw-mb-0 !tw-font-bold !tw-text-muted" for="checkAll">{{
|
|
"all" | i18n
|
|
}}</label>
|
|
</th>
|
|
<!-- Organization vault -->
|
|
<th
|
|
*ngIf="showAdminActions"
|
|
bitCell
|
|
bitSortable="name"
|
|
[fn]="sortByName"
|
|
[class]="showExtraColumn ? 'lg:tw-w-3/5' : 'tw-w-full'"
|
|
>
|
|
{{ "name" | i18n }}
|
|
</th>
|
|
<!-- Individual vault -->
|
|
<th
|
|
*ngIf="!showAdminActions"
|
|
bitCell
|
|
[class]="showExtraColumn ? 'lg:tw-w-3/5' : 'tw-w-full'"
|
|
>
|
|
{{ "name" | i18n }}
|
|
</th>
|
|
<th bitCell *ngIf="showOwner" class="tw-hidden tw-w-2/5 lg:tw-table-cell">
|
|
{{ "owner" | i18n }}
|
|
</th>
|
|
<th bitCell class="tw-w-2/5" *ngIf="showCollections">{{ "collections" | i18n }}</th>
|
|
<th bitCell bitSortable="groups" [fn]="sortByGroups" class="tw-w-2/5" *ngIf="showGroups">
|
|
{{ "groups" | i18n }}
|
|
</th>
|
|
<th
|
|
bitCell
|
|
bitSortable="permissions"
|
|
default="desc"
|
|
[fn]="sortByPermissions"
|
|
class="tw-w-2/5"
|
|
*ngIf="showPermissionsColumn"
|
|
>
|
|
{{ "permission" | i18n }}
|
|
</th>
|
|
<th bitCell class="tw-w-12 tw-text-right">
|
|
<button
|
|
[disabled]="disabled || isEmpty || disableMenu"
|
|
[bitMenuTriggerFor]="headerMenu"
|
|
[attr.title]="disableMenu ? ('missingPermissions' | i18n) : ''"
|
|
bitIconButton="bwi-ellipsis-v"
|
|
size="small"
|
|
type="button"
|
|
appA11yTitle="{{ 'options' | i18n }}"
|
|
></button>
|
|
<bit-menu #headerMenu>
|
|
<button *ngIf="bulkMoveAllowed" type="button" bitMenuItem (click)="bulkMoveToFolder()">
|
|
<i class="bwi bwi-fw bwi-folder" aria-hidden="true"></i>
|
|
{{ "addToFolder" | i18n }}
|
|
</button>
|
|
<button
|
|
*ngIf="showAdminActions && showBulkEditCollectionAccess"
|
|
type="button"
|
|
bitMenuItem
|
|
(click)="bulkEditCollectionAccess()"
|
|
>
|
|
<i class="bwi bwi-fw bwi-users" aria-hidden="true"></i>
|
|
{{ "editAccess" | i18n }}
|
|
</button>
|
|
<button
|
|
*ngIf="
|
|
(showAdminActions || showAssignToCollections()) && bulkAssignToCollectionsAllowed
|
|
"
|
|
type="button"
|
|
bitMenuItem
|
|
(click)="assignToCollections()"
|
|
>
|
|
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
|
|
{{ "assignToCollections" | i18n }}
|
|
</button>
|
|
<button *ngIf="showBulkTrashOptions" type="button" bitMenuItem (click)="bulkRestore()">
|
|
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
|
|
{{ "restoreSelected" | i18n }}
|
|
</button>
|
|
<button *ngIf="showDelete" type="button" bitMenuItem (click)="bulkDelete()">
|
|
<span class="tw-text-danger">
|
|
<i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i>
|
|
{{ (showBulkTrashOptions ? "permanentlyDeleteSelected" : "delete") | i18n }}
|
|
</span>
|
|
</button>
|
|
</bit-menu>
|
|
</th>
|
|
</tr>
|
|
</ng-container>
|
|
<ng-template body let-rows$>
|
|
<ng-container *cdkVirtualFor="let item of rows$; templateCacheSize: 0">
|
|
<tr
|
|
*ngIf="item.collection"
|
|
bitRow
|
|
appVaultCollectionRow
|
|
alignContent="middle"
|
|
[disabled]="disabled"
|
|
[collection]="item.collection"
|
|
[showOwner]="showOwner"
|
|
[showCollections]="showCollections"
|
|
[showGroups]="showGroups"
|
|
[organizations]="allOrganizations"
|
|
[showPermissionsColumn]="showPermissionsColumn"
|
|
[groups]="allGroups"
|
|
[canDeleteCollection]="canDeleteCollection(item.collection)"
|
|
[canEditCollection]="canEditCollection(item.collection)"
|
|
[canViewCollectionInfo]="canViewCollectionInfo(item.collection)"
|
|
[checked]="selection.isSelected(item)"
|
|
(checkedToggled)="selection.toggle(item)"
|
|
(onEvent)="event($event)"
|
|
></tr>
|
|
<!--
|
|
addAccessStatus check here so ciphers do not show if user
|
|
has filtered for collections with addAccess
|
|
-->
|
|
<tr
|
|
*ngIf="item.cipher && (!addAccessToggle || (addAccessToggle && addAccessStatus !== 1))"
|
|
bitRow
|
|
appVaultCipherRow
|
|
alignContent="middle"
|
|
[disabled]="disabled"
|
|
[cipher]="item.cipher"
|
|
[showOwner]="showOwner"
|
|
[showCollections]="showCollections"
|
|
[showGroups]="showGroups"
|
|
[showPremiumFeatures]="showPremiumFeatures"
|
|
[useEvents]="useEvents"
|
|
[viewingOrgVault]="viewingOrgVault"
|
|
[cloneable]="canClone(item)"
|
|
[organizations]="allOrganizations"
|
|
[collections]="allCollections"
|
|
[checked]="selection.isSelected(item)"
|
|
[canEditCipher]="canEditCipher(item.cipher)"
|
|
[canManageCollection]="canManageCollection(item.cipher)"
|
|
(checkedToggled)="selection.toggle(item)"
|
|
(onEvent)="event($event)"
|
|
></tr>
|
|
</ng-container>
|
|
</ng-template>
|
|
</bit-table>
|
|
</cdk-virtual-scroll-viewport>
|