From 407bbefe5b0b932f6c6bed65193815c78b4d41b5 Mon Sep 17 00:00:00 2001 From: Satoshi Fujii Date: Wed, 26 Feb 2020 15:39:38 +0900 Subject: Add 'required in runtime' for service inputs User may want to set required to true for some inputs so that make sure those input values are given at service instantiation time. By this change 'required in runtime' column is introduced into service inputs table in Properties Assignment screen and user can select required true/false for each input. Change-Id: I0d676d2d20e02c975d51c7f4d2bb63c699743d66 Issue-ID: SDC-2659 Signed-off-by: Satoshi Fujii --- .../app/models/properties-inputs/input-fe-model.ts | 10 ++++++++++ .../logic/inputs-table/inputs-table.component.html | 13 ++++++++++++- .../logic/inputs-table/inputs-table.component.less | 21 +++++++++++++++++---- .../logic/inputs-table/inputs-table.component.ts | 7 ++++++- .../properties-table.component.html | 2 +- .../properties-table.component.less | 10 ++++++++-- .../unsaved-changes/unsaved-changes.component.ts | 2 -- .../declare-list/declare-list.component.html | 9 +++++++++ .../declare-list/declare-list.component.ts | 1 + .../declare-list/declare-list.module.ts | 4 +++- .../properties-assignment.module.ts | 6 +++++- .../properties-assignment.page.component.html | 1 + .../properties-assignment.page.component.ts | 16 ++++++++++------ 13 files changed, 83 insertions(+), 19 deletions(-) (limited to 'catalog-ui/src') diff --git a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts index c349f41ea2..85c514bcbc 100644 --- a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts +++ b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts @@ -34,6 +34,7 @@ export class InputFEModel extends InputBEModel { defaultValueObjOrig:any; defaultValueObjIsChanged:boolean; derivedDataType: DerivedPropertyType; + requiredOrig: boolean; constructor(input?: InputBEModel) { super(input); @@ -47,6 +48,8 @@ export class InputFEModel extends InputBEModel { this.derivedDataType = this.getDerivedPropertyType(); this.resetDefaultValueObjValidation(); this.updateDefaultValueObjOrig(); + + this.requiredOrig = this.required; } } @@ -77,4 +80,11 @@ export class InputFEModel extends InputBEModel { return !_.isEqual(this.defaultValueObj, this.defaultValueObjOrig); } + hasRequiredChanged(): boolean { + return this.required !== this.requiredOrig; + } + + hasChanged(): boolean { + return this.hasDefaultValueChanged() || this.hasRequiredChanged(); + } } \ No newline at end of file diff --git a/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html b/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html index eeba590046..d3db53aa43 100644 --- a/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html +++ b/catalog-ui/src/app/ng2/components/logic/inputs-table/inputs-table.component.html @@ -29,6 +29,9 @@ +
+ Req. in RT +
Value
@@ -37,7 +40,9 @@
-
{{input.name}}
+
+ {{input.name}} +
@@ -54,6 +59,12 @@ {{input.type | contentAfterLastDot}}
+ +
+ +
; @Input() readonly: boolean; @Input() isLoading: boolean; + @Input() componentType: string; @Output() inputChanged: EventEmitter = new EventEmitter(); @Output() deleteInput: EventEmitter = new EventEmitter(); @@ -47,7 +48,7 @@ export class InputsTableComponent { sortBy: String; reverse: boolean; - selectedInputToDelete: InputFEModel; + selectedInputToDelete: InputFEModel; sort = (sortBy) => { this.reverse = (this.sortBy === sortBy) ? !this.reverse : true; @@ -88,6 +89,10 @@ export class InputsTableComponent { this.inputChanged.emit(input); }; + onRequiredChanged = (input: InputFEModel, event) => { + this.inputChanged.emit(input); + } + onDeleteInput = () => { this.deleteInput.emit(this.selectedInputToDelete); this.modalService.closeCurrentModal(); diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html index 89b85d3578..af7a61204c 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html @@ -27,7 +27,7 @@
-
ES +
EntrySchema
diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.less b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.less index 86832e57f0..8c2c6ce940 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.less +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.less @@ -129,8 +129,10 @@ &:last-child { border-right:#d2d2d2 solid 1px; } + + // Column: Property Name &.col1 { - flex: 1 0 210px; + flex: 1 0 190px; max-width:300px; display: flex; @media @smaller-screen { flex: 0 0 25%;} @@ -149,20 +151,24 @@ flex: 0 0 auto; } } + + // Column: Type &.col2 { flex: 0 0 150px; max-width:150px; @media @smaller-screen { flex: 0 0 20%;} } + // Column: ES &.col3 { flex:0 0 120px; max-width:120px; @media @smaller-screen { flex: 0 0 15%;} } + // Column: Value &.valueCol { - flex: 2 0 300px; + flex: 2 0 250px; display: flex; @media @smaller-screen { flex: 1 0 40%;} } diff --git a/catalog-ui/src/app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component.ts b/catalog-ui/src/app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component.ts index b8fdeaf659..c752f9a042 100644 --- a/catalog-ui/src/app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component.ts +++ b/catalog-ui/src/app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component.ts @@ -12,6 +12,4 @@ export class UnsavedChangesComponent { constructor(){ } - - } \ No newline at end of file diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.html index c0bcc7885e..187ffa6efe 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.html +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.html @@ -56,6 +56,15 @@ [ngModelOptions]="{ debounce: 200 }">
+ +
+ + +
+
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts index fe3106649b..8ca4f44116 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts @@ -57,6 +57,7 @@ export class DeclareListComponent { this.propertyModel = new PropertyBEModel(); this.propertyModel.type = ''; this.propertyModel.schema.property.type = ''; + this.propertyModel.required = false; const types: string[] = PROPERTY_DATA.TYPES; // All types - simple type + map + list this.dataTypes = this.dataTypeService.getAllDataTypes(); // Get all data types in service const nonPrimitiveTypes: string[] = _.filter(Object.keys(this.dataTypes), (type: string) => { diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.module.ts index 97667f9261..82e9b6ff8b 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.module.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.module.ts @@ -25,6 +25,7 @@ import { FormElementsModule } from 'app/ng2/components/ui/form-components/form-e import { UiElementsModule } from 'app/ng2/components/ui/ui-elements.module'; import { TranslateModule } from '../../../shared/translator/translate.module'; import { DeclareListComponent } from './declare-list.component'; +import { SdcUiComponentsModule } from 'onap-ui-angular'; @NgModule({ declarations: [ @@ -35,7 +36,8 @@ import { DeclareListComponent } from './declare-list.component'; FormsModule, FormElementsModule, UiElementsModule, - TranslateModule + TranslateModule, + SdcUiComponentsModule ], exports: [], entryComponents: [ diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts index f5500d42ae..3def63e0d2 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts @@ -34,6 +34,8 @@ import {HierarchyNavService} from "./services/hierarchy-nav.service"; import {PropertiesUtils} from "./services/properties.utils"; import {InputsUtils} from "./services/inputs.utils"; import {ComponentModeService} from "../../services/component-services/component-mode.service"; +import {SdcUiComponentsModule} from "onap-ui-angular"; +import {ModalFormsModule} from "app/ng2/components/ui/forms/modal-forms.module"; @NgModule({ declarations: [ @@ -48,7 +50,9 @@ import {ComponentModeService} from "../../services/component-services/component- GlobalPipesModule, PropertyTableModule, PoliciesTableModule, - UiElementsModule], + UiElementsModule, + SdcUiComponentsModule, + ModalFormsModule], entryComponents: [PropertiesAssignmentComponent], exports: [ diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html index 8d4215aaec..6856ae8358 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html @@ -47,6 +47,7 @@ [inputs]="inputs | searchFilter:'name':searchQuery" [instanceNamesMap]="componentInstanceNamesMap" [isLoading]="loadingInputs" + [componentType]="component.componentType" (deleteInput)="deleteInput($event)" (inputChanged)="dataChanged($event)"> diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts index 4b84f0e66f..725847bc6d 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts @@ -348,7 +348,7 @@ export class PropertiesAssignmentComponent { if (this.isPropertiesTabSelected && item instanceof PropertyFEModel) { itemHasChanged = item.hasValueObjChanged(); } else if (this.isInputsTabSelected && item instanceof InputFEModel) { - itemHasChanged = item.hasDefaultValueChanged(); + itemHasChanged = item.hasChanged(); } else if (this.isPoliciesTabSelected && item instanceof InputFEModel) { itemHasChanged = item.hasDefaultValueChanged(); } @@ -574,16 +574,17 @@ export class PropertiesAssignmentComponent { let typelist: any = PROPERTY_TYPES.LIST; let uniID: any = insId; let boolfalse: any = false; + let required: any = content.propertyModel.required; let schem :any = { "empty": boolfalse, "property": { "type": content.propertyModel.simpleType, - "required": boolfalse + "required": required } } let schemaProp :any = { "type": content.propertyModel.simpleType, - "required": boolfalse + "required": required } reglistInput.description = content.propertyModel.description; @@ -592,7 +593,7 @@ export class PropertiesAssignmentComponent { reglistInput.schemaType = content.propertyModel.simpleType; reglistInput.instanceUniqueId = uniID; reglistInput.uniqueId = uniID; - reglistInput.required =boolfalse; + reglistInput.required = required; reglistInput.schema = schem; reglistInput.schemaProperty = schemaProp; @@ -789,6 +790,8 @@ export class PropertiesAssignmentComponent { response.forEach((resInput) => { const changedInput = this.changedData.shift(); this.inputsUtils.resetInputDefaultValue(changedInput, resInput.defaultValue); + changedInput.required = resInput.required; + changedInput.requiredOrig = resInput.required; }); console.log("updated the component inputs and got this response: ", response); } @@ -842,6 +845,7 @@ export class PropertiesAssignmentComponent { handleReverseItem = (changedItem) => { changedItem = changedItem; this.inputsUtils.resetInputDefaultValue(changedItem, changedItem.defaultValue); + changedItem.required = changedItem.requiredOrig; }; } @@ -906,8 +910,8 @@ export class PropertiesAssignmentComponent { {id: 'cancelButton', text: 'Cancel', type: SdcUiCommon.ButtonType.secondary, size: 'xsm', closeModal: true, callback: () => reject()}, {id: 'discardButton', text: 'Discard', type: SdcUiCommon.ButtonType.secondary, size: 'xsm', closeModal: true, callback: () => { this.reverseChangedData(); resolve()}}, {id: 'saveButton', text: 'Save', type: SdcUiCommon.ButtonType.primary, size: 'xsm', closeModal: true, disabled: !this.isValidChangedData, callback: () => this.doSaveChangedData(resolve, reject)} - ] as SdcUiCommon.IModalButtonComponent[] - } as SdcUiCommon.IModalConfig, UnsavedChangesComponent, {isValidChangedData: this.isValidChangedData}); + ] as SdcUiCommon.IModalButtonComponent[] + } as SdcUiCommon.IModalConfig, UnsavedChangesComponent, {isValidChangedData: this.isValidChangedData}); }); } -- cgit 1.2.3-korg