summaryrefslogtreecommitdiffstats
path: root/cds-ui/client
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client')
-rw-r--r--cds-ui/client/package.json4
-rw-r--r--cds-ui/client/src/app/common/modules/README.md22
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/blueprint.component.html5
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts1
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts66
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html16
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts22
7 files changed, 108 insertions, 28 deletions
diff --git a/cds-ui/client/package.json b/cds-ui/client/package.json
index 796bf3aa6..9ad47413d 100644
--- a/cds-ui/client/package.json
+++ b/cds-ui/client/package.json
@@ -32,9 +32,11 @@
"d3": "^5.9.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
+ "jszip": "^3.2.0",
"material-design-icons": "^3.0.1",
"ng2-ace-editor": "^0.3.9",
"rxjs": "6.3.3",
+ "stream": "0.0.2",
"tslib": "^1.9.0",
"zone.js": "0.8.26"
},
@@ -59,4 +61,4 @@
"tslint": "5.11.0",
"typescript": "3.1.6"
}
-} \ No newline at end of file
+}
diff --git a/cds-ui/client/src/app/common/modules/README.md b/cds-ui/client/src/app/common/modules/README.md
new file mode 100644
index 000000000..196842e93
--- /dev/null
+++ b/cds-ui/client/src/app/common/modules/README.md
@@ -0,0 +1,22 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+This folder contains common module. All the third party imports/libraries, that could be used at many components, should be imported here into a single module and that module can be used across. \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.component.html b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.component.html
index 5098d563f..32369376c 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.component.html
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END============================================ -->
+
<!-- <app-cbawizard [appName]="appName"></app-cbawizard>
<router-outlet></router-outlet> -->
<mat-card class="CBAform">
@@ -32,10 +33,10 @@ limitations under the License.
<button mat-button matStepperNext class="matStepNextBtn">Proceed</button>
</div>
</mat-step>
- <mat-step [stepControl]="thirdFormGroup">
+ <!-- <mat-step [stepControl]="thirdFormGroup">
<ng-template matStepLabel>Deploy</ng-template>
<app-deploy-template></app-deploy-template>
- </mat-step>
+ </mat-step> -->
<mat-step [stepControl]="thirdFormGroup">
<ng-template matStepLabel>Test</ng-template>
<app-test-template></app-test-template>
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
index 9073d10cf..46dca73dd 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
@@ -31,6 +31,7 @@ import { IAppState } from '../../../../common/core/store/state/app.state';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model';
+import { LoadBlueprintSuccess } from '../../../../common/core/store/actions/blueprint.action';
interface FoodNode {
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 5fe28e7f9..c6b6cc78b 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -19,13 +19,15 @@ limitations under the License.
============LICENSE_END============================================
*/
-import { Component, OnInit, EventEmitter, Output } from '@angular/core';
+import { Component, OnInit, EventEmitter, Output, ViewChild } from '@angular/core';
import { Store } from '@ngrx/store';
+import * as JSZip from 'jszip';
+import { Observable } from 'rxjs';
+
import { IBlueprint } from '../../../../common/core/store/models/blueprint.model';
import { IBlueprintState } from '../../../../common/core/store/models/blueprintState.model';
import { IAppState } from '../../../../common/core/store/state/app.state';
import { LoadBlueprintSuccess } from '../../../../common/core/store/actions/blueprint.action';
-import { Observable } from 'rxjs';
@Component({
selector: 'app-search-template',
@@ -39,6 +41,14 @@ export class SearchTemplateComponent implements OnInit {
blueprintState: IBlueprintState;
bpState: Observable<IBlueprintState>;
+ @ViewChild('fileInput') fileInput;
+ result: string = '';
+
+ public paths = [];
+ public tree;
+ private zipFile: JSZip = new JSZip();
+ private fileObject: any;
+
constructor(private store: Store<IAppState>) { }
ngOnInit() {
@@ -46,8 +56,15 @@ export class SearchTemplateComponent implements OnInit {
fileChanged(e: any) {
this.file = e.target.files[0];
+
+ // this.zipFile.loadAsync(this.file)
+ // .then((zip) => {
+ // if(zip) {
+ // this.buildFileViewData(zip);
+ // }
+ // });
}
-
+
updateBlueprintState() {
let fileReader = new FileReader();
fileReader.readAsText(this.file);
@@ -57,4 +74,47 @@ export class SearchTemplateComponent implements OnInit {
me.store.dispatch(new LoadBlueprintSuccess(data));
}
}
+
+ async buildFileViewData(zip) {
+ for (var file in zip.files) {
+ this.fileObject = {
+ name: zip.files[file].name,
+ data: ''
+ };
+ const value = <any>await zip.files[file].async('string');
+ this.fileObject.data = value;
+ this.paths.push(this.fileObject);
+ }
+ this.arrangeTreeData(this.paths);
+ }
+
+ arrangeTreeData(paths) {
+ const tree = [];
+
+ paths.forEach((path) => {
+
+ const pathParts = path.name.split('/');
+ pathParts.shift();
+ let currentLevel = tree;
+
+ pathParts.forEach((part) => {
+ const existingPath = currentLevel.filter(level => level.name === part);
+
+ if (existingPath.length > 0) {
+ currentLevel = existingPath[0].children;
+ } else {
+ const newPart = {
+ name: part,
+ children: [],
+ data: path.data
+ };
+
+ currentLevel.push(newPart);
+ currentLevel = newPart.children;
+ }
+ });
+ });
+ console.log('tree: ', tree);
+ return tree;
+ }
}
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
index 2ee660fbd..3ad578d36 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
@@ -25,15 +25,21 @@
<input matInput placeholder="Tags" formControlName="_tags">
</mat-form-field>
<mat-form-field class="form-field">
- <input matInput placeholder="Data Type" formControlName="_type">
+ <mat-select matInput placeholder="Data Type" formControlName="_type">
+ <mat-option value="string">string</mat-option>
+ <mat-option value="string">list</mat-option>
+ </mat-select>
</mat-form-field>
- <mat-form-field class="form-field" >
- <textarea matInput placeholder="Description" formControlName="_description"></textarea>
+ <mat-form-field class="form-field" >
+ <input matInput placeholder="entry_schema" formControlName="entry_schema">
</mat-form-field>
<mat-form-field class="form-field" >
- <input matInput placeholder="required" formControlName="_required">
+ <mat-select placeholder="required" formControlName="_required">
+ <mat-option value="true">true</mat-option>
+ <mat-option value="false">false</mat-option>
+ </mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
- <input matInput placeholder="entry_schema" formControlName="entry_schema">
+ <textarea matInput placeholder="Description" formControlName="_description"></textarea>
</mat-form-field>
</form> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
index bc309f4f8..f44c9b0d1 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
@@ -20,7 +20,6 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
-import sample_licenses from '../../../../../assets/sample-licenses.json';
@Component({
selector: 'app-resource-metadata',
@@ -30,28 +29,17 @@ import sample_licenses from '../../../../../assets/sample-licenses.json';
export class ResourceMetadataComponent implements OnInit {
ResourceMetadata: FormGroup;
- data=sample_licenses;
constructor(private _formBuilder: FormBuilder) {
this.ResourceMetadata = this._formBuilder.group({
Resource_Name: ['', Validators.required],
_tags: ['', Validators.required],
_description : ['', Validators.required],
- _type: ['', Validators.required],
- _required: ['', Validators.required],
- entry_schema: ['', Validators.required]
- });
+ _type: ['string', Validators.required],
+ _required: ['false', Validators.required],
+ entry_schema: ['']
+ });
}
- ngOnInit() {
- this.ResourceMetadata = this._formBuilder.group({
- Resource_Name: [this.data["name"], Validators.required],
- _tags: [this.data["tags"], Validators.required],
- _required : [this.data["property"]["required"], Validators.required],
- _description : [this.data["property"]["description"], Validators.required],
- _type: [this.data["property"]["type"], Validators.required],
- entry_schema: [this.data["property"]["entry_schema"]["type"], Validators.required]
- });
-
- }
+ ngOnInit() {}
}