aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2018-08-29 17:01:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-02-18 18:35:30 +0200
commit6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch)
tree936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts
parent67d99f816cc583643c35193197594cf78d8ce60a (diff)
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts
new file mode 100644
index 000000000..9318b3aa7
--- /dev/null
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.service.ts
@@ -0,0 +1,41 @@
+import {Injectable} from "@angular/core";
+import {NgRedux} from "@angular-redux/store";
+import {AppState} from "../../../shared/store/reducers";
+import {AaiService} from "../../../shared/services/aaiService/aai.service";
+import {Subject} from "rxjs";
+import {ComponentInfoModel, ComponentInfoType} from "./component-info-model";
+import {ModelInformationItem} from "../../../shared/components/model-information/model-information.component";
+import * as _ from 'lodash';
+@Injectable()
+export class ComponentInfoService {
+ static triggerComponentInfoChange: Subject<ComponentInfoModel> = new Subject<ComponentInfoModel>();
+ constructor( private _store: NgRedux<AppState>, private _aaiService : AaiService){ }
+
+ getInfoForService(serviceModelId):ComponentInfoModel {
+ if(_.isNil(this._store.getState().service.serviceHierarchy[serviceModelId])) return null;
+
+ let serviceHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId].service;
+ const serviceInstance = this._store.getState().service.serviceInstance[serviceModelId];
+ const modelInfoItems: ModelInformationItem[] = [
+ ModelInformationItem.createInstance("Subscriber Name",this._aaiService.extractSubscriberNameBySubscriberId(serviceInstance.globalSubscriberId)),
+ ModelInformationItem.createInstance("Service Type",serviceInstance.subscriptionServiceType),
+ ModelInformationItem.createInstance("Service Role",serviceHierarchy.serviceRole),
+ ];
+ serviceHierarchy.type = serviceHierarchy.serviceType;
+ return this.addGeneralInfoItems(modelInfoItems, ComponentInfoType.SERVICE, serviceHierarchy, serviceInstance );
+ }
+
+
+ addGeneralInfoItems(modelInfoSpecificItems: ModelInformationItem[], type: ComponentInfoType, model, instance) {
+ let modelInfoItems: ModelInformationItem[] = [
+ ModelInformationItem.createInstance("Type", (model && model.type) ? model.type : ((instance && instance.modelInfo) ? instance.modelInfo.modelType : null)),
+ ModelInformationItem.createInstance("Model Version", model ? model.version : null),
+ ModelInformationItem.createInstance("Model Customization ID", model ? model.customizationUuid : null),
+ ModelInformationItem.createInstance("Instance ID", instance ? instance.instanceId : null),
+ ModelInformationItem.createInstance("In Maintenance", instance? instance.inMaint : null),
+ ];
+ modelInfoItems = modelInfoItems.concat(modelInfoSpecificItems);
+ const modelInfoItemsWithoutEmpty = _.filter(modelInfoItems, function(item){ return !item.values.every(_.isNil)});
+ return new ComponentInfoModel(type, modelInfoItemsWithoutEmpty, []);
+ }
+}