aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models/workspace/tabs/general
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/view-models/workspace/tabs/general')
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts255
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html64
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general.less36
3 files changed, 273 insertions, 82 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 b03d7c4d7c..68f789808a 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
@@ -21,11 +21,13 @@
'use strict';
import * as _ from "lodash";
import {ModalsHandler, ValidationUtils, EVENTS, CHANGE_COMPONENT_CSAR_VERSION_FLAG, ComponentType, DEFAULT_ICON,
- ResourceType, ComponentState} from "app/utils";
+ ResourceType, ComponentState, instantiationType, ComponentFactory} from "app/utils";
import {CacheService, EventListenerService, ProgressService, OnboardingService} from "app/services";
-import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service, ICsarComponent} from "app/models";
+import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service, ICsarComponent, Component} from "app/models";
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
import {Dictionary} from "lodash";
+import { PREVIOUS_CSAR_COMPONENT } from "../../../../utils/constants";
+
export class Validation {
componentNameValidationPattern:RegExp;
@@ -62,8 +64,11 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
importCsarProgressKey:string;
browseFileLabel:string;
componentCategories:componentCategories;
+ instantiationTypes:Array<instantiationType>;
- onToscaFileChange():void;
+ save():Promise<any>;
+ revert():void;
+ onImportFileChange():void;
validateField(field:any):boolean;
validateName(isInit:boolean):void;
calculateUnique(mainCategory:string, subCategory:string):string; // Build unique string from main and sub category
@@ -74,6 +79,8 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
openOnBoardingModal():void;
initCategoreis():void;
initEnvironmentContext():void;
+ initInstantiationTypes():void;
+ onInstantiationTypeChange():void;
updateIcon():void;
possibleToUpdateIcon():boolean;
}
@@ -101,7 +108,8 @@ export class GeneralViewModel {
'$interval',
'$filter',
'$timeout',
- 'Sdc.Services.OnboardingService'
+ 'Sdc.Services.OnboardingService',
+ 'ComponentFactory'
];
constructor(private $scope:IGeneralScope,
@@ -124,7 +132,8 @@ export class GeneralViewModel {
protected $interval:any,
private $filter:ng.IFilterService,
private $timeout:ng.ITimeoutService,
- private onBoardingService:OnboardingService) {
+ private onBoardingService:OnboardingService,
+ private ComponentFactory:ComponentFactory) {
this.initScopeValidation();
this.initScopeMethods();
@@ -146,51 +155,64 @@ export class GeneralViewModel {
this.$scope.validation.projectCodeValidationPattern = this.ProjectCodeValidationPattern;
};
- private initImportedToscaBrowseFile = ():void =>{
- // Init the decision if to show onboarding
- this.$scope.isShowOnboardingSelectionBrowse = false;
- if (this.$scope.component.isResource() &&
- this.$scope.isEditMode() &&
- (<Resource>this.$scope.component).resourceType == ResourceType.VF &&
- (<Resource>this.$scope.component).csarUUID) {
- this.$scope.isShowOnboardingSelectionBrowse = true;
- let onboardCsarFilesMap:Dictionary<Dictionary<string>> = this.cacheService.get('onboardCsarFilesMap');
- // The onboardCsarFilesMap in cache contains map of [packageId]:[vsp display name for brows]
- // if the map is empty - Do request to BE
- if(onboardCsarFilesMap) {
- if (onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID]){
- this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID][(<Resource>this.$scope.component).csarVersion];
- }
- }
- if(!onboardCsarFilesMap || !this.$scope.importedToscaBrowseFileText){
+ private loadOnboardingFileCache = ():ng.IPromise<Dictionary<any>> =>{
- let onSuccess = (vsps:Array<ICsarComponent>): void =>{
- onboardCsarFilesMap = {};
- _.each(vsps, (vsp:ICsarComponent)=>{
- onboardCsarFilesMap[vsp.packageId] = onboardCsarFilesMap[vsp.packageId] || {};
- onboardCsarFilesMap[vsp.packageId][vsp.version] = vsp.vspName + " (" + vsp.version + ")";
- });
- this.cacheService.set('onboardCsarFilesMap', onboardCsarFilesMap);
- this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID][(<Resource>this.$scope.component).csarVersion];
- };
+ let onboardCsarFilesMap:Dictionary<Dictionary<string>>;
+ let onSuccess = (vsps:Array<ICsarComponent>) =>{
+ onboardCsarFilesMap = {};
+ _.each(vsps, (vsp:ICsarComponent)=>{
+ onboardCsarFilesMap[vsp.packageId] = onboardCsarFilesMap[vsp.packageId] || {};
+ onboardCsarFilesMap[vsp.packageId][vsp.version] = vsp.vspName + " (" + vsp.version + ")";
+ });
+ this.cacheService.set('onboardCsarFilesMap', onboardCsarFilesMap);
+ return onboardCsarFilesMap;
+ };
+ let onError = (): void =>{
+ console.log("Error getting onboarding list");
+ };
+ return this.onBoardingService.getOnboardingVSPs().then(onSuccess, onError);
+ };
+
+ private setImportedFileText = ():void => {
- let onError = (): void =>{
- console.log("Error getting onboarding list");
- };
+ if(!this.$scope.isShowOnboardingSelectionBrowse) return;
- this.onBoardingService.getOnboardingVSPs().then(onSuccess, onError);
+ //these variables makes it easier to read this logic
+ let csarUUID:string = (<Resource>this.$scope.component).csarUUID;
+ let csarVersion:string = (<Resource>this.$scope.component).csarVersion;
+
+ let onboardCsarFilesMap:Dictionary<Dictionary<string>> = this.cacheService.get('onboardCsarFilesMap');
+ let assignFileName = ():void => {
+ if(this.$scope.component.vspArchived){
+ this.$scope.importedToscaBrowseFileText = 'VSP is archived';
+ } else {
+ this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[csarUUID][csarVersion];
}
}
- };
-
- private initScope = ():void => {
- // Work around to change the csar version
- if (this.cacheService.get(CHANGE_COMPONENT_CSAR_VERSION_FLAG)) {
- (<Resource>this.$scope.component).csarVersion = this.cacheService.get(CHANGE_COMPONENT_CSAR_VERSION_FLAG);
+
+ if(this.$scope.component.vspArchived || (onboardCsarFilesMap && onboardCsarFilesMap[csarUUID] && onboardCsarFilesMap[csarUUID][csarVersion])){ //check that the file name is already in cache
+ assignFileName();
+ } else {
+ this.loadOnboardingFileCache().then((onboardingFiles) => {
+ onboardCsarFilesMap = onboardingFiles;
+ this.cacheService.set('onboardCsarFilesMap', onboardingFiles);
+ assignFileName();
+ }, ()=> {});
}
+
+ }
+ isCreateModeAvailable(verifyObj:string): boolean {
+ var isCheckout:boolean = ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState;
+ return this.$scope.isCreateMode() || (isCheckout && !verifyObj)
+ }
+
+ private initScope = ():void => {
+
+
this.$scope.importCsarProgressKey = "importCsarProgressKey";
+
this.$scope.browseFileLabel = this.$scope.component.isResource() && (<Resource>this.$scope.component).resourceType === ResourceType.VF ? "Upload file" : "Upload VFC";
this.$scope.progressService = this.progressService;
this.$scope.componentCategories = new componentCategories();
@@ -216,9 +238,33 @@ export class GeneralViewModel {
if (this.$scope.isEditMode() && resource.resourceType == ResourceType.VF && !resource.csarUUID) {
this.$scope.isShowFileBrowse = true;
}
+ } else if(this.$scope.component.isService()){
+ // Init Instantiation types
+ this.$scope.initInstantiationTypes();
+ }
+
+ // Work around to change the csar version
+ if (this.cacheService.get(CHANGE_COMPONENT_CSAR_VERSION_FLAG)) {
+ //(<Resource>this.$scope.component).csarVersion = this.cacheService.get(CHANGE_COMPONENT_CSAR_VERSION_FLAG);
+ this.cacheService.remove(CHANGE_COMPONENT_CSAR_VERSION_FLAG);
+ this.$scope.updateUnsavedFileFlag(true);
+
+ if (!this.$scope.isViewMode() && 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.setOriginComponent(this.cacheService.get(PREVIOUS_CSAR_COMPONENT));
+ this.cacheService.remove(PREVIOUS_CSAR_COMPONENT);
+ }
}
- this.initImportedToscaBrowseFile();
+
+ // Init the decision if to show onboarding
+ if (this.$scope.component.isResource() && this.$scope.isEditMode() &&
+ (<Resource>this.$scope.component).resourceType == ResourceType.VF && (<Resource>this.$scope.component).csarUUID) {
+ this.$scope.isShowOnboardingSelectionBrowse = true;
+ this.setImportedFileText();
+ } else {
+ this.$scope.isShowOnboardingSelectionBrowse = false;
+ }
+
//init file extensions based on the file that was imported.
if (this.$scope.component.isResource() && (<Resource>this.$scope.component).importedFile) {
@@ -231,11 +277,14 @@ export class GeneralViewModel {
(<Resource>this.$scope.component).importedFile.filetype = "yaml";
this.$scope.importedFileExtension = this.sdcConfig.toscaFileExtension;
}
+ this.$scope.restoreFile = angular.copy((<Resource>this.$scope.originComponent).importedFile); //create backup
} else if (this.$scope.isEditMode() && (<Resource>this.$scope.component).resourceType === ResourceType.VF) {
this.$scope.importedFileExtension = this.sdcConfig.csarFileExtension;
//(<Resource>this.$scope.component).importedFile.filetype="csar";
}
+
+
this.$scope.setValidState(true);
this.$scope.calculateUnique = (mainCategory:string, subCategory:string):string => {
@@ -252,6 +301,12 @@ export class GeneralViewModel {
this.$scope.originComponent.contactId = this.$scope.component.contactId;
}
+
+ this.$scope.$on('$destroy', () => {
+ this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE_WITH_SAVE);
+ this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE);
+ });
+
};
// Convert category string MainCategory_#_SubCategory to Array with one item (like the server except)
@@ -299,14 +354,28 @@ export class GeneralViewModel {
}
};
+ this.$scope.initInstantiationTypes = ():void => {
+ if (this.$scope.componentType === ComponentType.SERVICE) {
+ this.$scope.instantiationTypes = new Array();
+ this.$scope.instantiationTypes.push(instantiationType.A_LA_CARTE);
+ this.$scope.instantiationTypes.push(instantiationType.MACRO);
+ var instantiationTypeField:string =(<Service>this.$scope.component).instantiationType;
+ if (instantiationTypeField === ""){
+ this.$scope.instantiationTypes.push("");
+ }
+ else if (this.isCreateModeAvailable(instantiationTypeField)) {
+ (<Service>this.$scope.component).instantiationType = instantiationType.A_LA_CARTE;
+
+ }
+ }
+ };
this.$scope.initEnvironmentContext = ():void => {
if (this.$scope.componentType === ComponentType.SERVICE) {
this.$scope.environmentContextObj = this.cacheService.get('UIConfiguration').environmentContext;
var environmentContext:string =(<Service>this.$scope.component).environmentContext;
- var isCheckout:boolean = ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState;
// In creation new service OR check outing old service without environmentContext parameter - set default value
- if(this.$scope.isCreateMode() || (isCheckout && !environmentContext)){
+ if(this.isCreateModeAvailable(environmentContext)){
(<Service>this.$scope.component).environmentContext = this.$scope.environmentContextObj.defaultValue;
}
}
@@ -320,19 +389,33 @@ export class GeneralViewModel {
};
this.$scope.openOnBoardingModal = ():void => {
+ if(this.$scope.component.vspArchived) return;
let csarUUID = (<Resource>this.$scope.component).csarUUID;
- this.ModalsHandler.openOnboadrdingModal('Update', csarUUID).then(()=> {
- // OK
- this.$scope.uploadFileChangedInGeneralTab();
- }, ()=> {
- // ERROR
- });
+ let csarVersion = (<Resource>this.$scope.component).csarVersion;
+ this.ModalsHandler.openOnboadrdingModal('Update', csarUUID, csarVersion).then((result)=> {
+
+ if(result){
+ this.ComponentFactory.getComponentWithMetadataFromServer(result.type.toUpperCase(), result.previousComponent.uniqueId).then(
+ (component:Component)=> {
+ if (result.componentCsar && component.isResource()){
+ this.cacheService.set(PREVIOUS_CSAR_COMPONENT, angular.copy(component));
+ component = this.ComponentFactory.updateComponentFromCsar(result.componentCsar, <Resource>component);
+ }
+
+ this.$scope.setComponent(component);
+ this.$scope.updateUnsavedFileFlag(true);
+ this.setImportedFileText();
+ }, ()=> {
+ // ERROR
+ });
+ }
+ }, () => {});
};
this.$scope.updateIcon = ():void => {
this.ModalsHandler.openUpdateIconModal(this.$scope.component).then((isDirty:boolean)=> {
- if(!this.$scope.isCreateMode()){
- this.$state.current.data.unsavedChanges = this.$state.current.data.unsavedChanges || isDirty;
+ if(isDirty && !this.$scope.isCreateMode()){
+ this.setUnsavedChanges(true);
}
}, ()=> {
// ERROR
@@ -340,7 +423,7 @@ export class GeneralViewModel {
};
this.$scope.possibleToUpdateIcon = ():boolean => {
- if(this.$scope.componentCategories.selectedCategory && (!this.$scope.component.isResource() || this.$scope.component.vendorName)){
+ if(this.$scope.componentCategories.selectedCategory && (!this.$scope.component.isResource() || this.$scope.component.vendorName) && !this.$scope.component.isAlreadyCertified()){
return true;
}else{
return false;
@@ -364,7 +447,6 @@ export class GeneralViewModel {
return;
}
- //?????????????????????????
let subtype:string = ComponentType.RESOURCE == this.$scope.componentType ? this.$scope.component.getComponentSubType() : undefined;
let onFailed = (response) => {
@@ -407,6 +489,55 @@ export class GeneralViewModel {
}
};
+
+ this.EventListenerService.registerObserverCallback(EVENTS.ON_LIFECYCLE_CHANGE_WITH_SAVE, (nextState) => {
+ if (this.$state.current.data.unsavedChanges && this.$scope.isValidForm){
+ this.$scope.save().then(() => {
+ this.$scope.handleChangeLifecycleState(nextState);
+ }, () => {
+ console.error("Save failed, unable to change lifecycle state to " + nextState);
+ });
+ } else if(!this.$scope.isValidForm){
+ console.error("Form is not valid");
+ } else {
+ let newCsarVersion:string;
+ if(this.$scope.unsavedFile){
+ newCsarVersion = (<Resource>this.$scope.component).csarVersion;
+ }
+ this.$scope.handleChangeLifecycleState(nextState, newCsarVersion);
+ }
+ });
+
+
+ this.$scope.revert = ():void => {
+ //in state of import file leave the file in place
+
+ this.$scope.setComponent(this.ComponentFactory.createComponent(this.$scope.originComponent));
+
+ if (this.$scope.component.isResource() && this.$scope.restoreFile) {
+ (<Resource>this.$scope.component).importedFile = angular.copy(this.$scope.restoreFile);
+ }
+
+ this.setImportedFileText();
+ this.$scope.updateBreadcrumbs(this.$scope.component); //update on workspace
+
+ this.$scope.componentCategories.selectedCategory = this.$scope.originComponent.selectedCategory;
+ this.setUnsavedChanges(false);
+ this.$scope.updateUnsavedFileFlag(false);
+ this.$scope.editForm.$setPristine();
+ };
+
+ this.$scope.onImportFileChange = () => {
+
+ if( !this.$scope.restoreFile && this.$scope.editForm.fileElement.value && this.$scope.editForm.fileElement.value.filename || //if file started empty but we have added a new one
+ this.$scope.restoreFile && !angular.equals(this.$scope.restoreFile, this.$scope.editForm.fileElement.value)){ //or file was swapped for a new one
+ this.$scope.updateUnsavedFileFlag(true);
+ } else {
+ this.$scope.updateUnsavedFileFlag(false);
+ this.$scope.editForm.fileElement.$setPristine();
+ }
+ };
+
this.$scope.$watchCollection('component.name', (newData:any):void => {
this.$scope.validateName(false);
});
@@ -417,9 +548,10 @@ export class GeneralViewModel {
});
this.$scope.$watch("editForm.$dirty", (newVal, oldVal) => {
- if (newVal !== oldVal) {
- this.$state.current.data.unsavedChanges = newVal && !this.$scope.isCreateMode();
+ if (newVal && !this.$scope.isCreateMode()) {
+ this.setUnsavedChanges(true);
}
+
});
this.$scope.onCategoryChange = ():void => {
@@ -439,9 +571,12 @@ export class GeneralViewModel {
this.$scope.component.icon = DEFAULT_ICON;
}
};
- this.EventListenerService.registerObserverCallback(EVENTS.ON_CHECKOUT, this.$scope.reload);
- this.EventListenerService.registerObserverCallback(EVENTS.ON_REVERT, ()=>{
- this.$scope.componentCategories.selectedCategory = this.$scope.originComponent.selectedCategory;
- });
+ this.EventListenerService.registerObserverCallback(EVENTS.ON_LIFECYCLE_CHANGE, this.$scope.reload);
+
+ };
+
+ private setUnsavedChanges = (hasChanges:boolean):void => {
+ this.$state.current.data.unsavedChanges = hasChanges;
};
+
}
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 36976c610e..28b033a64b 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
@@ -1,5 +1,14 @@
<div include-padding="true" class="sdc-workspace-general-step">
-
+ <div class="w-sdc-main-container-body-content-action-buttons">
+ <div data-ng-if="unsavedFile && !isCreateMode() && !isViewMode()" class="unsaved-file-warning">
+ <span class="sprite-new sdc-warning"></span> Click save to update to the new VSP
+ </div>
+ <button class="tlv-btn blue" data-ng-if="isDesigner()" data-ng-show="isGeneralView()" data-ng-class="{'disabled' : !isValidForm || isDisableMode() || isViewMode() || isCreateMode()}"
+ data-ng-click="save()" data-tests-id="create/save" tooltips tooltip-content="Save">Save</button>
+ <span data-ng-if="isDesigner()" data-ng-class="{'disabled' :isDisableMode() || isViewMode() || isCreateMode()}" ng-click="revert()" class="sprite-new revert-btn" data-tests-id="revert"
+ data-ng-show="isGeneralView()" tooltips tooltip-content="Revert"></span>
+
+ </div>
<form novalidate class="w-sdc-form" name="editForm" validation-on-load form-to-validate="editForm">
<div class="w-sdc-form-section-container">
@@ -9,10 +18,13 @@
<div class="w-sdc-form-column">
<div class="upper-general-fields">
<div class="selected-icon-container" data-ng-class="{'show-only-on-over':'defaulticon'!=component.icon && !isViewMode()}">
- <div class="selected-icon-inner-container">
+ <div class="selected-icon-inner-container ">
<div class="sprite-new update-component-icon" data-ng-click="updateIcon()" data-ng-if="!isViewMode() && possibleToUpdateIcon()"></div>
<div class="i-sdc-form-item-suggested-icon large selected-icon {{component.iconSprite}} {{component.icon}}"
- data-ng-class="{ 'disable': isViewMode() || !possibleToUpdateIcon() }"
+ data-ng-class="{
+ 'disable': isViewMode() || !possibleToUpdateIcon(),
+ 'archive-component active-component-static': component.archived
+ }"
ng-model="component.icon"
tooltips tooltip-content='{{component.icon | translate}}'
>
@@ -27,7 +39,7 @@
data-ng-class="{'view-mode': isViewMode()}"
name="componentName"
data-ng-init="isCreateMode() && validateName(true)"
- data-ng-maxlength="50"
+ data-ng-maxlength="50"
data-ng-model="component.name"
type="text"
data-required
@@ -53,7 +65,7 @@
<!--------------------- CATEGORIES -------------------->
<div class="i-sdc-form-item"
- data-ng-class="{'error': validateField(editForm.category)}">
+ data-ng-class="{'error': validateField(editForm.category)}">
<loader data-display="!categories && !initCategoreis()" relative="true"></loader>
<label class="i-sdc-form-label required">Category</label>
<select class="i-sdc-form-select"
@@ -132,14 +144,17 @@
<div class="w-sdc-form-column">
<!--------------------- IMPORT TOSCA FILE USING BROWSE (ALSO VFC) -------------------->
<div class="i-sdc-form-item" ng-if="isShowFileBrowse">
+
+ <!-- // element-disabled="{{!isCreateMode()&&!(isEditMode()&&component.resourceType=='VF')&&component.vspArchived}} || {{isViewMode()}}" -->
+
<label class="i-sdc-form-label" data-ng-class="{'required':isCreateMode()}">{{browseFileLabel}}</label>
<file-upload id="fileUploadElement"
class="i-sdc-form-input"
element-name="fileElement"
- element-disabled="{{!isCreateMode()&&!(isEditMode()&&component.resourceType=='VF')}} || {{isViewMode()}}"
+ element-disabled="{{(!isCreateMode()&&!(isEditMode()&&component.resourceType=='VF'))|| isViewMode() || component.vspArchived}}"
form-element="editForm"
file-model="component.importedFile"
- on-file-changed-in-directive="uploadFileChangedInGeneralTab"
+ on-file-changed-in-directive="onImportFileChange"
extensions="{{importedFileExtension}}"
default-text="'Browse to select file'"
data-ng-class="{'error':!(isEditMode()&&component.resourceType=='VF') && (!editForm.fileElement.$valid || !component.importedFile.filename)}"></file-upload>
@@ -147,16 +162,16 @@
<!--------------------- IMPORT TOSCA FILE USING ONBOARDING -------------------->
<div class="i-sdc-form-item" ng-if="isShowOnboardingSelectionBrowse">
- <label class="i-sdc-form-label required">Select VSP</label>
- <div class="i-sdc-form-file-upload i-sdc-form-input">
- <span class="i-sdc-form-file-name" data-tests-id="filename">{{(fileModel && fileModel.filename) || importedToscaBrowseFileText}}</span>
- <div class="i-sdc-form-file-upload-x-btn" ng-click="cancel()" data-ng-show="fileModel.filename && fileModel.filename!=='' && elementDisabled!=='true'"></div>
- <input type="button" name="fileElement"/>
- <div class="file-upload-browse-btn" data-ng-click="openOnBoardingModal()" data-tests-id="browseButton">Browse</div>
- </div>
+ <label class="i-sdc-form-label required">Select VSP</label>
+ <div class="i-sdc-form-file-upload i-sdc-form-input">
+ <span class="i-sdc-form-file-name" data-ng-disabled="component.vspArchived" data-tests-id="filename">{{(fileModel && fileModel.filename) || importedToscaBrowseFileText }}</span>
+ <div class="i-sdc-form-file-upload-x-btn" ng-click="cancel()" data-ng-show="fileModel.filename && fileModel.filename!=='' && elementDisabled!=='true'"></div>
+ <input type="button" data-ng-disabled="component.vspArchived" name="fileElement" />
+ <div class="file-upload-browse-btn" data-ng-click="openOnBoardingModal()" data-ng-disabled="!component.vspArchived" data-tests-id="browseButton">Browse</div>
+ </div>
</div>
- <div class="input-error-file-upload" data-ng-show="component.importedFile && (!editForm.fileElement.$valid || !component.importedFile.filename)">
+ <div class="input-error-file-upload" data-ng-disabled="!component.archived" data-ng-show="component.importedFile && (!editForm.fileElement.$valid || !component.importedFile.filename)">
<!-- editForm.fileElement.$error.required <== Can not use this, because the browse is done from outside for the first time -->
<span ng-show="!(isEditMode()&&component.resourceType=='VF')&&!component.importedFile.filename" translate="NEW_SERVICE_RESOURCE_ERROR_TOSCA_FILE_REQUIRED"></span><!-- Required -->
<span ng-show="editForm.fileElement.$error.maxsize" translate="VALIDATION_ERROR_MAX_FILE_SIZE"></span>
@@ -283,7 +298,7 @@
</div>
<!--------------------- Resource Model Number -------------------->
- <!--------------------- ECOMPGENERATEDNAMING -------------------->
+ <!--------------------- ECOMPGENERATEDNAMING -------------------->
<div class="i-sdc-form-item"
data-ng-class="{'error': validateField(editForm.ecompGeneratedNaming)}"
@@ -307,7 +322,7 @@
<!--------------------- NAMING POLICY -------------------->
<div ng-if="component.isService()" class="i-sdc-form-item" data-ng-class="{'error': validateField(editForm.namingPolicy)}">
- <label class="i-sdc-form-label">Naming policy</label>
+ <label class="i-sdc-form-label">Naming Policy</label>
<input class="i-sdc-form-input"
name="namingPolicy"
data-ng-class="{'view-mode': isViewMode() || !component.ecompGeneratedNaming}"
@@ -389,6 +404,21 @@
</div>
<!--------------------- ENVIRONMENT CONTEXT ------------------>
+ <!--------------------- Instantiation Type -------------------->
+ <div class="i-sdc-form-item" data-ng-if="component.isService() && instantiationTypes">
+ <label class="i-sdc-form-label">Instantiation Type</label>
+ <select class="i-sdc-form-select"
+ name="instantiationType"
+ data-ng-class="{'view-mode': isViewMode()}"
+ data-ng-disabled="component.isCsarComponent()"
+ data-ng-model="component.instantiationType"
+ data-tests-id="selectInstantiationType">
+ <option ng-repeat="type in instantiationTypes">{{type}}</option>
+
+ </select>
+ </div>
+
+ <!--------------------- Instantiation Type -------------------->
<div class="meta-data" data-ng-if="component.creationDate">
<div>
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general.less b/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
index b9b59deb1b..b60e4b8de4 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
@@ -1,5 +1,12 @@
.sdc-workspace-general-step {
display: flex;
+ flex-direction: column;
+ .w-sdc-main-container-body-content-action-buttons{
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ margin-bottom: 10px;
+ }
.w-sdc-form {
padding: 0;
flex-grow: 10;
@@ -26,10 +33,15 @@
width: 100px;
height: 28px;
text-align: center;
+ border-left: solid 1px #cfcfcf;
&.disabled {
cursor: default;
}
+
+ &:hover:not(.disabled) {
+ background-color: #dbdee2;
+ }
}
}
@@ -80,8 +92,7 @@
padding: 8px 0 2px 20px;
text-align: left;
background-color: @tlv_color_t;
- position: absolute;
- bottom: 0;
+ position: relative;
width: 100%;
.meta-data-item-value{
padding-bottom: 6px;
@@ -97,19 +108,19 @@
display: flex;
align-items: center;
.selected-icon-inner-container{
- height: 64px;
- width: 64px;
+ height: 60px;
+ width: 60px;
margin: 0 auto;
}
.update-component-icon{
position: relative;
float: right;
cursor: pointer;
+ z-index: 1;
}
.selected-icon{
position: relative;
top: -20px;
- z-index: -1;
&.disable{
position: inherit;
}
@@ -137,7 +148,22 @@
}
+ .unsaved-file-warning {
+ border: solid 1px #ffb81c;
+ padding: 5px 8px;
+ display: flex;
+ align-items: center;
+ color: #ffb81c;
+ margin-right: 10px;
+ border-radius: 2px;
+ .sdc-warning {
+ margin-right:4px;
+ }
+ }
+ .revert-btn {
+ margin-left: 10px;
+ }
}