Skip to content
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

feat(ontology): refactor list of properties in resource class (DSP-1360) #389

Merged
merged 29 commits into from Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
87bd979
feat(ontology): own component for list of properties in res class
kilchenmann Feb 16, 2021
5baf95c
Merge branch 'main' into wip/dsp-1210-edit-res-property
kilchenmann Feb 16, 2021
96a6c64
test(ontology): update test for property info component
kilchenmann Feb 16, 2021
268115d
feat(ontology): better list of props in class
kilchenmann Feb 16, 2021
b0f8ebc
Merge branch 'main' into wip/dsp-1210-edit-res-property
kilchenmann Feb 17, 2021
b86ccdf
chore(cache): better error message in cache
kilchenmann Feb 17, 2021
00be1f2
chore(ontology): better cache handling to use in child component
kilchenmann Feb 17, 2021
a0684e1
feat(ontology): new list of properties in res class
kilchenmann Feb 17, 2021
d177214
style(ontology): refactor res class viewer
kilchenmann Feb 17, 2021
bf7490b
chore(ontology): update property info component
kilchenmann Feb 17, 2021
48e2323
refactor(ontology): clean up code
kilchenmann Feb 17, 2021
e49503a
refactor(ontology): clean up code
kilchenmann Feb 17, 2021
700b152
refactor(ontology): clean up code
kilchenmann Feb 17, 2021
84e9bca
Merge branch 'main' into wip/dsp-1360-list-of-properties-in-res-class
Feb 17, 2021
7125bee
test(ontology): bug fix in tests
kilchenmann Feb 17, 2021
2f91151
chore(deps): update package-lock.json
kilchenmann Feb 17, 2021
b11b155
fix(ontology): avoid `null:null` in prop type tooltip
kilchenmann Feb 18, 2021
50b6eaf
chore(ontology): add missing space
kilchenmann Feb 18, 2021
9edc72d
fix(ontology): display prop even without gui order
kilchenmann Feb 18, 2021
3956cdc
style(ontology): fix design issue in res class form
kilchenmann Feb 18, 2021
6a5a3e4
refactor(ontology): clean up code
kilchenmann Feb 18, 2021
b6ef4bb
refactor(ontology): clean up code
kilchenmann Feb 18, 2021
e006deb
feat(ontology): support all project ontologies in list of properties
kilchenmann Feb 18, 2021
791b4b6
chore(ontology): delete console.logs
kilchenmann Feb 18, 2021
d64b745
refactor(ontology): fix typo in comments
kilchenmann Feb 20, 2021
0752f1f
fix(ontology): fix cache issues in main ontology view
kilchenmann Feb 20, 2021
2f2b27d
refactor(ontology): delete console.logs
kilchenmann Feb 20, 2021
8cf574e
test(ontology): add more property info tests
kilchenmann Feb 20, 2021
84e8d1c
Merge branch 'main' into wip/dsp-1360-list-of-properties-in-res-class
Feb 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/app/app.module.ts
Expand Up @@ -90,6 +90,7 @@ import { PersonTemplateComponent } from './project/board/person-template/person-
import { AddressTemplateComponent } from './project/board/address-template/address-template.component';
import { OrganisationTemplateComponent } from './project/board/organisation-template/organisation-template.component';
import { EditListItemComponent } from './project/list/list-item-form/edit-list-item/edit-list-item.component';
import { PropertyInfoComponent } from './project/ontology/property-info/property-info.component';

