[AC-2487] [AC-2486] Changes to restricted access view (#9118)

* [AC-2487] Hide edit/view collection button in restricted access view

* [AC-2486] Update button icon and text in restricted access view
This commit is contained in:
Thomas Rittson 2024-05-14 08:41:03 +10:00 committed by GitHub
parent 8c5841a76a
commit a4cc7a3ec3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 16 deletions

View File

@ -3,6 +3,7 @@ import { Component, EventEmitter, Input, Output } from "@angular/core";
import { ButtonModule, NoItemsModule, svgIcon } from "@bitwarden/components"; import { ButtonModule, NoItemsModule, svgIcon } from "@bitwarden/components";
import { SharedModule } from "../../shared"; import { SharedModule } from "../../shared";
import { CollectionDialogTabType } from "../components/collection-dialog";
const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="10 -10 120 140" fill="none"> const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="10 -10 120 140" fill="none">
<rect class="tw-stroke-secondary-600" width="134" height="86" x="3" y="31.485" stroke-width="6" rx="11"/> <rect class="tw-stroke-secondary-600" width="134" height="86" x="3" y="31.485" stroke-width="6" rx="11"/>
@ -16,24 +17,36 @@ const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height=
template: `<bit-no-items [icon]="icon" class="tw-mt-2 tw-block"> template: `<bit-no-items [icon]="icon" class="tw-mt-2 tw-block">
<span slot="title" class="tw-mt-4 tw-block">{{ "collectionAccessRestricted" | i18n }}</span> <span slot="title" class="tw-mt-4 tw-block">{{ "collectionAccessRestricted" | i18n }}</span>
<button <button
*ngIf="canEditCollection"
slot="button" slot="button"
bitButton bitButton
(click)="viewCollectionClicked.emit()" (click)="viewCollectionClicked.emit({ readonly: false, tab: collectionDialogTabType.Info })"
buttonType="secondary" buttonType="secondary"
type="button" type="button"
> >
<i aria-hidden="true" class="bwi bwi-pencil-square"></i> {{ buttonText | i18n }} <i aria-hidden="true" class="bwi bwi-pencil-square"></i> {{ "editCollection" | i18n }}
</button>
<button
*ngIf="!canEditCollection && canViewCollectionInfo"
slot="button"
bitButton
(click)="viewCollectionClicked.emit({ readonly: true, tab: collectionDialogTabType.Access })"
buttonType="secondary"
type="button"
>
<i aria-hidden="true" class="bwi bwi-users"></i> {{ "viewAccess" | i18n }}
</button> </button>
</bit-no-items>`, </bit-no-items>`,
}) })
export class CollectionAccessRestrictedComponent { export class CollectionAccessRestrictedComponent {
protected icon = icon; protected icon = icon;
protected collectionDialogTabType = CollectionDialogTabType;
@Input() canEditCollection = false; @Input() canEditCollection = false;
@Input() canViewCollectionInfo = false;
@Output() viewCollectionClicked = new EventEmitter<void>(); @Output() viewCollectionClicked = new EventEmitter<{
readonly: boolean;
get buttonText() { tab: CollectionDialogTabType;
return this.canEditCollection ? "editCollection" : "viewCollection"; }>();
}
} }

View File

@ -116,13 +116,14 @@
</bit-no-items> </bit-no-items>
<collection-access-restricted <collection-access-restricted
*ngIf="showCollectionAccessRestricted" *ngIf="showCollectionAccessRestricted"
[canEditCollection]="organization.isProviderUser" [canEditCollection]="
selectedCollection.node?.canEdit(organization, flexibleCollectionsV1Enabled)
"
[canViewCollectionInfo]="
selectedCollection.node?.canViewCollectionInfo(organization, flexibleCollectionsV1Enabled)
"
(viewCollectionClicked)=" (viewCollectionClicked)="
editCollection( editCollection(selectedCollection.node, $event.tab, $event.readonly)
selectedCollection.node,
CollectionDialogTabType.Info,
!organization.isProviderUser
)
" "
> >
</collection-access-restricted> </collection-access-restricted>

View File

@ -7740,9 +7740,6 @@
"success": { "success": {
"message": "Success" "message": "Success"
}, },
"viewCollection": {
"message": "View collection"
},
"restrictedGroupAccess": { "restrictedGroupAccess": {
"message": "You cannot add yourself to groups." "message": "You cannot add yourself to groups."
}, },