diff options
Diffstat (limited to 'cds-ui/client/src/app/feature-modules')
6 files changed, 23 insertions, 53 deletions
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/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"> |