Skip to content

Commit

Permalink
Dsp 945 resource viewer (#330)
Browse files Browse the repository at this point in the history
* DSP-945-update resource viewer

* enhancement (results-viewer) In worksace, display search results and
  resource viewer in side-by-side column

Co-authored-by: André Kilchenmann <[email protected]>
  • Loading branch information
Snehal Kumbhar and André Kilchenmann authored Nov 25, 2020
1 parent a57b603 commit a66f848
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@dasch-swiss/dsp-ui": "1.0.0-rc.11",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"angular-split": "^4.0.0",
"ckeditor5-custom-build": "github:dasch-swiss/ckeditor_custom_build",
"core-js": "^3.6.5",
"d3": "^5.15.1",
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ import { SelectResourceClassComponent } from './workspace/resource/resource-inst
import { SelectPropertiesComponent } from './workspace/resource/resource-instance-form/select-properties/select-properties.component';
import { SwitchPropertiesComponent } from './workspace/resource/resource-instance-form/select-properties/switch-properties/switch-properties.component';

import { AngularSplitModule } from 'angular-split';

// translate: AoT requires an exported function for factories
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/i18n/', '.json')
Expand Down Expand Up @@ -162,7 +164,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
}),
AngularSplitModule.forRoot()
],
providers: [
{
Expand Down
11 changes: 9 additions & 2 deletions src/app/workspace/results/results.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<div class="content large middle" *ngIf="searchParams">
<dsp-list-view [search]="searchParams" (resourceSelected)="openResource($event)"></dsp-list-view>
<div class="content" *ngIf="searchParams" style="margin-top: 20px; height: 100vh;">
<as-split direction="horizontal">
<as-split-area [size]="40">
<dsp-list-view [search]="searchParams" (resourceSelected)="openResource($event)"></dsp-list-view>
</as-split-area>
<as-split-area [size]="60">
<dsp-resource-view [iri]="resourceIri" (openProject)="openProject($event)"></dsp-resource-view>
</as-split-area>
</as-split>
</div>
1 change: 1 addition & 0 deletions src/app/workspace/results/results.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 9 additions & 1 deletion src/app/workspace/results/results.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { SearchParams } from '@dasch-swiss/dsp-ui';
import { ReadProject } from '@dasch-swiss/dsp-js';

@Component({
selector: 'app-results',
Expand All @@ -13,6 +14,8 @@ export class ResultsComponent implements OnInit {

resIri: string;

resourceIri: string;

constructor(
private _route: ActivatedRoute,
private _router: Router
Expand All @@ -37,6 +40,11 @@ export class ResultsComponent implements OnInit {
}

openResource(id: string) {
this._router.navigate(['/resource/' + encodeURIComponent(id)]);
this.resourceIri = id;
}

// open project in new tab
openProject(project: ReadProject){
window.open('/project/' + project.shortcode, "_blank");
}
}

0 comments on commit a66f848

Please sign in to comment.