diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2022-10-05 14:54:09 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-10-14 05:53:38 +0000 |
commit | c53d40dd69c956dabfd30eb7dcecad03151747fe (patch) | |
tree | 6372171ea4e168a0619b3e0ca1e924fa45757bfb /catalog-ui/src/app/view-models/forms | |
parent | b24a4f2f4edf845c10ef42545496256b0bdbb8a8 (diff) |
Support viewing of VFC property details when checked in
Issue-ID: SDC-4208
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I4c16ca4058716bfee6a52b37604a045ecabc975c
Diffstat (limited to 'catalog-ui/src/app/view-models/forms')
2 files changed, 20 insertions, 16 deletions
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts index 17e82099ab..103b1341c0 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts @@ -62,6 +62,7 @@ interface IPropertyFormViewModelScope extends ng.IScope { dataTypes:DataTypesMap; isTypeDataType:boolean; maxLength:number; + isViewOnly:boolean; isPropertyValueOwner:boolean; isVnfConfiguration:boolean; constraints:string[]; @@ -101,6 +102,7 @@ export class PropertyFormViewModel { 'ModalServiceSdcUI', 'filteredProperties', '$timeout', + 'isViewOnly', 'isPropertyValueOwner', 'propertyOwnerType', 'propertyOwnerId', @@ -125,6 +127,7 @@ export class PropertyFormViewModel { private modalService:SdcUiServices.ModalService, private filteredProperties:Array<PropertyModel>, private $timeout:ng.ITimeoutService, + private isViewOnly:boolean, private isPropertyValueOwner:boolean, private propertyOwnerType:string, private propertyOwnerId:string, @@ -232,6 +235,7 @@ export class PropertyFormViewModel { private initScope = ():void => { //scope properties + this.$scope.isViewOnly = this.isViewOnly; this.$scope.isLoading = true; this.$scope.forms = {}; this.$scope.validationPattern = this.ValidationPattern; @@ -398,17 +402,17 @@ export class PropertyFormViewModel { this.$scope.$watch("forms.editForm.$invalid", (newVal) => { if (this.$scope.editPropertyModel.hasGetFunctionValue) { - this.$scope.footerButtons[0].disabled = newVal || !this.$scope.editPropertyModel.property.toscaFunction; + this.$scope.footerButtons[0].disabled = newVal || !this.$scope.editPropertyModel.property.toscaFunction || this.isViewOnly; } else { - this.$scope.footerButtons[0].disabled = newVal; + this.$scope.footerButtons[0].disabled = newVal || this.isViewOnly; } }); this.$scope.$watch("forms.editForm.$valid", (newVal) => { if (this.$scope.editPropertyModel.hasGetFunctionValue) { - this.$scope.footerButtons[0].disabled = !newVal || !this.$scope.editPropertyModel.property.toscaFunction; + this.$scope.footerButtons[0].disabled = !newVal || !this.$scope.editPropertyModel.property.toscaFunction || this.isViewOnly; } else { - this.$scope.footerButtons[0].disabled = !newVal; + this.$scope.footerButtons[0].disabled = !newVal || this.isViewOnly; } }); diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html index 67fce08311..a6fd69755a 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html @@ -13,11 +13,11 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<ng1-modal modal="modalInstanceProperty" type="classic" class="sdc-edit-property-container" buttons="footerButtons" header="{{isNew ? 'Add' : 'Update' }} Property" show-close-button="true" data-tests-id="sdc-edit-property-container"> +<ng1-modal modal="modalInstanceProperty" type="classic" class="sdc-edit-property-container" buttons="footerButtons" header="{{isNew ? 'Add' : isViewOnly ? '' : 'Update'}} Property {{isViewOnly ? 'Definition' : ''}}" show-close-button="true" data-tests-id="sdc-edit-property-container"> <loader data-display="isLoading" relative="false" size="medium"></loader> <div class="sdc-modal-top-bar" data-ng-if="!isNew"> <div class="sdc-modal-top-bar-buttons"> - <span ng-click="delete(editPropertyModel.property)" data-ng-class="{'disabled' : isPropertyValueOwner || editPropertyModel.property.readonly || propertyOwnerType == 'group' || propertyOwnerType == 'policy'}" class="sprite-new delete-btn" data-tests-id="delete_property" sdc-smart-tooltip="">Delete</span> + <span ng-click="delete(editPropertyModel.property)" data-ng-class="{'disabled' : isPropertyValueOwner || editPropertyModel.property.readonly || propertyOwnerType == 'group' || propertyOwnerType == 'policy' || isViewOnly}" class="sprite-new delete-btn" data-tests-id="delete_property" sdc-smart-tooltip="">Delete</span> <span class="delimiter"></span> <span data-ng-click="getPrev()" data-ng-class="{'disabled' : !currentPropertyIndex }" class="sprite-new left-arrow" data-tests-id="get-prev" sdc-smart-tooltip="">Previous</span> <span data-ng-click="getNext()" data-ng-class="{'disabled' : isLastProperty }" class="sprite-new right-arrow" data-tests-id="get-next" sdc-smart-tooltip="">Next</span> @@ -38,7 +38,7 @@ <input class="i-sdc-form-input" data-tests-id="propertyName" data-ng-maxlength="50" - data-ng-disabled="!isNew || editPropertyModel.property.readonly" + data-ng-disabled="!isNew || editPropertyModel.property.readonly || isViewOnly" maxlength="50" data-ng-model="editPropertyModel.property.name" type="text" @@ -65,7 +65,7 @@ <select class="i-sdc-form-select" data-tests-id="propertyType" data-required - data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly" + data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly" name="type" data-ng-change="onTypeChange()" data-ng-model="editPropertyModel.property.type"> @@ -88,7 +88,7 @@ <select class="i-sdc-form-select" data-required data-tests-id="schema-type" - data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly" + data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly" name="schemaType" data-ng-change="onSchemaTypeChange()" data-ng-model="editPropertyModel.property.schema.property.type"> @@ -122,7 +122,7 @@ <label class="i-sdc-form-label">Description</label> <textarea class="i-sdc-form-textarea" data-ng-maxlength="400" - data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly" + data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly" maxlength="400" data-ng-pattern="commentValidationPattern" name="description" @@ -167,7 +167,7 @@ type-name="editPropertyModel.property.type" parent-form-obj="forms.editForm" fields-prefix-name="currentPropertyIndex" - read-only="editPropertyModel.property.readonly && !isPropertyValueOwner" + read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly" default-value="{{getDefaultValue()}}" expand-by-default="true"></fields-structure> @@ -178,7 +178,7 @@ schema-property="editPropertyModel.property.schema.property" parent-form-obj="forms.editForm" fields-prefix-name="currentPropertyIndex" - read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isVnfConfiguration" + read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isVnfConfiguration || isViewOnly" default-value="{{getDefaultValue()}}" max-length="maxLength" constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues"> @@ -190,7 +190,7 @@ schema-property="editPropertyModel.property.schema.property" parent-form-obj="forms.editForm" fields-prefix-name="currentPropertyIndex" - read-only="editPropertyModel.property.readonly && !isPropertyValueOwner" + read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly" default-value="{{getDefaultValue()}}" max-length="maxLength" constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues"></type-list> @@ -205,7 +205,7 @@ <select class="i-sdc-form-select" data-tests-id="constraints" ng-if="(editPropertyModel.property.constraints)" - data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner" + data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly" data-ng-change="onValueChange()" data-ng-model="editPropertyModel.property.value"> @@ -226,7 +226,7 @@ data-tests-id="defaultvalue" ng-if="!(editPropertyModel.property.constraints) && !((editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean')" data-ng-maxlength="maxLength" - data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner" + data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly" maxlength="{{maxLength}}" data-ng-model="editPropertyModel.property.value" type="text" @@ -241,7 +241,7 @@ <select class="i-sdc-form-select" data-tests-id="booleantype" ng-if="(editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean'" - data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner" + data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly" name="value" data-ng-change="onValueChange()" data-ng-model="editPropertyModel.property.value"> |