diff options
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab')
2 files changed, 26 insertions, 11 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html index a9cde0eb9..9bd08b7cb 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html @@ -32,7 +32,7 @@ <div class="single-line-model"> <label class="label-name">Name <span>*</span></label> <div class="label-input"> - <input type="input" [readOnly]="!packageNameAndVersionEnables" [(ngModel)]="metaDataTab.name" + <input type="input" [readOnly]="!packageNameAndVersionEnables" (change)="checkRequiredElements()" [(ngModel)]="metaDataTab.name" placeholder="Package name"> </div> <!--<div class="model-note-container error-message"> @@ -44,7 +44,7 @@ <div class="single-line-model"> <label class="label-name">Version <span>*</span></label> <div class="label-input"> - <input type="input" [readOnly]="!packageNameAndVersionEnables" [(ngModel)]="metaDataTab.version" + <input type="input" [readOnly]="!packageNameAndVersionEnables" (change)="checkRequiredElements()" [(ngModel)]="metaDataTab.version" (input)="validatePackageNameAndVersion()" [pattern]="versionPattern" placeholder="Example: 1.0.0"> </div> <div class="model-note-container error-message">{{errorMessage}}</div> @@ -52,7 +52,7 @@ <div class="single-line-model"> <label class="label-name">Description <span>*</span></label> <div class="label-input"> - <input type="input" [(ngModel)]="metaDataTab.description" placeholder="Descripe the package"> + <input type="input" [(ngModel)]="metaDataTab.description" (change)="checkRequiredElements()" placeholder="Descripe the package"> </div> </div> @@ -119,4 +119,4 @@ </div> </div> -</div>
\ No newline at end of file +</div> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts index c74a1e01e..c82ccc6b6 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts @@ -1,8 +1,8 @@ -import { Component, OnInit } from '@angular/core'; -import { PackageCreationService } from '../package-creation.service'; -import { MetaDataTabModel } from '../mapping-models/metadata/MetaDataTab.model'; -import { PackageCreationStore } from '../package-creation.store'; -import { ActivatedRoute } from '@angular/router'; +import {Component, OnInit} from '@angular/core'; +import {PackageCreationService} from '../package-creation.service'; +import {MetaDataTabModel} from '../mapping-models/metadata/MetaDataTab.model'; +import {PackageCreationStore} from '../package-creation.store'; +import {ActivatedRoute} from '@angular/router'; @Component({ @@ -16,7 +16,7 @@ export class MetadataTabComponent implements OnInit { tags = new Set<string>(); customKeysMap = new Map(); modes: any[] = [ - { name: 'Designer Mode', style: 'mode-icon icon-topologyView-active' }]; + {name: 'Designer Mode', style: 'mode-icon icon-topologyView-active'}]; /* {name: 'Scripting Mode', style: 'mode-icon icon-topologySource'}, {name: 'Generic Script Mode', style: 'mode-icon icon-topologySource'}];*/ modeType = this.modes[0].name; @@ -104,8 +104,10 @@ export class MetadataTabComponent implements OnInit { this.packageCreationService.checkBluePrintNameAndVersion(this.metaDataTab.name, this.metaDataTab.version).then(element => { if (element) { this.errorMessage = 'Package name already exists with this version. Use different name or different version number.'; + } else if (!this.metaDataTab.version.match(this.versionPattern)) { + this.errorMessage = 'version should be as example 1.0.0'; } else { - this.errorMessage = ' '; + this.errorMessage = ''; } }); } @@ -115,4 +117,17 @@ export class MetadataTabComponent implements OnInit { saveMetaDataToStore() { this.packageCreationStore.changeMetaData(this.metaDataTab); } + + checkRequiredElements() { + const newMetaData = new MetaDataTabModel(); + newMetaData.description = this.metaDataTab.description; + newMetaData.name = this.metaDataTab.name; + newMetaData.version = this.metaDataTab.version; + newMetaData.templateTags = this.metaDataTab.templateTags; + newMetaData.mapOfCustomKey = this.metaDataTab.mapOfCustomKey; + newMetaData.mode = this.metaDataTab.mode; + this.packageCreationStore.changeMetaData(newMetaData); + } + + } |