summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models/workspace
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-06-16 23:21:04 +0100
committerMichael Morris <michael.morris@est.tech>2021-07-15 13:22:37 +0000
commit53df976426f8845adf58e8ff9355764343a38549 (patch)
treeaa1653532eaf24722be2689f3d6addd0f15094eb /catalog-ui/src/app/view-models/workspace
parentf94241f6b5f25ddda29e505306b16af7f5b82749 (diff)
Specify model at service creation
Allows a user to select a model when designing a service Issue-ID: SDC-3621 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I386e43ddeb649a4ba0805f153e4b47e8a528cff0
Diffstat (limited to 'catalog-ui/src/app/view-models/workspace')
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts20
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html17
2 files changed, 35 insertions, 2 deletions
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index b456bece19..9b7a92b297 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -33,7 +33,7 @@ import {
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";
@@ -53,6 +53,10 @@ export class componentCategories {//categories field bind to this obj in order t
selectedCategory:string;
}
+export class componentModel {
+ selectedModel:string;
+}
+
export interface IEnvironmentContext {
defaultValue:string;
validValues:Array<string>;
@@ -73,6 +77,7 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
importCsarProProgressKey:string;
browseFileLabel:string;
componentCategories:componentCategories;
+ componentModel:componentModel;
instantiationTypes:Array<instantiationType>;
isHiddenCategorySelected: boolean;
@@ -95,6 +100,7 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
onInstantiationTypeChange():void;
updateIcon():void;
possibleToUpdateIcon():boolean;
+ initModel():void;
}
// tslint:disable-next-line:max-classes-per-file
@@ -124,6 +130,7 @@ export class GeneralViewModel {
'ComponentFactory',
'ImportVSPService',
'ElementService',
+ 'ModelService',
'$stateParams'
];
@@ -150,6 +157,7 @@ export class GeneralViewModel {
private ComponentFactory:ComponentFactory,
private importVSPService: ImportVSPService,
private elementService: ElementService,
+ private modelService: ModelService,
private $stateParams: any) {
this.initScopeValidation();
@@ -270,6 +278,7 @@ export class GeneralViewModel {
// 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
@@ -451,6 +460,15 @@ export class GeneralViewModel {
}
};
+ 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;
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
index d598e170a4..d2529f9bb6 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
@@ -607,7 +607,22 @@
</div>
</div>
- <!--------------------- Instantiation Type -------------------->
+ <!--------------------- Base Type -------------------->
+
+ <!--------------------- Model -------------------->
+ <div class="i-sdc-form-item" data-ng-if="component.isService()">
+ <label class="i-sdc-form-label">Model</label>
+ <select class="i-sdc-form-select"
+ name="modelName"
+ data-ng-class="{'view-mode': isViewMode()}"
+ data-ng-disabled="component.isCsarComponent() || !isCreateMode()"
+ data-ng-model="component.model"
+ data-tests-id="modelName">
+ <option value="">SDC AID</option>
+ <option ng-repeat="model in models | orderBy:[name]">{{model}}</option>
+ </select>
+ </div>
+ <!--------------------- Model -------------------->
<div class="meta-data" data-ng-if="component.creationDate">
<div>