aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-08-30 16:02:04 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-08-31 10:34:02 +0000
commit0192c9f95f9b9aa64f8574700f9d55190f56f286 (patch)
treefec4cd84b63ee9222e25a658548805f4b856ea62 /catalog-ui/src/app
parent243e567a44b042d9792f3436dedff9eeda8f720f (diff)
Declare implicit attributes as outputs
Issue-ID: SDC-4611 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I2ecbca99de356d593845c69bbe62d3547387dfa8
Diffstat (limited to 'catalog-ui/src/app')
-rw-r--r--catalog-ui/src/app/ng2/pages/attributes-outputs/attributes-outputs.page.component.ts78
-rw-r--r--catalog-ui/src/app/ng2/pages/attributes-outputs/services/attributes.utils.ts3
2 files changed, 57 insertions, 24 deletions
diff --git a/catalog-ui/src/app/ng2/pages/attributes-outputs/attributes-outputs.page.component.ts b/catalog-ui/src/app/ng2/pages/attributes-outputs/attributes-outputs.page.component.ts
index 76001a7f28..85d2756da8 100644
--- a/catalog-ui/src/app/ng2/pages/attributes-outputs/attributes-outputs.page.component.ts
+++ b/catalog-ui/src/app/ng2/pages/attributes-outputs/attributes-outputs.page.component.ts
@@ -44,6 +44,9 @@ import {
InstanceBeAttributesMap,
InstanceFeAttributesMap
} from "app/models/attributes-outputs/attribute-fe-map";
+import {
+ InstanceBePropertiesMap
+} from "app/models/properties-inputs/property-fe-map";
import {ModalService} from "../../services/modal.service";
import {InstanceFeDetails} from "../../../models/instance-fe-details";
import {HierarchyDisplayOptions} from "../../components/logic/hierarchy-navigtion/hierarchy-display-options";
@@ -109,22 +112,24 @@ export class AttributesOutputsComponent {
@ViewChild('attributeOutputTabs') attributeOutputTabs: Tabs;
- constructor(private attributesService: AttributesService,
- private hierarchyNavService: HierarchyNavService,
- private attributesUtils: AttributesUtils,
- private outputsUtils: OutputsUtils,
- private componentServiceNg2: ComponentServiceNg2,
- private componentInstanceServiceNg2: ComponentInstanceServiceNg2,
- @Inject("$stateParams") _stateParams,
- @Inject("$scope") private $scope: ng.IScope,
- @Inject("$state") private $state: ng.ui.IStateService,
- @Inject("Notification") private Notification: any,
- private componentModeService: ComponentModeService,
- private EventListenerService: EventListenerService,
- private ModalServiceSdcUI: SdcUiServices.ModalService,
- private ModalService: ModalService,
- private keysPipe: KeysPipe,
- private topologyTemplateService: TopologyTemplateService) {
+ constructor(
+ private attributesService: AttributesService,
+ private hierarchyNavService: HierarchyNavService,
+ private attributesUtils: AttributesUtils,
+ private outputsUtils: OutputsUtils,
+ private componentServiceNg2: ComponentServiceNg2,
+ private componentInstanceServiceNg2: ComponentInstanceServiceNg2,
+ @Inject("$stateParams") _stateParams,
+ @Inject("$scope") private $scope: ng.IScope,
+ @Inject("$state") private $state: ng.ui.IStateService,
+ @Inject("Notification") private Notification: any,
+ private componentModeService: ComponentModeService,
+ private EventListenerService: EventListenerService,
+ private ModalServiceSdcUI: SdcUiServices.ModalService,
+ private ModalService: ModalService,
+ private keysPipe: KeysPipe,
+ private topologyTemplateService: TopologyTemplateService
+ ) {
this.instanceFeAttributesMap = new InstanceFeAttributesMap();
/* This is the way you can access the component data, please do not use any data except metadata, all other data should be received from the new api calls on the first time
@@ -234,7 +239,7 @@ export class AttributesOutputsComponent {
.subscribe((response) => {
this.serviceBeAttributesMap = new InstanceBeAttributesMap();
this.serviceBeAttributesMap[this.component.uniqueId] = response;
- this.processInstanceAttributesResponse(this.serviceBeAttributesMap, false);
+ this.processInstanceAttributesResponse(this.serviceBeAttributesMap, false, null);
}, (error) => {
this.Notification.error({
message: 'Failed to get Service Attribute:' + error,
@@ -259,14 +264,15 @@ export class AttributesOutputsComponent {
changeSelectedInstance = (instance: ComponentInstance) => {
this.selectedInstanceData = instance;
this.loadingAttributes = true;
+ this.instanceFeAttributesMap = undefined;
if (instance instanceof ComponentInstance) {
- let instanceBeAttributesMap: InstanceBeAttributesMap = new InstanceBeAttributesMap();
+ let instanceBeAttributesMap: InstanceBeAttributesMap | InstanceBePropertiesMap = new InstanceBeAttributesMap();
if (this.isOutput(instance.originType)) {
this.componentInstanceServiceNg2
.getComponentInstanceOutputs(this.component, instance)
.subscribe(response => {
instanceBeAttributesMap[instance.uniqueId] = response;
- this.processInstanceAttributesResponse(instanceBeAttributesMap, true);
+ this.processInstanceAttributesResponse(instanceBeAttributesMap, true, instance.uniqueId);
}, error => {
this.Notification.error({
message: 'Failed to change Selected Instance:' + error,
@@ -281,8 +287,23 @@ export class AttributesOutputsComponent {
this.componentInstanceServiceNg2
.getComponentInstanceAttributes(this.component, instance.uniqueId)
.subscribe(response => {
+ instanceBeAttributesMap = new InstanceBeAttributesMap();
+ instanceBeAttributesMap[instance.uniqueId] = response;
+ this.processInstanceAttributesResponse(instanceBeAttributesMap, false, instance.uniqueId);
+ }, error => {
+ this.Notification.error({
+ message: 'Failed to change Selected Instance:' + error,
+ title: 'Failure'
+ });
+ }, () => {
+ this.loadingAttributes = false;
+ });
+ this.componentInstanceServiceNg2
+ .getComponentInstanceProperties(this.component, instance.uniqueId)
+ .subscribe(response => {
+ instanceBeAttributesMap = new InstanceBePropertiesMap();
instanceBeAttributesMap[instance.uniqueId] = response;
- this.processInstanceAttributesResponse(instanceBeAttributesMap, false);
+ this.processInstanceAttributesResponse(instanceBeAttributesMap, false, instance.uniqueId);
}, error => {
this.Notification.error({
message: 'Failed to change Selected Instance:' + error,
@@ -292,7 +313,6 @@ export class AttributesOutputsComponent {
this.loadingAttributes = false;
});
}
-
this.resourceIsReadonly = (instance.componentName === "vnfConfiguration");
} else {
this.loadingAttributes = false;
@@ -306,8 +326,20 @@ export class AttributesOutputsComponent {
/**
* Entry point handling response from server
*/
- processInstanceAttributesResponse = (instanceBeAttributesMap: InstanceBeAttributesMap, originTypeIsVF: boolean) => {
- this.instanceFeAttributesMap = this.attributesUtils.convertAttributesMapToFEAndCreateChildren(instanceBeAttributesMap, originTypeIsVF, this.outputs); //create flattened children, disable declared attribs, and init values
+ processInstanceAttributesResponse = (instanceBeAttributesMap: InstanceBePropertiesMap | InstanceBeAttributesMap, originTypeIsVF: boolean, instanceId: string) => {
+ let attributesMap = this.attributesUtils.convertAttributesMapToFEAndCreateChildren(instanceBeAttributesMap, originTypeIsVF, this.outputs); //create flattened children, disable declared attribs, and init values
+ if (!this.instanceFeAttributesMap) {
+ this.instanceFeAttributesMap = attributesMap;
+ } else if (instanceId) {
+ let toAdd: AttributeFEModel[];
+ if (instanceBeAttributesMap instanceof InstanceBeAttributesMap) {
+ toAdd = this.instanceFeAttributesMap[instanceId].filter(currentAtr => !attributesMap[instanceId].some(newAtr => newAtr.name === currentAtr.name))
+ this.instanceFeAttributesMap[instanceId] = attributesMap[instanceId];
+ } else {
+ toAdd = attributesMap[instanceId].filter(currentAtr => !this.instanceFeAttributesMap[instanceId].some(newAtr => newAtr.name === currentAtr.name))
+ }
+ this.instanceFeAttributesMap[instanceId] = this.instanceFeAttributesMap[instanceId].concat(toAdd);
+ }
this.checkedAttributesCount = 0;
};
diff --git a/catalog-ui/src/app/ng2/pages/attributes-outputs/services/attributes.utils.ts b/catalog-ui/src/app/ng2/pages/attributes-outputs/services/attributes.utils.ts
index 51b1823ce2..8c857d09a1 100644
--- a/catalog-ui/src/app/ng2/pages/attributes-outputs/services/attributes.utils.ts
+++ b/catalog-ui/src/app/ng2/pages/attributes-outputs/services/attributes.utils.ts
@@ -24,6 +24,7 @@ import { DataTypeService } from "app/ng2/services/data-type.service";
import { PROPERTY_TYPES } from "app/utils";
import { AttributesService } from "app/ng2/services/attributes.service";
import { InstanceBeAttributesMap, InstanceFeAttributesMap } from "app/models/attributes-outputs/attribute-fe-map";
+import { InstanceBePropertiesMap } from "app/models/properties-inputs/property-fe-map";
import {OutputFEModel} from "../../../../models/attributes-outputs/output-fe-model";
import { AttributeBEModel, DerivedAttributeType } from "app/models/attributes-outputs/attribute-be-model";
import { AttributeFEModel } from "app/models/attributes-outputs/attribute-fe-model";
@@ -43,7 +44,7 @@ export class AttributesUtils {
* 3. Initialize valueObj (which also creates any new list/map flattened children as needed)
* Returns InstanceFeAttributesMap
*/
- public convertAttributesMapToFEAndCreateChildren = (instanceAttributesMap:InstanceBeAttributesMap, isVF:boolean, outputs?:Array<OutputFEModel>): InstanceFeAttributesMap => {
+ public convertAttributesMapToFEAndCreateChildren = (instanceAttributesMap:InstanceBeAttributesMap | InstanceBePropertiesMap, isVF:boolean, outputs?:Array<OutputFEModel>): InstanceFeAttributesMap => {
let instanceFeAttributesMap:InstanceFeAttributesMap = new InstanceFeAttributesMap();
angular.forEach(instanceAttributesMap, (attributes:Array<AttributeBEModel>, instanceId:string) => {
let propertyFeArray: Array<AttributeFEModel> = [];