ValidationUtils
} from "app/utils";
import {EventListenerService, ProgressService} from "app/services";
-import {CacheService, ElementService, ImportVSPService, OnboardingService} from "app/services-ng2";
+import {CacheService, ElementService, ModelService, ImportVSPService, OnboardingService} from "app/services-ng2";
import {Component, IAppConfigurtaion, ICsarComponent, IMainCategory, IMetadataKey, ISubCategory, IValidate, Resource, Service} from "app/models";
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
import {CATEGORY_SERVICE_METADATA_KEYS, PREVIOUS_CSAR_COMPONENT} from "../../../../utils/constants";
selectedCategory:string;
}
+export class componentModel {
+ selectedModel:string;
+}
+
export interface IEnvironmentContext {
defaultValue:string;
validValues:Array<string>;
importCsarProProgressKey:string;
browseFileLabel:string;
componentCategories:componentCategories;
+ componentModel:componentModel;
instantiationTypes:Array<instantiationType>;
isHiddenCategorySelected: boolean;
onInstantiationTypeChange():void;
updateIcon():void;
possibleToUpdateIcon():boolean;
+ initModel():void;
}
// tslint:disable-next-line:max-classes-per-file
'ComponentFactory',
'ImportVSPService',
'ElementService',
+ 'ModelService',
'$stateParams'
];
private ComponentFactory:ComponentFactory,
private importVSPService: ImportVSPService,
private elementService: ElementService,
+ private modelService: ModelService,
private $stateParams: any) {
this.initScopeValidation();
// Init Instantiation types
this.$scope.initInstantiationTypes();
this.$scope.initBaseTypes();
+ this.$scope.initModel();
}
if (this.cacheService.get(PREVIOUS_CSAR_COMPONENT)) { //keep the old component in the cache until checkout, so we dont need to pass it around
}
};
+ this.$scope.initModel = ():void => {
+ if (this.$scope.componentType === ComponentType.SERVICE) {
+ this.$scope.models = new Array();
+ this.modelService.getModels().subscribe((modelsFound: Model[]) => {
+ modelsFound.forEach(model => {this.$scope.models.push(model.name)});})
+ this.$scope.models.filter(model => model.name === (<Service>this.$scope.component).model);
+ }
+ };
+
this.$scope.initEnvironmentContext = ():void => {
if (this.$scope.componentType === ComponentType.SERVICE) {
this.$scope.environmentContextObj = this.cacheService.get('UIConfiguration').environmentContext;