Skip to content

Commit

Permalink
Merged in DSC-1184 (pull request DSpace#954)
Browse files Browse the repository at this point in the history
DSC-1184

Approved-by: Giuseppe Digilio
  • Loading branch information
vins01-4science authored and atarix83 committed Nov 7, 2023
2 parents 6eb328c + 6e05504 commit 30543a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/app/core/data/version-history-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ import { VERSION_HISTORY } from '../shared/version-history.resource-type';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { VersionDataService } from './version-data.service';
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
import { getAllSucceededRemoteData, getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload, getRemoteDataPayload } from '../shared/operators';
import {
getAllSucceededRemoteData,
getFirstCompletedRemoteData,
getFirstSucceededRemoteDataPayload,
getRemoteDataPayload
} from '../shared/operators';
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
import { hasValueOperator } from '../../shared/empty.util';
import { Item } from '../shared/item.model';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('DsoVersioningModalService', () => {
let router;
let workspaceItemDataService;
let itemService;
let editItemService;

const mockItem: Item = Object.assign(new Item(), {
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
Expand Down Expand Up @@ -48,6 +49,7 @@ describe('DsoVersioningModalService', () => {
router = jasmine.createSpyObj('router', ['navigateByUrl']);
workspaceItemDataService = jasmine.createSpyObj('workspaceItemDataService', ['findByItem']);
itemService = jasmine.createSpyObj('itemService', ['findByHref']);
editItemService = jasmine.createSpyObj('editItemService', ['invalidateItemCache']);

service = new DsoVersioningModalService(
modalService,
Expand All @@ -56,7 +58,8 @@ describe('DsoVersioningModalService', () => {
itemVersionShared,
router,
workspaceItemDataService,
itemService
itemService,
editItemService,
);
}));
describe('when onCreateNewVersion() is called', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { ItemVersionsSharedService } from '../../../item-page/versions/item-vers
import {
ItemVersionsSummaryModalComponent
} from '../../../item-page/versions/item-versions-summary-modal/item-versions-summary-modal.component';
import { EditItemDataService } from '../../../core/submission/edititem-data.service';
import { fromPromise } from 'rxjs/internal/observable/innerFrom';

/**
* Service to take care of all the functionality related to the version creation modal
Expand All @@ -34,6 +36,7 @@ export class DsoVersioningModalService {
protected router: Router,
protected workspaceItemDataService: WorkspaceitemDataService,
protected itemService: ItemDataService,
protected editItemService: EditItemDataService,
) {
}

Expand Down Expand Up @@ -71,11 +74,9 @@ export class DsoVersioningModalService {
getFirstSucceededRemoteDataPayload<Item>(),
switchMap((newVersionItem: Item) => this.workspaceItemDataService.findByItem(newVersionItem.uuid, true, false)),
getFirstSucceededRemoteDataPayload<WorkspaceItem>(),
).subscribe((wsItem) => {
const wsiId = wsItem.id;
const route = 'workspaceitems/' + wsiId + '/edit';
this.router.navigateByUrl(route);
});
map((wsItem: WorkspaceItem) => `workspaceitems/${wsItem?.id}/edit`),
switchMap((route: string) => fromPromise(this.router.navigateByUrl(route))),
).subscribe(() => this.editItemService.invalidateItemCache(item.uuid));
}

/**
Expand Down

0 comments on commit 30543a4

Please sign in to comment.