Skip to content

Commit 390cb62

Browse files
committed
Merge branch 'joe-history-issues' into 'master'
fix (ui): Joe/History issues and improvements (platform#215) See merge request postgres-ai/database-lab!646
2 parents 48f7518 + 5e4764b commit 390cb62

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

ui/packages/platform/src/components/Dashboard/Dashboard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
415415
a: (props) => {
416416
const { href, target, children } = props
417417
return (
418-
<Link to={href as string} target={target}>
419-
{children as string}
418+
<Link to={String(href)} target={target}>
419+
{String(children)}
420420
</Link>
421421
)
422422
},
@@ -438,8 +438,8 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
438438
a: (props) => {
439439
const { href, target, children } = props
440440
return (
441-
<Link to={href as string} target={target}>
442-
{children as string}
441+
<Link to={String(href)} target={target}>
442+
{String(children)}
443443
</Link>
444444
)
445445
},

ui/packages/platform/src/components/FlameGraph.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class FlameGraph extends Component<FlameGraphProps, FlameGraphState> {
164164
let explainJson
165165

166166
try {
167-
explainJson = JSON.parse(this.props.data as string)
167+
explainJson = JSON.parse(String(this.props.data))
168168
} catch (err) {
169169
this.setNoData(prevState as FlameGraphState, true)
170170
return

ui/packages/platform/src/components/JoeHistory/JoeHistory.tsx

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,6 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
321321
this.unsubscribe()
322322
}
323323

324-
componentDidUpdate(prevProps: JoeHistoryProps) {
325-
if (JSON.stringify(prevProps) !== JSON.stringify(this.props)) {
326-
let filter = this.buildFilter()
327-
filter && this.applyFilter(filter, false)
328-
}
329-
}
330-
331324
onCommandClick(
332325
_: MouseEvent<HTMLTableRowElement, globalThis.MouseEvent>,
333326
project: string,
@@ -372,7 +365,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
372365
return queryParams
373366
}
374367

375-
applyFilter(value?: string, changeUrl?: boolean) {
368+
applyFilter(value?: string, changeUrl = true) {
376369
const { orgId } = this.props
377370
let filterValue =
378371
typeof value !== 'undefined' ? value : this.state.searchFilter
@@ -402,7 +395,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
402395
}
403396
}
404397
} else {
405-
queryParams = this.getQueryParams(filterValue as string)
398+
queryParams = this.getQueryParams(filterValue)
406399
}
407400

408401
let search = filterValue
@@ -424,7 +417,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
424417
}
425418
}
426419

427-
queryParams.search = search?.trim() as string
420+
queryParams.search = search?.trim()
428421

429422
Object.keys(queryParams).forEach(
430423
(key) =>
@@ -498,7 +491,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
498491
return userName
499492
}
500493

501-
return this.state.data?.userProfile?.data.info.email as string
494+
return String(this.state.data?.userProfile?.data.info.email)
502495
}
503496

504497
getSessionId(command: CommandDataProps) {
@@ -597,7 +590,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
597590
const isFilterAvailable =
598591
(commandStore &&
599592
commandStore.isHistoryExists &&
600-
commandStore.isHistoryExists[orgId as number]) ||
593+
commandStore.isHistoryExists[orgId]) ||
601594
commands.length > 0 ||
602595
(commands.length === 0 &&
603596
(this.state.searchFilter ? this.state.searchFilter : '') !== '')
@@ -836,7 +829,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
836829
title={
837830
format.formatTimestampUtc(
838831
c['created_at'],
839-
) as string
832+
) ?? ''
840833
}
841834
classes={{ tooltip: classes.toolTip }}
842835
>
@@ -986,7 +979,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
986979
inline
987980
title={
988981
this.state.searchFilter === ''
989-
? 'There is no Joe Bot history yet'
982+
? 'No bot – no history (yet)'
990983
: 'No commands matching the filters.'
991984
}
992985
actions={
@@ -1018,9 +1011,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
10181011
disabled={commandStore && commandStore.isProcessing}
10191012
onClick={() => this.addInstance()}
10201013
>
1021-
<span className={classes.whiteSpace}>
1022-
Add instance
1023-
</span>
1014+
<span className={classes.whiteSpace}>Add Joe</span>
10241015
</Button>
10251016
),
10261017
},
@@ -1030,9 +1021,12 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
10301021
>
10311022
{this.state.searchFilter === '' ? (
10321023
<p>
1033-
Joe Bot is a virtual DBA for SQL Optimization. Joe helps
1034-
engineers quickly troubleshoot and optimize SQL. Joe runs on
1035-
top of the Database Lab Engine. (
1024+
Joe Bot is a virtual DBA helping engineers analyze and
1025+
optimize PostgreSQL queries. It provides a convenient,
1026+
chat-like interface to full-size Postgres clones that are
1027+
provisioned and seconds, behaves as production (same execution
1028+
plans, same data volumes), writable and isolated for safe
1029+
"what if" experiments to check various optimization ideas (
10361030
<Link to="https://postgres.ai/docs/joe" target="_blank">
10371031
Learn more
10381032
</Link>

0 commit comments

Comments
 (0)