diff options
author | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-08-30 14:56:27 +0200 |
---|---|---|
committer | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-08-30 15:17:04 +0200 |
commit | e78a071a0f9a530e98bcc73b4ad31097fe053e81 (patch) | |
tree | 6c13e19f22be921d7d89b53732a35564c73158a7 /cds-ui/designer-client/src/app/modules/feature-modules | |
parent | 65a445a2afd3ca2d1022d2e7c7fc71ec12698e87 (diff) |
fixing metadata at editing package
Issue-ID: CCSDK-2336
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I4eafbacb1dddf4644ecd60a00af4980f8e9ffc69
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules')
4 files changed, 40 insertions, 18 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/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(); + + } } |