diff --git a/src/app/main/directive/base-value.directive.ts b/src/app/main/directive/base-value.directive.ts index aa895ed362..76f2775f57 100644 --- a/src/app/main/directive/base-value.directive.ts +++ b/src/app/main/directive/base-value.directive.ts @@ -31,6 +31,11 @@ export abstract class BaseValueDirective { */ @Input() valueRequiredValidator = true; + /** + * disable the comment field + */ + @Input() commentDisabled? = false; + shouldShowComment = false; /** diff --git a/src/app/workspace/resource/properties/properties.component.html b/src/app/workspace/resource/properties/properties.component.html index f9a4830052..28f645283c 100644 --- a/src/app/workspace/resource/properties/properties.component.html +++ b/src/app/workspace/resource/properties/properties.component.html @@ -117,23 +117,24 @@

- - +
- - +
diff --git a/src/app/workspace/resource/properties/properties.component.spec.ts b/src/app/workspace/resource/properties/properties.component.spec.ts index d38582719f..d5e2b89e5e 100644 --- a/src/app/workspace/resource/properties/properties.component.spec.ts +++ b/src/app/workspace/resource/properties/properties.component.spec.ts @@ -28,7 +28,6 @@ import { EmitEvent, Events, PropertyInfoValues, - UserService, ValueOperationEventService } from '@dasch-swiss/dsp-ui'; import { of, Subscription } from 'rxjs'; @@ -36,6 +35,7 @@ import { DspResource } from '../dsp-resource'; import { PropertiesComponent } from './properties.component'; import { IncomingService } from '../incoming.service'; import { DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens'; +import { UserService } from '../services/user.service'; /** * test host component to simulate parent component. diff --git a/src/app/workspace/resource/properties/properties.component.ts b/src/app/workspace/resource/properties/properties.component.ts index 86a26ccf16..15fd8776b7 100644 --- a/src/app/workspace/resource/properties/properties.component.ts +++ b/src/app/workspace/resource/properties/properties.component.ts @@ -1,5 +1,6 @@ import { Component, EventEmitter, Inject, Input, OnChanges, OnDestroy, OnInit, Output } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; +import { PageEvent } from '@angular/material/paginator'; import { ApiResponseData, ApiResponseError, @@ -25,24 +26,23 @@ import { UpdateResourceMetadataResponse, UserResponse } from '@dasch-swiss/dsp-js'; -import { - AddedEventValue, - DeletedEventValue, - Events, - UpdatedEventValues, - UserService, - ValueOperationEventService, - ValueService -} from '@dasch-swiss/dsp-ui'; import { Subscription } from 'rxjs'; +import { DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens'; import { ConfirmationWithComment, DialogComponent } from 'src/app/main/dialog/dialog.component'; import { ErrorHandlerService } from 'src/app/main/error/error-handler.service'; +import { NotificationService } from 'src/app/main/services/notification.service'; import { DspResource } from '../dsp-resource'; -import { RepresentationConstants } from '../representation/file-representation'; import { IncomingService } from '../incoming.service'; -import { PageEvent } from '@angular/material/paginator'; -import { DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens'; -import { NotificationService } from 'src/app/main/services/notification.service'; +import { RepresentationConstants } from '../representation/file-representation'; +import { UserService } from '../services/user.service'; +import { + AddedEventValue, + DeletedEventValue, + Events, + UpdatedEventValues, + ValueOperationEventService +} from '../services/value-operation-event.service'; +import { ValueService } from '../services/value.service'; // object of property information from ontology class, properties and property values export interface PropertyInfoValues { @@ -434,6 +434,18 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy { } } + /** + * given a resource property, check if its cardinality allows a value to be deleted + * + * @param prop the resource property + */ + deleteValueIsAllowed(prop: PropertyInfoValues): boolean { + const isAllowed = CardinalityUtil.deleteValueForPropertyAllowed( + prop.propDef.id, prop.values.length, this.resource.res.entityInfo.classes[this.resource.res.type]); + + return isAllowed; + } + /** * updates the UI in the event of an existing value being deleted * diff --git a/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.html b/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.html index 479aae4111..92bf2dba76 100644 --- a/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.html +++ b/src/app/workspace/resource/resource-instance-form/resource-instance-form.component.html @@ -1,5 +1,6 @@ - -
+ +
@@ -14,8 +15,7 @@
- - + (resourceClassSelected)="selectProperties($event)"> @@ -42,7 +39,7 @@ -
+
@@ -67,11 +60,14 @@ - + + - -
+