diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6f12e33c57..fcf06cb989 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -50,16 +50,7 @@ import { TruncatePipe } from './main/pipes/string-transformation/truncate.pipe'; import { SelectLanguageComponent } from './main/select-language/select-language.component'; import { DatadogRumService } from './main/services/datadog-rum.service'; import { MaterialModule } from './material-module'; -import { AddressTemplateComponent } from './project/board/address-template/address-template.component'; -import { AttributionTabViewComponent } from './project/board/attribution-tab-view/attribution-tab-view.component'; import { BoardComponent } from './project/board/board.component'; -import { ContactsTabViewComponent } from './project/board/contacts-tab-view/contacts-tab-view.component'; -import { DatasetTabViewComponent } from './project/board/dataset-tab-view/dataset-tab-view.component'; -import { OrganisationTemplateComponent } from './project/board/organisation-template/organisation-template.component'; -import { PersonTemplateComponent } from './project/board/person-template/person-template.component'; -import { ProjectTabViewComponent } from './project/board/project-tab-view/project-tab-view.component'; -import { TermsTabViewComponent } from './project/board/terms-tab-view/terms-tab-view.component'; -import { UrlTemplateComponent } from './project/board/url-template/url-template.component'; import { AddUserComponent } from './project/collaboration/add-user/add-user.component'; import { CollaborationComponent } from './project/collaboration/collaboration.component'; import { SelectGroupComponent } from './project/collaboration/select-group/select-group.component'; @@ -178,13 +169,11 @@ export function httpLoaderFactory(httpClient: HttpClient) { AccountComponent, AddGroupComponent, AddRegionFormComponent, - AddressTemplateComponent, AddUserComponent, AddValueComponent, AdminImageDirective, AdvancedSearchComponent, AppComponent, - AttributionTabViewComponent, AudioComponent, BoardComponent, BooleanValueComponent, @@ -196,10 +185,8 @@ export function httpLoaderFactory(httpClient: HttpClient) { ComparisonComponent, ConfirmationDialogComponent, ConfirmationMessageComponent, - ContactsTabViewComponent, CookiePolicyComponent, DashboardComponent, - DatasetTabViewComponent, DateEditComponent, DateInputComponent, DateInputTextComponent, @@ -250,17 +237,14 @@ export function httpLoaderFactory(httpClient: HttpClient) { OntologyComponent, OntologyFormComponent, OntologyVisualizerComponent, - OrganisationTemplateComponent, PasswordFormComponent, PermissionComponent, - PersonTemplateComponent, ProfileComponent, ProgressIndicatorComponent, ProjectComponent, ProjectFormComponent, ProjectsComponent, ProjectsListComponent, - ProjectTabViewComponent, PropertiesComponent, PropertyFormComponent, PropertyInfoComponent, @@ -303,7 +287,6 @@ export function httpLoaderFactory(httpClient: HttpClient) { SublistValueComponent, SwitchPropertiesComponent, SystemComponent, - TermsTabViewComponent, TextValueAsHtmlComponent, TextValueAsStringComponent, TextValueAsXMLComponent, @@ -313,7 +296,6 @@ export function httpLoaderFactory(httpClient: HttpClient) { TruncatePipe, UploadComponent, UriValueComponent, - UrlTemplateComponent, UserComponent, UserFormComponent, UserMenuComponent, diff --git a/src/app/project/board/address-template/address-template.component.ts b/src/app/project/board/address-template/address-template.component.ts deleted file mode 100644 index 4e7c3aa4aa..0000000000 --- a/src/app/project/board/address-template/address-template.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Address } from '@dasch-swiss/dsp-js'; - -@Component({ - selector: 'app-address-template', - template: ` -
-
- Address: -
-
- {{ address.streetAddress }}, {{ address.postalCode }} {{ address.addressLocality }} -
-
- ` -}) -export class AddressTemplateComponent { - @Input() address: Address; -} diff --git a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.html b/src/app/project/board/attribution-tab-view/attribution-tab-view.component.html deleted file mode 100644 index bf3f4c8cdb..0000000000 --- a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.html +++ /dev/null @@ -1,28 +0,0 @@ - -
- -

The following people are involved in the creation of the dataset:

- - - - -

Agent(s):

-
-
-
- -
-
- -
-
-
-
- -
diff --git a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.scss b/src/app/project/board/attribution-tab-view/attribution-tab-view.component.scss deleted file mode 100644 index bf913e52fc..0000000000 --- a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.attribution-entry { - margin-top: 20px; - background-color: #fffdfd; - - .color-for-role { - color: brown; - } -} diff --git a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.spec.ts b/src/app/project/board/attribution-tab-view/attribution-tab-view.component.spec.ts deleted file mode 100644 index 89661a7601..0000000000 --- a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { PersonTemplateComponent } from '../person-template/person-template.component'; -import { AttributionTabViewComponent } from './attribution-tab-view.component'; - - -describe('AttributionTabViewComponent', () => { - let component: AttributionTabViewComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - AttributionTabViewComponent, PersonTemplateComponent - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AttributionTabViewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.ts b/src/app/project/board/attribution-tab-view/attribution-tab-view.component.ts deleted file mode 100644 index b229edc450..0000000000 --- a/src/app/project/board/attribution-tab-view/attribution-tab-view.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Attribution, IId, Organization, Person } from '@dasch-swiss/dsp-js'; -import { MetadataService } from '../dataset-metadata.service'; - -@Component({ - selector: 'app-attribution-tab-view', - templateUrl: './attribution-tab-view.component.html', - styleUrls: ['./attribution-tab-view.component.scss'] -}) -export class AttributionTabViewComponent { - // attribution input - @Input() attributions: Attribution[]; - - @Input() subProperties: Object; - - currentAgent: Person | Organization | IId; - - constructor(private _metadataService: MetadataService) { - } - - // return the type of agent to use correct template to display it - setAgent (agent: Person | Organization | IId): string { - let atype = this._metadataService.getContactType(agent); - if (atype) { - this.currentAgent = agent; - } else { - this.currentAgent = this.subProperties[agent.id]; - atype = this._metadataService.getContactType(this.currentAgent); - } - return atype; - } -} diff --git a/src/app/project/board/board.component.html b/src/app/project/board/board.component.html index 87a796e97c..a50ea1b4bf 100644 --- a/src/app/project/board/board.component.html +++ b/src/app/project/board/board.component.html @@ -1,4 +1,4 @@ - +
@@ -50,178 +50,6 @@

- -
- No metadata defined for the selected project. -
- - -
-
-
- -
- -
- - - - perm_data_setting - Project - - - - - - - collections - Dataset - - - - - - - assignment - Attribution - - - - - - - receipt - Terms & conditions - - - - - - portrait - Contact - - - - -
-
- -
- - - - - - - - - -
-
diff --git a/src/app/project/board/board.component.spec.ts b/src/app/project/board/board.component.spec.ts index 51b2714e5f..cf9e97d719 100644 --- a/src/app/project/board/board.component.spec.ts +++ b/src/app/project/board/board.component.spec.ts @@ -15,12 +15,7 @@ import { DialogComponent } from 'src/app/main/dialog/dialog.component'; import { ErrorComponent } from 'src/app/main/error/error.component'; import { TestConfig } from 'test.config'; import { CacheService } from '../../main/cache/cache.service'; -import { AttributionTabViewComponent } from './attribution-tab-view/attribution-tab-view.component'; import { BoardComponent } from './board.component'; -import { ContactsTabViewComponent } from './contacts-tab-view/contacts-tab-view.component'; -import { DatasetTabViewComponent } from './dataset-tab-view/dataset-tab-view.component'; -import { ProjectTabViewComponent } from './project-tab-view/project-tab-view.component'; -import { TermsTabViewComponent } from './terms-tab-view/terms-tab-view.component'; describe('BoardComponent', () => { let component: BoardComponent; @@ -34,12 +29,7 @@ describe('BoardComponent', () => { declarations: [ BoardComponent, DialogComponent, - ErrorComponent, - AttributionTabViewComponent, - ContactsTabViewComponent, - DatasetTabViewComponent, - ProjectTabViewComponent, - TermsTabViewComponent + ErrorComponent ], imports: [ BrowserAnimationsModule, diff --git a/src/app/project/board/board.component.ts b/src/app/project/board/board.component.ts index f41cfd6297..6f99645e4a 100644 --- a/src/app/project/board/board.component.ts +++ b/src/app/project/board/board.component.ts @@ -33,7 +33,6 @@ export class BoardComponent implements OnInit { // loading for progress indicator loading: boolean; - metadataLoading: boolean; // permissions of logged-in user session: Session; @@ -48,20 +47,6 @@ export class BoardComponent implements OnInit { color = 'primary'; - // variables to store metadata information - projectsMetadata: ProjectsMetadata; - datasetList: Dataset[] = []; - singleProjectList: SingleProject[] = []; - subProperties = {}; - selectedDataset: Dataset; - selectedProject: SingleProject; - - // list of dataset names to display as radio buttons in right side column - datasetOptions: DatasetRadioOption[]; - - // different metadata download formats - metadataDownloadFormats = ['JSON-LD', 'XML', 'Triplestore', 'CSV']; - constructor( @Inject(DspApiConnectionToken) private _dspApiConnection: KnoraApiConnection, private _cache: CacheService, @@ -83,7 +68,6 @@ export class BoardComponent implements OnInit { ngOnInit() { this.loading = true; - this.metadataLoading = true; // get information about the logged-in user, if one is logged-in if (this._session.getSession()) { @@ -102,9 +86,6 @@ export class BoardComponent implements OnInit { (response: ReadProject) => { this.project = response; - // get project and dataset metadata from backend - this.getProjectMetadata(); - // is logged-in user projectAdmin? if (this._session.getSession()) { this.projectAdmin = this.sysAdmin ? this.sysAdmin : this.session.user.projectAdmin.some(e => e === this.project.id); @@ -120,94 +101,6 @@ export class BoardComponent implements OnInit { this.loading = false; } - getProjectMetadata() { - // get project metadata from backend - this._dspApiConnection.v2.metadata.getProjectMetadata(this.project.id).subscribe( - (response: ProjectsMetadata) => { - this.projectsMetadata = response; - - this.metadataLoading = false; - - // create list according to it's type - this.projectsMetadata.projectsMetadata.forEach((obj) => { - if (obj instanceof Dataset) { - this.datasetList.push(obj); - } else if (obj instanceof SingleProject) { - this.singleProjectList.push(obj); - } else { - this.subProperties[obj.id] = obj; - } - }); - - const dsOptions = []; - // dataset options to display radio buttons for selection in right column - for (let idx = 0; idx < this.datasetList.length; idx++) { - dsOptions.push({ - name: this.datasetList[idx].title, - id: idx, - checked: idx === 0 ? true : false - }); - } - - this.datasetOptions = dsOptions; - - // by default display first dataset - this.selectedDataset = this.datasetList[0]; - - // get project - this.getProjectForDataset(); - }, - (error: ApiResponseError) => { - // in case of a 404: the metadata are not defined - // it will be displayed by one sentence in the - // content container - if (error.status !== 404) { - // use default error behavior - this._errorHandler.showMessage(error); - } - - this.metadataLoading = false; - } - ); - } - - getProjectForDataset() { - // get selected project for this dataset - // note that dataset always contains only one SingleProject - for (const proj of this.singleProjectList) { - if (this.selectedDataset.project.id === proj.id) { - this.selectedProject = proj; - break; - } - } - } - - getSubProperty(id: string): object { - return this.subProperties[id]; - } - - // download metadata - downloadMetadata() { - const blob: Blob = new Blob([JSON.stringify(this.projectsMetadata)], { type: 'application/json' }); - const fileName = 'metadata.json'; - const objectUrl: string = URL.createObjectURL(blob); - const a: HTMLAnchorElement = document.createElement('a') as HTMLAnchorElement; - - a.href = objectUrl; - a.download = fileName; - document.body.appendChild(a); - a.click(); - - document.body.removeChild(a); - URL.revokeObjectURL(objectUrl); - } - - // update the selected dataset object - updateDataset(event: MatRadioChange) { - this.selectedDataset = this.datasetList[event.value]; - this.getProjectForDataset(); - } - // copy link to clipboard copyToClipboard(msg: string) { const message = 'Copied to clipboard!'; diff --git a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.html b/src/app/project/board/contacts-tab-view/contacts-tab-view.component.html deleted file mode 100644 index e951282467..0000000000 --- a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
-

Contact point is not available!

-
-
-
- - -
- -
- -
- -
- -
-
-
- diff --git a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.scss b/src/app/project/board/contacts-tab-view/contacts-tab-view.component.scss deleted file mode 100644 index 8b13789179..0000000000 --- a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.scss +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.spec.ts b/src/app/project/board/contacts-tab-view/contacts-tab-view.component.spec.ts deleted file mode 100644 index b285e0f646..0000000000 --- a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.spec.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContactsTabViewComponent } from './contacts-tab-view.component'; -import { Component, ViewChild } from '@angular/core'; -import { PersonTemplateComponent } from '../person-template/person-template.component'; -import { AddressTemplateComponent } from '../address-template/address-template.component'; - -/** - * test host component to simulate parent component. - */ -@Component({ - selector: 'app-board-host-component', - template: '' -}) -class TestHostBoardComponent { - - @ViewChild('contactsTabView') contactsTabView: ContactsTabViewComponent; - - // input parameters - contactDetails = { - 'address': { 'addressLocality': 'Basel', 'postalCode': '4000', 'streetAddress': 'Teststrasse' }, - 'email': 'stewart.abraham@test.ch', - 'familyName': 'Abraham', - 'givenName': 'Stewart', - 'jobTitle': 'Dr.', - 'memberOf': 'http://ns.dasch.swiss/test-dasch', - 'sameAs': { 'type': 'https://schema.org/URL', 'value': 'https://orcid.org/0000-0002-1825-0097' } - }; -} - -describe('ContactsTabViewComponent', () => { - let testHostComponent: TestHostBoardComponent; - let testHostFixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - TestHostBoardComponent, - AddressTemplateComponent, - ContactsTabViewComponent, - PersonTemplateComponent - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - testHostFixture = TestBed.createComponent(TestHostBoardComponent); - testHostComponent = testHostFixture.componentInstance; - testHostFixture.detectChanges(); - }); - - // todo: add test case when test data is ready - /* it('should create', () => { - expect(testHostComponent).toBeTruthy(); - }); */ -}); diff --git a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.ts b/src/app/project/board/contacts-tab-view/contacts-tab-view.component.ts deleted file mode 100644 index 5572184143..0000000000 --- a/src/app/project/board/contacts-tab-view/contacts-tab-view.component.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { IId, Organization, Person } from '@dasch-swiss/dsp-js'; -import { MetadataService } from '../dataset-metadata.service'; - -@Component({ - selector: 'app-contacts-tab-view', - templateUrl: './contacts-tab-view.component.html', - styleUrls: ['./contacts-tab-view.component.scss'] -}) -export class ContactsTabViewComponent implements OnInit { - // contact details - @Input() contactDetails: Person[] | Organization[] | IId[]; - - @Input() subProperties: Object; - - contactsList = []; - contactType: string; - - constructor(private _metadataService: MetadataService) { - } - - ngOnInit() { - - if (this.contactDetails) { - // check which type of array is present - this.contactType = this._metadataService.getContactType(this.contactDetails[0]); - - // if contactType is person or organization - if (this.contactType) { - this.contactsList = this.contactDetails; - return; - } - - // if contactType is undefined, it means it contains the array of IId objects - for (const contact of this.contactDetails) { - this.contactsList.push(this.subProperties[contact.id]); - } - this.contactType = this._metadataService.getContactType(this.contactsList[0]); - } - } -} diff --git a/src/app/project/board/dataset-metadata.service.ts b/src/app/project/board/dataset-metadata.service.ts deleted file mode 100644 index ad49174a45..0000000000 --- a/src/app/project/board/dataset-metadata.service.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Injectable } from '@angular/core'; -import { IId, Organization, Person } from '@dasch-swiss/dsp-js'; - -@Injectable({ - providedIn: 'root' -}) -export class MetadataService { - - constructor() { } - - /** - * determine if the object is of type Person or Organization or Iid - * @param obj Person | Organization | IId - */ - getContactType(obj: Person | Organization | IId): string { - if (obj instanceof Person) { - return 'person'; - } else if (obj instanceof Organization) { - return 'organization'; - } - return undefined; - } -} diff --git a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.html b/src/app/project/board/dataset-tab-view/dataset-tab-view.component.html deleted file mode 100644 index 673aab2d4f..0000000000 --- a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-

Selected dataset: {{ metadata.title }}

-

Click on the radio button in the right side panel to change the dataset.

-
- -
-

Default dataset is displayed, to change it click on the radio button in the right side panel.

-
- -
-
-
-
-
-

- {{ prop.key }} -

-
-
-
- {{ prop.value }} -
-
- -
-
- {{ prop.value | date:'MMMM d, yyyy' }} -
-
-
-
-
-
diff --git a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.scss b/src/app/project/board/dataset-tab-view/dataset-tab-view.component.scss deleted file mode 100644 index e5780ee921..0000000000 --- a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "../../../../assets/style/config"; - -.note { - font-style: italic; - color: $warn; - padding-left: 0px; -} diff --git a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.spec.ts b/src/app/project/board/dataset-tab-view/dataset-tab-view.component.spec.ts deleted file mode 100644 index e61ad79498..0000000000 --- a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Component, ViewChild } from '@angular/core'; -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { DatasetTabViewComponent } from './dataset-tab-view.component'; - -/** -* test host component to simulate parent component. -*/ -@Component({ - selector: 'app-board-host-component', - template: '' -}) -class TestHostBoardComponent { - - @ViewChild('datasetTabView') datasetTabView: DatasetTabViewComponent; - - // metadata object - // datasetMetadata = {}; -} - -describe('DatasetTabViewComponent', () => { - let testHostComponent: TestHostBoardComponent; - let testHostFixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - TestHostBoardComponent, - DatasetTabViewComponent - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - testHostFixture = TestBed.createComponent(TestHostBoardComponent); - testHostComponent = testHostFixture.componentInstance; - testHostFixture.detectChanges(); - }); - - // todo: add test case when test data is ready - /* it('should create', () => { - expect(testHostComponent).toBeTruthy(); - }); */ -}); diff --git a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.ts b/src/app/project/board/dataset-tab-view/dataset-tab-view.component.ts deleted file mode 100644 index 87bb381f60..0000000000 --- a/src/app/project/board/dataset-tab-view/dataset-tab-view.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { Dataset } from '@dasch-swiss/dsp-js'; - -@Component({ - selector: 'app-dataset-tab-view', - templateUrl: './dataset-tab-view.component.html', - styleUrls: ['./dataset-tab-view.component.scss'] -}) -export class DatasetTabViewComponent implements OnInit { - - // metadata input object - @Input() metadata: Dataset; - - // number of datasets available for this project - @Input() noOfDatasets: number; - - metadataObject: {[key: string]: any}; - - // metadata keys that we do not want to display - excludeKeys = ['project', 'qualifiedAttribution']; - - // metadata keys that require specific format to display - templateKeys = ['abstract', 'distribution', 'documentation', 'license', 'sameAs', ]; - - // date keys from metadata object for formatting - dateKeys = ['dateCreated', 'dateModified', 'datePublished']; - - ngOnInit() { - this.metadataObject = this.metadata; - } -} diff --git a/src/app/project/board/organisation-template/organisation-template.component.ts b/src/app/project/board/organisation-template/organisation-template.component.ts deleted file mode 100644 index dffac1bede..0000000000 --- a/src/app/project/board/organisation-template/organisation-template.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Organization } from '@dasch-swiss/dsp-js'; - -@Component({ - selector: 'app-organisation-template', - template: ` -
- - -
- -
- - - - -
- ` -}) - -export class OrganisationTemplateComponent { - // input parameter - @Input() organisation: Organization; -} diff --git a/src/app/project/board/person-template/person-template.component.html b/src/app/project/board/person-template/person-template.component.html deleted file mode 100644 index 9205e19a8e..0000000000 --- a/src/app/project/board/person-template/person-template.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
- - - -
- -
- - - - - - - -
diff --git a/src/app/project/board/person-template/person-template.component.scss b/src/app/project/board/person-template/person-template.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/project/board/person-template/person-template.component.spec.ts b/src/app/project/board/person-template/person-template.component.spec.ts deleted file mode 100644 index b61360e911..0000000000 --- a/src/app/project/board/person-template/person-template.component.spec.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { PersonTemplateComponent } from './person-template.component'; -import { Component, ViewChild } from '@angular/core'; -import { AddressTemplateComponent } from '../address-template/address-template.component'; - - -/** - * test host component to simulate parent component. - */ -@Component({ - selector: 'app-contact-host-component', - template: '' -}) -class TestHostContactComponent { - - @ViewChild('personView') personView: PersonTemplateComponent; - - // input parameters - contactDetails = { - 'address': { 'addressLocality': 'Basel', 'postalCode': '4000', 'streetAddress': 'Teststrasse' }, - 'email': ['stewart.abraham@test.ch'], - 'familyName': 'Abraham', - 'givenName': 'Stewart', - 'jobTitle': ['Dr.'], - 'id': 'http://ns.dasch.swiss/repository#test-berry', - 'memberOf': [ - { - 'address': { 'addressLocality': 'Basel', 'postalCode': '4000', 'streetAddress': 'Teststrasse' }, - 'email': 'info@dasch.swiss', - 'id': 'http://ns.dasch.swiss/repository#test-dasch', - 'name': ['TEST'], - 'type': 'http://ns.dasch.swiss/repository#Organization', - 'url': [{ 'type': 'https://schema.org/URL', 'url': 'https://test.swiss' }] - } - ], - 'sameAs': [{ 'type': 'https://schema.org/URL', 'value': 'https://orcid.org/0000-0002-1825-0097', 'url': 'https://orcid.org/0000-0002-1825-0097' }] - }; -} - -describe('PersonTemplateComponent', () => { - let testHostComponent: TestHostContactComponent; - let testHostFixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - TestHostContactComponent, - AddressTemplateComponent, - PersonTemplateComponent - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - testHostFixture = TestBed.createComponent(TestHostContactComponent); - testHostComponent = testHostFixture.componentInstance; - testHostFixture.detectChanges(); - }); - - // todo: add test case when test data is ready - /* it('should create', () => { - expect(testHostComponent).toBeTruthy(); - }); */ -}); diff --git a/src/app/project/board/person-template/person-template.component.ts b/src/app/project/board/person-template/person-template.component.ts deleted file mode 100644 index bba0899bfc..0000000000 --- a/src/app/project/board/person-template/person-template.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { Organization, Person } from '@dasch-swiss/dsp-js'; - - -@Component({ - selector: 'app-person-template', - templateUrl: './person-template.component.html', - styleUrls: ['./person-template.component.scss'] -}) -export class PersonTemplateComponent implements OnInit { - // input parameter - @Input() person: Person; - - @Input() subProperties: Object; - - organizationList = []; - - ngOnInit() { - // check if members list is the list of [Organization] or [Iid] - let isOrganizationType = false; - - // if it is [Organization] - if (this.person.memberOf[0] instanceof Organization) { - isOrganizationType = true; - this.organizationList = this.person.memberOf; - } - - // if it is [Iid], get data for every organization - if (!isOrganizationType) { - for (const entry of this.person.memberOf) { - this.organizationList.push(this.subProperties[entry.id]); - } - } - } -} diff --git a/src/app/project/board/project-tab-view/project-tab-view.component.html b/src/app/project/board/project-tab-view/project-tab-view.component.html deleted file mode 100644 index d032629e55..0000000000 --- a/src/app/project/board/project-tab-view/project-tab-view.component.html +++ /dev/null @@ -1,112 +0,0 @@ -

Metadata for selected project is listed below.

- -
-
-
-
-
-

- {{ prop.key }} -

-
-
- - -
-
-
-
- -
-
- -
-
-
-
- - -
- - {{ kword }} - -
- - -
-
-

{{ dmp.isAvailable? 'Available' : 'Unavailable' }}

-
- -
-
-
- - -
-
- - - - - - - -
-
- - -
-
- -
-
- - -
-
- {{ prop.value }} -
-
- {{ prop.value | date:'MMMM d, yyyy' }} -
-
- -
-
-
-
-
-
-
diff --git a/src/app/project/board/project-tab-view/project-tab-view.component.scss b/src/app/project/board/project-tab-view/project-tab-view.component.scss deleted file mode 100644 index 843142d287..0000000000 --- a/src/app/project/board/project-tab-view/project-tab-view.component.scss +++ /dev/null @@ -1,25 +0,0 @@ -@import "../../../../assets/style/theme"; - -.mat-icon-text { - display: flex; - align-items: center; - - .mat-icon { - margin-right: 8px; - } -} - -.funder, .grant { - ::ng-deep .organization-name, ::ng-deep .person-name, .grant-name { - margin-top: 0px !important; - } -} - -.funder:not(:last-child), .grant:not(:last-child) { - border-bottom: 1px solid $primary_100; -} - -.funder:not(:first-child), .grant:not(:first-child) { - margin-top: 1em; -} - diff --git a/src/app/project/board/project-tab-view/project-tab-view.component.spec.ts b/src/app/project/board/project-tab-view/project-tab-view.component.spec.ts deleted file mode 100644 index 3655810b50..0000000000 --- a/src/app/project/board/project-tab-view/project-tab-view.component.spec.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { Component, ViewChild } from '@angular/core'; -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatCardModule } from '@angular/material/card'; -import { MatChipsModule } from '@angular/material/chips'; -import { MatIconModule } from '@angular/material/icon'; -import { AddressTemplateComponent } from '../address-template/address-template.component'; -import { OrganisationTemplateComponent } from '../organisation-template/organisation-template.component'; -import { PersonTemplateComponent } from '../person-template/person-template.component'; -import { ProjectTabViewComponent } from './project-tab-view.component'; - -/** - * test host component to simulate parent component. - */ -@Component({ - selector: 'app-board-host-component', - template: '' -}) -class TestHostBoardComponent { - - @ViewChild('projectTabView') projectTabView: ProjectTabViewComponent; - - // input parameters - projectMetadata = { - 'alternateName': 'test', - 'contactPoint': { - 'address': { 'addressLocality': 'Basel', 'postalCode': '4000', 'streetAddress': 'Teststrasse' }, - 'email': 'stewart.abraham@test.ch', - 'familyName': 'Abraham', - 'givenName': 'Stewart', - 'jobTitle': 'Dr.', - 'memberOf': 'http://ns.dasch.swiss/test-dasch', - 'sameAs': { 'type': 'https://schema.org/URL', 'value': 'https://orcid.org/0000-0002-1825-0097' }, - 'organisation': { - 'address': { 'addressLocality': 'Toronto', 'postalCode': '40000', 'streetAddress': 'University of Toronto Street' }, - 'email': '/info@universityoftoronto.ca', - 'name': 'University of Toronto', - 'url': { 'type': 'https://schema.org/URL', 'value': 'http://www.utoronto.ca/' } - } - }, - 'description': 'Dies ist ein Testprojekt...alle Properties wurden verwendet, um diese zu testen', - 'discipline': { 'name': 'SKOS UNESCO Nomenclature', 'url': 'http://skos.um.es/unesco6/11' }, - 'endDate': '2001-01-26', - 'funder': 'http://ns.dasch.swiss/test-funder', - 'grant': { - 'funder': [ - { - 'address': { 'addressLocality': 'Toronto', 'postalCode': '40000', 'streetAddress': 'University of Toronto Street' }, - 'email': '/info@universityoftoronto.ca', - 'name': 'University of Toronto', - 'url': { 'type': 'https://schema.org/URL', 'value': 'http://www.utoronto.ca/' } - }, - { - 'address': { 'addressLocality': 'Basel', 'postalCode': '4000', 'streetAddress': 'Teststrasse' }, - 'email': 'lauren.berry@unibas.ch', - 'familyName': 'Berry', - 'givenName': 'Lauren', - 'jobTitle': 'Dr.', - 'organisation': { - 'address': { 'addressLocality': 'Toronto', 'postalCode': '40000', 'streetAddress': 'University of Toronto Street' }, - 'email': 'info@universityoftoronto.ca', - 'name': 'University of Toronto', - 'url': 'http://www.utoronto.ca/' - } - }], 'name': 'Test Grant Name', 'number': '0123456789', 'url': { 'type': 'https://schema.org/URL', 'value': 'http://p3.snf.ch/testproject' } - }, - 'keywords': ['science', 'mathematics', 'history of science', 'history of mathematics'], - 'name': 'Testprojektname (test)', - 'publication': 'testpublication', - 'shortcode': '0000', - 'spatialCoverage': [ - { 'place': { 'name': 'Geonames', 'url': 'https://www.geonames.org/2017370/russian-federation.html' } }, { - 'place': { - 'name': 'Geonames', - 'url': 'https://www.geonames.org/2658434/switzerland.html' - } - }, { 'place': { 'name': 'Geonames', 'url': 'https://www.geonames.org/3175395/italian-republic.html' } }, { - 'place': { - 'name': 'Geonames', - 'url': 'https://www.geonames.org/2921044/federal-republic-of-germany.html' - } - }, { 'place': { 'name': 'Geonames', 'url': 'https://www.geonames.org/3017382/republic-of-france.html' } }, { - 'place': { - 'name': 'Geonames', - 'url': 'https://www.geonames.org/6269131/england.html' - } - }, { 'place': { 'name': 'Geonames', 'url': 'https://www.geonames.org/6255148/europe.html' } }], - 'startDate': '2000-07-26', - 'temporalCoverage': { 'name': 'Chronontology Dainst', 'url': 'http://chronontology.dainst.org/period/Ef9SyESSafJ1' }, - 'url': { 'type': 'https://schema.org/URL', 'value': 'https://test.dasch.swiss/' } - }; - -} - -describe('ProjectTabViewComponent', () => { - let testHostComponent: TestHostBoardComponent; - let testHostFixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - TestHostBoardComponent, - AddressTemplateComponent, - OrganisationTemplateComponent, - PersonTemplateComponent, - ProjectTabViewComponent - ], - imports: [ - MatCardModule, - MatChipsModule, - MatIconModule - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - testHostFixture = TestBed.createComponent(TestHostBoardComponent); - testHostComponent = testHostFixture.componentInstance; - testHostFixture.detectChanges(); - }); - - // todo: add test case when test data is ready - /* it('should create', () => { - expect(testHostComponent).toBeTruthy(); - }); */ -}); diff --git a/src/app/project/board/project-tab-view/project-tab-view.component.ts b/src/app/project/board/project-tab-view/project-tab-view.component.ts deleted file mode 100644 index 72befa6878..0000000000 --- a/src/app/project/board/project-tab-view/project-tab-view.component.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { - DataManagementPlan, - Grant, IId, IUrl, Organization, Person, Place, SingleProject -} from '@dasch-swiss/dsp-js'; -import { MetadataService } from '../dataset-metadata.service'; - -@Component({ - selector: 'app-project-tab-view', - templateUrl: './project-tab-view.component.html', - styleUrls: ['./project-tab-view.component.scss'] -}) -export class ProjectTabViewComponent implements OnInit { - - // metadata object - @Input() selectedProject: SingleProject; - @Input() subProperties: Object; - - projectObject: {[key: string]: any}; - - // metadata keys that we do not want to display in template - excludeKeys = ['contactPoint']; - - // list of date keys from metadata object - // used for formatting - dateKeys = ['startDate', 'endDate']; - - // keys that require IUrl template - iUrlTemplatesKeys = ['discipline', 'temporalCoverage', 'url']; - - dmps: DataManagementPlan[] = []; - funders: Person[] | Organization[] = []; - funderType: string; - grants = []; - - constructor(private _metadataService: MetadataService) { - } - - ngOnInit() { - - this.projectObject = this.selectedProject; - - // get DMP - if (this.selectedProject.dataManagementPlan) { - this.dmps = this.getDMP(this.selectedProject.dataManagementPlan); - } - - // get funder details - this.getFunders(this.selectedProject.funder); - - // get grants if present - if (this.selectedProject.grant) { - this.getGrants(this.selectedProject.grant); - } - - } - - getDMP(currenDmps: DataManagementPlan | IId[]): DataManagementPlan[] { - if (currenDmps instanceof DataManagementPlan) { - return [currenDmps]; - } - - const tmp: DataManagementPlan[] = []; - for (const iid of currenDmps) { - tmp.push(this.subProperties[iid.id]); - } - return tmp; - } - - getFunders(flist: any[]) { - // check if it is person, organization or IId - this.funderType = this._metadataService.getContactType(flist[0]); - - if (this.funderType) { - this.funders = flist; - return; - } - - for (const funder of flist) { - this.funders.push(this.subProperties[funder.id]); - } - this.funderType = this._metadataService.getContactType(this.funders[0]); - } - - getGrants(glist: any[]) { - let tmpGrants: Grant[] = []; - - if (glist[0] instanceof Grant) { - tmpGrants = glist; - } else { - // if it is IId objects array, retrive it's details - for (const iid of glist) { - tmpGrants.push(this.subProperties[iid.id]); - } - } - // get funder details along with other details - for (const grant of tmpGrants) { - - // checck if grant contains person, organization or IId objects - let ftype = this._metadataService.getContactType(grant.funder[0]); - let flist = []; - if (ftype) { - // it is a person of organization object - flist = grant.funder; - } else { - // it means it is a IId object. So we need to retrive the details - // of every funder using the id provided here - for (const fund of grant.funder) { - flist.push(this.subProperties[fund.id]); - } - ftype = this._metadataService.getContactType(flist[0]); - } - - const tmpGrantObj = { - funder : flist, - funderType: ftype, - name: grant.name ? grant.name : undefined, - number: grant.number ? grant.number : undefined, - url: grant.url ? grant.url : undefined - }; - - this.grants.push(tmpGrantObj); - } - } - -} diff --git a/src/app/project/board/terms-tab-view/terms-tab-view.component.html b/src/app/project/board/terms-tab-view/terms-tab-view.component.html deleted file mode 100644 index e62811e5cc..0000000000 --- a/src/app/project/board/terms-tab-view/terms-tab-view.component.html +++ /dev/null @@ -1,25 +0,0 @@ -
- - -
- - -
diff --git a/src/app/project/board/terms-tab-view/terms-tab-view.component.scss b/src/app/project/board/terms-tab-view/terms-tab-view.component.scss deleted file mode 100644 index c444022695..0000000000 --- a/src/app/project/board/terms-tab-view/terms-tab-view.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.license-image { - max-width: 150px; - object-fit: contain; - margin: 24px 0px; - display: block; -} - diff --git a/src/app/project/board/terms-tab-view/terms-tab-view.component.spec.ts b/src/app/project/board/terms-tab-view/terms-tab-view.component.spec.ts deleted file mode 100644 index b795962eee..0000000000 --- a/src/app/project/board/terms-tab-view/terms-tab-view.component.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TermsTabViewComponent } from './terms-tab-view.component'; -import { Component, ViewChild } from '@angular/core'; - -/** - * test host component to simulate parent component. - */ -@Component({ - selector: 'app-board-host-component', - template: '' -}) -class TestHostBoardComponent { - - @ViewChild('termsTabView') termsTabView: TermsTabViewComponent; - - // input parameters - conditionsOfAccess = 'Open Access'; - license = [{ 'type': 'https://schema.org/URL', 'value': 'https://creativecommons.org/licenses/by/3.0', 'url': 'https://creativecommons.org/licenses/by/3.0' }]; -} - -describe('TermsTabViewComponent', () => { - let testHostComponent: TestHostBoardComponent; - let testHostFixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ - TestHostBoardComponent, - TermsTabViewComponent - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - testHostFixture = TestBed.createComponent(TestHostBoardComponent); - testHostComponent = testHostFixture.componentInstance; - testHostFixture.detectChanges(); - }); - - it('should create', () => { - expect(testHostComponent).toBeTruthy(); - }); -}); - diff --git a/src/app/project/board/terms-tab-view/terms-tab-view.component.ts b/src/app/project/board/terms-tab-view/terms-tab-view.component.ts deleted file mode 100644 index cf9ea8661a..0000000000 --- a/src/app/project/board/terms-tab-view/terms-tab-view.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - selector: 'app-terms-tab-view', - templateUrl: './terms-tab-view.component.html', - styleUrls: ['./terms-tab-view.component.scss'] -}) -export class TermsTabViewComponent { - - // conditions input from parent component to display it in template - @Input() conditions: string; - - // license from parent component to display it in template - @Input() license: object; - -} diff --git a/src/app/project/board/url-template/url-template.component.ts b/src/app/project/board/url-template/url-template.component.ts deleted file mode 100644 index f76147ca6c..0000000000 --- a/src/app/project/board/url-template/url-template.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { IUrl } from '@dasch-swiss/dsp-js'; - -@Component({ - selector: 'app-url-template', - template: ` -
-
-

{{ str }}

-
-
- -
-
- ` -}) -export class UrlTemplateComponent implements OnInit { - @Input() urls: IUrl | IUrl[] | string[]; - - @Input() label = 'URL(s)'; - - @Input() displayLabel = false; - - templateType: string; - - ngOnInit() { - if (!(this.urls instanceof Array)) { - this.urls = [this.urls]; - } - - this.templateType = this.getTemplateType(this.urls[0]); - } - - /** - * determine if the object is of type string or IUrl - * @param obj string | IUrl - */ - getTemplateType (obj: IUrl | string): string { - if (typeof obj === 'string') { - return 'string'; - } - return 'IUrl'; - } -} diff --git a/src/app/workspace/resource/representation/still-image/still-image.component.spec.ts b/src/app/workspace/resource/representation/still-image/still-image.component.spec.ts index 33b5ff97fc..80f3716ddd 100644 --- a/src/app/workspace/resource/representation/still-image/still-image.component.spec.ts +++ b/src/app/workspace/resource/representation/still-image/still-image.component.spec.ts @@ -192,7 +192,8 @@ describe('StillImageComponent', () => { const iiifUrlEle = iiifUrlDebugElement.nativeElement; expect(iiifUrlEle.innerText).toEqual('https://iiif.test.dasch.swiss:443/0803/incunabula_0000003840.jp2/full/3210,5144/0/default.jpg'); - + expect(iiifUrlEle.getAttribute('target')).toEqual('_blank'); + expect(iiifUrlEle.getAttribute('href')).toEqual('https://iiif.test.dasch.swiss:443/0803/incunabula_0000003840.jp2/full/3210,5144/0/default.jpg'); }); it('should have 1 test region loaded (rectangle)', () => {