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): adjust tooltip text when property is inherited (DEV-323) #674

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -56,7 +56,11 @@
<mat-icon>tune</mat-icon>
</button>
<span matTooltipPosition="above"
[matTooltip]="((!propCanBeDeleted) ? 'The property can\'t be removed because it is in use' : 'Remove property from resource class')">
[matTooltip]="((!propCanBeDeleted) ?
(propCard.isInherited ?
'The property can\'t be removed because it is inherited from another class' :
'The property can\'t be removed because it is in use'
) : 'Remove property from resource class')">
<button mat-button [disabled]="!propCanBeDeleted" class="delete"
(click)="removePropertyFromClass.emit({iri: propDef.id, label: propDef.label})">
<mat-icon>backspace</mat-icon>
Expand All @@ -73,7 +77,7 @@
</button>
</span>
<span matTooltipPosition="above"
[matTooltip]="((resClasses.length > 0 || !propCanBeDeleted) ? 'The property can\'t be deleted because it is used in a class' : 'Delete property')">
[matTooltip]="((resClasses.length > 0) ? 'The property can\'t be deleted because it is used in a class' : 'Delete property')">
<button mat-button [disabled]="resClasses.length > 0" class="delete"
(click)="deleteResourceProperty.emit({iri: propDef.id, label: propDef.label})">
<mat-icon>delete</mat-icon>
Expand Down
23 changes: 15 additions & 8 deletions src/app/project/ontology/property-info/property-info.component.ts
Expand Up @@ -283,14 +283,21 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
delCard.cardinalities = [this.propCard];
onto.entity = delCard;

this._dspApiConnection.v2.onto.canDeleteCardinalityFromResourceClass(onto).subscribe(
(canDoRes: CanDoResponse) => {
this.propCanBeDeleted = canDoRes.canDo;
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
}
);
// property can only be removed from class if it's not inherited from another prop or class
if (this.propCard.isInherited) {
this.propCanBeDeleted = false;
} else {
this._dspApiConnection.v2.onto.canDeleteCardinalityFromResourceClass(onto).subscribe(
(canDoRes: CanDoResponse) => {
this.propCanBeDeleted = canDoRes.canDo;
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
}
);
}


}
}
}
Expand Down