summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-16 13:33:15 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-16 13:33:15 +0000
commit583ab2d2660ea46d67301c239cbafa70f0aed075 (patch)
treeb960dfbdba5dfbe137889b0bd5d930535806e9af
parent8344dc8ae21ece556581b9820b0f018e68ae4a0d (diff)
parent695f9a8c735d27bbae3dddfccc87a6efe1c36cee (diff)
Merge "Test template- display message"
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html12
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts16
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts5
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts39
4 files changed, 65 insertions, 7 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
index da3580cd5..c69c511e6 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
@@ -18,21 +18,25 @@ See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END============================================
-->
-<div class="testTemplateContainer">
+<div style="border: 1px solid #3f51b5; padding: 1em;">
+ <i class="fa fa-exclamation-circle" style="color: #3f51b5" aria-hidden="true"></i>
+
+</div>
+<div class="testTemplateContainer">
<div class="editorContainer">
<div class="editorDiv">
<p>Request</p>
- <ace-editor [(text)]="text" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
+ <ace-editor [(text)]="requestText" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
<div class="btnContainer">
- <button class="button">Submit</button>
+ <button class="button" (click)="submitRequest()">Submit</button>
<button class="button">Clear</button>
</div>
</div>
<div class="editorDiv">
<p>Response</p>
- <ace-editor [(text)]="text" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
+ <ace-editor [(text)]="responseText" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
</div>
</div>
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
index 9a7a570ad..63c00e508 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
@@ -30,6 +30,7 @@ import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState
import { IBlueprint } from 'src/app/common/core/store/models/blueprint.model';
import { IMetaData } from '../../../common/core/store/models/metadata.model';
import { LoadBlueprintSuccess } from 'src/app/common/core/store/actions/blueprint.action';
+import { TestTemplateService } from './test-template.service'
import "ace-builds/webpack-resolver";
import 'brace';
@@ -47,8 +48,10 @@ export class TestTemplateComponent implements OnInit {
private workflows = [];
@ViewChild('editor') editor;
options: any = { fontSize: "100%", printMargin: false, tabSize: 2 };
+ requestText: string;
+ responseText: string;
- constructor(private store: Store<IAppState>) {
+ constructor(private store: Store<IAppState>, private testTemplateService: TestTemplateService) {
this.blueprintpState = this.store.select('blueprint')
.subscribe((data: any) => {
console.log(data);
@@ -81,4 +84,15 @@ export class TestTemplateComponent implements OnInit {
}
+ submitRequest() {
+ this.testTemplateService.submitRequest(this.requestText)
+ .subscribe((response) =>{
+ this.responseText = response;
+ window.alert('Success');
+ },
+ (error)=>{
+ this.responseText = "Error in processing request";
+ })
+ }
+
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
index ea5b5ffb2..6eca01877 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
@@ -25,7 +25,7 @@ import { TestTemplateComponent } from './test-template.component';
import { TestTemplateRoutingModule } from './test-template-routing.module';
import { AppMaterialModule } from '../../../common/modules/app-material.module';
import { AceEditorModule } from 'ng2-ace-editor';
-
+import { TestTemplateService } from './test-template.service';
@NgModule({
declarations: [
TestTemplateComponent
@@ -38,6 +38,7 @@ import { AceEditorModule } from 'ng2-ace-editor';
AppMaterialModule,
TestTemplateRoutingModule,
AceEditorModule
- ]
+ ],
+ providers: [TestTemplateService]
})
export class TestTemplateModule { }
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
new file mode 100644
index 000000000..8df8e78a6
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
@@ -0,0 +1,39 @@
+/*
+============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============================================
+*/
+
+
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable, observable } from 'rxjs';
+import { ApiService } from '../../../common/core/services/api.service';
+import { LoopbackConfig } from '../../../common/constants/app-constants';
+
+@Injectable()
+export class TestTemplateService {
+ // blueprintUrl = '../../constants/blueprint.json';
+
+ constructor(private _http: HttpClient, private api: ApiService) {
+ }
+
+ submitRequest(request) {
+ return this.api.get('', request);
+ }
+} \ No newline at end of file