Skip to content

Commit

Permalink
[CST-5253] Fix view item button for claim task in the mydspace result…
Browse files Browse the repository at this point in the history
…s list
  • Loading branch information
atarix83 committed Apr 29, 2022
1 parent 55e77d1 commit bfb84c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
(processCompleted)="this.processCompleted.emit($event)">
</ds-claimed-task-actions-loader>

<!-- <ng-container *ngIf="hasViewAction(workflowAction)"> -->
<button class="btn btn-primary workflow-view" ngbTooltip="{{'submission.workflow.generic.view-help' | translate}}"
[routerLink]="[getWorkflowItemViewRoute((workflowitem$ | async))]">
<i class="fa fa-info-circle"></i> {{"submission.workflow.generic.view" | translate}}
</button>
<!-- </ng-container> -->

<ds-claimed-task-actions-loader [option]="returnToPoolOption" [object]="object"
(processCompleted)="this.processCompleted.emit($event)">
</ds-claimed-task-actions-loader>
</div>
</ng-container>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,22 @@ describe('ClaimedTaskActionsComponent', () => {
});
}));

describe('when edit options is not available', () => {
it('should display a view button', waitForAsync(() => {
component.object = null;
component.initObjects(mockObject);
fixture.detectChanges();

fixture.whenStable().then(() => {
const debugElement = fixture.debugElement.query(By.css('.workflow-view'));
expect(debugElement).toBeTruthy();
expect(debugElement.nativeElement.innerText.trim()).toBe('submission.workflow.generic.view');
});
it('should display a view button', waitForAsync(() => {
component.object = null;
component.initObjects(mockObject);
fixture.detectChanges();

}));
fixture.whenStable().then(() => {
const debugElement = fixture.debugElement.query(By.css('.workflow-view'));
expect(debugElement).toBeTruthy();
expect(debugElement.nativeElement.innerText.trim()).toBe('submission.workflow.generic.view');
});

it('getWorkflowItemViewRoute should return the combined uri to show a workspaceitem', waitForAsync(() => {
const href = component.getWorkflowItemViewRoute(workflowitem);
expect(href).toEqual('/workflowitems/333/view');
}));
});
}));

it('getWorkflowItemViewRoute should return the combined uri to show a workspaceitem', waitForAsync(() => {
const href = component.getWorkflowItemViewRoute(workflowitem);
expect(href).toEqual('/workflowitems/333/view');
}));

});
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,6 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
this.actionRD$ = object.action;
}

/**
* Check if claimed task actions should display a view item button.
* @param workflowAction
*/
hasViewAction(workflowAction: WorkflowAction) {
return !workflowAction?.options.includes('submit_edit_metadata');
}

/**
* Get the workflowitem view route.
*/
Expand Down

0 comments on commit bfb84c8

Please sign in to comment.