aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client
diff options
context:
space:
mode:
authorAhmed <ahmed.eldeeb.ext@orange.com>2020-03-03 15:29:38 +0200
committerKAPIL SINGAL <ks220y@att.com>2020-03-06 16:23:50 +0000
commit88929cf6c21023328644fc637627371733b085d8 (patch)
tree3a097e24a3f7d0ac3a23c2f1ac275b6e12aaa3f1 /cds-ui/designer-client
parentfdfeef7ae2f543553e2f7a7cf322b6d075599e20 (diff)
Fixing some bugs in package creation tabs
Issue-ID: CCSDK-2123 Signed-off-by: Ahmed <ahmed.eldeeb.ext@orange.com> Change-Id: Id7a457470b14ab3491d4e6b9bdd74ef93990dd2c
Diffstat (limited to 'cds-ui/designer-client')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts14
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html27
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts26
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html3
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts47
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html4
6 files changed, 66 insertions, 55 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
index bc31e6c25..dc0cf7f3b 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
@@ -1,7 +1,7 @@
-import {Component, OnInit} from '@angular/core';
-import {FileSystemFileEntry, NgxFileDropEntry} from 'ngx-file-drop';
-import {PackageCreationStore} from '../package-creation.store';
-import {PackageCreationUtils} from '../package-creation.utils';
+import { Component, OnInit } from '@angular/core';
+import { FileSystemFileEntry, NgxFileDropEntry } from 'ngx-file-drop';
+import { PackageCreationStore } from '../package-creation.store';
+import { PackageCreationUtils } from '../package-creation.utils';
@Component({
@@ -18,6 +18,8 @@ export class ImportsTabComponent implements OnInit {
public files: NgxFileDropEntry[] = [];
constructor(private packageCreationStore: PackageCreationStore, private packageCreationUtils: PackageCreationUtils) {
+ }
+ ngOnInit(): void {
this.packageCreationStore.state$.subscribe(cbaPackage => {
if (cbaPackage.definitions && cbaPackage.definitions.imports && cbaPackage.definitions.imports.size > 0) {
this.definitionFiles = cbaPackage.definitions.imports;
@@ -25,10 +27,6 @@ export class ImportsTabComponent implements OnInit {
});
}
- ngOnInit(): void {
- // TODO
- }
-
public dropped(files: NgxFileDropEntry[]) {
this.files = files;
for (const droppedFile of files) {
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 0ae8efb47..89724be79 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
@@ -2,12 +2,11 @@
<div class="single-line">
<label class="label-name">Mode</label>
<label name="trst" *ngFor="let mode of modes; let i = index">
- <input class="form-check-input" [(ngModel)]="metaDataTab.mode" type="radio" name="exampleRadios"
- id="exampleRadios1" value={{mode.name}}>
+ <input class="form-check-input" [(ngModel)]="modeType" type="radio" name="radioMode" id="radioMode"
+ [value]="mode.name">
<span>
- <i [className]="mode.style" aria-hidden="true"
- [id]="mode.name"></i>
+ <i [className]="mode.style" aria-hidden="true" [id]="mode.name"></i>
{{mode.name}}
</span>
</label>
@@ -31,7 +30,7 @@
<label class="label-name">Name <span>*</span></label>
<div class="label-input">
<input type="input" [readOnly]="!packageNameAndVersionEnables" [(ngModel)]="metaDataTab.name"
- placeholder="Topology name.vLB.CDS">
+ placeholder="Topology name.vLB.CDS">
</div>
<!--<div class="model-note-container error-message">
Package name already exists with this version. Please enter a different name or enter different version
@@ -42,8 +41,8 @@
<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)="validatePackageNameAndVersion()"
- placeholder="Example: 1.0.0">
+ <input type="input" [readOnly]="!packageNameAndVersionEnables" [(ngModel)]="metaDataTab.version"
+ (input)="validatePackageNameAndVersion()" placeholder="Example: 1.0.0">
</div>
<div class="model-note-container error-message">{{errorMessage}}</div>
</div>
@@ -58,13 +57,13 @@
<label class="label-name">tags</label>
<div class="label-input">
<input type="input" (keyup.enter)="addTag($event)" [(ngModel)]="metaDataTab.tags"
- placeholder="Ex., vDNS-CDS">
+ placeholder="Ex., vDNS-CDS">
</div>
<div class="model-note-container tag-notes">Seprate tags with comma or space</div>
<div class="model-note-container tages-container">
<span *ngFor="let tag of tags" class="single-tage">{{tag}} <i (click)="removeTag(tag)"
- class="fa fa-times-circle"></i></span>
+ class="fa fa-times-circle"></i></span>
</div>
</div>
</div>
@@ -91,8 +90,8 @@
</div>
</div>
<div class="single-line-custom-key-delete">
- <button (click)="removeKey($event,map.key)"
- class="custom-key-delete"><i aria-hidden="true" class="icon-delete"></i></button>
+ <button (click)="removeKey($event,map.key)" class="custom-key-delete"><i aria-hidden="true"
+ class="icon-delete"></i></button>
</div>
</div>
@@ -101,14 +100,14 @@
<label class="label-name"><span>{{customKeysMap.size + 1}}.</span> Name</label>
<div class="label-input">
<input (keyup.enter)="addCustomKey()" name="key" type="input" class="mapKey"
- placeholder="Enter name">
+ placeholder="Enter name">
</div>
</div>
<div class="single-line-custom-key">
<label class="label-name">Value</label>
<div class="label-input">
<input (keyup.enter)="addCustomKey()" class="mapValue" name="value" type="input"
- placeholder="Enter value">
+ placeholder="Enter value">
</div>
</div>
<!-- <div class="single-line-custom-key-delete"><button (click)="removeKey($event)"
@@ -117,4 +116,4 @@
</div>
</div>
-</div>
+</div> \ No newline at end of file
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 63c10ad7b..3a9b7b880 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({
@@ -15,16 +15,18 @@ export class MetadataTabComponent implements OnInit {
counter = 0;
tags = new Set<string>();
customKeysMap = new Map();
- modes: object[] = [
- {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'}];
+ modes: any[] = [
+ { name: 'Designer Mode', style: 'mode-icon icon-designer-mode' }];
/* {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'},
{name: 'Generic Script Mode', style: 'mode-icon icon-generic-script-mode'}];*/
+ modeType = this.modes[0].name;
private metaDataTab: MetaDataTabModel = new MetaDataTabModel();
private errorMessage: string;
- constructor(private route: ActivatedRoute,
- private packageCreationService: PackageCreationService,
- private packageCreationStore: PackageCreationStore
+ constructor(
+ private route: ActivatedRoute,
+ private packageCreationService: PackageCreationService,
+ private packageCreationStore: PackageCreationStore
) {
}
@@ -32,6 +34,7 @@ export class MetadataTabComponent implements OnInit {
ngOnInit() {
this.metaDataTab.templateTags = this.tags;
this.metaDataTab.mapOfCustomKey = this.customKeysMap;
+ this.metaDataTab.mode = this.modeType;
const id = this.route.snapshot.paramMap.get('id');
id ? this.packageNameAndVersionEnables = false :
@@ -46,8 +49,9 @@ export class MetadataTabComponent implements OnInit {
this.tags = element.metaData.templateTags;
this.metaDataTab.templateTags = this.tags;
console.log(element);
- if (element.metaData.mode && element.metaData.mode.includes(' DEFAULT')) {
+ if (element.metaData.mode && element.metaData.mode.includes('DEFAULT')) {
this.metaDataTab.mode = 'Designer Mode';
+ this.modeType = this.metaDataTab.mode;
}
this.customKeysMap = element.metaData.mapOfCustomKey;
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html
index 8d1894c57..5dd68ed72 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html
@@ -24,7 +24,8 @@
aria-expanded="false" class="btn btn-link collapsed" data-toggle="collapse">
<i class="icon-file-code"></i> {{file.key}}
</button>
- <a (click)="removeFile(mapIndex)" class="accordion-delete"><i class="icon-delete"></i></a>
+ <a (click)="removeFile(file.key,mapIndex)" class="accordion-delete"><i
+ class="icon-delete"></i></a>
</h5>
</div>
<div [attr.aria-labelledby]="'head-script-'+mapIndex" [id]="'id-script-'+mapIndex" class="collapse"
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts
index 36cccc88c..5387489a2 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts
@@ -1,6 +1,6 @@
-import {Component, OnInit} from '@angular/core';
-import {FileSystemFileEntry, NgxFileDropEntry} from 'ngx-file-drop';
-import {PackageCreationStore} from '../package-creation.store';
+import { Component, OnInit } from '@angular/core';
+import { FileSystemFileEntry, NgxFileDropEntry } from 'ngx-file-drop';
+import { PackageCreationStore } from '../package-creation.store';
import 'ace-builds/src-noconflict/ace';
import 'ace-builds/webpack-resolver';
@@ -18,9 +18,7 @@ export class ScriptsTabComponent implements OnInit {
constructor(
private packageCreationStore: PackageCreationStore,
- ) {
-
- }
+ ) { }
ngOnInit() {
@@ -29,13 +27,6 @@ export class ScriptsTabComponent implements OnInit {
this.scriptsFiles = cbaPackage.scripts.files;
}
});
-
- /* this.packageStore.state$.subscribe(res => {
- // this.scriptsFiles =
- console.log('from scripts');
- console.log(res.scripts);
- this.scriptsFiles = res.scripts.files;
- });*/
}
public dropped(files: NgxFileDropEntry[]) {
@@ -52,11 +43,18 @@ export class ScriptsTabComponent implements OnInit {
}
}
- removeFile(fileIndex: number) {
- console.log(this.uploadedFiles[fileIndex]);
- const filename = 'Scripts/' + this.uploadedFiles[fileIndex].name;
- this.packageCreationStore.removeFileFromState(filename);
- this.uploadedFiles.splice(fileIndex, 1);
+ removeFile(filePath: string, FileIndex: number) {
+ const filename = filePath.split('/')[2] || '';
+ // const filename = 'Scripts/' + this.getFileType(this.uploadedFiles[fileIndex].name) + '/' + this.uploadedFiles[fileIndex].name;
+ this.packageCreationStore.removeFileFromState(filePath);
+ // remove from upload files array
+ // tslint:disable-next-line: prefer-for-of
+ for (let i = 0; i < this.uploadedFiles.length; i++) {
+ if (this.uploadedFiles[i].name === filename) {
+ this.uploadedFiles.splice(i, 1);
+ break;
+ }
+ }
}
public fileOver(event) {
@@ -73,7 +71,7 @@ export class ScriptsTabComponent implements OnInit {
droppedFile.file((file: File) => {
const fileReader = new FileReader();
fileReader.onload = (e) => {
- this.packageCreationStore.addScripts('Scripts/' + droppedFile.name,
+ this.packageCreationStore.addScripts('Scripts/' + this.getFileType(droppedFile.name) + '/' + droppedFile.name,
fileReader.result.toString());
};
fileReader.readAsText(file);
@@ -82,6 +80,17 @@ export class ScriptsTabComponent implements OnInit {
}
}
+ getFileType(filename: string): string {
+ let fileType = '';
+ const fileExtension = filename.substring(filename.lastIndexOf('.') + 1);
+ if (fileExtension === 'py') {
+ fileType = 'python';
+ } else if (fileExtension === 'kt') {
+ fileType = 'kotlin';
+ }
+ return fileType;
+ }
+
resetTheUploadedFiles() {
this.uploadedFiles = [];
}
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
index f57ab100b..502e098d3 100644
--- a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
@@ -5,14 +5,14 @@
<div class="overflow-container">
<ul class="menu-dropdown">
<li class="active">
- <a routerLink="packages/list">Packages</a>
+ <a routerLink="/packages">Packages</a>
<span class="icon">
<!-- <i class="fa fa-dashboard"></i> -->
<i class="icon-package"></i>
</span>
</li>
<li class="menu-hasdropdown">
- <a href="#">Data Dictionary</a>
+ <a >Data Dictionary</a>
<span class="icon">
<i class="icon-dictionary"></i>
</span>