mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
replaced wfi components by task components that render wfi's
This commit is contained in:
@@ -262,6 +262,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
"admin.workflow.breadcrumbs": "Admin Workflow",
|
||||
|
||||
"admin.workflow.title": "Admin Workflow",
|
||||
|
||||
|
||||
|
||||
|
||||
"auth.errors.invalid-user": "Invalid email address or password.",
|
||||
|
||||
"auth.messages.expired": "Your session has expired. Please log in again.",
|
||||
@@ -1385,6 +1393,8 @@
|
||||
"menu.section.toggle.statistics_task": "Toggle Statistics Task section",
|
||||
|
||||
|
||||
"menu.section.workflow": "Active Workflows",
|
||||
|
||||
|
||||
"mydspace.description": "",
|
||||
|
||||
@@ -2213,5 +2223,9 @@
|
||||
"virtual-metadata.delete-item.modal-head": "The virtual metadata of this relation",
|
||||
|
||||
"virtual-metadata.delete-relationship.modal-head": "Select the items for which you want to save the virtual metadata as real metadata",
|
||||
|
||||
"workflowAdmin.search.results.head": "Active Workflows",
|
||||
|
||||
"workflowAdmin.search.results.head": "Active Workflows",
|
||||
}
|
||||
|
||||
|
@@ -28,13 +28,15 @@ export function getRegistriesModulePath() {
|
||||
{
|
||||
path: 'search',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AdminWorkflowPageComponent,
|
||||
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' }
|
||||
component: AdminSearchPageComponent,
|
||||
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' }
|
||||
},
|
||||
{
|
||||
path: 'workflow',
|
||||
component: AdminSearchPageComponent,
|
||||
}
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AdminWorkflowPageComponent,
|
||||
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' }
|
||||
},
|
||||
])
|
||||
],
|
||||
providers: [
|
||||
|
@@ -447,7 +447,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.workflow',
|
||||
link: '/admin/worklow'
|
||||
link: '/admin/workflow'
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'user-check',
|
||||
index: 10
|
||||
|
@@ -1,3 +1 @@
|
||||
BLABLABALAB
|
||||
|
||||
<ds-configuration-search-page configuration="workflowConfiguration" [context]="context"></ds-configuration-search-page>
|
||||
<ds-configuration-search-page configuration="workflowAdmin" [context]="context"></ds-configuration-search-page>
|
||||
|
@@ -1,15 +0,0 @@
|
||||
<ng-template dsListableObject>
|
||||
</ng-template>
|
||||
<div #badges class="position-absolute ml-1">
|
||||
<div *ngIf="dso && !dso.isDiscoverable" class="private-badge">
|
||||
<span class="badge badge-danger">{{ "admin.search.item.private" | translate }}</span>
|
||||
</div>
|
||||
<div *ngIf="dso && dso.isWithdrawn" class="withdrawn-badge">
|
||||
<span class="badge badge-warning">{{ "admin.search.item.withdrawn" | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<ul #buttons class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<ds-item-admin-workflow-search-result-actions-element class="d-flex justify-content-between" [item]="dso" [small]="true"></ds-item-admin-workflow-search-result-actions-element>
|
||||
</li>
|
||||
</ul>
|
@@ -0,0 +1,6 @@
|
||||
<ds-workflow-item-admin-workflow-grid-element
|
||||
[index]="index"
|
||||
[object]="wfi$ | async"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"
|
||||
></ds-workflow-item-admin-workflow-grid-element>
|
@@ -0,0 +1,121 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { Bitstream } from '../../../../../core/shared/bitstream.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service';
|
||||
import { SharedModule } from '../../../../../shared/shared.module';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { PoolTaskAdminWorkflowSearchResultGridElementComponent } from './pool-task-admin-workflow-search-result-grid-element.component';
|
||||
|
||||
describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
let component: PoolTaskAdminWorkflowSearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<PoolTaskAdminWorkflowSearchResultGridElementComponent>;
|
||||
let id;
|
||||
let searchResult;
|
||||
|
||||
const mockBitstreamDataService = {
|
||||
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||
return createSuccessfulRemoteDataObject$(new Bitstream());
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
id = '780b2588-bda5-4112-a1cd-0b15000a5339';
|
||||
searchResult = new ItemSearchResult();
|
||||
searchResult.indexableObject = new Item();
|
||||
searchResult.indexableObject.uuid = id;
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule(
|
||||
{
|
||||
declarations: [PoolTaskAdminWorkflowSearchResultGridElementComponent],
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PoolTaskAdminWorkflowSearchResultGridElementComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = searchResult;
|
||||
component.linkTypes = CollectionElementLinkType;
|
||||
component.index = 0;
|
||||
component.viewModes = ViewMode;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('when the item is not withdrawn', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isWithdrawn = false;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should not show the withdrawn badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.withdrawn-badge'));
|
||||
expect(badge).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is withdrawn', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isWithdrawn = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the withdrawn badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.withdrawn-badge'));
|
||||
expect(badge).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is not private', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isDiscoverable = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
it('should not show the private badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.private-badge'));
|
||||
expect(badge).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is private', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isDiscoverable = false;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the private badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.private-badge'));
|
||||
expect(badge).not.toBeNull();
|
||||
});
|
||||
})
|
||||
});
|
@@ -0,0 +1,45 @@
|
||||
import { Component, ComponentFactoryResolver, ElementRef, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { getListableObjectComponent, listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { getItemEditPath } from '../../../../../+item-page/item-page-routing.module';
|
||||
import { URLCombiner } from '../../../../../core/url-combiner/url-combiner';
|
||||
import {
|
||||
ITEM_EDIT_DELETE_PATH,
|
||||
ITEM_EDIT_MOVE_PATH,
|
||||
ITEM_EDIT_PRIVATE_PATH,
|
||||
ITEM_EDIT_PUBLIC_PATH,
|
||||
ITEM_EDIT_REINSTATE_PATH,
|
||||
ITEM_EDIT_WITHDRAW_PATH
|
||||
} from '../../../../../+item-page/edit-item-page/edit-item-page.routing.module';
|
||||
import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
|
||||
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||
import { PoolTaskSearchResult } from '../../../../../shared/object-collection/shared/pool-task-search-result.model';
|
||||
import { PoolTask } from '../../../../../core/tasks/models/pool-task-object.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../core/shared/operators';
|
||||
|
||||
@listableObjectComponent(PoolTaskSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
selector: 'ds-pool-task-admin-workflow-search-result-grid-element',
|
||||
styleUrls: ['./pool-task-admin-workflow-search-result-grid-element.component.scss'],
|
||||
templateUrl: './pool-task-admin-workflow-search-result-grid-element.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an pool task search result on the admin search page
|
||||
*/
|
||||
export class PoolTaskAdminWorkflowSearchResultGridElementComponent extends SearchResultGridElementComponent<PoolTaskSearchResult, PoolTask> implements OnInit {
|
||||
public wfi$: Observable<WorkflowItem>;
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.wfi$ = (this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<ng-template dsListableObject>
|
||||
</ng-template>
|
||||
<div #badges class="position-absolute ml-1">
|
||||
<div class="workflow-badge">
|
||||
<span class="badge badge-info">{{ "admin.workflow.item.workflow" | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<ul #buttons class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<ds-workflow-item-admin-workflow-actions-element class="d-flex justify-content-between" [wfi]="object" [small]="true"></ds-workflow-item-admin-workflow-actions-element>
|
||||
</li>
|
||||
</ul>
|
@@ -17,11 +17,11 @@ import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { ItemAdminWorkflowSearchResultGridElementComponent } from './item-admin-workflow-search-result-grid-element.component';
|
||||
import { WorkflowItemAdminWorkflowGridElementComponent } from './workflow-item-admin-workflow-grid-element.component';
|
||||
|
||||
describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
let component: ItemAdminWorkflowSearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<ItemAdminWorkflowSearchResultGridElementComponent>;
|
||||
let component: WorkflowItemAdminWorkflowGridElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemAdminWorkflowGridElementComponent>;
|
||||
let id;
|
||||
let searchResult;
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
init();
|
||||
TestBed.configureTestingModule(
|
||||
{
|
||||
declarations: [ItemAdminWorkflowSearchResultGridElementComponent],
|
||||
declarations: [WorkflowItemAdminWorkflowGridElementComponent],
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
@@ -59,7 +59,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ItemAdminWorkflowSearchResultGridElementComponent);
|
||||
fixture = TestBed.createComponent(WorkflowItemAdminWorkflowGridElementComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = searchResult;
|
||||
component.linkTypes = CollectionElementLinkType;
|
@@ -19,33 +19,32 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
|
||||
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { AbstractListableElementComponent } from '../../../../../shared/object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
|
||||
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
selector: 'ds-item-admin-workflow-search-result-grid-element',
|
||||
styleUrls: ['./item-admin-workflow-search-result-grid-element.component.scss'],
|
||||
templateUrl: './item-admin-workflow-search-result-grid-element.component.html'
|
||||
selector: 'ds-workflow-item-admin-workflow-grid-element',
|
||||
styleUrls: ['./workflow-item-admin-workflow-grid-element.component.scss'],
|
||||
templateUrl: './workflow-item-admin-workflow-grid-element.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an item search result on the admin search page
|
||||
* The component for displaying a list element for an workflow item on the admin search page
|
||||
*/
|
||||
export class ItemAdminWorkflowSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> implements OnInit {
|
||||
export class WorkflowItemAdminWorkflowGridElementComponent extends AbstractListableElementComponent<WorkflowItem> {
|
||||
@ViewChild(ListableObjectDirective, { static: true }) listableObjectDirective: ListableObjectDirective;
|
||||
@ViewChild('badges', { static: true }) badges: ElementRef;
|
||||
@ViewChild('buttons', { static: true }) buttons: ElementRef;
|
||||
|
||||
constructor(protected truncatableService: TruncatableService,
|
||||
protected bitstreamDataService: BitstreamDataService,
|
||||
private componentFactoryResolver: ComponentFactoryResolver
|
||||
) {
|
||||
super(truncatableService, bitstreamDataService);
|
||||
constructor(private componentFactoryResolver: ComponentFactoryResolver) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the dynamic child component
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
|
||||
|
||||
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
|
@@ -1,12 +0,0 @@
|
||||
<div *ngIf="dso && !dso.isDiscoverable" class="private-badge">
|
||||
<span class="badge badge-danger">{{ "admin.search.item.private" | translate }}</span>
|
||||
</div>
|
||||
<div *ngIf="dso && dso.isWithdrawn" class="withdrawn-badge">
|
||||
<span class="badge badge-warning">{{ "admin.search.item.withdrawn" | translate }}</span>
|
||||
</div>
|
||||
<ds-listable-object-component-loader [object]="object"
|
||||
[viewMode]="viewModes.ListElement"
|
||||
[index]="index"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"></ds-listable-object-component-loader>
|
||||
<ds-item-admin-workflow-search-result-actions-element [item]="dso" [small]="false"></ds-item-admin-workflow-search-result-actions-element>
|
@@ -1,20 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||
|
||||
@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
selector: 'ds-item-admin-workflow-search-result-list-element',
|
||||
styleUrls: ['./item-admin-workflow-search-result-list-element.component.scss'],
|
||||
templateUrl: './item-admin-workflow-search-result-list-element.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an item search result on the admin search page
|
||||
*/
|
||||
export class ItemAdminWorkflowSearchResultListElementComponent extends SearchResultListElementComponent<ItemSearchResult, Item> {
|
||||
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<ds-workflow-item-admin-workflow-search-result-list-element
|
||||
[index]="index"
|
||||
[object]="wfi$ | async"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"
|
||||
></ds-workflow-item-admin-workflow-search-result-list-element>
|
@@ -0,0 +1,101 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { PoolTaskAdminWorkflowSearchResultListElementComponent } from './pool-task-admin-workflow-search-result-list-element.component';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
|
||||
describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
let component: PoolTaskAdminWorkflowSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PoolTaskAdminWorkflowSearchResultListElementComponent>;
|
||||
let id;
|
||||
let searchResult;
|
||||
|
||||
function init() {
|
||||
id = '780b2588-bda5-4112-a1cd-0b15000a5339';
|
||||
searchResult = new ItemSearchResult();
|
||||
searchResult.indexableObject = new Item();
|
||||
searchResult.indexableObject.uuid = id;
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
declarations: [PoolTaskAdminWorkflowSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PoolTaskAdminWorkflowSearchResultListElementComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = searchResult;
|
||||
component.linkTypes = CollectionElementLinkType;
|
||||
component.index = 0;
|
||||
component.viewModes = ViewMode;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('when the item is not withdrawn', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isWithdrawn = false;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should not show the withdrawn badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.withdrawn-badge'));
|
||||
expect(badge).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is withdrawn', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isWithdrawn = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the withdrawn badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.withdrawn-badge'));
|
||||
expect(badge).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is not private', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isDiscoverable = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
it('should not show the private badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.private-badge'));
|
||||
expect(badge).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the item is private', () => {
|
||||
beforeEach(() => {
|
||||
component.dso.isDiscoverable = false;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the private badge', () => {
|
||||
const badge = fixture.debugElement.query(By.css('div.private-badge'));
|
||||
expect(badge).not.toBeNull();
|
||||
});
|
||||
})
|
||||
});
|
@@ -0,0 +1,29 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||
import { PoolTaskSearchResult } from '../../../../../shared/object-collection/shared/pool-task-search-result.model';
|
||||
import { PoolTask } from '../../../../../core/tasks/models/pool-task-object.model';
|
||||
import { Observable, pipe } from 'rxjs';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../core/shared/operators';
|
||||
|
||||
@listableObjectComponent(PoolTaskSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
selector: 'ds-pooltask-admin-workflow-search-result-list-element',
|
||||
styleUrls: ['./pool-task-admin-workflow-search-result-list-element.component.scss'],
|
||||
templateUrl: './pool-task-admin-workflow-search-result-list-element.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an pool task search result on the admin search page
|
||||
*/
|
||||
export class PoolTaskAdminWorkflowSearchResultListElementComponent extends SearchResultListElementComponent<PoolTaskSearchResult, PoolTask> {
|
||||
public wfi$: Observable<WorkflowItem>;
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.wfi$ = (this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
<div class="workflow-badge">
|
||||
<span class="badge badge-info">{{ "admin.workflow.item.workflow" | translate }}</span>
|
||||
</div>
|
||||
<ds-listable-object-component-loader [object]="object"
|
||||
[viewMode]="viewModes.ListElement"
|
||||
[index]="index"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"></ds-listable-object-component-loader>
|
||||
<ds-workflow-item-admin-workflow-actions-element [wfi]="object" [small]="false"></ds-workflow-item-admin-workflow-actions-element>
|
@@ -8,12 +8,12 @@ import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { ItemAdminWorkflowSearchResultListElementComponent } from './item-admin-workflow-search-result-list-element.component';
|
||||
import { WorkflowItemAdminWorkflowListElementComponent } from './workflow-item-admin-workflow-list-element.component';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
|
||||
describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
let component: ItemAdminWorkflowSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ItemAdminWorkflowSearchResultListElementComponent>;
|
||||
let component: WorkflowItemAdminWorkflowListElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemAdminWorkflowListElementComponent>;
|
||||
let id;
|
||||
let searchResult;
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
declarations: [ItemAdminWorkflowSearchResultListElementComponent],
|
||||
declarations: [WorkflowItemAdminWorkflowListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
@@ -39,7 +39,7 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ItemAdminWorkflowSearchResultListElementComponent);
|
||||
fixture = TestBed.createComponent(WorkflowItemAdminWorkflowListElementComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = searchResult;
|
||||
component.linkTypes = CollectionElementLinkType;
|
@@ -0,0 +1,19 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { AbstractListableElementComponent } from '../../../../../shared/object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
|
||||
@listableObjectComponent(WorkflowItem, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-admin-workflow-list-element',
|
||||
styleUrls: ['./workflow-item-admin-workflow-list-element.component.scss'],
|
||||
templateUrl: './workflow-item-admin-workflow-list-element.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an workflow item on the admin search page
|
||||
*/
|
||||
export class WorkflowItemAdminWorkflowListElementComponent extends AbstractListableElementComponent<WorkflowItem> {
|
||||
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { getItemEditPath } from '../../../+item-page/item-page-routing.module';
|
||||
import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||
import {
|
||||
ITEM_EDIT_DELETE_PATH,
|
||||
ITEM_EDIT_MOVE_PATH,
|
||||
ITEM_EDIT_PRIVATE_PATH,
|
||||
ITEM_EDIT_PUBLIC_PATH,
|
||||
ITEM_EDIT_REINSTATE_PATH,
|
||||
ITEM_EDIT_WITHDRAW_PATH
|
||||
} from '../../../+item-page/edit-item-page/edit-item-page.routing.module';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-item-admin-workflow-search-result-actions-element',
|
||||
styleUrls: ['./item-admin-workflow-search-result-actions.component.scss'],
|
||||
templateUrl: './item-admin-workflow-search-result-actions.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying the actions for a list element for an item search result on the admin search page
|
||||
*/
|
||||
export class ItemAdminWorkflowSearchResultActionsComponent {
|
||||
/**
|
||||
* The item to perform the actions on
|
||||
*/
|
||||
@Input() public item: Item;
|
||||
|
||||
/**
|
||||
* Whether or not to use small buttons
|
||||
*/
|
||||
@Input() public small: boolean;
|
||||
|
||||
/**
|
||||
* Returns the path to the edit page of this item
|
||||
*/
|
||||
getEditPath(): string {
|
||||
return getItemEditPath(this.item.uuid)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the withdraw page of this item
|
||||
*/
|
||||
getWithdrawPath(): string {
|
||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_WITHDRAW_PATH).toString();
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemAdminWorkflowSearchResultActionsComponent } from './item-admin-workflow-search-result-actions.component';
|
||||
import { ItemAdminWorkflowSearchResultActionsComponent } from './workflow-item-admin-workflow-actions.component';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import {
|
||||
ITEM_EDIT_DELETE_PATH,
|
@@ -0,0 +1,39 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { getItemEditPath } from '../../../+item-page/item-page-routing.module';
|
||||
import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||
import { ITEM_EDIT_WITHDRAW_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing.module';
|
||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-admin-workflow-actions-element',
|
||||
styleUrls: ['./workflow-item-admin-workflow-actions.component.scss'],
|
||||
templateUrl: './workflow-item-admin-workflow-actions.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying the actions for a list element for an item on the admin workflow page
|
||||
*/
|
||||
export class WorkflowItemAdminWorkflowActionsComponent {
|
||||
/**
|
||||
* The item to perform the actions on
|
||||
*/
|
||||
@Input() public wfi: WorkflowItem;
|
||||
|
||||
/**
|
||||
* Whether or not to use small buttons
|
||||
*/
|
||||
@Input() public small: boolean;
|
||||
|
||||
/**
|
||||
* Returns the path to the delete page of this workflow item
|
||||
*/
|
||||
getDeletePath(): string {
|
||||
return getDeletePath(this.wfi.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the send back page of this workflow item
|
||||
*/
|
||||
getSendBackPath(): string {
|
||||
return getSendPath(this.wfi.id);
|
||||
}
|
||||
}
|
@@ -12,10 +12,12 @@ import { ItemAdminSearchResultGridElementComponent } from './admin-search-page/a
|
||||
import { CommunityAdminSearchResultGridElementComponent } from './admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component';
|
||||
import { CollectionAdminSearchResultGridElementComponent } from './admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component';
|
||||
import { ItemAdminSearchResultActionsComponent } from './admin-search-page/admin-search-results/item-admin-search-result-actions.component';
|
||||
import { ItemAdminWorkflowSearchResultGridElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/item-search-result/item-admin-workflow-search-result-grid-element.component';
|
||||
import { ItemAdminWorkflowSearchResultActionsComponent } from './admin-workflow-page/admin-workflow-search-results/item-admin-workflow-search-result-actions.component';
|
||||
import { ItemAdminWorkflowSearchResultListElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/item-search-result/item-admin-workflow-search-result-list-element.component';
|
||||
import { WorkflowItemAdminWorkflowGridElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-admin-workflow-grid-element.component';
|
||||
import { WorkflowItemAdminWorkflowActionsComponent } from './admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component';
|
||||
import { WorkflowItemAdminWorkflowListElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-admin-workflow-list-element.component';
|
||||
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
|
||||
import { PoolTaskAdminWorkflowSearchResultListElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/pool-task-item-search-result/pool-task-admin-workflow-search-result-list-element.component';
|
||||
import { PoolTaskAdminWorkflowSearchResultGridElementComponent } from './admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/pool-task-search-result/pool-task-admin-workflow-search-result-grid-element.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -36,9 +38,12 @@ import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow
|
||||
CollectionAdminSearchResultGridElementComponent,
|
||||
ItemAdminSearchResultActionsComponent,
|
||||
|
||||
ItemAdminWorkflowSearchResultListElementComponent,
|
||||
ItemAdminWorkflowSearchResultGridElementComponent,
|
||||
ItemAdminWorkflowSearchResultActionsComponent,
|
||||
WorkflowItemAdminWorkflowListElementComponent,
|
||||
WorkflowItemAdminWorkflowGridElementComponent,
|
||||
WorkflowItemAdminWorkflowActionsComponent,
|
||||
|
||||
PoolTaskAdminWorkflowSearchResultListElementComponent,
|
||||
PoolTaskAdminWorkflowSearchResultGridElementComponent,
|
||||
],
|
||||
entryComponents: [
|
||||
ItemAdminSearchResultListElementComponent,
|
||||
@@ -49,9 +54,12 @@ import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow
|
||||
CollectionAdminSearchResultGridElementComponent,
|
||||
ItemAdminSearchResultActionsComponent,
|
||||
|
||||
ItemAdminWorkflowSearchResultListElementComponent,
|
||||
ItemAdminWorkflowSearchResultGridElementComponent,
|
||||
ItemAdminWorkflowSearchResultActionsComponent,
|
||||
WorkflowItemAdminWorkflowListElementComponent,
|
||||
WorkflowItemAdminWorkflowGridElementComponent,
|
||||
WorkflowItemAdminWorkflowActionsComponent,
|
||||
|
||||
PoolTaskAdminWorkflowSearchResultListElementComponent,
|
||||
PoolTaskAdminWorkflowSearchResultGridElementComponent,
|
||||
]
|
||||
})
|
||||
export class AdminModule {
|
||||
|
@@ -0,0 +1 @@
|
||||
<ds-modify-item-overview [item]="wfi.item"></ds-modify-item-overview>
|
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WorkflowItemDeleteComponent } from './workflow-item-delete.component';
|
||||
|
||||
describe('WorkflowItemDeleteComponent', () => {
|
||||
let component: WorkflowItemDeleteComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemDeleteComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WorkflowItemDeleteComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WorkflowItemDeleteComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,16 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WorkflowItem } from '../../core/submission/models/workflowitem.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-delete',
|
||||
templateUrl: './workflow-item-delete.component.html',
|
||||
styleUrls: ['./workflow-item-delete.component.scss']
|
||||
})
|
||||
export class WorkflowItemDeleteComponent implements OnInit {
|
||||
wfi: WorkflowItem;
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { WorkflowItemsEditPageRoutingModule } from './workflowitems-edit-page-routing.module';
|
||||
import { SubmissionModule } from '../submission/submission.module';
|
||||
import { WorkflowItemDeleteComponent } from './workflow-item-delete/workflow-item-delete.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -11,7 +12,7 @@ import { SubmissionModule } from '../submission/submission.module';
|
||||
SharedModule,
|
||||
SubmissionModule,
|
||||
],
|
||||
declarations: []
|
||||
declarations: [WorkflowItemDeleteComponent]
|
||||
})
|
||||
/**
|
||||
* This module handles all modules that need to access the workflowitems edit page.
|
||||
|
Reference in New Issue
Block a user