configure menu section, reprocess button condition

This commit is contained in:
FrancescoMolinaro
2024-01-17 16:42:06 +01:00
parent 9e9b4cae15
commit 1a65b56c2b
3 changed files with 45 additions and 42 deletions

View File

@@ -33,7 +33,10 @@
<td> <td>
<div class="d-flex flex-column"> <div class="d-flex flex-column">
<button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">{{ 'notify-message-result.detail' | translate }}</button> <button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">{{ 'notify-message-result.detail' | translate }}</button>
<button *ngIf="message.queueStatusLabel !== reprocessStatus" (click)="reprocessMessage(message)" class="btn btn-warning"> <button *ngIf="message.queueStatusLabel !== reprocessStatus && (message.queueStatusLabel === failureStatus || message.queueStatusLabel === unmappedActionStatus)"
(click)="reprocessMessage(message)"
class="btn btn-warning"
>
{{ 'notify-message-result.reprocess' | translate }} {{ 'notify-message-result.reprocess' | translate }}
</button> </button>
</div> </div>

View File

@@ -33,6 +33,8 @@ import { DatePipe } from '@angular/common';
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{ export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{
public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]); public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]);
public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY'; public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY';
public failureStatus = 'QUEUE_STATUS_FAILED';
public unmappedActionStatus = 'QUEUE_STATUS_UNMAPPED_ACTION';
//we check on one type of config to render specific table headers //we check on one type of config to render specific table headers
public isInbound: boolean; public isInbound: boolean;

View File

@@ -171,8 +171,7 @@ export class MenuResolver implements Resolve<boolean> {
this.authorizationService.isAuthorized(FeatureID.AdministratorOf), this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.authorizationService.isAuthorized(FeatureID.CanSubmit), this.authorizationService.isAuthorized(FeatureID.CanSubmit),
this.authorizationService.isAuthorized(FeatureID.CanEditItem), this.authorizationService.isAuthorized(FeatureID.CanEditItem),
this.authorizationService.isAuthorized(FeatureID.CanSeeQA) ]).subscribe(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin, canSubmit, canEditItem]) => {
]).subscribe(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin, canSubmit, canEditItem, canSeeQA]) => {
const newSubMenuList = [ const newSubMenuList = [
{ {
id: 'new_community', id: 'new_community',
@@ -301,49 +300,12 @@ export class MenuResolver implements Resolve<boolean> {
icon: 'pencil-alt', icon: 'pencil-alt',
index: 1 index: 1
}; };
const notificationSubMenuList = [
/* Notifications */
{
id: 'notifications',
active: false,
visible: true,
model: {
type: MenuItemType.TEXT,
text: 'menu.section.notifications'
} as TextMenuItemModel,
icon: 'bell',
index: 4
},
{
id: 'notifications_quality-assurance',
parentID: 'notifications',
active: false,
visible: canSeeQA,
model: {
type: MenuItemType.LINK,
text: 'menu.section.quality-assurance',
link: '/notifications/quality-assurance'
} as LinkMenuItemModel,
},
{
id: 'notifications_reciter',
parentID: 'notifications',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
text: 'menu.section.notifications_reciter',
link: '/notifications/' + NOTIFICATIONS_RECITER_SUGGESTION_PATH
} as LinkMenuItemModel,
},
];
const menuList = [ const menuList = [
...newSubMenuList, ...newSubMenuList,
newSubMenu, newSubMenu,
...editSubMenuList, ...editSubMenuList,
editSubMenu, editSubMenu,
...notificationSubMenuList,
// TODO: enable this menu item once the feature has been implemented // TODO: enable this menu item once the feature has been implemented
// { // {
@@ -582,8 +544,10 @@ export class MenuResolver implements Resolve<boolean> {
* Create menu sections dependent on whether or not the current user is a site administrator * Create menu sections dependent on whether or not the current user is a site administrator
*/ */
createSiteAdministratorMenuSections() { createSiteAdministratorMenuSections() {
this.authorizationService.isAuthorized(FeatureID.AdministratorOf) combineLatest([
.subscribe((authorized) => { this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.authorizationService.isAuthorized(FeatureID.CanSeeQA)
]).subscribe(([authorized, canSeeQA]) => {
const menuList = [ const menuList = [
/* Admin Search */ /* Admin Search */
{ {
@@ -707,6 +671,40 @@ export class MenuResolver implements Resolve<boolean> {
link: '/admin/ldn/services' link: '/admin/ldn/services'
} as LinkMenuItemModel, } as LinkMenuItemModel,
}, },
/* Notifications */
{
id: 'notifications',
active: false,
visible: authorized,
model: {
type: MenuItemType.TEXT,
text: 'menu.section.notifications'
} as TextMenuItemModel,
icon: 'bell',
index: 4
},
{
id: 'notifications_quality-assurance',
parentID: 'notifications',
active: false,
visible: authorized && canSeeQA,
model: {
type: MenuItemType.LINK,
text: 'menu.section.quality-assurance',
link: '/notifications/quality-assurance'
} as LinkMenuItemModel,
},
{
id: 'notifications_reciter',
parentID: 'notifications',
active: false,
visible: authorized,
model: {
type: MenuItemType.LINK,
text: 'menu.section.notifications_reciter',
link: '/notifications/' + NOTIFICATIONS_RECITER_SUGGESTION_PATH
} as LinkMenuItemModel,
},
]; ];
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, { menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, {