// translate: AoT requires an exported function for factories
export function HttpLoaderFactory(httpClient: HttpClient) {
Expand Down Expand Up @@ -162,7 +163,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
PersonTemplateComponent,
AddressTemplateComponent,
OrganisationTemplateComponent,
EditListItemComponent
EditListItemComponent,
PropertyInfoComponent
],
imports: [
AppRoutingModule,
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/cache/cache.service.ts
Expand Up @@ -71,7 +71,7 @@ export class CacheService {
});

} else {
return throwError('Requested key is not available in Cache');
return throwError('Requested key "' + key + '" is not available in Cache');
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/app/project/ontology/default-data/default-properties.ts
@@ -1,6 +1,6 @@
import { Constants } from '@dasch-swiss/dsp-js';

export interface Property {
export interface Category {
group: string;
elements: PropertyType[];
}
Expand All @@ -15,7 +15,7 @@ export interface PropertyType {
}

export class DefaultProperties {
public static data: Property[] = [
public static data: Category[] = [
{
group: 'Text',
elements: [
Expand Down
@@ -1,7 +1,7 @@
<dsp-progress-indicator *ngIf="loading"></dsp-progress-indicator>

<form [formGroup]="ontologyForm" (ngSubmit)="createOntology()" class="form" *ngIf="!loading">
<!-- auto complete list to select resource classs -->
<!-- auto complete list to select resource classes -->
<div class="form-content">
<mat-form-field class="large-field ontology-name">
<input matInput [maxlength]="nameMaxLength" [formControl]="ontologyForm.controls['name']"
Expand Down
34 changes: 17 additions & 17 deletions src/app/project/ontology/ontology.component.html
@@ -1,7 +1,8 @@
<div *ngIf="projectAdmin" class="desktop-only">

<p class="note warning center">This is a first version of the data model editor. Some features may not work as
intended.</p>
<p class="note warning center">
This is a first version of the data model editor. Some features may not work as intended.
</p>
<dsp-progress-indicator *ngIf="loading"></dsp-progress-indicator>

<!-- toolbar: select ontology -->
Expand Down Expand Up @@ -54,7 +55,7 @@ <h2 class="mat-title">
</div>

<!-- main content: overview shows resource classes of ontology -->
<div *ngIf="ontology" class="ontology-editor">
<div *ngIf="!loading && ontology" class="ontology-editor">

<mat-toolbar class="ontology-editor-header">
<mat-toolbar-row>
Expand Down Expand Up @@ -128,7 +129,7 @@ <h3 class="mat-title" [matTooltip]="ontology.id">{{ontology?.label}}</h3>
<div class="ontology-editor-canvas drag-drop-stop">
<div class="ontology-editor-grid">

<!-- list of resource classs -->
<!-- list of resource classes -->
<div *ngFor="let resClass of ontoClasses; let i = index" class="resource-class" cdkDrag
cdkDragBoundary=".drag-drop-stop">
<mat-toolbar class="resource-class-header" cdkDragHandle>
Expand Down Expand Up @@ -157,19 +158,18 @@ <h4 mat-card-title [matTooltip]="resClass.comment" matTooltipPosition="above">
</mat-menu>
</mat-toolbar-row>
</mat-toolbar>
<div class="resource-class-properties">
<ul>
<span *ngFor="let prop of resClass.propertiesList">
<!-- display only properties with guiOrder and they exist in list of properties
and objectType is not a linkValue (otherwise we have the property twice) -->
<li
*ngIf="prop.guiOrder >= 0 && ontology?.properties[prop.propertyIndex] && ontology?.properties[prop.propertyIndex].objectType !== 'http://api.knora.org/ontology/knora-api/v2#LinkValue'">
{{ontology?.properties[prop.propertyIndex].label}}
</li>
</span>

</ul>
</div>
<mat-list class="resource-class-properties">
<span *ngFor="let prop of resClass.propertiesList">
<!-- display only properties with guiOrder and if they exist in list of properties;
objectType is not a linkValue (otherwise we have the property twice) -->
<app-property-info
*ngIf="ontology?.properties[prop.propertyIndex]
&& ontology?.properties[prop.propertyIndex].objectType !== 'http://api.knora.org/ontology/knora-api/v2#LinkValue'"
[propDef]="ontology?.properties[prop.propertyIndex]" [propCard]="prop"
[projectcode]="projectcode">
</app-property-info>
</span>
</mat-list>

</div>

Expand Down
12 changes: 6 additions & 6 deletions src/app/project/ontology/ontology.component.scss
@@ -1,7 +1,7 @@
@import "~@angular/material/theming";
@import "../../../assets/style/config";

$width: 304px;
$width: 340px;

.app-toolbar-action {
&.select-form {
Expand Down Expand Up @@ -50,10 +50,9 @@ $width: 304px;

.ontology-editor-grid {
display: grid;
grid-template-rows: auto; // value would be "masonry" as soon it's implemented in all browsers
grid-template-columns: repeat(auto-fill, minmax($width, 1fr));
grid-column-gap: 12px;
grid-row-gap: 12px;
// padding-top: 60px;
grid-gap: 6px;
}
}
}
Expand All @@ -65,7 +64,7 @@ $width: 304px;
@include mat-elevation-transition;
@include mat-elevation(2);
padding: 12px;
margin: 12px;
margin: 6px;
background-color: #fff;

.resource-class-header {
Expand All @@ -77,7 +76,8 @@ $width: 304px;
}

.resource-class-properties {
li {
li.property-info {
list-style-type: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
4 changes: 3 additions & 1 deletion src/app/project/ontology/ontology.component.spec.ts
Expand Up @@ -28,6 +28,7 @@ import { ErrorComponent } from 'src/app/main/error/error.component';
import { TestConfig } from 'test.config';
import { OntologyVisualizerComponent } from './ontology-visualizer/ontology-visualizer.component';
import { OntologyComponent } from './ontology.component';
import { PropertyInfoComponent } from './property-info/property-info.component';

describe('OntologyComponent', () => {
let component: OntologyComponent;
Expand All @@ -39,7 +40,8 @@ describe('OntologyComponent', () => {
OntologyComponent,
OntologyVisualizerComponent,
DialogComponent,
ErrorComponent
ErrorComponent,
PropertyInfoComponent
],
imports: [
BrowserAnimationsModule,
Expand Down