mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 05:23:06 +00:00
finished dynamic menus
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import { Component, Injector, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { slideSidebar } from '../../shared/animations/slide';
|
||||
import { slide, slideHorizontal, slideSidebar } from '../../shared/animations/slide';
|
||||
import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service';
|
||||
import { MenuService } from '../../shared/menu/menu.service';
|
||||
import { MenuID, SectionType } from '../../shared/menu/initial-menus-state';
|
||||
import { MenuComponent } from '../../shared/menu/menu.component';
|
||||
import { TextSectionTypeModel } from '../../shared/menu/models/section-types/text.model';
|
||||
import { LinkSectionTypeModel } from '../../shared/menu/models/section-types/link.model';
|
||||
import { AuthService } from '../../core/auth/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-admin-sidebar',
|
||||
templateUrl: './admin-sidebar.component.html',
|
||||
styleUrls: ['./admin-sidebar.component.scss'],
|
||||
animations: [slideSidebar]
|
||||
animations: [slideHorizontal, slideSidebar]
|
||||
})
|
||||
export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
menuID = MenuID.ADMIN;
|
||||
@@ -22,14 +23,22 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
|
||||
constructor(protected menuService: MenuService,
|
||||
protected injector: Injector,
|
||||
private variableService: CSSVariableService) {
|
||||
private variableService: CSSVariableService,
|
||||
private authService: AuthService
|
||||
) {
|
||||
super(menuService, injector);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.createMenu();
|
||||
super.ngOnInit();
|
||||
this.sidebarWidth = this.variableService.getVariable('adminSidebarWidth');
|
||||
this.createMenu();
|
||||
this.authService.isAuthenticated()
|
||||
.subscribe((loggedIn: boolean) => {
|
||||
if (loggedIn) {
|
||||
this.menuService.showMenu(this.menuID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createMenu() {
|
||||
@@ -39,7 +48,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.new' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.new'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'plus-circle'
|
||||
},
|
||||
{
|
||||
@@ -47,28 +59,44 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.new_community', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.new_community',
|
||||
link: '/communities/submission'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'new_collection',
|
||||
parentID: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.new_collection', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.new_collection',
|
||||
link: '/collections/submission'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'new_item',
|
||||
parentID: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.new_item', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.new_item',
|
||||
link: '/items/submission'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'new_item_version',
|
||||
parentID: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.new_item_version', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.new_item_version',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Edit */
|
||||
@@ -76,7 +104,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'edit',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.edit' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.edit'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'pencil-alt'
|
||||
},
|
||||
{
|
||||
@@ -84,21 +115,33 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'edit',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.edit_community', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.edit_community',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'edit_collection',
|
||||
parentID: 'edit',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.edit_collection', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.edit_collection',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'edit_item',
|
||||
parentID: 'edit',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.edit_item', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.edit_item',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Import */
|
||||
@@ -106,22 +149,35 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'import',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.import' } as TextSectionTypeModel,
|
||||
icon: 'sign-in-alt'
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.import'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'sign-in-alt',
|
||||
index: -1
|
||||
},
|
||||
{
|
||||
id: 'import_metadata',
|
||||
parentID: 'import',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.import_metadata', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.import_metadata',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
index: 1
|
||||
},
|
||||
{
|
||||
id: 'import_batch',
|
||||
parentID: 'import',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.import_batch', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.import_batch',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Export */
|
||||
@@ -129,7 +185,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'export',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.export' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.export'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'sign-out-alt'
|
||||
},
|
||||
{
|
||||
@@ -137,27 +196,43 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'export',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.export_community', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.export_community',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'export_collection',
|
||||
parentID: 'export',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.export_collection', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.export_collection',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'export_item',
|
||||
parentID: 'export',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.export_item', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.export_item',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
}, {
|
||||
id: 'export_metadata',
|
||||
parentID: 'export',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.export_metadata', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.export_metadata',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Access Control */
|
||||
@@ -165,7 +240,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'access_control',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.access_control' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.access_control'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'key'
|
||||
},
|
||||
{
|
||||
@@ -173,21 +251,33 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'access_control',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.access_control_people', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.access_control_people',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'access_control_groups',
|
||||
parentID: 'access_control',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.access_control_groups', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.access_control_groups',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'access_control_authorizations',
|
||||
parentID: 'access_control',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.access_control_authorizations', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.access_control_authorizations',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Search */
|
||||
@@ -195,7 +285,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'find',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.find' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.find'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'search'
|
||||
},
|
||||
{
|
||||
@@ -203,21 +296,33 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'find',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.find_items', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.find_items',
|
||||
link: '/search'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'find_withdrawn_items',
|
||||
parentID: 'find',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.find_withdrawn_items', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.find_withdrawn_items',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'find_private_items',
|
||||
parentID: 'find',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.find_private_items', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.find_private_items',
|
||||
link: '/admin/items'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Registries */
|
||||
@@ -225,7 +330,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'registries',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.TEXT, text: 'admin.sidebar.section.registries' } as TextSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.TEXT,
|
||||
text: 'admin.sidebar.section.registries'
|
||||
} as TextSectionTypeModel,
|
||||
icon: 'list'
|
||||
},
|
||||
{
|
||||
@@ -233,14 +341,22 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.registries_metadata', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.registries_metadata',
|
||||
link: '/registries/metadata'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
{
|
||||
id: 'registries_format',
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.registries_format', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.registries_format',
|
||||
link: '/registries/format'
|
||||
} as LinkSectionTypeModel,
|
||||
},
|
||||
|
||||
/* Curation tasks */
|
||||
@@ -248,16 +364,24 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'curation_tasks',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.curation_task', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.curation_task',
|
||||
link: '/curation'
|
||||
} as LinkSectionTypeModel,
|
||||
icon: 'filter'
|
||||
},
|
||||
|
||||
/* Statistics */
|
||||
{
|
||||
id: 'statistics',
|
||||
id: 'statistics_task',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.statistics', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.statistics_task',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
icon: 'chart-bar'
|
||||
},
|
||||
|
||||
@@ -266,7 +390,11 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
id: 'control_panel',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: { type: SectionType.LINK, text: 'admin.sidebar.section.control_panel', link: '#' } as LinkSectionTypeModel,
|
||||
model: {
|
||||
type: SectionType.LINK,
|
||||
text: 'admin.sidebar.section.control_panel',
|
||||
link: '#'
|
||||
} as LinkSectionTypeModel,
|
||||
icon: 'cogs'
|
||||
},
|
||||
];
|
||||
@@ -297,4 +425,5 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
this.sidebarOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user