mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-4499] Version history (WIP) - Removed summary page (with routing) and modal
This commit is contained in:
@@ -28,6 +28,7 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
|||||||
import { ItemEditBitstreamDragHandleComponent } from './item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component';
|
import { ItemEditBitstreamDragHandleComponent } from './item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component';
|
||||||
import { PaginatedDragAndDropBitstreamListComponent } from './item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component';
|
import { PaginatedDragAndDropBitstreamListComponent } from './item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component';
|
||||||
import { VirtualMetadataComponent } from './virtual-metadata/virtual-metadata.component';
|
import { VirtualMetadataComponent } from './virtual-metadata/virtual-metadata.component';
|
||||||
|
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
|
||||||
import { ItemAuthorizationsComponent } from './item-authorizations/item-authorizations.component';
|
import { ItemAuthorizationsComponent } from './item-authorizations/item-authorizations.component';
|
||||||
import { ObjectValuesPipe } from '../../shared/utils/object-values-pipe';
|
import { ObjectValuesPipe } from '../../shared/utils/object-values-pipe';
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@ import { ObjectValuesPipe } from '../../shared/utils/object-values-pipe';
|
|||||||
ItemMetadataComponent,
|
ItemMetadataComponent,
|
||||||
ItemRelationshipsComponent,
|
ItemRelationshipsComponent,
|
||||||
ItemBitstreamsComponent,
|
ItemBitstreamsComponent,
|
||||||
|
ItemVersionHistoryComponent,
|
||||||
EditInPlaceFieldComponent,
|
EditInPlaceFieldComponent,
|
||||||
ItemEditBitstreamComponent,
|
ItemEditBitstreamComponent,
|
||||||
ItemEditBitstreamBundleComponent,
|
ItemEditBitstreamBundleComponent,
|
||||||
|
@@ -13,6 +13,7 @@ import { ItemCollectionMapperComponent } from './item-collection-mapper/item-col
|
|||||||
import { ItemMoveComponent } from './item-move/item-move.component';
|
import { ItemMoveComponent } from './item-move/item-move.component';
|
||||||
import { ItemRelationshipsComponent } from './item-relationships/item-relationships.component';
|
import { ItemRelationshipsComponent } from './item-relationships/item-relationships.component';
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
|
||||||
import { ItemAuthorizationsComponent } from './item-authorizations/item-authorizations.component';
|
import { ItemAuthorizationsComponent } from './item-authorizations/item-authorizations.component';
|
||||||
import { ResourcePolicyTargetResolver } from '../../shared/resource-policies/resolvers/resource-policy-target.resolver';
|
import { ResourcePolicyTargetResolver } from '../../shared/resource-policies/resolvers/resource-policy-target.resolver';
|
||||||
import { ResourcePolicyResolver } from '../../shared/resource-policies/resolvers/resource-policy.resolver';
|
import { ResourcePolicyResolver } from '../../shared/resource-policies/resolvers/resource-policy.resolver';
|
||||||
@@ -43,7 +44,6 @@ import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.gua
|
|||||||
*/
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
// items/<id>/edit/''/public
|
|
||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
@@ -99,8 +99,7 @@ import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.gua
|
|||||||
}, */
|
}, */
|
||||||
{
|
{
|
||||||
path: 'versionhistory',
|
path: 'versionhistory',
|
||||||
loadChildren: () => import('./version-history/version-history.module')
|
component: ItemVersionHistoryComponent,
|
||||||
.then((m) => m.VersionHistoryModule),
|
|
||||||
data: { title: 'item.edit.tabs.versionhistory.title', showBreadcrumbs: true },
|
data: { title: 'item.edit.tabs.versionhistory.title', showBreadcrumbs: true },
|
||||||
canActivate: [ItemPageVersionHistoryGuard]
|
canActivate: [ItemPageVersionHistoryGuard]
|
||||||
},
|
},
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { ItemVersionHistoryComponent } from './item-version-history.component';
|
import { ItemVersionHistoryComponent } from './item-version-history.component';
|
||||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { VarDirective } from '../../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('ItemVersionHistoryComponent', () => {
|
describe('ItemVersionHistoryComponent', () => {
|
||||||
let component: ItemVersionHistoryComponent;
|
let component: ItemVersionHistoryComponent;
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { getFirstSucceededRemoteData } from '../../../../core/shared/operators';
|
import { getFirstSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { AlertType } from '../../../../shared/alert/aletr-type';
|
import { AlertType } from '../../../shared/alert/aletr-type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-version-history',
|
selector: 'ds-item-version-history',
|
@@ -1,5 +0,0 @@
|
|||||||
<ds-form [formId]="formId"
|
|
||||||
[formModel]="formModel"
|
|
||||||
[formGroup]="formGroup"
|
|
||||||
[formLayout]="formLayout">
|
|
||||||
</ds-form>
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ItemVersionHistoryFormComponent } from './item-version-history-form.component';
|
|
||||||
|
|
||||||
describe('ItemVersionHistoryCreateComponent', () => {
|
|
||||||
let component: ItemVersionHistoryFormComponent;
|
|
||||||
let fixture: ComponentFixture<ItemVersionHistoryFormComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ ItemVersionHistoryFormComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ItemVersionHistoryFormComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,74 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { getFirstSucceededRemoteData } from '../../../../core/shared/operators';
|
|
||||||
import { VersionDataService } from '../../../../core/data/version-data.service';
|
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
import { DynamicFormControlModel, DynamicFormLayout, DynamicInputModel } from '@ng-dynamic-forms/core';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-item-version-history-edit',
|
|
||||||
templateUrl: './item-version-history-form.component.html',
|
|
||||||
styleUrls: ['./item-version-history-form.component.scss']
|
|
||||||
})
|
|
||||||
export class ItemVersionHistoryFormComponent implements OnInit {
|
|
||||||
|
|
||||||
versionId;
|
|
||||||
|
|
||||||
itemId;
|
|
||||||
|
|
||||||
itemVersion: DynamicInputModel;
|
|
||||||
|
|
||||||
formId = 'item-version-form';
|
|
||||||
formModel: DynamicFormControlModel[];
|
|
||||||
formGroup: FormGroup;
|
|
||||||
formLayout: DynamicFormLayout = {
|
|
||||||
itemVersion: {
|
|
||||||
grid: {
|
|
||||||
host: 'row'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private versionDataService: VersionDataService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
|
|
||||||
this.versionId = this.route.snapshot.params.versionId;
|
|
||||||
|
|
||||||
console.log(this.route.snapshot.params);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.itemVersion = new DynamicInputModel({
|
|
||||||
id: 'groupName',
|
|
||||||
label: 'item version label',
|
|
||||||
name: 'itemVersion',
|
|
||||||
validators: {
|
|
||||||
required: null,
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
this.formModel = [
|
|
||||||
this.itemVersion,
|
|
||||||
];
|
|
||||||
|
|
||||||
/*this.versionDataService.findById(this.versionId).pipe(getFirstSucceededRemoteData()).subscribe(
|
|
||||||
(res) => {
|
|
||||||
this.versionDataService.update()
|
|
||||||
const updatedVersion =
|
|
||||||
Object.assign({}, res.payload, {
|
|
||||||
summary: 'New summary',
|
|
||||||
});
|
|
||||||
this.versionDataService.update(updatedVersion).pipe(take(1)).subscribe();
|
|
||||||
}
|
|
||||||
);*/ // TODO check not null
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
<div>
|
|
||||||
<div class="modal-header">VERSION SUMMARY TMP
|
|
||||||
<button type="button" class="close" (click)="close()" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<h5 class="px-2">HEADER (NEW/EDIT)</h5>
|
|
||||||
<p>input</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ItemVersionSummaryModalComponent } from './item-version-summary-modal.component';
|
|
||||||
|
|
||||||
describe('ItemVersionSummaryModalComponent', () => {
|
|
||||||
let component: ItemVersionSummaryModalComponent;
|
|
||||||
let fixture: ComponentFixture<ItemVersionSummaryModalComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ ItemVersionSummaryModalComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ItemVersionSummaryModalComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,23 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-item-version-summary-modal',
|
|
||||||
templateUrl: './item-version-summary-modal.component.html',
|
|
||||||
styleUrls: ['./item-version-summary-modal.component.scss']
|
|
||||||
})
|
|
||||||
export class ItemVersionSummaryModalComponent implements OnInit {
|
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the modal
|
|
||||||
*/
|
|
||||||
close() {
|
|
||||||
this.activeModal.close();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,20 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { SharedModule } from '../../../shared/shared.module';
|
|
||||||
import { VersionHistoryRoutingModule } from './version-history.routing.module';
|
|
||||||
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
|
|
||||||
import { ItemVersionHistoryFormComponent } from './item-version-history-form/item-version-history-form.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
ItemVersionHistoryComponent,
|
|
||||||
ItemVersionHistoryFormComponent
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
VersionHistoryRoutingModule
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class VersionHistoryModule {
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';
|
|
||||||
import { ItemVersionHistoryFormComponent } from './item-version-history-form/item-version-history-form.component';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Routing module that handles the routing for the Edit Item page administrator functionality
|
|
||||||
*/
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
// items/<id>/edit/''/version-history
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: ItemVersionHistoryComponent,
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// path: '',
|
|
||||||
// pathMatch: 'full',
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'create',
|
|
||||||
component: ItemVersionHistoryFormComponent,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':versionId/edit',
|
|
||||||
component: ItemVersionHistoryFormComponent,
|
|
||||||
}
|
|
||||||
])
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class VersionHistoryRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -2,6 +2,7 @@
|
|||||||
<div *ngVar="(versionRD$ | async)?.payload as itemVersion">
|
<div *ngVar="(versionRD$ | async)?.payload as itemVersion">
|
||||||
<div class="mb-2" *ngIf="versions?.page?.length > 0 || displayWhenEmpty">
|
<div class="mb-2" *ngIf="versions?.page?.length > 0 || displayWhenEmpty">
|
||||||
<h2 *ngIf="displayTitle">{{"item.version.history.head" | translate}}</h2>
|
<h2 *ngIf="displayTitle">{{"item.version.history.head" | translate}}</h2>
|
||||||
|
<!-- <p>TMP CURRENT VERSION = {{itemVersion.version}} {{item.uuid}} {{item.handle}}</p>check async -->
|
||||||
<ds-pagination *ngIf="versions?.page?.length > 0"
|
<ds-pagination *ngIf="versions?.page?.length > 0"
|
||||||
[hideGear]="true"
|
[hideGear]="true"
|
||||||
[hidePagerWhenSinglePage]="true"
|
[hidePagerWhenSinglePage]="true"
|
||||||
|
@@ -19,8 +19,6 @@ import { followLink } from '../../utils/follow-link-config.model';
|
|||||||
import { hasValue, hasValueOperator } from '../../empty.util';
|
import { hasValue, hasValueOperator } from '../../empty.util';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
|
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { ItemVersionSummaryModalComponent } from '../../../item-page/edit-item-page/version-history/item-version-summary-modal/item-version-summary-modal.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-versions',
|
selector: 'ds-item-versions',
|
||||||
@@ -110,12 +108,11 @@ export class ItemVersionsComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private versionHistoryService: VersionHistoryDataService,
|
constructor(private versionHistoryService: VersionHistoryDataService,
|
||||||
private paginationService: PaginationService,
|
private paginationService: PaginationService,
|
||||||
private modalService: NgbModal,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditDialog() {
|
openEditDialog() {
|
||||||
this.modalService.open(ItemVersionSummaryModalComponent);
|
// TODO REMOVE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user