Add Item Status Edit Actions

Add the Item Withdraw and Reistate action
Add the make Item Private and Public action
Add the Permanently Delete action
This commit is contained in:
Yana De Pauw
2018-12-18 16:52:11 +01:00
parent a3b4883e2d
commit d9a393c8e6
38 changed files with 1984 additions and 76 deletions

View File

@@ -0,0 +1,16 @@
<table id="metadata" class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">{{'item.edit.modify.overview.field'| translate}}</th>
<th scope="col">{{'item.edit.modify.overview.value'| translate}}</th>
<th scope="col">{{'item.edit.modify.overview.language'| translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let metadatum of metadata" class="metadata-row">
<td>{{metadatum.key}}</td>
<td>{{metadatum.value}}</td>
<td>{{metadatum.language}}</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,55 @@
import {Item} from '../../../core/shared/item.model';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {ModifyItemOverviewComponent} from './modify-item-overview.component';
import {By} from '@angular/platform-browser';
import {TranslateModule} from '@ngx-translate/core';
let comp: ModifyItemOverviewComponent;
let fixture: ComponentFixture<ModifyItemOverviewComponent>;
const mockItem = Object.assign(new Item(), {
id: 'fake-id',
handle: 'fake/handle',
lastModified: '2018',
metadata: [
{key: 'dc.title', value: 'Mock item title', language: 'en'},
{key: 'dc.contributor.author', value: 'Mayer, Ed', language: ''}
]
});
describe('ModifyItemOverviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()],
declarations: [ModifyItemOverviewComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ModifyItemOverviewComponent);
comp = fixture.componentInstance;
comp.item = mockItem;
fixture.detectChanges();
});
it('should render a table of existing metadata fields in the item', () => {
const metadataRows = fixture.debugElement.queryAll(By.css('tr.metadata-row'));
expect(metadataRows.length).toEqual(2);
const titleRow = metadataRows[0].queryAll(By.css('td'));
expect(titleRow.length).toEqual(3);
expect(titleRow[0].nativeElement.innerHTML).toContain('dc.title');
expect(titleRow[1].nativeElement.innerHTML).toContain('Mock item title');
expect(titleRow[2].nativeElement.innerHTML).toContain('en');
const authorRow = metadataRows[1].queryAll(By.css('td'));
expect(authorRow.length).toEqual(3);
expect(authorRow[0].nativeElement.innerHTML).toContain('dc.contributor.author');
expect(authorRow[1].nativeElement.innerHTML).toContain('Mayer, Ed');
expect(authorRow[2].nativeElement.innerHTML).toEqual('');
});
});

View File

@@ -0,0 +1,20 @@
import {Component, Input, OnInit} from '@angular/core';
import {Item} from '../../../core/shared/item.model';
import {Metadatum} from '../../../core/shared/metadatum.model';
@Component({
selector: 'ds-modify-item-overview',
templateUrl: './modify-item-overview.component.html'
})
/**
* Component responsible for rendering a table containing the metadatavalues from the to be edited item
*/
export class ModifyItemOverviewComponent implements OnInit {
@Input() item: Item;
metadata: Metadatum[];
ngOnInit(): void {
this.metadata = this.item.metadata;
}
}