diff options
5 files changed, 43 insertions, 19 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html index 0d0f5ef93..1e5b18d43 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html @@ -26,7 +26,8 @@ <i class="icon-save-sm" aria-hidden="true"></i> <span>Save</span> </button> - <button data-target="#discardChangesModal" data-toggle="modal" class="action-button" [disabled]="!isSaveEnabled"> + <button data-target="#discardChangesModal" data-toggle="modal" class="action-button" + [disabled]="!isSaveEnabled"> <i class="icon-discard-sm" aria-hidden="true"></i> <span>Discard Changes</span> </button> @@ -682,7 +683,7 @@ <!--Nav Tabs--> <div class="col"> <div class="nav nav-tabs " id="nav-tab" role="tablist"> - <a class="nav-item nav-link active complete" id="nav-metadata-tab" data-toggle="tab" + <a [classList]="metadataClasses" id="nav-metadata-tab" data-toggle="tab" href="#nav-metadata" role="tab" aria-controls="nav-metadata" aria-selected="true" autofocus #nameit (focusout)="saveMetaData()">METADATA</a> <a class="nav-item nav-link" id="nav-template-tab" data-toggle="tab" href="#nav-template" @@ -702,7 +703,7 @@ <div class="col"> <div class="tab-content" id="nav-tabContent"> <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" - aria-labelledby="nav-metadata-tab"> + aria-labelledby="nav-metadata-tab" (click)="clickEvent()"> <app-metadata-tab></app-metadata-tab> </div> <div class="tab-pane fade" id="nav-template" role="tabpanel" diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts index a69e45fce..764a5b9b1 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts @@ -41,6 +41,7 @@ export class ConfigurationDashboardComponent implements OnInit { vlbDefinition: VlbDefinition = new VlbDefinition(); isSaveEnabled = false; versionPattern = '^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$'; + metadataClasses = 'nav-item nav-link active'; constructor( private route: ActivatedRoute, @@ -58,17 +59,22 @@ export class ConfigurationDashboardComponent implements OnInit { this.elementRef.nativeElement.focus(); this.refreshCurrentPackage(); - const regexp = RegExp(this.versionPattern); - this.packageCreationStore.state$.subscribe(cbaPackage => { - if (cbaPackage && cbaPackage.metaData && cbaPackage.metaData.description - && cbaPackage.metaData.name && cbaPackage.metaData.version && - regexp.test(cbaPackage.metaData.version)) { - this.isSaveEnabled = true; - } else { - this.isSaveEnabled = false; - } - }); + this.packageCreationStore.state$.subscribe( + cbaPackage => { + if (cbaPackage && cbaPackage.metaData && cbaPackage.metaData.description + && cbaPackage.metaData.name && cbaPackage.metaData.version && + regexp.test(cbaPackage.metaData.version)) { + this.isSaveEnabled = true; + if (!this.metadataClasses.includes('complete')) { + this.metadataClasses += 'complete'; + } + } else { + this.metadataClasses = this.metadataClasses.replace('complete', ''); + this.isSaveEnabled = false; + } + + }); } private refreshCurrentPackage() { @@ -172,6 +178,7 @@ export class ConfigurationDashboardComponent implements OnInit { saveMetaData() { this.metadataTabComponent.saveMetaDataToStore(); + } getMetaDataTabInfo(fileData: string) { @@ -292,4 +299,8 @@ export class ConfigurationDashboardComponent implements OnInit { console.log('Error -' + error.message); }); } + + clickEvent() { + this.isSaveEnabled = true; + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts index 58307005c..f739ceb2e 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/DesignerCreationMode.ts @@ -69,7 +69,9 @@ export class DesignerCreationMode extends PackageCreationModes { vlbDefinition.metadata = metadata; const files: Import[] = []; cbaPackage.definitions.imports.forEach((valueOfFile, key) => { - files.push({file: key}); + if (!key.includes(cbaPackage.metaData.name)) { + files.push({file: key}); + } }); console.log(vlbDefinition); vlbDefinition.imports = files; diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html index fc001b11b..48d4dd57f 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html @@ -36,7 +36,7 @@ <div class="nav nav-tabs " id="nav-tab" role="tablist"> <a class="nav-item nav-link active" id="nav-metadata-tab" data-toggle="tab" href="#nav-metadata" role="tab" aria-controls="nav-metadata" aria-selected="false" - autofocus #nameit (focusout)="test()">METADATA</a> + autofocus #nameit (focusout)="saveMetaData()" [classList]="metadataClasses">METADATA</a> <a class="nav-item nav-link" id="nav-template-tab" data-toggle="tab" href="#nav-template" role="tab" aria-controls="nav-template" aria-selected="false">TEMPLATE & MAPPING</a> <a class="nav-item nav-link" id="nav-scripts-tab" data-toggle="tab" href="#nav-scripts" @@ -53,7 +53,7 @@ <div class="row mt-4"> <div class="col"> <div class="tab-content" id="nav-tabContent"> - <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" + <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" aria-labelledby="nav-metadata-tab"> <app-metadata-tab></app-metadata-tab> </div> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts index bba45c810..e91313b2e 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts @@ -67,6 +67,7 @@ export class PackageCreationComponent implements OnInit { @ViewChild('nameit', {static: true}) elementRef: ElementRef; versionPattern = '^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$'; + metadataClasses = 'nav-item nav-link active complete'; ngOnInit() { this.elementRef.nativeElement.focus(); @@ -76,8 +77,14 @@ export class PackageCreationComponent implements OnInit { && cbaPackage.metaData.name && cbaPackage.metaData.version && regexp.test(cbaPackage.metaData.version)) { this.isSaveEnabled = true; + if (!this.metadataClasses.includes('complete')) { + console.log('added'); + this.metadataClasses += 'complete'; + } + console.log('perhaps it is been added'); } else { this.isSaveEnabled = false; + this.metadataClasses = this.metadataClasses.replace('complete', ''); } }); } @@ -127,11 +134,14 @@ export class PackageCreationComponent implements OnInit { } - test() { - this.metadataTabComponent.saveMetaDataToStore(); - } goBackToDashBorad() { this.router.navigate(['/packages']); } + + saveMetaData() { + console.log('executed change'); + this.metadataTabComponent.saveMetaDataToStore(); + + } } |