New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(resource): improve list of properties in resource viewer (DSP-1663) #453
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dd12fdf
feat(resource): combination of two components
kilchenmann 79682a2
Merge branch 'main' into wip/dsp-1663-show-all-props-toggle
kilchenmann 0c32907
test(resource): complete tests in properties comp
kilchenmann 2eed04c
refactor(resource): delete unused components
kilchenmann 3457d39
test(resource): enable all tests
kilchenmann 0da8e69
refactor(resource): clean up code
kilchenmann bbd792b
refactor(resource): clean up code
kilchenmann 9bdad1a
style(resource): fix style issue in still image viewer
kilchenmann 17058ef
refactor: sort imports
kilchenmann 6d725d1
Merge branch 'main' into wip/dsp-1663-show-all-props-toggle
kilchenmann File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
src/app/workspace/resource/properties/properties.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
<!-- toolbar --> | ||
<div class="toolbar" *ngIf="project"> | ||
<!-- resource info --> | ||
<h3 class="label mat-title"> | ||
{{resource.res.label}} | ||
</h3> | ||
<span class="fill-remaining-space"></span> | ||
|
||
<!-- tools: share, add to favorites, edit, delete etc. --> | ||
<span> | ||
<!-- TODO: activate favorite action to add resource to collection --> | ||
<!-- | ||
<button mat-button class="add-res-to-collection"> | ||
<mat-icon>star_border</mat-icon> | ||
</button> | ||
--> | ||
|
||
<!-- Toggle list of properties: all or only the ones with value --> | ||
<button mat-button class="toggle-props" matTooltip="Toggle list of properties" matTooltipPosition="above" | ||
(click)="showAllProps = !showAllProps"> | ||
<mat-icon>{{showAllProps ? 'unfold_less' : 'unfold_more'}}</mat-icon> | ||
<span class="desktop-only">{{showAllProps ? 'Hide empty' : 'Show all'}} properties</span> | ||
</button> | ||
|
||
<!-- TODO: activate delete action to delete the whole resource --> | ||
<!-- | ||
<button mat-button class="delete-res"> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
--> | ||
|
||
<!-- Share resource by copying the ark url --> | ||
<button mat-button class="share-res" matTooltip="Share resource by copying ARK url" matTooltipPosition="above" | ||
[matMenuTriggerFor]="share"> | ||
<mat-icon>share</mat-icon> | ||
<span class="desktop-only">Citation Link</span> | ||
</button> | ||
<mat-menu #share="matMenu" class="res-share-menu"> | ||
<!-- citation link - ARK URL --> | ||
<div class="ark-url-label mat-body"> | ||
<label for="clipboard-arkurl">Citation Link (ARK URL)</label> | ||
</div> | ||
<div class="ark-url-input"> | ||
<input id="clipboard-arkurl" class="clipboard-arkurl" cols="30" rows="10" readonly | ||
[(ngModel)]="resource.res.versionArkUrl" /> | ||
<button mat-button class="btn-copy-arkurl" [cdkCopyToClipboard]="resource.res.versionArkUrl" | ||
matTooltip="Copy ARK url" matTooltipPosition="below" (click)="openSnackBar()"> | ||
<mat-icon class="icon-arkurl">content_copy</mat-icon> | ||
</button> | ||
</div> | ||
</mat-menu> | ||
</span> | ||
</div> | ||
|
||
<!-- additional line with project and user information --> | ||
<div class="infobar mat-caption" *ngIf="project && user"> | ||
<p *ngIf="displayProjectInfo">This resource belongs to the project | ||
<span class="project link" (click)="openProject(project)" (mouseover)="previewProject(project)"> | ||
<b>{{project?.shortname}}</b> | ||
<mat-icon inline>open_in_new</mat-icon> | ||
</span> | ||
</p> | ||
<span class="fill-remaining-space"></span> | ||
<p *ngIf="user || resource.res.creationDate"> | ||
Created | ||
<span *ngIf="user">by {{(user.username ? user.username : user.givenName + ' ' + user.familyName)}}</span> | ||
<span *ngIf="resource.res.creationDate"> on {{resource.res.creationDate | date}}</span> | ||
</p> | ||
</div> | ||
|
||
<!-- list of properties --> | ||
<div class="properties-container"> | ||
<div class="properties" *ngIf="resource.resProps.length !== 0; else noProperties"> | ||
|
||
<!-- list of properties --> | ||
<div *ngFor="let prop of resource.resProps; let last = last"> | ||
<!-- show property; all in case of showAll === true or only the ones with prop.values --> | ||
<div *ngIf="!prop.propDef['isLinkProperty'] && showAllProps || ( prop.values && prop.values.length > 0 )" | ||
[class.border-bottom]="prop.values && !last" | ||
class="property"> | ||
<div class="property-label"> | ||
<!-- label of the property --> | ||
<h3 class="label mat-subheading-1" | ||
[class.label-info]="prop.propDef.comment" | ||
[matTooltip]="prop.propDef.comment" | ||
matTooltipPosition="above"> | ||
{{prop.propDef.label}} | ||
</h3> | ||
</div> | ||
<div class="property-value"> | ||
<!-- the value(s) of the property --> | ||
<div *ngFor="let val of prop.values"> | ||
<dsp-display-edit *ngIf="val" | ||
#displayEdit | ||
[parentResource]="resource.res" | ||
[displayValue]="val" | ||
[propArray]="resource.resProps" | ||
(referredResourceClicked)="openResource($event)" | ||
(referredResourceHovered)="previewResource($event)"> | ||
</dsp-display-edit> | ||
</div> | ||
<!-- Add value form --> | ||
<div *ngIf="addValueFormIsVisible && propID === prop.propDef.id"> | ||
<dsp-add-value #addValue | ||
class="add-value" | ||
[parentResource]="resource.res" | ||
[resourcePropertyDefinition]="$any(resource.res.entityInfo.properties[prop.propDef.id])" | ||
(operationCancelled)="hideAddValueForm()"> | ||
</dsp-add-value> | ||
</div> | ||
<!-- Add button --> | ||
<div *ngIf="addValueIsAllowed(prop)"> | ||
<button class="create" | ||
(click)="showAddValueForm(prop)" | ||
title="Add a new value"> | ||
<mat-icon>add_box</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<ng-template #noProperties>The resource {{resource?.res.resourceClassLabel}} has no defined | ||
properties.</ng-template> | ||
</div> |
66 changes: 56 additions & 10 deletions
66
...erties/resource-properties.component.scss → ...urce/properties/properties.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please sort the imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 17058ef