Просмотр исходного кода

[frontend] Show query results in the SQL Scratchpad example

Johan Ahlen 4 лет назад
Родитель
Сommit
bf8d9285e2

+ 2 - 2
desktop/core/src/desktop/js/apps/editor/components/result/ResultTable.vue

@@ -150,13 +150,13 @@
 
     mounted(): void {
       this.subTracker.subscribe(EXECUTABLE_UPDATED_EVENT, (executable: Executable) => {
-        if (this.executable.id === executable.id) {
+        if (this.executable && this.executable.id === executable.id) {
           this.updateFromExecutable(executable);
         }
       });
 
       this.subTracker.subscribe(RESULT_UPDATED_EVENT, (executionResult: ExecutionResult) => {
-        if (this.executable.id === executionResult.executable.id) {
+        if (this.executable && this.executable.id === executionResult.executable.id) {
           this.handleResultChange();
         }
       });

+ 3 - 3
tools/examples/components/sql-scratchpad/src/App.css

@@ -1,18 +1,18 @@
 .app {
   height: 100%;
-  background-color: #282c34;
+  background-color: #ccc;
   display: flex;
   flex-direction: column;
 }
 
 .app > .app-header {
   flex: 0 0 32px;
-  background-color: #282c34;
+  background-color: #ccc;
   align-items: center;
   text-align: center;
   justify-content: center;
   font-size: 25px;
-  color: white;
+  color: #282c34;
 }
 
 .inline-block {

+ 1 - 1
tools/examples/components/sql-scratchpad/src/components/SqlScratchpad.tsx

@@ -71,7 +71,7 @@ export class SqlScratchpad extends React.Component<{}, SqlScratchpadState> {
           <ExecuteActions activeExecutable={this.state.activeExecutable}/>
         </div>
         <div className="result-table">
-          <ResultTable/>
+          <ResultTable activeExecutable={this.state.activeExecutable}/>
         </div>
       </React.Fragment>
     } else {