diff options
Diffstat (limited to 'cds-ui/client/src/app')
13 files changed, 97 insertions, 84 deletions
diff --git a/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts b/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts index cadf4f9e3..7457f2f8c 100644 --- a/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts +++ b/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts @@ -20,7 +20,7 @@ limitations under the License. */ export interface ITopologyTemplate { - inputs: object; - node_template: object; - workflow: object; + inputs: object[]; + node_template: object[]; + workflow: object[]; }
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/shared.module.ts b/cds-ui/client/src/app/common/shared/shared.module.ts index 4ee7cca87..8db020d52 100644 --- a/cds-ui/client/src/app/common/shared/shared.module.ts +++ b/cds-ui/client/src/app/common/shared/shared.module.ts @@ -25,16 +25,19 @@ import { HomeComponent } from './components/home/home.component'; import { CBAWizardComponent } from './components/cbawizard/cbawizard.component'; import { MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule} from '@angular/material'; import { RouterModule } from "@angular/router"; +import { SearchPipe } from './pipes/search.pipe'; @NgModule({ declarations: [ HomeComponent, - CBAWizardComponent + CBAWizardComponent, + SearchPipe ], exports: [ HomeComponent, - CBAWizardComponent + CBAWizardComponent, + SearchPipe ], imports: [ CommonModule, diff --git a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts index 8368592fd..3a25e92f0 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts @@ -31,8 +31,7 @@ import { ModifyTemplateModule } from './modify-template/modify-template.module'; import { DeployTemplateModule } from './deploy-template/deploy-template.module'; import { TestTemplateModule } from './test-template/test-template.module'; -import { MatToolbarModule, MatButtonModule, MatSidenavModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule} from '@angular/material'; -import { MatIconModule } from '@angular/material/icon'; +import { AppMaterialModule } from '../../../app/common/modules/app-material.module'; @NgModule({ declarations: [ @@ -42,22 +41,7 @@ import { MatIconModule } from '@angular/material/icon'; CommonModule, BlueprintRoutingModule, SharedModule, - MatToolbarModule, - MatButtonModule, - MatSidenavModule, - MatIconModule, - MatListModule, - MatGridListModule, - MatCardModule, - MatMenuModule, - MatTableModule, - MatPaginatorModule, - MatSortModule, - MatInputModule, - MatSelectModule, - MatRadioModule, - MatFormFieldModule, - MatStepperModule, + AppMaterialModule, SelectTemplateModule, ModifyTemplateModule, DeployTemplateModule, diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/designer/designer.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/designer/designer.component.ts index b332f8fe4..b8f88d90c 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/designer/designer.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/designer/designer.component.ts @@ -19,7 +19,7 @@ limitations under the License. ============LICENSE_END============================================ */ -import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; +import { Component, OnInit, ViewChild, ElementRef, Output, EventEmitter } from '@angular/core'; import * as d3 from 'd3'; import { text } from 'd3'; @@ -29,7 +29,7 @@ import { text } from 'd3'; styleUrls: ['./designer.component.scss'] }) export class DesignerComponent implements OnInit { - + @Output() onNodeSelect = new EventEmitter(); @ViewChild('svgArea') graphContainer: ElementRef; dataForsimulation; svg; @@ -116,8 +116,6 @@ export class DesignerComponent implements OnInit { .attr('cx', 97) .attr('cy', 20) .attr('r', 5) - .attr('width', 10) - .attr('height', 10) .attr('fill', 'orange') if(d.requirementsArray) { @@ -127,8 +125,6 @@ export class DesignerComponent implements OnInit { .attr('cx', 97) .attr('cy', 60) .attr('r', 5) - .attr('width', 10) - .attr('height', 10) .attr('fill', 'blue') requirement.x = xbyMath + 95; requirement.y = ybyMath + 60; @@ -142,8 +138,6 @@ export class DesignerComponent implements OnInit { .attr('cx', 97) .attr('cy', 40) .attr('r', 5) - .attr('width', 10) - .attr('height', 10) .attr('fill', 'green'); capability.x = xbyMath + 97; capability.y = ybyMath + 40; @@ -245,4 +239,8 @@ export class DesignerComponent implements OnInit { console.log('mouse over'); } + trigerNodeSelectEvent(d) { + this.onNodeSelect.emit(d); +} + } diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html index 1ba944a30..d59597021 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html @@ -50,18 +50,10 @@ limitations under the License. <div class="outerDiv divtwo" (click)="on = !on" ondrop="dropcalled(event)" ondragover="allowDrop(event)" id="svgDiv"> - <!-- <canvas class="cnv" height="500"> --> - <!-- <div cdkDropList #doneList="cdkDropList" [cdkDropListData]="done" [cdkDropListConnectedTo]="[pendingList,reviewList]" - style="height: 100%;width: 100%" (cdkDropListDropped)="drop($event)"> --> - <!-- <canvas id="canvasArea" class="cnv" height="500" width="500" (click)="selected($event)"> --> - <!-- <div class="item-box" *ngFor="let item of done" cdkDrag>{{item}}</div> --> - <!-- </canvas> --> - <!-- </div> --> - <!-- </canvas> --> - <!-- <svg id="svgArea" width="1000px" height="100%" style="background-color: #C0C0C0"> --> - <!-- <rect x="0" y="0" width="300" height="200" fill="yellow"></rect> --> - <!-- </svg> --> - <app-designer></app-designer> + <button style="cursor: pointer; position: absolute;top: 4em;right: 27em; padding: 6px;color: white; background-color:#3f51b5;margin-right: 2em;border-radius: 2em; ">Enrichment</button> + <button (click) ="changeView()" style="cursor: pointer; position: absolute;top: 4em;right: 22em; padding: 6px;color: white;background-color:#3f51b5; border-radius: 2em">{{viewText}}</button> + <app-designer *ngIf="designerMode" (onNodeSelect)="on = !on; viewNodeDetails($event)"></app-designer> + <app-editor *ngIf="editorMode"></app-editor> </div> diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.ts index a02bb97fa..1efdefce6 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.ts @@ -28,9 +28,29 @@ import { Component, OnInit } from '@angular/core'; }) export class ModifyTemplateComponent implements OnInit { + designerMode: boolean = true; + editorMode: boolean = false; + viewText: string = "Editor View"; + constructor() { } ngOnInit() { } + viewNodeDetails(nodeTemplate) { + console.log(nodeTemplate); + } + + changeView() { + if(this.viewText == 'Editor View') { + this.editorMode = true; + this.designerMode = false; + this.viewText = 'Designer View' + } else { + this.editorMode = false; + this.designerMode = true; + this.viewText = 'Editor View' + } + } + } diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.module.ts index 9ccb9977f..1ab7a8045 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.module.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.module.ts @@ -26,11 +26,13 @@ import { ModifyTemplateComponent } from './modify-template.component'; import { ModifyTemplateRoutingModule } from './modify-template-routing.module'; import { AppMaterialModule } from '../../../common/modules/app-material.module'; import { DesignerComponent } from './designer/designer.component'; +import { EditorComponent } from './editor/editor.component'; @NgModule({ declarations: [ ModifyTemplateComponent, - DesignerComponent + DesignerComponent, + EditorComponent ], exports: [ ModifyTemplateComponent, diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts index 176cc55a7..cfcb6471a 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts @@ -19,10 +19,14 @@ limitations under the License. ============LICENSE_END============================================ */ -import { Component, OnInit, EventEmitter, Output } from '@angular/core'; +import { Component, OnInit, EventEmitter, Output, AfterViewInit, AfterContentInit, OnChanges, DoCheck, AfterViewChecked } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { IMetaData } from '../../../../common/core/store/models/metadata.model'; import { A11yModule } from '@angular/cdk/a11y'; +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'; @Component({ selector: 'app-metadata', @@ -32,11 +36,11 @@ import { A11yModule } from '@angular/cdk/a11y'; export class MetadataComponent implements OnInit { CBAMetadataForm: FormGroup; metadata: IMetaData; + bpState: Observable<IBlueprintState>; @Output() metadataform = new EventEmitter<IMetaData>(); - constructor(private formBuilder: FormBuilder) { } - - ngOnInit() { + constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) { + this.bpState = this.store.select('blueprint'); this.CBAMetadataForm = this.formBuilder.group({ template_author: ['', Validators.required], author_email: ['', Validators.required], @@ -46,9 +50,33 @@ export class MetadataComponent implements OnInit { template_tags: ['', Validators.required] }); } + + ngOnInit() { + this.bpState.subscribe( + blueprintdata => { + var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess }; + this.metadata = blueprintState.blueprint.metadata; + let metadatavalues = []; + for (let key in this.metadata) { + if (this.metadata.hasOwnProperty(key)) { + metadatavalues.push(this.metadata[key]); + } + } + let temp_author = metadatavalues[0]; + console.log(temp_author); + this.CBAMetadataForm = this.formBuilder.group({ + template_author: [metadatavalues[0], Validators.required], + author_email: [metadatavalues[1], Validators.required], + user_groups: [metadatavalues[2], Validators.required], + template_name: [metadatavalues[3], Validators.required], + template_version: [metadatavalues[4], Validators.required], + template_tags: [metadatavalues[5], Validators.required] + }); + }) + } + UploadMetadata() { this.metadata = Object.assign({}, this.CBAMetadataForm.value); - console.log(this.metadata.template_author); this.metadataform.emit(this.metadata); } diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html index f97ea0ee7..b6cd90286 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html @@ -22,5 +22,5 @@ limitations under the License. <input type="file" accept=".json" (change)="fileChanged($event)"> </div> <div> - <button mat-button matStepperNext class="matStepNextBtn" (click)="extractBlueprint()">Upload</button> + <button mat-button matStepperNext class="matStepNextBtn" (click)="updateBlueprintState()">Upload</button> </div>
\ No newline at end of file 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 3a344c9fc..5fe28e7f9 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 @@ -21,7 +21,11 @@ limitations under the License. import { Component, OnInit, EventEmitter, Output } from '@angular/core'; import { Store } from '@ngrx/store'; -import { IBlueprint} from '../../../../common/core/store/models/blueprint.model'; +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', @@ -29,25 +33,28 @@ import { IBlueprint} from '../../../../common/core/store/models/blueprint.model' styleUrls: ['./search-template.component.scss'] }) export class SearchTemplateComponent implements OnInit { - file: any; + file: File; localBluePrintData: IBlueprint; fileText: object[]; - - constructor() { } + blueprintState: IBlueprintState; + bpState: Observable<IBlueprintState>; + + constructor(private store: Store<IAppState>) { } - ngOnInit() { } + ngOnInit() { + } fileChanged(e: any) { this.file = e.target.files[0]; + } + + updateBlueprintState() { let fileReader = new FileReader(); - fileReader.readAsText(e.srcElement.files[0]); + fileReader.readAsText(this.file); var me = this; fileReader.onload = function () { - let fileData = JSON.stringify(fileReader.result); - me.localBluePrintData = JSON.parse(fileData); - console.log(me.localBluePrintData); + var data: IBlueprint = JSON.parse(fileReader.result.toString()); + me.store.dispatch(new LoadBlueprintSuccess(data)); } } - extractBlueprint(){ - } } diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.module.ts index f586246d2..16947d4c8 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.module.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.module.ts @@ -28,9 +28,6 @@ import { SelectTemplateComponent } from './select-template.component'; import { SelectTemplateRoutingModule } from './select-template-routing.module'; import { AppMaterialModule } from 'src/app/common/modules/app-material.module'; -import { MatToolbarModule, MatButtonModule, MatSidenavModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule} from '@angular/material'; -import { MatIconModule } from '@angular/material/icon'; - @NgModule({ declarations: [ TemplateOptionsComponent, @@ -48,22 +45,6 @@ import { MatIconModule } from '@angular/material/icon'; CommonModule, SelectTemplateRoutingModule, ReactiveFormsModule, - MatToolbarModule, - MatButtonModule, - MatSidenavModule, - MatIconModule, - MatListModule, - MatGridListModule, - MatCardModule, - MatMenuModule, - MatTableModule, - MatPaginatorModule, - MatSortModule, - MatInputModule, - MatSelectModule, - MatRadioModule, - MatFormFieldModule, - MatStepperModule, AppMaterialModule ] }) diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html index 83c9ae2c0..c488dfdd7 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html @@ -33,7 +33,7 @@ </div> </mat-step> <mat-step [stepControl]="step2FormGroup"> - <ng-template matStepLabel>Browse Template file</ng-template> + <ng-template matStepLabel>Browse or Search Resources</ng-template> <app-upload-resource (change)="fileChange(fileupload.files)"></app-upload-resource><br><br> <app-existing-model></app-existing-model> <div> diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.html index 6de9648bc..279842b83 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.html @@ -19,6 +19,4 @@ */--> -<p> - upload-resource works! -</p> +<input type="file" accept=".zip"> |