Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous fixes #392

Merged
merged 8 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions src/app/+admin/admin-sidebar/admin-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,18 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
parentID: 'new',
active: false,
visible: true,
// model: {
// type: MenuItemType.ONCLICK,
// text: 'menu.section.new_item',
// function: () => {
// this.modalService.open(CreateItemParentSelectorComponent);
// }
// } as OnClickMenuItemModel,
model: {
type: MenuItemType.ONCLICK,
type: MenuItemType.LINK,
text: 'menu.section.new_item',
function: () => {
this.modalService.open(CreateItemParentSelectorComponent);
}
} as OnClickMenuItemModel,
link: '/submit'
} as LinkMenuItemModel,
},
{
id: 'new_item_version',
Expand All @@ -154,7 +159,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.new_item_version',
link: '#'
link: ''
} as LinkMenuItemModel,
},

Expand Down Expand Up @@ -230,7 +235,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.import_metadata',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -241,7 +246,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.import_batch',
link: '#'
link: ''
} as LinkMenuItemModel,
},
/* Export */
Expand All @@ -264,7 +269,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.export_community',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -275,7 +280,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.export_collection',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -286,7 +291,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.export_item',
link: '#'
link: ''
} as LinkMenuItemModel,
}, {
id: 'export_metadata',
Expand All @@ -296,7 +301,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.export_metadata',
link: '#'
link: ''
} as LinkMenuItemModel,
},

Expand All @@ -320,7 +325,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.access_control_people',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -331,7 +336,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.access_control_groups',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -342,7 +347,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.access_control_authorizations',
link: '#'
link: ''
} as LinkMenuItemModel,
},

Expand Down Expand Up @@ -377,7 +382,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.find_withdrawn_items',
link: '#'
link: ''
} as LinkMenuItemModel,
},
{
Expand All @@ -388,7 +393,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.find_private_items',
link: '/admin/items'
link: ''
} as LinkMenuItemModel,
},

Expand Down Expand Up @@ -435,7 +440,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.curation_task',
link: '/curation'
link: ''
} as LinkMenuItemModel,
icon: 'filter',
index: 7
Expand All @@ -449,7 +454,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.statistics_task',
link: '#'
link: ''
} as LinkMenuItemModel,
icon: 'chart-bar',
index: 8
Expand All @@ -463,7 +468,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
model: {
type: MenuItemType.LINK,
text: 'menu.section.control_panel',
link: '#'
link: ''
} as LinkMenuItemModel,
icon: 'cogs',
index: 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorat
templateUrl: './expandable-admin-sidebar-section.component.html',
styleUrls: ['./expandable-admin-sidebar-section.component.scss'],
animations: [rotate, slide, bgColor]

})

