diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.html b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.html index e261a63e48..1bb704db1a 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.html +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.html @@ -21,7 +21,14 @@
- views.hql-editor.EQ +
+
+ views.hql-editor.EQ +
+ + + +
diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.ts index 35d686a043..28a6240dbc 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.component.ts @@ -53,6 +53,12 @@ export class SqlEditorComponent implements OnInit, OnDestroy{ @Input() height:number = 500; + /** + * Indicates if query execution failed + */ + @Input() + queryExecutionFailure:boolean; + @Output() sqlChange = new EventEmitter(); @@ -141,6 +147,10 @@ export class SqlEditorComponent implements OnInit, OnDestroy{ } } + overrideQueryFailureCheck() { + this.sqlChange.emit(this.sql); + } + ngOnInit(){ this.browseDatabasePlaceholder = this._translateService.instant('"views.hql-editor.Database') diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.module.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.module.ts index a3785c1145..49616dbd5e 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.module.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/shared/sql-editor/sql-editor.module.ts @@ -10,6 +10,7 @@ import {SqlEditorComponent} from "./sql-editor.component"; import {FlexLayoutModule} from "@angular/flex-layout"; import {CodemirrorModule} from "ng2-codemirror"; import {CovalentDialogsModule} from "@covalent/core/dialogs"; +import {CovalentMessageModule } from '@covalent/core/message'; import {TranslateModule} from "@ngx-translate/core"; import {MatProgressBarModule} from "@angular/material/progress-bar"; import {KyloCodeMirrorModule} from "../../../codemirror-require/codemirror.module"; @@ -38,6 +39,7 @@ import {KyloCodeMirrorModule} from "../../../codemirror-require/codemirror.modul KyloCodeMirrorModule, CodemirrorModule, CovalentDialogsModule, + CovalentMessageModule, TranslateModule ], providers: [ diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.html b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.html index 27817c0cc6..883932a2d7 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.html +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.html @@ -94,7 +94,7 @@ @@ -110,7 +110,7 @@ + [allowExecuteQuery]="false" [height]="400" *ngIf="advancedMode == true" (sqlChange)="advancedModeSql($event)" [queryExecutionFailure]="queryExecutionFailure"> diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.ts index f693c66ab6..f785d1eca9 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/build-query/build-query-ng2.component.ts @@ -112,6 +112,12 @@ export class BuildQueryComponent implements OnDestroy, OnChanges, OnInit { @Input() form: FormGroup; + /** + * Indicates if query execution failed + */ + @Input() + queryExecutionFailure:boolean; + /** * Event emitted to return to the previous step */ @@ -124,6 +130,12 @@ export class BuildQueryComponent implements OnDestroy, OnChanges, OnInit { @Output() next = new EventEmitter(); + /** + * Event emitted to indicate sql was changed + */ + @Output() + sqlChange = new EventEmitter(); + /** * Indicates if the UI is in advanced mode */ @@ -367,6 +379,7 @@ export class BuildQueryComponent implements OnDestroy, OnChanges, OnInit { this.model.sql = sql; this.validate(); } + this.sqlChange.emit(sql); return this.model.sql; } diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/services/spark/spark-query-engine.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/services/spark/spark-query-engine.ts index 5018f88ab7..2cd2b4dbaa 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/services/spark/spark-query-engine.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/services/spark/spark-query-engine.ts @@ -506,7 +506,7 @@ export class SparkQueryEngine extends QueryEngine { // Send the request - self.$http.post(this.apiUrl + "/transform", JSON.stringify(body), { + self.httpBackendClient.post(this.apiUrl + "/transform", JSON.stringify(body), { headers: {"Content-Type": "application/json"}, responseType: "json" }).toPromise().then(successCallback, errorCallback); diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.html b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.html index f1390455b0..a8562d6cea 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.html +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.html @@ -101,11 +101,11 @@

Sampling

- - + + diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.ts index 9164730346..891b937b20 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/transform-data.component.ts @@ -113,6 +113,12 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, @Output() next = new EventEmitter(); + /** + * Event emitted to indicate query failure + */ + @Output() + queryFailure = new EventEmitter(); + //Flag to determine if we can move on to the next step isValid: boolean = false; @@ -374,7 +380,9 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, // Initial load will trigger query from the table model. if (this.isLoaded) { - this.query(); + this.query().catch((result) => { + console.debug("Error executing query!"); + }); } this.isLoaded = true; }; @@ -708,16 +716,19 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, deferred.complete(); }; const errorCallback = (message: string) => { + console.debug("Query error!"); + this.queryFailure.emit(); this.setExecutingQuery(false); this.resetAllProgress(); - this.showError(this.cleanError(message)); // Reset state if (this.engine.canUndo()) { this.onUndo(); } this.removeExecution(promise); + this.hiveDataLoaded = false; deferred.error(message); + this.back.emit(); }; const notifyCallback = (progress: number) => { //self.setQueryProgress(progress * 100); @@ -1177,7 +1188,9 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, let rows = this.engine.getRows(); if (columns === null || rows === null) { - this.query(); + this.query().catch((result) => { + console.debug("Error executing query!"); + }); } else { this.updateGrid(); } @@ -1193,7 +1206,9 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, }); this.pushFormulaToEngine(`select(${fieldNames.join(',')})`, {}); - this.query(); + this.query().catch((result) => { + console.debug("Error executing query!"); + }); } //noinspection JSUnusedGlobalSymbols @@ -1240,7 +1255,9 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, this.query().catch(reason => { // reverse impact self.engine.restoreLastKnownState(); - this.query(); + this.query().catch((result) => { + console.debug("Error executing query!"); + }); this.functionHistory = this.engine.getHistory(); }); } @@ -1312,6 +1329,8 @@ export class TransformDataComponent implements AfterViewInit, ColumnController, feedModel.table.syncTableFieldPolicyNames() this.engine.save(); resolve(true); + }).catch((result) => { + console.debug("Error executing query!"); }); } }); diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/visual-query-table/visual-query-table.component.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/visual-query-table/visual-query-table.component.ts index c8aa884f0d..f33c47c260 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/visual-query-table/visual-query-table.component.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/transform-data/visual-query-table/visual-query-table.component.ts @@ -108,6 +108,9 @@ export class VisualQueryTable implements OnDestroy, OnChanges, OnInit { @Input("table-state") tableState: number; + @Input() + loadingInProgress: boolean = false; + /** * Previous state */ @@ -178,6 +181,12 @@ export class VisualQueryTable implements OnDestroy, OnChanges, OnInit { this.painter.headerFont = this.options.headerFont; this.painter.rowFont = this.options.rowFont } + if(changes.loadingInProgress) { + //if loading complete, refresh the screen to see the data values + if (changes.loadingInProgress.currentValue == false) { + this.refresh(); + } + } } ngOnInit() { diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.html b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.html index 8cd1355254..c3dc1fa304 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.html +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.html @@ -2,13 +2,15 @@ Build Query - + Transform Data + *ngIf="visitedTransform" + (queryFailure)="queryFailed()"> diff --git a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.ts b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.ts index e5a8e8750d..89a01dda34 100644 --- a/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.ts +++ b/ui/ui-app/src/main/resources/static/js/feed-mgr/visual-query/visual-query-stepper.component.ts @@ -81,6 +81,10 @@ export class VisualQueryStepperComponent implements OnInit, OnDestroy { */ visitedTransform = false; + /** + * Indicates if query execution has failed + */ + queryExecutionFailure = false; /** * Constructs a {@code VisualQueryComponent}. @@ -154,4 +158,19 @@ export class VisualQueryStepperComponent implements OnInit, OnDestroy { doSave() { this.save.emit(); } + + /** + * Indicate query failure + */ + queryFailed() { + this.queryExecutionFailure = true; + } + + /** + * Indicate SQL has changed + */ + sqlChanged() { + //reset flag to allow new query's execution + this.queryExecutionFailure = false; + } }