diff options
Diffstat (limited to 'cds-ui/designer-client')
9 files changed, 190 insertions, 139 deletions
diff --git a/cds-ui/designer-client/package.json b/cds-ui/designer-client/package.json index df6b02b4a..096e96eb9 100644 --- a/cds-ui/designer-client/package.json +++ b/cds-ui/designer-client/package.json @@ -7,7 +7,8 @@ "build": "npm run lint && ng build --prod --aot ", "test": "ng test", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "sonar": "sonar-scanner" }, "private": true, "dependencies": { @@ -76,6 +77,7 @@ "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", + "sonar-scanner": "^3.1.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.5.3" diff --git a/cds-ui/designer-client/sonar-project.properties b/cds-ui/designer-client/sonar-project.properties new file mode 100644 index 000000000..6b246e759 --- /dev/null +++ b/cds-ui/designer-client/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.host.url=http://localhost:9000 +sonar.login=admin +sonar.password=admin +sonar.projectKey=designer-client-app +sonar.projectName=designer-client-app +sonar.projectVersion=1.0 +sonar.sourceEncoding=UTF-8 +sonar.sources=src +sonar.exclusions=**/node_modules/** +sonar.tests=src +sonar.test.inclusions=**/*.spec.ts +sonar.typescript.lcov.reportPaths=coverage/lcov.info 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 eb121e98e..079e4edbc 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 @@ -2,12 +2,12 @@ import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {BluePrintDetailModel} from '../model/BluePrint.detail.model'; import {PackageCreationStore} from '../package-creation/package-creation.store'; -import {FilesContent, FolderNodeElement, MetaDataTabModel} from '../package-creation/mapping-models/metadata/MetaDataTab.model'; +import {FilesContent, FolderNodeElement} from '../package-creation/mapping-models/metadata/MetaDataTab.model'; import {MetadataTabComponent} from '../package-creation/metadata-tab/metadata-tab.component'; import * as JSZip from 'jszip'; import {ConfigurationDashboardService} from './configuration-dashboard.service'; import {TemplateTopology, VlbDefinition} from '../package-creation/mapping-models/definitions/VlbDefinition'; -import {CBAPackage, DslDefinition} from '../package-creation/mapping-models/CBAPacakge.model'; +import {CBAPackage} from '../package-creation/mapping-models/CBAPacakge.model'; import {PackageCreationUtils} from '../package-creation/package-creation.utils'; import {PackageCreationModes} from '../package-creation/creationModes/PackageCreationModes'; import {PackageCreationBuilder} from '../package-creation/creationModes/PackageCreationBuilder'; @@ -65,8 +65,6 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl cbaPackage => { this.cbaPackage = cbaPackage; }); - - } ngOnInit() { @@ -89,7 +87,6 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl } - private refreshCurrentPackage(id?) { this.id = this.route.snapshot.paramMap.get('id'); console.log(this.id); @@ -109,80 +106,10 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl this.viewedPackage.artifactName + '/' + this.viewedPackage.artifactVersion).subscribe(response => { const blob = new Blob([response], {type: 'application/octet-stream'}); this.currentBlob = blob; - this.extractBlobToStore(blob, this.viewedPackage); + this.packageCreationExtractionService.extractBlobToStore(blob); }); } - private extractBlobToStore(blob: Blob, bluePrintDetailModel: BluePrintDetailModel) { - this.zipFile.loadAsync(blob).then((zip) => { - Object.keys(zip.files).forEach((filename) => { - zip.files[filename].async('string').then((fileData) => { - console.log(filename); - if (fileData) { - if (filename.includes('Scripts/')) { - this.setScripts(filename, fileData); - } else if (filename.includes('Templates/')) { - if (filename.includes('-mapping.')) { - this.setMapping(filename, fileData); - } else if (filename.includes('-template.')) { - this.setTemplates(filename, fileData); - } - - } else if (filename.includes('Definitions/')) { - this.setImports(filename, fileData, bluePrintDetailModel); - } else if (filename.includes('TOSCA-Metadata/')) { - const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData); - this.setMetaData(metaDataTabInfo, bluePrintDetailModel); - } - } - }); - }); - }); - } - - setScripts(filename: string, fileData: any) { - this.packageCreationStore.addScripts(filename, fileData); - } - - setImports(filename: string, fileData: any, bluePrintDetailModels: BluePrintDetailModel) { - console.log(filename); - if (filename.includes(bluePrintDetailModels.artifactName)) { - let definition = new VlbDefinition(); - definition = fileData as VlbDefinition; - definition = JSON.parse(fileData); - const dslDefinition = new DslDefinition(); - dslDefinition.content = this.packageCreationUtils.transformToJson(definition.dsl_definitions); - const mapOfCustomKeys = new Map<string, string>(); - for (const metadataKey in definition.metadata) { - if (!this.entryDefinitionKeys.includes(metadataKey + '')) { - mapOfCustomKeys.set(metadataKey + '', definition.metadata[metadataKey + '']); - } - } - this.packageCreationStore.changeDslDefinition(dslDefinition); - this.packageCreationStore.setCustomKeys(mapOfCustomKeys); - if (definition.topology_template) { - const content = {}; - const workflow = 'workflows'; - content[workflow] = definition.topology_template.workflows; - const nodeTemplates = 'node_templates'; - content[nodeTemplates] = definition.topology_template.node_templates; - this.designerStore.saveSourceContent(JSON.stringify(content)); - this.packageCreationStore.addTopologyTemplate(definition.topology_template); - } - - } - this.packageCreationStore.addDefinition(filename, fileData); - - } - - setTemplates(filename: string, fileData: any) { - this.packageCreationStore.addTemplate(filename, fileData); - } - - setMapping(fileName: string, fileData: string) { - this.packageCreationStore.addMapping(fileName, fileData); - } - editBluePrint() { this.configurationDashboardService.deletePackage(this.viewedPackage.id).subscribe(res => { this.formTreeData(); @@ -201,26 +128,8 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl this.filesData.push(this.folder.TREE_DATA); } - setMetaData(metaDataObject: MetaDataTabModel, bluePrintDetailModel: BluePrintDetailModel) { - metaDataObject.description = bluePrintDetailModel.artifactDescription; - this.packageCreationStore.changeMetaData(metaDataObject); - - } - saveMetaData() { this.metadataTabComponent.saveMetaDataToStore(); - - } - - getMetaDataTabInfo(fileData: string) { - const metaDataTabModel = new MetaDataTabModel(); - const arrayOfLines = fileData.split('\n'); - metaDataTabModel.entryFileName = arrayOfLines[3].split(':')[1]; - metaDataTabModel.name = arrayOfLines[4].split(':')[1]; - metaDataTabModel.version = arrayOfLines[5].split(':')[1]; - metaDataTabModel.mode = arrayOfLines[6].split(':')[1]; - metaDataTabModel.templateTags = new Set<string>(arrayOfLines[7].split(':')[1].split(',')); - return metaDataTabModel; } saveBluePrintToDataBase() { @@ -316,7 +225,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl const blobInfo = new Blob([response], {type: 'application/octet-stream'}); this.currentBlob = blobInfo; this.packageCreationStore.clear(); - this.extractBlobToStore(this.currentBlob, this.viewedPackage); + this.packageCreationExtractionService.extractBlobToStore(this.currentBlob); this.isSaveEnabled = true; this.toastService.info('enriched successfully '); }); @@ -351,7 +260,9 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl } checkSkipTypesOfAction() { + console.log(this.cbaPackage); if (this.cbaPackage.templateTopology.node_templates && this.cbaPackage.templateTopology.workflows) { + console.log('eeeeee'); this.goToDesignerMode(this.id); } else { this.dataTarget = '#exampleModalLong'; diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts index fe98fa22b..aa7964453 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation-extraction.service.ts @@ -1,25 +1,26 @@ -import { Injectable, ViewChild } from '@angular/core'; -import { MetaDataTabModel } from './mapping-models/metadata/MetaDataTab.model'; -import { VlbDefinition } from './mapping-models/definitions/VlbDefinition'; -import { DslDefinition } from './mapping-models/CBAPacakge.model'; -import { PackageCreationStore } from './package-creation.store'; +import {Injectable, ViewChild} from '@angular/core'; +import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; +import {VlbDefinition} from './mapping-models/definitions/VlbDefinition'; +import {DslDefinition} from './mapping-models/CBAPacakge.model'; +import {PackageCreationStore} from './package-creation.store'; import * as JSZip from 'jszip'; -import { PackageCreationUtils } from './package-creation.utils'; -import { MetadataTabComponent } from './metadata-tab/metadata-tab.component'; -import { DesignerStore } from '../designer/designer.store'; +import {PackageCreationUtils} from './package-creation.utils'; +import {MetadataTabComponent} from './metadata-tab/metadata-tab.component'; +import {DesignerStore} from '../designer/designer.store'; +import {BluePrintDetailModel} from '../model/BluePrint.detail.model'; @Injectable({ providedIn: 'root' }) export class PackageCreationExtractionService { - private zipFile: JSZip = new JSZip(); + private zipFile: JSZip; private entryDefinitionKeys: string[] = ['template_tags', 'user-groups', 'author-email', 'template_version', 'template_name', 'template_author', 'template_description']; private toscaMetaDataKeys: string[] = ['TOSCA-Meta-File-Version', 'CSAR-Version', 'Created-By', 'Entry-Definitions', 'Template-Name', 'Template-Version', 'Template-Type', 'Template-Tags']; - @ViewChild(MetadataTabComponent, { static: false }) + @ViewChild(MetadataTabComponent, {static: false}) private metadataTabComponent: MetadataTabComponent; constructor( @@ -31,7 +32,7 @@ export class PackageCreationExtractionService { } public extractBlobToStore(blob) { - + this.zipFile = new JSZip(); let packageName = null; this.zipFile.loadAsync(blob).then((zip) => { Object.keys(zip.files).filter(fileName => fileName.includes('TOSCA-Metadata/')) @@ -73,11 +74,11 @@ export class PackageCreationExtractionService { }); } - private setScripts(filename: string, fileData: any) { + public setScripts(filename: string, fileData: any) { this.packageCreationStore.addScripts(filename, fileData); } - private setImports(filename: string, fileData: any, packageName: string) { + public setImports(filename: string, fileData: any, packageName: string) { console.log(filename); if (filename.includes(packageName)) { let definition = new VlbDefinition(); @@ -102,17 +103,19 @@ export class PackageCreationExtractionService { const nodeTemplates = 'node_templates'; content[nodeTemplates] = definition.topology_template ? definition.topology_template.node_templates : {}; this.designerStore.saveSourceContent(JSON.stringify(content)); + this.packageCreationStore.addTopologyTemplate(definition.topology_template); + } this.packageCreationStore.addDefinition(filename, fileData); } - private setTemplates(filename: string, fileData: any) { + public setTemplates(filename: string, fileData: any) { this.packageCreationStore.addTemplate(filename, fileData); } - private setMapping(fileName: string, fileData: string) { + public setMapping(fileName: string, fileData: string) { this.packageCreationStore.addMapping(fileName, fileData); } @@ -120,7 +123,13 @@ export class PackageCreationExtractionService { this.packageCreationStore.changeMetaData(metaDataObject); } - private getMetaDataTabInfo(fileData: string) { + public setMetaDataWithObject(metaDataObject: MetaDataTabModel, bluePrintDetailModel: BluePrintDetailModel) { + metaDataObject.description = bluePrintDetailModel.artifactDescription; + this.packageCreationStore.changeMetaData(metaDataObject); + + } + + public getMetaDataTabInfo(fileData: string) { const metaDataTabModel = new MetaDataTabModel(); const arrayOfLines = fileData.split('\n'); 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 25f5c5996..c7285774e 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 @@ -19,7 +19,7 @@ limitations under the License. ============LICENSE_END============================================ */ -import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; +import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {FilesContent, FolderNodeElement, MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; import * as JSZip from 'jszip'; @@ -42,7 +42,7 @@ import {DesignerStore} from '../designer/designer.store'; templateUrl: './package-creation.component.html', styleUrls: ['./package-creation.component.css'] }) -export class PackageCreationComponent extends ComponentCanDeactivate implements OnInit { +export class PackageCreationComponent extends ComponentCanDeactivate implements OnInit, OnDestroy { // adding initial referencing to designer mode @@ -84,6 +84,8 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements this.elementRef.nativeElement.focus(); const regexp = RegExp(this.versionPattern); this.packageCreationStore.state$.subscribe(cbaPackage => { + console.log(cbaPackage); + console.log('abbaaaas' + cbaPackage.metaData.name); this.cbaPackage = cbaPackage; if (cbaPackage && cbaPackage.metaData && cbaPackage.metaData.description && cbaPackage.metaData.name && cbaPackage.metaData.version && @@ -164,4 +166,8 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements canDeactivate(): boolean { return this.isSaveEnabled; } + + ngOnDestroy(): void { + + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts index 94ab9ed02..ed3db4286 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts @@ -21,23 +21,41 @@ limitations under the License. import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; +import {Observable, Subject} from 'rxjs'; import {ApiService} from '../../../../common/core/services/api.service'; import {BlueprintURLs, ResourceDictionaryURLs} from '../../../../common/constants/app-constants'; import {PackagesApiService} from '../packages-api.service'; import {PackagesStore} from '../packages.store'; import {ResourceDictionary} from './mapping-models/ResourceDictionary.model'; +import {FilesContent, FolderNodeElement} from './mapping-models/metadata/MetaDataTab.model'; +import {PackageCreationModes} from './creationModes/PackageCreationModes'; +import {PackageCreationBuilder} from './creationModes/PackageCreationBuilder'; +import {PackageCreationStore} from './package-creation.store'; +import {CBAPackage} from './mapping-models/CBAPacakge.model'; +import {PackageCreationUtils} from './package-creation.utils'; +import * as JSZip from 'jszip'; +import {DesignerStore} from '../designer/designer.store'; @Injectable({ providedIn: 'root' }) export class PackageCreationService { - - - constructor(private api: ApiService, private packagesListService: PackagesApiService, private packagesStore: PackagesStore) { + private cbaPackage: CBAPackage; + folder: FolderNodeElement = new FolderNodeElement(); + filesData: any = []; + zipFile: JSZip = new JSZip(); + + constructor(private api: ApiService, private packagesListService: PackagesApiService, + private packagesStore: PackagesStore, private designerStore: DesignerStore, + private packageCreationStore: PackageCreationStore, private packageCreationUtils: PackageCreationUtils + ) { + this.packageCreationStore.state$.subscribe( + cbaPackage => { + this.cbaPackage = cbaPackage; + }); } - private saveBlueprint(body: any | null, options?: any): Observable<any> { + private saveBlueprint(body: any | null, options?: any): Observable<string> { return this.api.post(BlueprintURLs.save, body, {responseType: 'text'}); } @@ -58,7 +76,7 @@ export class PackageCreationService { this.packagesStore.getAll(); } - savePackage(blob) { + public savePackage(blob): Observable<string> { const formData = this.getFormData(blob); return this.saveBlueprint(formData); } @@ -87,5 +105,65 @@ export class PackageCreationService { return this.api.getCustomized(BlueprintURLs.download + id, {responseType: 'blob'}); } + public saveBluePrintToDataBase(): Observable<string> { + this.formTreeData(); + this.create(); + const subject = new Subject<any>(); + this.zipFile.generateAsync({type: 'blob'}) + .then(blob => { + this.savePackage(blob).subscribe(bluePrintModel => { + subject.next(bluePrintModel); + }); + }); + return subject.asObservable(); + } + + public deployCurrentPackage() { + this.formTreeData(); + this.create(); + const subject = new Subject<any>(); + this.zipFile.generateAsync({type: 'blob'}) + .then(blob => { + this.deploy(blob).subscribe(bluePrintModel => { + subject.next(bluePrintModel); + }); + }); + return subject.asObservable(); + } + + public enrichCurrentPackage() { + this.formTreeData(); + this.create(); + const subject = new Subject<any>(); + return this.zipFile.generateAsync({type: 'blob'}) + .then(blob => { + return this.enrichPackage(blob).pipe(); + }); + // return subject.asObservable(); + + } + + private create() { + this.zipFile = new JSZip(); + FilesContent.getMapOfFilesNamesAndContent().forEach((value, key) => { + this.zipFile.folder(key.split('/')[0]); + this.zipFile.file(key, value); + }); + + } + + private formTreeData() { + + FilesContent.clear(); + let packageCreationModes: PackageCreationModes; + this.cbaPackage = PackageCreationModes.mapModeType(this.cbaPackage); + this.cbaPackage.metaData = PackageCreationModes.setEntryPoint(this.cbaPackage.metaData); + packageCreationModes = PackageCreationBuilder.getCreationMode(this.cbaPackage); + this.designerStore.state$.subscribe(state => { + this.cbaPackage.templateTopology.content = this.packageCreationUtils.transformToJson(state.template); + }); + packageCreationModes.execute(this.cbaPackage, this.packageCreationUtils); + this.filesData.push(this.folder.TREE_DATA); + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html index 34644c42c..870770ac5 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html @@ -123,18 +123,26 @@ </div> - + </div> - + <div id="mapping-table" [hidden]="resourceDictionaryRes?.length == 0" class="mapping-table mx-4 my-2"> <div class="btn-group mapping-editBar" role="group"> - <div class="custom-control custom-checkbox" tooltip="Select All" placement="bottom"> - <input type="checkbox" class="custom-control-input" id="customCheck1" checked> + <div class="custom-control custom-checkbox" tooltip="Select All" placement="bottom"> + <input type="checkbox" (click)="selectAllProps()" class="custom-control-input" + id="customCheck1" + [checked]="resourceDictionaryRes.length>0&&resourceDictionaryRes.length === this.selectedProps.size"> <label class="custom-control-label" for="customCheck1"></label> - </div> - <button type="button" class="btn" tooltip="Re-mapping" placement="bottom"><i class="icon-autoMap"></i></button> - <button type="button" class="btn" tooltip="Remove" placement="bottom"><i class="icon-delete-sm"></i></button> - </div> + </div> + <button [disabled]="selectedProps.size <=0" type="button" class="btn" (click)="reMap()" + tooltip="Re-mapping" placement="bottom"><i class="icon-autoMap"></i></button> + <button [disabled]="selectedProps.size <=0" type="button" class="btn" (click)="removeProps()" + tooltip="Remove" placement="bottom"><i class="icon-delete-sm"></i></button> + <div style="line-height: 35px;font-size: 10px;"> + <span>{{selectedProps.size}} selected </span> + <span>({{resourceDictionaryRes.length}} attributes in total)</span> + </div> + </div> <table datatable [dtOptions]="initDtOptions" [dtTrigger]="dtTrigger" class="row-border hover"> <thead> <tr> @@ -152,13 +160,15 @@ <tbody> <tr *ngFor="let dict of resourceDictionaryRes"> <td> - <div class="custom-control custom-checkbox" tooltip="Select" placement="bottom"> - <input type="checkbox" class="custom-control-input" id="customCheck2" [checked]="selectedProps.has(dict.name)" - (click)="selectProp(dict.name)"> - <label class="custom-control-label" for="customCheck2"></label> - </div> - <!-- <input type="checkbox" [checked]="selectedProps.has(dict.name)" + <div class="custom-control custom-checkbox" tooltip="Select" placement="bottom"> + <input type="checkbox" class="custom-control-input" + id="customCheck-{{dict.name}}" [checked]="selectedProps.has(dict.name)" + (click)="selectProp(dict.name)"> + <label class="custom-control-label" for="customCheck-{{dict.name}}"></label> + </div> + <!-- <input type="checkbox" [checked]="selectedProps.has(dict.name)" (click)="selectProp(dict.name)"></td> --> + </td> <td> <img *ngIf="dict.definition?.property?.required" src="/assets/img/icon-required-yes.svg"> @@ -193,9 +203,22 @@ </div> <div id="mapping-table-res" [hidden]="mappingRes?.length == 0" class="mapping-table mx-4 my-2"> + <!-- <div class="btn-group mapping-editBar" role="group"> + <div class="custom-control custom-checkbox" tooltip="Select All" placement="bottom"> + <input type="checkbox" (click)="selectAllProps()" class="custom-control-input" + id="customCheck2" + [checked]="resourceDictionaryRes.length>0&&resourceDictionaryRes.length === this.selectedProps.size"> + <label class="custom-control-label" for="customCheck2"></label> + </div> + <button [disabled]="selectedProps.size <=0" type="button" class="btn" (click)="reMap()" + tooltip="Re-mapping" placement="bottom"><i class="icon-autoMap"></i></button> + <button [disabled]="selectedProps.size <=0" type="button" class="btn" (click)="removeProps()" + tooltip="Remove" placement="bottom"><i class="icon-delete-sm"></i></button> + </div> --> <table datatable [dtOptions]="dtOptions" [dtTrigger]="resTableDtTrigger" class="row-border hover"> <thead> <tr> + <!-- <th></th> --> <th>Required</th> <th>Parameter Name</th> <th>Dictionary Name</th> @@ -208,6 +231,14 @@ </thead> <tbody> <tr *ngFor="let dict of mappingRes"> + <!-- <td> + <div class="custom-control custom-checkbox" tooltip="Select" placement="bottom"> + <input type="checkbox" class="custom-control-input" + id="customCheck2-{{dict.name}}" [checked]="selectedProps.has(dict.name)" + (click)="selectProp(dict.name)"> + <label class="custom-control-label" for="customCheck2-{{dict.name}}"></label> + </div> + </td> --> <td> <img *ngIf="dict.definition?.property?.required" src="/assets/img/icon-required-yes.svg"> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts index 94fa3db99..9d94b6bf8 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts @@ -53,8 +53,8 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { currentMapping: any; edit = false; fileToDelete: any = {}; - parserFactory = new ParserFactory(); - selectedProps = new Set<string>(); + parserFactory: ParserFactory; + selectedProps: Set<string>; constructor( private packageCreationStore: PackageCreationStore, @@ -68,6 +68,8 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy { } ngOnInit() { + this.selectedProps = new Set<string>(); + this.parserFactory = new ParserFactory(); this.templateStore.state$.subscribe(templateInfo => { // init Template&mapping vars console.log('Oninit'); diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts index 50799a531..dae58a493 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts @@ -19,11 +19,11 @@ export class ImportPackageComponent implements OnInit { constructor(private packageCreationExtractionService: PackageCreationExtractionService, private packageCreationStore: PackageCreationStore, private router: Router) { - this.packageCreationStore.clear(); + } ngOnInit() { - this.packageCreationStore.clear(); + } removeInitFile(index) { @@ -72,7 +72,7 @@ export class ImportPackageComponent implements OnInit { public fileLeave(event) { console.log(event); } - +// TODO mix two function in ond bigger one saveFileToStore() { console.log(this.uploadedFiles.length); const file = this.getFile(this.uploadedFiles[this.uploadedFiles.length - 1]); |