From 75aacbbe1acf78fa53378f07f0a8c7769449a17e Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 17 Jul 2017 21:12:03 +0300 Subject: [SDC] rebase 1710 code Change-Id: I532ed68979fee7840ea8a5395e7e965b155fb9f9 Signed-off-by: Michael Lando --- .../workspace/tabs/general/general-view-model.ts | 49 +- .../workspace/tabs/general/general-view.html | 552 +++++++++++---------- .../workspace/tabs/general/general.less | 80 ++- 3 files changed, 415 insertions(+), 266 deletions(-) (limited to 'catalog-ui/src/app/view-models/workspace/tabs/general') 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 05b3324bbb..1dc326a7c0 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 @@ -22,14 +22,16 @@ import {ModalsHandler, ValidationUtils, EVENTS, CHANGE_COMPONENT_CSAR_VERSION_FLAG, ComponentType, DEFAULT_ICON, ResourceType} from "app/utils"; import {CacheService, EventListenerService, ProgressService} from "app/services"; -import {IAppConfigurtaion, Product, IValidate, IMainCategory, Resource, ISubCategory,Service} from "app/models"; +import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service} from "app/models"; import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model"; export class Validation { componentNameValidationPattern:RegExp; contactIdValidationPattern:RegExp; tagValidationPattern:RegExp; - vendorValidationPattern:RegExp; + VendorReleaseValidationPattern:RegExp; + VendorNameValidationPattern:RegExp; + VendorModelNumberValidationPattern:RegExp; commentValidationPattern:RegExp; projectCodeValidationPattern:RegExp; } @@ -63,6 +65,8 @@ export interface IGeneralScope extends IWorkspaceViewModelScope { onEcompGeneratedNamingChange():void; openOnBoardingModal():void; initCategoreis():void; + updateIcon():void; + possibleToUpdateIcon():boolean; } export class GeneralViewModel { @@ -73,7 +77,9 @@ export class GeneralViewModel { 'ComponentNameValidationPattern', 'ContactIdValidationPattern', 'TagValidationPattern', - 'VendorValidationPattern', + 'VendorReleaseValidationPattern', + 'VendorNameValidationPattern', + 'VendorModelNumberValidationPattern', 'CommentValidationPattern', 'ValidationUtils', 'sdcConfig', @@ -93,7 +99,9 @@ export class GeneralViewModel { private ComponentNameValidationPattern:RegExp, private ContactIdValidationPattern:RegExp, private TagValidationPattern:RegExp, - private VendorValidationPattern:RegExp, + private VendorReleaseValidationPattern:RegExp, + private VendorNameValidationPattern:RegExp, + private VendorModelNumberValidationPattern:RegExp, private CommentValidationPattern:RegExp, private ValidationUtils:ValidationUtils, private sdcConfig:IAppConfigurtaion, @@ -121,7 +129,9 @@ export class GeneralViewModel { this.$scope.validation.componentNameValidationPattern = this.ComponentNameValidationPattern; this.$scope.validation.contactIdValidationPattern = this.ContactIdValidationPattern; this.$scope.validation.tagValidationPattern = this.TagValidationPattern; - this.$scope.validation.vendorValidationPattern = this.VendorValidationPattern; + this.$scope.validation.VendorReleaseValidationPattern = this.VendorReleaseValidationPattern; + this.$scope.validation.VendorNameValidationPattern = this.VendorNameValidationPattern; + this.$scope.validation.VendorModelNumberValidationPattern = this.VendorModelNumberValidationPattern; this.$scope.validation.commentValidationPattern = this.CommentValidationPattern; this.$scope.validation.projectCodeValidationPattern = this.ProjectCodeValidationPattern; }; @@ -140,12 +150,6 @@ export class GeneralViewModel { this.$scope.componentCategories = new componentCategories(); this.$scope.componentCategories.selectedCategory = this.$scope.component.selectedCategory; - // Workaround to short vendor name to 25 chars - // Amdocs send 27 chars, and the validation pattern is 25 chars. - if (this.$scope.component.vendorName) { - this.$scope.component.vendorName = this.$scope.component.vendorName.substr(0, 25); - } - // Init UIModel this.$scope.component.tags = _.without(this.$scope.component.tags, this.$scope.component.name); @@ -202,10 +206,7 @@ export class GeneralViewModel { }; //TODO remove this after handling contact in UI - if (this.$scope.component.isProduct() && this.$scope.isCreateMode()) { - (this.$scope.component).contacts = []; - (this.$scope.component).contacts.push(this.cacheService.get("user").userId); - } else if (this.$scope.isCreateMode()) { + if (this.$scope.isCreateMode()) { this.$scope.component.contactId = this.cacheService.get("user").userId; } @@ -273,6 +274,24 @@ export class GeneralViewModel { }); }; + 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; + } + }, ()=> { + // ERROR + }); + }; + + this.$scope.possibleToUpdateIcon = ():boolean => { + if(this.$scope.componentCategories.selectedCategory && (!this.$scope.component.isResource() || this.$scope.component.vendorName)){ + return true; + }else{ + return false; + } + } + this.$scope.validateName = (isInit:boolean):void => { if (isInit === undefined) { isInit = false; 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 2ad0cbacd6..d3626803e9 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 @@ -4,122 +4,121 @@
- -
- - -
- - -
- -
- {{(fileModel && fileModel.filename) || importedToscaBrowseFileText}} -
- -
Browse
-
-
- -
- - - - - -
- -
- - -
- - - -
- - - - - +
+
+
+
+
+
+
+
+
+ +
+ + + +
+ + + + + +
+
+ + + + + +
+ + + + +
+ +
+
+ +
-
- + +
+ - -
- - + -
- - - - - +
+ +
- + -
- +
@@ -130,110 +129,85 @@
- -
- - - - -
- -
-
- - - -
- - +
-
- - +
+ +
+ +
-
+ +
+ +
+ {{(fileModel && fileModel.filename) || importedToscaBrowseFileText}} +
+ +
Browse
+
+
- +
+ + + + + +
+ -
- - -
+ +
+ + +
+ +
- - - -
- - + + +
+ + -
- - +
+ +
- -
@@ -242,20 +216,20 @@ data-ng-class="{'view-mode': isViewMode()}" data-ng-model="component.vendorName" data-ng-model-options="{ debounce: 500 }" - data-ng-maxlength="25" + data-ng-maxlength="60" data-required ng-click="oldValue = component.vendorName" name="vendorName" data-ng-change="onVendorNameChange(oldValue)" - data-ng-pattern="validation.vendorValidationPattern" - maxlength="25" + data-ng-pattern="validation.VendorNameValidationPattern" + maxlength="60" data-ng-disabled="component.isAlreadyCertified() || (component.isCsarComponent() && component.vendorName && component.vendorName!=='')" data-tests-id="vendorName" - /> + />
- +
@@ -275,80 +249,160 @@ data-ng-maxlength="25" data-required name="vendorRelease" - data-ng-pattern="validation.vendorValidationPattern" + data-ng-pattern="validation.VendorReleaseValidationPattern" maxlength="25" data-ng-disabled="component.isCsarComponent() && component.vendorRelease && component.vendorRelease!==''" data-tests-id="vendorRelease" - /> + />
- +
+ +
+ + +
+ + +
+
+ -
- -
- - -
- + - +
+ + +
-
- - +
-
- + - -
- - +
+ + - -
- - +
+ + +
-
- - + + +
+ + +
+ + +
+
+ + + +
+ + +
+ + +
+
+ +
-
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 caa755cce3..9633ec5bb6 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,8 +1,8 @@ .sdc-workspace-general-step { - + display: flex; .w-sdc-form { padding: 0; - + flex-grow: 10; .i-sdc-form-file-upload{ input[type="button"] { cursor: pointer; @@ -33,6 +33,14 @@ } } + .description{ + height: 300px; + } + + .i-sdc-form-item.description-field{ + margin-bottom: 0; + } + .w-sdc-form-section-container { text-align: center; } @@ -43,6 +51,7 @@ width: auto; padding: 10px; } + margin-bottom: 15px; } .i-sdc-form-label { @@ -63,6 +72,73 @@ } + .w-sdc-form-column { + position: relative; + } + + .meta-data{ + padding: 8px 0 2px 20px; + text-align: left; + background-color: @tlv_color_t; + position: absolute; + bottom: 0; + width: 100%; + .meta-data-item-value{ + padding-bottom: 6px; + } + } + + .upper-general-fields{ + display: flex; + } + + .selected-icon-container{ + flex-grow: 1; + display: flex; + align-items: center; + .selected-icon-inner-container{ + height: 64px; + width: 64px; + margin: 0 auto; + } + .update-component-icon{ + position: relative; + float: right; + cursor: pointer; + } + .selected-icon{ + position: relative; + top: -20px; + z-index: -1; + &.disable{ + position: inherit; + } + } + &.show-only-on-over{ + .update-component-icon{ + display: none; + } + .selected-icon{ + position: inherit; + } + &:hover{ + .update-component-icon{ + display: inline-block; + } + .selected-icon{ + position: relative; + } + } + } + } + + .name-and-category-fields{ + flex-grow: 5; + } + + + + } -- cgit 1.2.3-korg