@rendersSectionForMenu(MenuID.ADMIN, true)
export class ExpandableAdminSidebarSectionComponent extends AdminSidebarSectionComponent implements OnInit {
/**
Expand Down
114 changes: 59 additions & 55 deletions src/app/+collection-page/collection-page.component.html
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
<div class="container">
<div class="collection-page"
*ngVar="(collectionRD$ | async) as collectionRD">
<div *ngIf="collectionRD?.hasSucceeded" @fadeInOut>
<div *ngIf="collectionRD?.payload as collection">
<!-- Collection Name -->
<ds-comcol-page-header
[name]="collection.name">
</ds-comcol-page-header>
<!-- Browse-By Links -->
<ds-comcol-page-browse-by [id]="collection.id"></ds-comcol-page-browse-by>
<!-- Collection logo -->
<ds-comcol-page-logo *ngIf="logoRD$"
[logo]="(logoRD$ | async)?.payload"
[alternateText]="'Collection Logo'">
</ds-comcol-page-logo>
<!-- Introductionary text -->
<ds-comcol-page-content
[content]="collection.introductoryText"
[hasInnerHtml]="true">
</ds-comcol-page-content>
<!-- News -->
<ds-comcol-page-content
[content]="collection.sidebarText"
[hasInnerHtml]="true"
[title]="'community.page.news'">
</ds-comcol-page-content>
<!-- Copyright -->
<ds-comcol-page-content
[content]="collection.copyrightText"
[hasInnerHtml]="true">
</ds-comcol-page-content>
<!-- Licence -->
<ds-comcol-page-content
[content]="collection.dcLicense"
[title]="'collection.page.license'">
</ds-comcol-page-content>
</div>
<div class="collection-page"
*ngVar="(collectionRD$ | async) as collectionRD">
<div *ngIf="collectionRD?.hasSucceeded" @fadeInOut>
<div *ngIf="collectionRD?.payload as collection">
<!-- Collection Name -->
<ds-comcol-page-header
[name]="collection.name">
</ds-comcol-page-header>
<!-- Browse-By Links -->
<ds-comcol-page-browse-by [id]="collection.id"></ds-comcol-page-browse-by>
<!-- Collection logo -->
<ds-comcol-page-logo *ngIf="logoRD$"
[logo]="(logoRD$ | async)?.payload"
[alternateText]="'Collection Logo'">
</ds-comcol-page-logo>
<!-- Introductionary text -->
<ds-comcol-page-content
[content]="collection.introductoryText"
[hasInnerHtml]="true">
</ds-comcol-page-content>
<!-- News -->
<ds-comcol-page-content
[content]="collection.sidebarText"
[hasInnerHtml]="true"
[title]="'community.page.news'">
</ds-comcol-page-content>
<!-- Copyright -->
<ds-comcol-page-content
[content]="collection.copyrightText"
[hasInnerHtml]="true">
</ds-comcol-page-content>
<!-- Licence -->
<ds-comcol-page-content
[content]="collection.dcLicense"
[title]="'collection.page.license'">
</ds-comcol-page-content>
</div>
<br>
<ng-container *ngVar="(itemRD$ | async) as itemRD">
<div *ngIf="itemRD?.hasSucceeded" @fadeIn>
<h2>{{'collection.page.browse.recent.head' | translate}}</h2>
<ds-viewable-collection
[config]="paginationConfig"
[sortConfig]="sortConfig"
[objects]="itemRD"
[hideGear]="true"
(paginationChange)="onPaginationChange($event)">
</ds-viewable-collection>
</div>
<ds-error *ngIf="itemRD?.hasFailed"
message="{{'error.recent-submissions' | translate}}"></ds-error>
<ds-loading *ngIf="!itemRD || itemRD.isLoading"
message="{{'loading.recent-submissions' | translate}}"></ds-loading>
</ng-container>
</div>
<ds-error *ngIf="collectionRD?.hasFailed"
message="{{'error.collection' | translate}}"></ds-error>
<ds-loading *ngIf="collectionRD?.isLoading"
message="{{'loading.collection' | translate}}"></ds-loading>
</div>
<ds-error *ngIf="collectionRD?.hasFailed" message="{{'error.collection' | translate}}"></ds-error>
<ds-loading *ngIf="collectionRD?.isLoading" message="{{'loading.collection' | translate}}"></ds-loading>
<br>
<ng-container *ngVar="(itemRD$ | async) as itemRD">
<div *ngIf="itemRD?.hasSucceeded" @fadeIn>
<h2>{{'collection.page.browse.recent.head' | translate}}</h2>
<ds-viewable-collection
[config]="paginationConfig"
[sortConfig]="sortConfig"
[objects]="itemRD"
[hideGear]="true"
(paginationChange)="onPaginationChange($event)">
</ds-viewable-collection>
</div>
<ds-error *ngIf="itemRD?.hasFailed" message="{{'error.recent-submissions' | translate}}"></ds-error>
<ds-loading *ngIf="!itemRD || itemRD.isLoading" message="{{'loading.recent-submissions' | translate}}"></ds-loading>
</ng-container>
</div>
</div>
47 changes: 25 additions & 22 deletions src/app/+collection-page/collection-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model';
import { CollectionDataService } from '../core/data/collection-data.service';
import { ItemDataService } from '../core/data/item-data.service';
Expand All @@ -16,11 +16,9 @@ import { Item } from '../core/shared/item.model';
import { fadeIn, fadeInOut } from '../shared/animations/fade';
import { hasValue, isNotEmpty } from '../shared/empty.util';
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
import { combineLatest, filter, first, flatMap, map } from 'rxjs/operators';
import { SearchService } from '../+search-page/search-service/search.service';
import { PaginatedSearchOptions } from '../+search-page/paginated-search-options.model';
import { toDSpaceObjectListRD } from '../core/shared/operators';
import { DSpaceObjectType } from '../core/shared/dspace-object-type.model';
import { filter, first, flatMap, map, switchMap } from 'rxjs/operators';
import { getSucceededRemoteData, redirectToPageNotFoundOn404 } from '../core/shared/operators';
import { FindAllOptions } from '../core/data/request.models';

@Component({
selector: 'ds-collection-page',
Expand All @@ -39,13 +37,13 @@ export class CollectionPageComponent implements OnInit, OnDestroy {
paginationConfig: PaginationComponentOptions;
sortConfig: SortOptions;
private subs: Subscription[] = [];
private collectionId: string;

constructor(
private collectionDataService: CollectionDataService,
private itemDataService: ItemDataService,
private metadata: MetadataService,
private route: ActivatedRoute
private route: ActivatedRoute,
private router: Router
) {
this.paginationConfig = new PaginationComponentOptions();
this.paginationConfig.id = 'collection-page-pagination';
Expand All @@ -56,7 +54,8 @@ export class CollectionPageComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.collectionRD$ = this.route.data.pipe(
map((data) => data.collection),
map((data) => data.collection as RemoteData<Collection>),
redirectToPageNotFoundOn404(this.router),
first()
);
this.logoRD$ = this.collectionRD$.pipe(
Expand All @@ -78,24 +77,28 @@ export class CollectionPageComponent implements OnInit, OnDestroy {
this.sortConfig,
{ direction: sortDirection, field: this.sortConfig.field }
);
this.collectionRD$.subscribe((rd: RemoteData<Collection>) => {
this.collectionId = rd.payload.id;
this.updatePage({
pagination: pagination,
sort: sort
});
this.updatePage({
pagination: pagination,
sort: sort
});
})
);
}

updatePage(searchOptions) {
this.itemRD$ = this.itemDataService.findAll({
scopeID: this.collectionId,
currentPage: searchOptions.pagination.currentPage,
elementsPerPage: searchOptions.pagination.pageSize,
sort: searchOptions.sort
});
this.itemRD$ = this.collectionRD$.pipe(
getSucceededRemoteData(),
map((rd) => rd.payload.id),
switchMap((id: string) => {
return this.itemDataService.findAll(
{
scopeID: id,
currentPage: searchOptions.pagination.currentPage,
elementsPerPage: searchOptions.pagination.pageSize,
sort: searchOptions.sort
});
})
)
}

ngOnDestroy(): void {
Expand Down
Loading