Skip to content

Commit 81d6cf2

Browse files
committed
Merge branch 'master' into w2p-69612_Edit-Community---Assign-Roles-Groups
2 parents e2c277d + 521b0d3 commit 81d6cf2

28 files changed

Lines changed: 1027 additions & 19 deletions

resources/i18n/en.json5

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,12 @@
11321132

11331133
"item.edit.tabs.status.title": "Item Edit - Status",
11341134

1135+
"item.edit.tabs.versionhistory.head": "Version History",
1136+
1137+
"item.edit.tabs.versionhistory.title": "Item Edit - Version History",
1138+
1139+
"item.edit.tabs.versionhistory.under-construction": "Editing or adding new versions is not yet possible in this user interface.",
1140+
11351141
"item.edit.tabs.view.head": "View Item",
11361142

11371143
"item.edit.tabs.view.title": "Item Edit - View",
@@ -1211,6 +1217,29 @@
12111217
"item.select.table.title": "Title",
12121218

12131219

1220+
"item.version.history.empty": "There are no other versions for this item yet.",
1221+
1222+
"item.version.history.head": "Version History",
1223+
1224+
"item.version.history.return": "Return",
1225+
1226+
"item.version.history.selected": "Selected version",
1227+
1228+
"item.version.history.table.version": "Version",
1229+
1230+
"item.version.history.table.item": "Item",
1231+
1232+
"item.version.history.table.editor": "Editor",
1233+
1234+
"item.version.history.table.date": "Date",
1235+
1236+
"item.version.history.table.summary": "Summary",
1237+
1238+
1239+
1240+
"item.version.notice": "This is not the latest version of this item. The latest version can be found <a href='{{destination}}'>here</a>.",
1241+
1242+
12141243

12151244
"journal.listelement.badge": "Journal",
12161245

resources/i18n/pt.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@
918918
"item.edit.move.processing": "Movendo...",
919919

920920
// "item.edit.move.search.placeholder": "Enter a search query to look for collections",
921-
"item.edit.move.search.placeholder": "nsira uma consulta para procurar coleções",
921+
"item.edit.move.search.placeholder": "Insira uma consulta para procurar coleções",
922922

923923
// "item.edit.move.success": "The item has been moved successfully",
924924
"item.edit.move.success": "O item foi movido com sucesso",

src/app/+item-page/edit-item-page/edit-item-page.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { EditRelationshipComponent } from './item-relationships/edit-relationshi
2222
import { EditRelationshipListComponent } from './item-relationships/edit-relationship-list/edit-relationship-list.component';
2323
import { ItemMoveComponent } from './item-move/item-move.component';
2424
import { VirtualMetadataComponent } from './virtual-metadata/virtual-metadata.component';
25+
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
2526

