From cf5670c44399d0a0e010928da871b6aeca197404 Mon Sep 17 00:00:00 2001
From: Bryan Burkholder <771133+bryanlb@users.noreply.github.com>
Date: Wed, 27 Mar 2024 16:13:34 -0700
Subject: [PATCH] Fix date handling, field count, small css teaks (#56)
---
CHANGELOG.md | 13 +++++++
package.json | 2 +-
src/datasource/components/Logs/LogsCell.tsx | 25 ++++++------
src/pages/explore.tsx | 42 +++++++--------------
4 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0cb2e4..82b4916 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.6.1
+### New features
+* N/A
+
+### Breaking changes
+* N/A
+
+### Bugs squashed
+* Resolved a date timezone formatting issue where dates were incorrectly rendered on explore page
+* Disabled field type icon as this was rendering incorrect types
+* Addressed some text alignment and overflow bugs
+* Fixed available field count not including top fields
+
## 0.6.0
### New features
* N/A
diff --git a/package.json b/package.json
index b075ec9..c576385 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "slack-astra-app",
- "version": "0.6.0",
+ "version": "0.6.1",
"description": "Grafana Astra App",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
diff --git a/src/datasource/components/Logs/LogsCell.tsx b/src/datasource/components/Logs/LogsCell.tsx
index 2ee9ad4..5ee5f5f 100644
--- a/src/datasource/components/Logs/LogsCell.tsx
+++ b/src/datasource/components/Logs/LogsCell.tsx
@@ -158,22 +158,23 @@ const DocumentCell = (log: Log, style: any, rowIndex: number, expanded: boolean,
fontFamily: 'monospace',
fontSize: '12px',
overflow: 'hidden',
- paddingTop: '10px',
+ paddingTop: '5px',
...style
}}
>
-
- {
- Array.from(log.keys()).map((key) => (
- key !== logMessageField ?
+
+
+ {
+ Array.from(log.keys()).map((key) => (
+ key !== logMessageField ?
- : <>>
- ))
- }
+ : <>>
+ ))
+ }
{
expanded ?
@@ -224,7 +225,7 @@ const TimestampCell = (timestamp: string, style: any, rowIndex: number, expanded
/>
<>
- {dateTimeParse(timestamp, {timeZone: getTimeZone()}).format("YYYY-MM-DD @ HH:mm:ss:SSS Z").toString()}
+ {dateTimeParse(new Date(timestamp), {timeZone: getTimeZone()}).format("YYYY-MM-DD @ HH:mm:ss:SSS Z").toString()}
>
);
diff --git a/src/pages/explore.tsx b/src/pages/explore.tsx
index b0f0906..b151bf8 100644
--- a/src/pages/explore.tsx
+++ b/src/pages/explore.tsx
@@ -22,7 +22,7 @@ import {
TextBoxVariable,
VariableValueSelectors,
} from '@grafana/scenes';
-import { AppRootProps, DataFrame } from '@grafana/data';
+import { AppRootProps, DataFrame, FieldType } from "@grafana/data";
import {
Button,
DrawStyle,
@@ -187,35 +187,22 @@ const AstraQueryRenderer = ({ model }: SceneComponentProps) => {
const AstraFieldsList = (fields: Field[], topTenMostPopularFields: Field[], datasourceUserConfig: DatasourceUserConfig) => {
const getIcon = (field: Field): string => {
- if (field.type === 'string') {
- return 'fa fas fa-font';
- }
+ // todo - since these all come back as string currently, return
+ return 'fa fas fa-circle';
- if (field.type === 'text') {
+ if (field.type === FieldType.string) {
return 'fa fas fa-font';
}
- if (field.type === 'integer') {
- return 'fa fas fa-hashtag';
- }
-
- if (field.type === 'float') {
- return 'fa fas fa-hashtag';
- }
-
- if (field.type === 'double') {
- return 'fa fas fa-hashtag';
- }
-
- if (field.type === 'long') {
+ if (field.type === FieldType.number) {
return 'fa fas fa-hashtag';
}
- if (field.type === 'boolean') {
- return 'fa fas fa-lightbulb';
+ if (field.type === FieldType.boolean) {
+ return 'fa fas fa-lightbulb-o';
}
- if (field.type === 'time') {
+ if (field.type === FieldType.time) {
return 'fa far fa-calendar';
}
@@ -283,16 +270,15 @@ const AstraFieldsList = (fields: Field[], topTenMostPopularFields: Field[], data
queryComponent.appendToQuery(`NOT ${field.name}: ${value}`)
}
>
-
);
@@ -300,7 +286,7 @@ const AstraFieldsList = (fields: Field[], topTenMostPopularFields: Field[], data
return (
-
+
{
({height, width}) => {
@@ -375,7 +361,7 @@ const AstraFieldsRenderer = ({ model }: SceneComponentProps) => {
-
+
{visible ? AstraFieldsList(fields, topTenMostPopularFields, datasourceUserConfig) : null}