diff options
author | 2020-12-15 20:30:59 +0200 | |
---|---|---|
committer | 2020-12-15 20:30:59 +0200 | |
commit | 1a1d0f5011351c0935f3be712e4f8f35496e16b5 (patch) | |
tree | 22bc489a0954e44b182fdb761b63755248771f43 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts | |
parent | 8d75eab6147cc6ad6b0fcc290631f7fadbd840c1 (diff) |
adding scripts features by allowing creating from scratch
Issue-ID: CCSDK-3051
Signed-off-by: Eltanany Shaaban <shaaban.eltanany.ext@orange.com>
Change-Id: I0c0fe79db8c49b40ac310d146c1dcd17c7a6597d
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.ts | 28 |
1 files changed, 28 insertions, 0 deletions
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 fb275a04a..60be0d7ba 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 @@ -19,6 +19,10 @@ export class ScriptsTabComponent implements OnInit { public files: NgxFileDropEntry[] = []; private fileNames: Set<string> = new Set(); fileToDelete: any = {}; + currentFileName: any; + scriptExtension: any; + currentFileContent = ''; + currentExtension = ''; constructor( private packageCreationStore: PackageCreationStore, @@ -123,4 +127,28 @@ export class ScriptsTabComponent implements OnInit { divElement.setAttribute('class', 'collapse show'); } } + + textCurrentChanges() { + console.log(this.currentFileName); + console.log(this.currentFileContent); + if (this.currentFileName) { + let fileExtension = 'kt'; + if (this.currentExtension.includes('python')) { + fileExtension = 'py'; + } else if (this.currentExtension.includes('ansible')) { + fileExtension = 'yaml'; + } + this.packageCreationStore.addScripts('Scripts/' + this.currentExtension + '/' + this.currentFileName + '.' + fileExtension + , this.currentFileContent); + this.toastService.success('the ' + this.currentFileName + ' has been added'); + this.currentFileName = ''; + this.currentExtension = ''; + this.currentFileContent = ''; + } + } + + changeExtension() { + this.currentExtension = this.scriptExtension; + console.log(this.scriptExtension); + } } |