Przeglądaj źródła

Explore: elastic small fixes (#18879)

- Fix cancellation error showing in UI
- Fix display of object values in log rows
Andrej Ocenas 6 lat temu
rodzic
commit
aab224ef29

+ 1 - 0
packages/grafana-ui/src/types/datasource.ts

@@ -425,6 +425,7 @@ export interface DataQueryError {
   status?: string;
   statusText?: string;
   refId?: string;
+  cancelled?: boolean;
 }
 
 export interface ScopedVar {

+ 3 - 1
public/app/core/logs_model.ts

@@ -260,7 +260,9 @@ export function logSeriesToLogsModel(logSeries: DataFrame[]): LogsModel {
       const timeLocal = time.format('YYYY-MM-DD HH:mm:ss');
       const timeUtc = toUtc(ts).format('YYYY-MM-DD HH:mm:ss');
 
-      const message = stringField.values.get(j);
+      let message = stringField.values.get(j);
+      // This should be string but sometimes isn't (eg elastic) because the dataFrame is not strongly typed.
+      message = typeof message === 'string' ? message : JSON.stringify(message);
 
       let logLevel = LogLevel.unknown;
       if (logLevelField) {

+ 1 - 1
public/app/features/explore/Table.tsx

@@ -46,7 +46,7 @@ export default class Table extends PureComponent<TableProps> {
       show: text !== 'Time',
       Cell: (row: any) => (
         <span className={filterable ? 'link' : ''} title={text + ': ' + row.value}>
-          {row.value}
+          {typeof row.value === 'string' ? row.value : JSON.stringify(row.value)}
         </span>
       ),
     }));

+ 4 - 0
public/app/features/explore/state/reducers.ts

@@ -589,6 +589,10 @@ export const processQueryResponse = (
   const replacePreviousResults = action.type === queryEndedAction.type;
 
   if (error) {
+    if (error.cancelled) {
+      return state;
+    }
+
     // For Angular editors
     state.eventBridge.emit('data-error', error);