mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Fix small issues
This commit is contained in:
@@ -73,7 +73,6 @@ export const MENUS = buildMenuStructure({
|
|||||||
ClaimMenuProvider.onRoute(
|
ClaimMenuProvider.onRoute(
|
||||||
MenuRoute.SIMPLE_ITEM_PAGE,
|
MenuRoute.SIMPLE_ITEM_PAGE,
|
||||||
MenuRoute.FULL_ITEM_PAGE,
|
MenuRoute.FULL_ITEM_PAGE,
|
||||||
MenuRoute.SIMPLE_COLLECTION_PAGE,
|
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
@@ -22,7 +22,6 @@ export interface PartialMenuSection {
|
|||||||
visible: boolean;
|
visible: boolean;
|
||||||
model: MenuItemModels;
|
model: MenuItemModels;
|
||||||
parentID?: string;
|
parentID?: string;
|
||||||
index?: number;
|
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
shouldPersistOnRouteChange?: boolean;
|
shouldPersistOnRouteChange?: boolean;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
@@ -65,7 +64,7 @@ export abstract class AbstractMenuProvider implements MenuProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the menu this provider is part of
|
* ID of the menu this provider is part of
|
||||||
* If not set up, this will be set based on the provider class name
|
* This will be set to the menu ID of the menu in which it is present in the app.menus.ts file
|
||||||
*/
|
*/
|
||||||
menuID?: MenuID;
|
menuID?: MenuID;
|
||||||
|
|
||||||
@@ -144,6 +143,10 @@ export abstract class AbstractMenuProvider implements MenuProvider {
|
|||||||
*/
|
*/
|
||||||
abstract getSections(route?: ActivatedRouteSnapshot, state?: RouterStateSnapshot): Observable<PartialMenuSection[]>;
|
abstract getSections(route?: ActivatedRouteSnapshot, state?: RouterStateSnapshot): Observable<PartialMenuSection[]>;
|
||||||
|
|
||||||
|
protected getAutomatedSectionId(indexOfSectionInProvider: number): string {
|
||||||
|
return `${this.menuProviderId}_${indexOfSectionInProvider};`
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -92,8 +92,8 @@ export class MenuProviderService {
|
|||||||
provider: AbstractMenuProvider,
|
provider: AbstractMenuProvider,
|
||||||
sections: PartialMenuSection[]
|
sections: PartialMenuSection[]
|
||||||
}, sectionIndex) => {
|
}, sectionIndex) => {
|
||||||
providerWithSection.sections.forEach((section) => {
|
providerWithSection.sections.forEach((section, index) => {
|
||||||
this.addSection(providerWithSection.provider, section);
|
this.addSection(providerWithSection.provider, section, index);
|
||||||
});
|
});
|
||||||
return this.waitForMenu$(providerWithSection.provider.menuID);
|
return this.waitForMenu$(providerWithSection.provider.menuID);
|
||||||
});
|
});
|
||||||
@@ -156,8 +156,8 @@ export class MenuProviderService {
|
|||||||
provider: AbstractMenuProvider,
|
provider: AbstractMenuProvider,
|
||||||
sections: PartialMenuSection[]
|
sections: PartialMenuSection[]
|
||||||
}) => {
|
}) => {
|
||||||
providerWithSection.sections.forEach((section) => {
|
providerWithSection.sections.forEach((section, index) => {
|
||||||
this.addSection(providerWithSection.provider, section);
|
this.addSection(providerWithSection.provider, section, index);
|
||||||
});
|
});
|
||||||
return this.waitForMenu$(providerWithSection.provider.menuID);
|
return this.waitForMenu$(providerWithSection.provider.menuID);
|
||||||
});
|
});
|
||||||
@@ -172,12 +172,13 @@ export class MenuProviderService {
|
|||||||
* @param provider - The provider of the section which will be used to provide extra data to the section
|
* @param provider - The provider of the section which will be used to provide extra data to the section
|
||||||
* @param section - The partial section to be added to the menus
|
* @param section - The partial section to be added to the menus
|
||||||
*/
|
*/
|
||||||
private addSection(provider: AbstractMenuProvider, section: PartialMenuSection) {
|
private addSection(provider: AbstractMenuProvider, section: PartialMenuSection, index: number) {
|
||||||
this.menuService.addSection(provider.menuID, {
|
this.menuService.addSection(provider.menuID, {
|
||||||
...section,
|
...section,
|
||||||
id: section.id ?? `${provider.menuProviderId}`,
|
id: section.id ?? `${provider.menuProviderId}_${index}`,
|
||||||
parentID: section.parentID ?? provider.parentID,
|
parentID: section.parentID ?? provider.parentID,
|
||||||
index: section.index ?? provider.index,
|
index: provider.index,
|
||||||
|
active: section.active ?? true,
|
||||||
shouldPersistOnRouteChange: section.shouldPersistOnRouteChange ?? provider.shouldPersistOnRouteChange,
|
shouldPersistOnRouteChange: section.shouldPersistOnRouteChange ?? provider.shouldPersistOnRouteChange,
|
||||||
alwaysRenderExpandable: section.alwaysRenderExpandable ?? provider.alwaysRenderExpandable,
|
alwaysRenderExpandable: section.alwaysRenderExpandable ?? provider.alwaysRenderExpandable,
|
||||||
});
|
});
|
||||||
|
@@ -53,7 +53,7 @@ function processProviderType(providers: Provider[], menuID: string, providerType
|
|||||||
const childProviderTypes = (providerType as any).childProviderTypes;
|
const childProviderTypes = (providerType as any).childProviderTypes;
|
||||||
|
|
||||||
childProviderTypes.forEach((childProviderType, childIndex: number) => {
|
childProviderTypes.forEach((childProviderType, childIndex: number) => {
|
||||||
processProviderType(providers, menuID, childProviderType, childIndex, `${menuID}_${index}`, hasSubProviders);
|
processProviderType(providers, menuID, childProviderType, childIndex, `${menuID}_${index}_0`, hasSubProviders);
|
||||||
});
|
});
|
||||||
processProviderType(providers, menuID, providerPart, index, parentID, true);
|
processProviderType(providers, menuID, providerPart, index, parentID, true);
|
||||||
|
|
||||||
|
@@ -58,4 +58,12 @@ export abstract class AbstractExpandableMenuProvider extends AbstractMenuProvide
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getAutomatedSectionIdForTopSection(): string {
|
||||||
|
return this.getAutomatedSectionId(0);
|
||||||
|
}
|
||||||
|
protected getAutomatedSectionIdForSubsection(indexOfSubSectionInProvider: number): string {
|
||||||
|
return `${this.menuProviderId}_0_${indexOfSubSectionInProvider};`
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ export class ClaimMenuProvider extends DSpaceObjectPageMenuProvider {
|
|||||||
this.translate.get('researcherprofile.success.claim.body'),
|
this.translate.get('researcherprofile.success.claim.body'),
|
||||||
);
|
);
|
||||||
this.authorizationService.invalidateAuthorizationsRequestCache();
|
this.authorizationService.invalidateAuthorizationsRequestCache();
|
||||||
this.menuService.hideMenuSection(MenuID.DSO_EDIT, this.menuProviderId);
|
this.menuService.hideMenuSection(MenuID.DSO_EDIT, this.getAutomatedSectionId(0));
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(
|
this.notificationsService.error(
|
||||||
this.translate.get('researcherprofile.error.claim.title'),
|
this.translate.get('researcherprofile.error.claim.title'),
|
||||||
|
Reference in New Issue
Block a user