[SDC] rebase code
Change-Id: I456ec65a233d277e6bae35e140f2e3da5765bae6
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Signed-off-by: Michael Lando <ml636r@att.com>
diff --git a/catalog-ui/src/app/models/properties-inputs/input-be-model.ts b/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
index 6d7854a..6767bce 100644
--- a/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
@@ -3,11 +3,17 @@
* Created by rc2122 on 6/1/2017.
*/
export class InputBEModel extends PropertyBEModel {
- properties:Array<ComponentInstanceProperty>;
- inputs:Array<ComponentInstanceInput>;
+ properties: Array<ComponentInstanceModel>;
+ inputs: Array<ComponentInstanceModel>;
+ instanceUniqueId: string;
+ propertyId: string;
- constructor(input?: PropertyBEModel) {
+ constructor(input?: InputBEModel) {
super(input);
+ this.instanceUniqueId = input.instanceUniqueId;
+ this.propertyId = input.propertyId;
+ this.properties = input.properties;
+ this.inputs = input.inputs;
}
@@ -17,33 +23,7 @@
}
-export class ComponentInstanceProperty extends PropertyBEModel {
+export interface ComponentInstanceModel extends InputBEModel {
componentInstanceId:string;
- componentInstanceName:string;
-
- constructor(property?: PropertyBEModel) {
- super(property);
- }
-
-
-
- public toJSON = (): any => {
- };
-
+ componentInstanceName: string;
}
-
-export class ComponentInstanceInput extends InputBEModel {
- componentInstanceId:string;
- componentInstanceName:string;
-
- constructor(property?: PropertyBEModel) {
- super(property);
- }
-
-
-
- public toJSON = (): any => {
- };
-
-}
-
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 4f34171..3af4431 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
@@ -5,41 +5,42 @@
export class InputFEModel extends InputBEModel {
isSimpleType: boolean;
- isDataType: boolean;
- instanceName: string;
- instanceId: string;
- propertyName: string;
-
+ relatedProperty: SimpleRelatedProperty;
constructor(input?: InputBEModel) {
super(input);
if (input) {
this.isSimpleType = PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1;
- this.isDataType = PROPERTY_DATA.TYPES.indexOf(this.type) == -1;
-
- let propNameIndex:number = this.name.indexOf('_');
- this.instanceName = this.name.substring(0, propNameIndex);
-
- if(input.properties && input.properties.length){
- this.instanceId = input.properties[0].componentInstanceId;
- this.propertyName = input.properties[0].name;
- }else if(input.inputs && input.inputs.length){
- this.instanceId = input.inputs[0].componentInstanceId;
- this.propertyName = input.inputs[0].name;
- }else{
- if (input.inputPath && input.inputPath.indexOf('#') > -1) {
- this.propertyName = input.inputPath.substring(0, input.inputPath.indexOf('#'))
- } else {
- this.inputPath = undefined; //input path may be populated even if its a parent - ensure its empty
- this.propertyName = this.name.substring(propNameIndex + 1);
- }
- }
+ this.relatedProperty = new SimpleRelatedProperty(input);
}
}
-
-
- public toJSON = (): any => {
- };
-
}
+
+export class SimpleRelatedProperty {
+ name: string;
+ value: string;
+ nestedPath: string;
+
+ constructor(input: InputBEModel) {
+ if(!input.instanceUniqueId){
+ return;
+ }
+ //Check if input is on DerivedFEProperty level, in which case we want to set a nested path
+ let instanceName = input.instanceUniqueId.split('.').pop();
+ if (input.inputPath && input.inputPath.indexOf('#') > -1
+ && instanceName + "_" + input.inputPath.split('#').join('_') == input.name) { //Ignore inputPath for a complex child on VL that was declared within VF, that was then dragged into service. For that case, input.name will be missing the vl name, so we'll know to ignore the path and fall into else case.
+ this.nestedPath = input.inputPath;
+ this.name = input.inputPath.substring(0, input.inputPath.indexOf('#'));
+ } else { //PropertyFEModel level. Can parse input name to get prop name.
+ let propNameLength = input.name.length - instanceName.length + 1;
+ this.name = input.name.substr(instanceName.length + 1, propNameLength);
+ }
+
+ //In declare response, input contains nested property, and we need to extract value so we can update our prop.
+ let nestedProperty = input.properties && input.properties[0] || input.inputs && input.inputs[0];
+ if (nestedProperty) {
+ this.value = nestedProperty.value;
+ }
+ }
+};
diff --git a/catalog-ui/src/app/models/properties.ts b/catalog-ui/src/app/models/properties.ts
index 357dac2..99a5b86 100644
--- a/catalog-ui/src/app/models/properties.ts
+++ b/catalog-ui/src/app/models/properties.ts
@@ -50,6 +50,7 @@
schema:SchemaPropertyGroupModel;
componentInstanceId:string;
parentValue:string;
+ ownerId:string;
//instance properties
value:string;
@@ -90,6 +91,7 @@
this.simpleType = property.simpleType;
this.componentInstanceId = property.componentInstanceId;
this.parentValue = property.parentValue;
+ this.ownerId = property.ownerId;
}
if (!this.schema || !this.schema.property) {
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts
index ea73d38..970c57d 100644
--- a/catalog-ui/src/app/ng2/app.module.ts
+++ b/catalog-ui/src/app/ng2/app.module.ts
@@ -11,13 +11,15 @@
StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
} from "./utils/ng1-upgraded-provider";
import {ConfigService} from "./services/config.service";
-import {HttpService} from "./services/http.service";
import {HttpModule} from '@angular/http';
import {AuthenticationService} from './services/authentication.service';
import {Cookie2Service} from "./services/cookie.service";
import {ComponentServiceNg2} from "./services/component-services/component.service";
import {ServiceServiceNg2} from "./services/component-services/service.service";
import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
+import { InterceptorService } from 'ng2-interceptors';
+import { XHRBackend, RequestOptions } from '@angular/http';
+import {HttpInterceptor} from "./services/http.interceptor.service";
export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
@@ -25,6 +27,13 @@
return () => config.loadValidationConfiguration();
}
+export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions){
+ let service = new InterceptorService(xhrBackend, requestOptions);
+ service.addInterceptor(new HttpInterceptor());
+ return service;
+}
+
+
// export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) {
// return new HttpService(backend, options);
// }
@@ -43,7 +52,6 @@
exports: [],
entryComponents: [],
providers: [
- HttpService,
DataTypesServiceProvider,
SharingServiceProvider,
CookieServiceProvider,
@@ -61,6 +69,11 @@
useFactory: configServiceFactory,
deps: [ConfigService],
multi: true
+ },
+ {
+ provide: InterceptorService,
+ useFactory: interceptorFactory,
+ deps: [XHRBackend, RequestOptions]
}
],
bootstrap: [AppComponent]
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 b59ef9d..b14f3af 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
@@ -15,7 +15,6 @@
import { PropertiesService } from './../../services/properties.service';
import { HierarchyNavService } from './../../services/hierarchy-nav.service';
import { PropertiesUtils } from './properties.utils';
-import { PostsService } from "../../services/posts.service";
import { DynamicElementModule } from 'app/ng2/components/dynamic-element/dynamic-element.module';
import { DynamicPropertyComponent } from './../../components/properties-table/dynamic-property/dynamic-property.component';
import {ConfirmationDeleteInputComponent} from "app/ng2/components/inputs-table/confirmation-delete-input/confirmation-delete-input.component"
@@ -27,6 +26,7 @@
import { ComponentModeService } from "app/ng2/services/component-mode.service"
import { ModalComponent } from "app/ng2/components/modal/modal.component"
import {LoaderComponent} from "app/ng2/components/loader/loader.component"
+import {HttpInterceptor} from "../../services/http.interceptor.service";
@NgModule({
declarations: [
@@ -63,7 +63,7 @@
// PopoverContentComponent,
// PopoverComponent
],
- providers: [PropertiesService, HierarchyNavService, PropertiesUtils, DataTypeService, PostsService, ContentAfterLastDotPipe, GroupByPipe, KeysPipe, ComponentModeService]
+ providers: [PropertiesService, HierarchyNavService, PropertiesUtils, DataTypeService,HttpInterceptor, ContentAfterLastDotPipe, GroupByPipe, KeysPipe, ComponentModeService]
})
export class PropertiesAssignmentModule {
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 22d6f2f..e66ed59 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
@@ -1,5 +1,4 @@
import {Component, ViewChild, ElementRef, Renderer, Inject} from "@angular/core";
-import {PostsService} from "../../services/posts.service";
import { PropertiesService } from "../../services/properties.service";
import { HierarchyNavService } from "../../services/hierarchy-nav.service";
import { PropertiesUtils } from './properties.utils';
@@ -8,15 +7,13 @@
import property = require("lodash/property");
import {ComponentServiceNg2} from "../../services/component-services/component.service";
import {ComponentInstanceServiceNg2} from "../../services/component-instance-services/component-instance.service"
-import { InputFEModel, ComponentInstance, PropertyBEModel, DerivedPropertyType, DerivedFEProperty, ResourceInstance, SimpleFlatProperty } from "app/models";
+import { InputBEModel, InputFEModel, ComponentInstance, PropertyBEModel, DerivedPropertyType, DerivedFEProperty, ResourceInstance, SimpleFlatProperty } from "app/models";
import {HierarchyDisplayOptions} from "../../components/hierarchy-navigtion/hierarchy-display-options"
import {PropertyRowSelectedEvent} from "./../../components/properties-table/properties-table.component";
import { KeysPipe } from 'app/ng2/pipes/keys.pipe';
import {FilterPropertiesAssignmentComponent} from "../../components/filter-properties-assignment/filter-properties-assignment.component";
import { ComponentModeService } from "app/ng2/services/component-mode.service"
import {WorkspaceMode, EVENTS} from "../../../utils/constants";
-import {ComponentInstanceProperty, InputBEModel} from "app/models"
-import {ComponentInstanceInput} from "../../../models/properties-inputs/input-be-model";
import {EventListenerService} from "app/services/event-listener-service"
@Component({
templateUrl: './properties-assignment.page.component.html',
@@ -102,6 +99,7 @@
}
this.selectFirstInstanceByDefault();
});
+
};
ngOnDestroy() {
@@ -292,41 +290,23 @@
this.setInputTabIndication(response.length);
this.checkedPropertiesCount = 0;
_.forEach(response, (input: InputBEModel) => {
- this.inputs.push(new InputFEModel(input));
- this.updatePropertyValueAfterDeclare(input);
+ let newInput: InputFEModel = new InputFEModel(input);
+ this.inputs.push(newInput);
+ this.updatePropertyValueAfterDeclare(newInput);
});
});
};
- updatePropertyValueAfterDeclare = (input: InputBEModel) => {
- _.forEach(input.properties, (property: ComponentInstanceProperty) => {
- this.updatePropertyOrInputValueAfterDeclare(property, input);
- });
- _.forEach(input.inputs, (inputInstance: ComponentInstanceInput) => {
- this.updatePropertyOrInputValueAfterDeclare(inputInstance, input);
- });
- }
-
- updatePropertyOrInputValueAfterDeclare = (inputSource: ComponentInstanceProperty | ComponentInstanceInput, input: InputBEModel) => {
- if (this.instanceFePropertiesMap[inputSource.componentInstanceId]) {
- let propertyForUpdatindVal = _.find(this.instanceFePropertiesMap[inputSource.componentInstanceId], (feProperty: PropertyFEModel) => {
- return feProperty.name == inputSource.name;
+ updatePropertyValueAfterDeclare = (input: InputFEModel) => {
+ if (this.instanceFePropertiesMap[input.instanceUniqueId]) {
+ let propertyForUpdatindVal = _.find(this.instanceFePropertiesMap[input.instanceUniqueId], (feProperty: PropertyFEModel) => {
+ return feProperty.name == input.relatedProperty.name;
});
- if (input.inputPath == propertyForUpdatindVal.name) input.inputPath = null; //Fix - if inputPath is sent for parent props, remove it
-
- propertyForUpdatindVal.setAsDeclared(input.inputPath); //set prop as declared before assigning value
- this.propertiesService.disableRelatedProperties(propertyForUpdatindVal, input.inputPath);
- this.propertiesUtils.resetPropertyValue(propertyForUpdatindVal, inputSource.value, input.inputPath);
- // if (input.inputPath) {
- // let childProp = _.find(propertyForUpdatindVal.flattenedChildren, (child: DerivedFEProperty) => {
- // return child.propertiesName == input.inputPath;
- // });
- // this.propertiesUtils.assignFlattenedChildrenValues(JSON.parse(inputSource.value), [childProp], inputSource.name);
- // } else {
- // propertyForUpdatindVal.valueObj = inputSource.value;
- // }
+ propertyForUpdatindVal.setAsDeclared(input.relatedProperty.nestedPath); //set prop as declared before assigning value
+ this.propertiesService.disableRelatedProperties(propertyForUpdatindVal, input.relatedProperty.nestedPath);
+ this.propertiesUtils.resetPropertyValue(propertyForUpdatindVal, input.relatedProperty.value, input.relatedProperty.nestedPath);
}
}
@@ -368,14 +348,6 @@
});
};
- getInstanceUniqueId = (instanceName: string): string => {
- let wantedInstance: ComponentInstance = this.instances.find((instance) => {
- return instance.normalizedName === instanceName;
- });
-
- return wantedInstance.uniqueId;
- };
-
/*** SEARCH RELATED FUNCTIONS ***/
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts
index 0eb8534..bdfbc4c 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts
@@ -20,8 +20,8 @@
*/
public convertPropertiesMapToFEAndCreateChildren = (instancePropertiesMap:InstanceBePropertiesMap, inputs:Array<InputFEModel>): InstanceFePropertiesMap => {
let instanceFePropertiesMap:InstanceFePropertiesMap = new InstanceFePropertiesMap();
- angular.forEach(instancePropertiesMap, (properties:Array<PropertyBEModel>, instanceName:string) => {
- let instanceInputs: Array<InputFEModel> = inputs.filter(input => input.instanceName == instanceName.split('.').pop());
+ angular.forEach(instancePropertiesMap, (properties:Array<PropertyBEModel>, instanceId:string) => {
+ let instanceInputs: Array<InputFEModel> = inputs.filter(input => input.instanceUniqueId == instanceId);
let propertyFeArray: Array<PropertyFEModel> = [];
_.forEach(properties, (property: PropertyBEModel) => {
@@ -35,9 +35,9 @@
newFEProp.flattenedChildren = this.createFlattenedChildren(newFEProp.type, newFEProp.name);
}
if (instanceInputs.length) { //if this prop (or any children) are declared, set isDeclared and disable checkbox on parents/children
- instanceInputs.filter(input => input.propertyName == newFEProp.name).forEach((input) => {
- newFEProp.setAsDeclared(input.inputPath); //if a path was sent, its a child prop. this param is optional
- this.propertiesService.disableRelatedProperties(newFEProp, input.inputPath);
+ instanceInputs.filter(input => input.relatedProperty.name == newFEProp.name).forEach((input) => {
+ newFEProp.setAsDeclared(input.relatedProperty.nestedPath); //if a path was sent, its a child prop. this param is optional
+ this.propertiesService.disableRelatedProperties(newFEProp, input.relatedProperty.nestedPath);
});
}
this.initValueObjectRef(newFEProp); //initialize valueObj.
@@ -46,7 +46,7 @@
this.dataTypeService.checkForCustomBehavior(newFEProp);
}
});
- instanceFePropertiesMap[instanceName] = propertyFeArray;
+ instanceFePropertiesMap[instanceId] = propertyFeArray;
});
return instanceFePropertiesMap;
@@ -140,10 +140,10 @@
});
}
- public resetPropertyValue = (property: PropertyFEModel, newValue: string, inputPath?: string): void => {
+ public resetPropertyValue = (property: PropertyFEModel, newValue: string, nestedPath?: string): void => {
property.value = newValue;
- if (inputPath) {
- let newProp = property.flattenedChildren.find(prop => prop.propertiesName == inputPath);
+ if (nestedPath) {
+ let newProp = property.flattenedChildren.find(prop => prop.propertiesName == nestedPath);
newProp && this.assignFlattenedChildrenValues(JSON.parse(newValue), [newProp], property.name);
} else {
this.initValueObjectRef(property);
diff --git a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
index 8570989..fd7e7b6 100644
--- a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
@@ -1,18 +1,18 @@
import {Injectable} from '@angular/core';
import {Response, RequestOptions, Headers} from '@angular/http';
import { Observable } from 'rxjs/Observable';
-import {HttpService} from "../http.service";
import {sdc2Config} from "../../../../main";
import {PropertyBEModel} from "app/models";
import {CommonUtils} from "app/utils";
import {Component, ComponentInstance, InputModel} from "app/models";
+import {InterceptorService} from "ng2-interceptors/index";
@Injectable()
export class ComponentInstanceServiceNg2 {
protected baseUrl;
- constructor(private http: HttpService) {
+ constructor(private http: InterceptorService) {
this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root;
}
diff --git a/catalog-ui/src/app/ng2/services/component-services/component.service.ts b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
index 3fa9fde..976d18e 100644
--- a/catalog-ui/src/app/ng2/services/component-services/component.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
@@ -1,17 +1,17 @@
-import {Injectable, Query} from '@angular/core';
+import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Response, URLSearchParams} from '@angular/http';
import { Component, PropertyBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData} from "app/models";
import {downgradeInjectable} from '@angular/upgrade/static';
-import {HttpService} from "../http.service";
import {COMPONENT_FIELDS} from "app/utils";
import {ComponentGenericResponse} from "../responses/component-generic-response";
import {sdc2Config} from "../../../../main";
import {InstanceBePropertiesMap} from "../../../models/properties-inputs/property-fe-map";
import {API_QUERY_PARAMS} from "app/utils";
import {ComponentType, ServerTypeUrl} from "../../../utils/constants";
+import {InterceptorService} from "ng2-interceptors/index";
declare var angular:angular.IAngularStatic;
@@ -20,7 +20,7 @@
protected baseUrl;
- constructor(private http:HttpService) {
+ constructor(private http:InterceptorService) {
this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root;
}
diff --git a/catalog-ui/src/app/ng2/services/component-services/service.service.ts b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
index d2f7078..147fe93 100644
--- a/catalog-ui/src/app/ng2/services/component-services/service.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
@@ -6,7 +6,7 @@
import {Service} from "app/models";
import { downgradeInjectable } from '@angular/upgrade/static';
import {sdc2Config} from "../../../../main";
-import {HttpService} from "../http.service";
+import {InterceptorService} from "ng2-interceptors/index";
@Injectable()
@@ -14,7 +14,7 @@
protected baseUrl = "";
- constructor(private http: HttpService) {
+ constructor(private http: InterceptorService) {
this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root;
}
diff --git a/catalog-ui/src/app/ng2/services/http.interceptor.service.ts b/catalog-ui/src/app/ng2/services/http.interceptor.service.ts
new file mode 100644
index 0000000..aebbdbf
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/http.interceptor.service.ts
@@ -0,0 +1,57 @@
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/toPromise';
+import 'rxjs/Rx';
+import { sdc2Config } from './../../../main';
+import { Interceptor, InterceptedRequest, InterceptedResponse } from 'ng2-interceptors';
+import {SharingService} from "../../services/sharing-service";
+import {ReflectiveInjector} from '@angular/core';
+import {Cookie2Service} from "./cookie.service";
+import {UUID} from "angular2-uuid";
+import {Dictionary} from "../../utils/dictionary/dictionary";
+
+export class HttpInterceptor implements Interceptor {
+
+ private cookieService: Cookie2Service;
+ private sharingService:SharingService;
+ constructor() {
+ let injector = ReflectiveInjector.resolveAndCreate([Cookie2Service,SharingService]);
+ this.cookieService = injector.get(Cookie2Service);
+ this.sharingService = injector.get(SharingService);
+ }
+
+ public interceptBefore(request: InterceptedRequest): InterceptedRequest {
+
+ /**
+ * For every request to the server, that the service id, or resource id is sent in the URL, need to pass UUID in the header.
+ * Check if the unique id exists in uuidMap, and if so get the UUID and add it to the header.
+ */
+
+ request.options.headers.append(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId());
+ var uuidValue = this.getUuidValue(request.url);
+ if(uuidValue!= ''){
+ request.options.headers.set('X-ECOMP-ServiceID',uuidValue);
+ }
+ request.options.headers.set('X-ECOMP-RequestID', UUID.UUID());
+ return request;
+
+ }
+
+ public interceptAfter(response: InterceptedResponse): InterceptedResponse {
+
+ return response;
+
+ }
+
+ private getUuidValue = (url: string) :string => {
+ let map:Dictionary<string, string> = this.sharingService.getUuidMap();
+ if (map && url.indexOf(sdc2Config.api.root) > 0) {
+ map.forEach((key:string) => {
+ if (url.indexOf(key) !== -1) {
+ return this.sharingService.getUuidValue(key);
+ }
+ });
+ }
+ return '';
+ }
+
+}
diff --git a/catalog-ui/src/app/ng2/services/posts.service.ts b/catalog-ui/src/app/ng2/services/posts.service.ts
deleted file mode 100644
index dbfd44f..0000000
--- a/catalog-ui/src/app/ng2/services/posts.service.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Injectable } from '@angular/core';
-import { Observable } from 'rxjs/Observable';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/toPromise';
-import 'rxjs/Rx';
-import {Response, Headers, RequestOptions, Http} from '@angular/http';
-import { COMPONENT_INSTANCE_RESPONSE,COMPONENT_INPUT_RESPONSE,COMPONENT_PROPERTIES_RESPONSE } from './mocks/properties.mock';
-import { HttpService } from './http.service';
-import { sdc2Config } from './../../../main';
-import {IAppConfigurtaion} from "../../models/app-config";
-
-@Injectable()
-export class PostsService {
-
- private base;
-
- constructor(private http: HttpService) {
- this.base = sdc2Config.api.root;
- }
-
- getAppVersion(): Observable<JSON> {
- return this.http
- .get(this.base + sdc2Config.api.GET_SDC_Version)
- .map((res: Response) => res.json());
- }
-
- // getProperties(id:string): Observable<any> {
- // return this.http
- // .get(this.base + sdc2Config.api.GET_SDC_Version)
- // .map((res: Response) => res.json());
- // }
-
- getProperties(): Observable<any> {
- return Observable.create(observer => {
- observer.next(COMPONENT_PROPERTIES_RESPONSE);
- observer.complete();
- });
- }
-
- getInstance(): Observable<any> {
- return Observable.create(observer => {
- observer.next(COMPONENT_INSTANCE_RESPONSE);
- observer.complete();
- });
- }
-
- getInputs(): Observable<any> {
- return Observable.create(observer => {
- observer.next(COMPONENT_INPUT_RESPONSE);
- observer.complete();
- });
- }
-
-}
diff --git a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
index 7dcd95d..38e23a5 100644
--- a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
+++ b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
@@ -3,7 +3,7 @@
*/
import { ArtifactGroupModel, PropertyModel, PropertiesGroup, AttributeModel, AttributesGroup, ComponentInstance,
- InputModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup,InputFEModel} from "app/models";
+ InputBEModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup,InputFEModel} from "app/models";
import {CommonUtils} from "app/utils";
import {Serializable} from "../utils/serializable";
import {PropertyBEModel} from "../../../models/properties-inputs/property-be-model";
@@ -18,7 +18,7 @@
public componentInstancesAttributes:AttributesGroup;
public componentInstancesRelations:Array<RelationshipModel>;
public componentInstances:Array<ComponentInstance>;
- public inputs:Array<PropertyBEModel>;
+ public inputs:Array<InputBEModel>;
public capabilities:CapabilitiesGroup;
public requirements:RequirementsGroup;
public properties:Array<PropertyModel>;
diff --git a/catalog-ui/src/app/utils/common-utils.ts b/catalog-ui/src/app/utils/common-utils.ts
index d8019d2..acfbd80 100644
--- a/catalog-ui/src/app/utils/common-utils.ts
+++ b/catalog-ui/src/app/utils/common-utils.ts
@@ -1,6 +1,6 @@
import {Module, AttributeModel, ResourceInstance, PropertyModel, InputFEModel} from "../models";
import {ComponentInstanceFactory} from "./component-instance-factory";
-import {PropertyBEModel, RelationshipModel} from "app/models";
+import {InputBEModel, PropertyBEModel, RelationshipModel} from "app/models";
export class CommonUtils {
@@ -57,13 +57,13 @@
return modules;
};
- static initInputs(inputsObj:Array<PropertyBEModel>):Array<PropertyBEModel> {
+ static initInputs(inputsObj: Array<InputBEModel>): Array<InputBEModel> {
- let inputs = new Array<PropertyBEModel>();
+ let inputs = new Array<InputBEModel>();
if(inputsObj) {
- _.forEach(inputsObj, (input:PropertyBEModel):void => {
- inputs.push(new PropertyBEModel(input));
+ _.forEach(inputsObj, (input: InputBEModel):void => {
+ inputs.push(new InputBEModel(input));
})
}
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view.html b/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view.html
index d1e0582..24011cc 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view.html
+++ b/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view.html
@@ -46,8 +46,8 @@
<span data-tests-id="propertyDescription_{{property.name}}" data-ng-bind="property.description"></span>
</div>
<div class="table-btn-col flex-item" ng-if="!isViewMode()">
- <button class="table-delete-btn" data-tests-id="delete_{{property.name}}" data-ng-if="property.parentUniqueId==component.uniqueId"
- data-ng-click="delete(property); $event.stopPropagation();" data-ng-class="{'disabled': isViewMode()}"> </button>
+ <button class="table-delete-btn" data-tests-id="delete_{{property.name}}" data-ng-if="!property.ownerId || property.ownerId==component.uniqueId"
+ data-ng-click="delete(property); $event.stopPropagation();" data-ng-class="{'disabled': isViewMode()}"></button>
</div>
</div>
</perfect-scrollbar>
diff --git a/catalog-ui/src/assets/styles/images/sprites/sprite-global.png b/catalog-ui/src/assets/styles/images/sprites/sprite-global.png
index fb9e798..7a795c7 100644
--- a/catalog-ui/src/assets/styles/images/sprites/sprite-global.png
+++ b/catalog-ui/src/assets/styles/images/sprites/sprite-global.png
Binary files differ
diff --git a/catalog-ui/src/assets/styles/sprite.less b/catalog-ui/src/assets/styles/sprite.less
index 62defccc..0c0f538 100644
--- a/catalog-ui/src/assets/styles/sprite.less
+++ b/catalog-ui/src/assets/styles/sprite.less
@@ -232,8 +232,8 @@
.filter-icon { background-position: -48px -1040px; width: 19px; height: 20px;}
.filter-icon:hover { background-position: -99px -1040px; width: 19px; height: 20px;}
.filled-checkbox-icon { background-position: -100px -1079px; width: 14px; height: 14px;}
-.round-checked-icon { background-position: -50px -1119px; width: 20px; height: 20px;}
-.round-checked-icon.disabled { background-position: -100px -1119px; width: 20px; height: 20px;}
+.round-checked-icon { background-position: -50px -1157px; width: 16px; height: 18px;}
+.round-checked-icon.disabled { background-position: -100px -1157px; width: 16px; height: 18px;}
.round-expand-icon { background-position: -50px -1188px; width: 15px; height: 15px; }
.round-expand-icon:hover { background-position: -100px -1188px; width: 15px; height: 15px; }
.round-expand-icon.open { background-position: -50px -1216px; width: 15px; height: 15px; }