2627
/**
2728
* Module that contains all components related to the Edit Item page administrator functionality
@@ -47,6 +48,7 @@ import { VirtualMetadataComponent } from './virtual-metadata/virtual-metadata.co
4748
ItemMetadataComponent,
4849
ItemRelationshipsComponent,
4950
ItemBitstreamsComponent,
51+
ItemVersionHistoryComponent,
5052
EditInPlaceFieldComponent,
5153
EditRelationshipComponent,
5254
EditRelationshipListComponent,

src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ItemPageResolver } from '../item-page.resolver';
21
import { NgModule } from '@angular/core';
32
import { RouterModule } from '@angular/router';
43
import { EditItemPageComponent } from './edit-item-page.component';
@@ -14,6 +13,7 @@ import { ItemCollectionMapperComponent } from './item-collection-mapper/item-col
1413
import { ItemMoveComponent } from './item-move/item-move.component';
1514
import { ItemRelationshipsComponent } from './item-relationships/item-relationships.component';
1615
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
16+
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
1717

1818
export const ITEM_EDIT_WITHDRAW_PATH = 'withdraw';
1919
export const ITEM_EDIT_REINSTATE_PATH = 'reinstate';
@@ -75,6 +75,11 @@ export const ITEM_EDIT_MOVE_PATH = 'move';
7575
/* TODO - change when curate page exists */
7676
component: ItemBitstreamsComponent,
7777
data: { title: 'item.edit.tabs.curate.title', showBreadcrumbs: true }
78+
},
79+
{
80+
path: 'versionhistory',
81+
component: ItemVersionHistoryComponent,
82+
data: { title: 'item.edit.tabs.versionhistory.title', showBreadcrumbs: true }
7883
}
7984
]
8085
},
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="mt-4">
2+
<ds-alert [content]="'item.edit.tabs.versionhistory.under-construction'" [type]="AlertTypeEnum.Warning"></ds-alert>
3+
</div>
4+
<div class="mt-2" *ngVar="(itemRD$ | async)?.payload as item">
5+
<ds-item-versions *ngIf="item" [item]="item" [displayWhenEmpty]="true" [displayTitle]="false"></ds-item-versions>
6+
</div>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { ItemVersionHistoryComponent } from './item-version-history.component';
2+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3+
import { VarDirective } from '../../../shared/utils/var.directive';
4+
import { RouterTestingModule } from '@angular/router/testing';
5+
import { TranslateModule } from '@ngx-translate/core';
6+
import { NO_ERRORS_SCHEMA } from '@angular/core';
7+
import { Item } from '../../../core/shared/item.model';
8+
import { ActivatedRoute } from '@angular/router';
9+
import { of as observableOf } from 'rxjs';
10+
import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
11+
12+
describe('ItemVersionHistoryComponent', () => {
13+
let component: ItemVersionHistoryComponent;
14+
let fixture: ComponentFixture<ItemVersionHistoryComponent>;
15+
16+
const item = Object.assign(new Item(), {
17+
uuid: 'item-identifier-1',
18+
handle: '123456789/1',
19+
});
20+
21+
beforeEach(async(() => {
22+
TestBed.configureTestingModule({
23+
declarations: [ItemVersionHistoryComponent, VarDirective],
24+
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])],
25+
providers: [
26+
{ provide: ActivatedRoute, useValue: { parent: { data: observableOf({ item: createSuccessfulRemoteDataObject(item) }) } } }
27+
],
28+
schemas: [NO_ERRORS_SCHEMA]
29+
}).compileComponents();
30+
}));
31+
32+
beforeEach(() => {
33+
fixture = TestBed.createComponent(ItemVersionHistoryComponent);
34+
component = fixture.componentInstance;
35+
fixture.detectChanges();
36+
});
37+
38+
it('should initialize the itemRD$ from the route\'s data', (done) => {
39+
component.itemRD$.subscribe((itemRD) => {
40+
expect(itemRD.payload).toBe(item);
41+
done();
42+
});
43+
});
44+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Component } from '@angular/core';
2+
import { Observable } from 'rxjs/internal/Observable';
3+
import { RemoteData } from '../../../core/data/remote-data';
4+
import { Item } from '../../../core/shared/item.model';
5+
import { map } from 'rxjs/operators';
6+
import { getSucceededRemoteData } from '../../../core/shared/operators';
7+
import { ActivatedRoute } from '@angular/router';
8+
import { AlertType } from '../../../shared/alert/aletr-type';
9+
10+
@Component({
11+
selector: 'ds-item-version-history',
12+
templateUrl: './item-version-history.component.html'
13+
})
14+
/**
15+
* Component for listing and managing an item's version history
16+
*/
17+
export class ItemVersionHistoryComponent {
18+
/**
19+
* The item to display the version history for
20+
*/
21+
itemRD$: Observable<RemoteData<Item>>;
22+
23+
/**
24+
* The AlertType enumeration
25+
* @type {AlertType}
26+
*/
27+
AlertTypeEnum = AlertType;
28+
29+
constructor(private route: ActivatedRoute) {
30+
}
31+
32+
ngOnInit(): void {
33+
this.itemRD$ = this.route.parent.data.pipe(map((data) => data.item)).pipe(getSucceededRemoteData()) as Observable<RemoteData<Item>>;
34+
}
35+
}

src/app/+item-page/full/full-item-page.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="container" *ngVar="(itemRD$ | async) as itemRD">
22
<div class="item-page" *ngIf="itemRD?.hasSucceeded" @fadeInOut>
33
<div *ngIf="itemRD?.payload as item">
4+
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
45
<ds-view-tracker [object]="item"></ds-view-tracker>
56
<ds-item-page-title-field [item]="item"></ds-item-page-title-field>
67
<div class="simple-view-link my-3">
@@ -21,6 +22,7 @@
2122
</table>
2223
<ds-item-page-full-file-section [item]="item"></ds-item-page-full-file-section>
2324
<ds-item-page-collections [item]="item"></ds-item-page-collections>
25+
<ds-item-versions class="mt-2" [item]="item"></ds-item-versions>
2426
</div>
2527
</div>
2628
<ds-error *ngIf="itemRD?.hasFailed" message="{{'error.item' | translate}}"></ds-error>

src/app/+item-page/item-page.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { AbstractIncrementalListComponent } from './simple/abstract-incremental-
5959
MetadataRepresentationListComponent,
6060
RelatedEntitiesSearchComponent,
6161
TabbedRelatedEntitiesSearchComponent,
62-
AbstractIncrementalListComponent
62+
AbstractIncrementalListComponent,
6363
],
6464
exports: [
6565
ItemComponent,

src/app/+item-page/item-page.resolver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ItemPageResolver implements Resolve<RemoteData<Item>> {
2828
followLink('owningCollection'),
2929
followLink('bundles'),
3030
followLink('relationships'),
31+
followLink('version', undefined, true, followLink('versionhistory')),
3132
).pipe(
3233
find((RD) => hasValue(RD.error) || RD.hasSucceeded),
3334
);

0 commit comments

Comments
 (0)