Skip to content

Commit

Permalink
Merge branch 'platform-ui-report-file-sql' into 'master'
Browse files Browse the repository at this point in the history
fix: fileID representation of SQL report files

See merge request postgres-ai/database-lab!899
  • Loading branch information
NikolayS committed Aug 20, 2024
2 parents dc655b1 + bf2ae74 commit e7e7dac
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions ui/packages/platform/src/components/ReportFile/ReportFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { Component, HTMLAttributeAnchorTarget } from 'react'
import { TextField, Button } from '@material-ui/core'
import { Button, TextField } from '@material-ui/core'
import ReactMarkdown from 'react-markdown'
import rehypeRaw from 'rehype-raw'
import remarkGfm from 'remark-gfm'
Expand Down Expand Up @@ -124,15 +124,13 @@ const textAreaStyles = (

class ReportFile extends Component<ReportFileWithStylesProps, ReportFileState> {
getFileId() {
let id = parseInt(this.props.match.params.fileId, 10)
/* eslint eqeqeq: 1 */
id =
id == parseInt(this.props.match.params.fileId)
? id
: parseInt(this.props.match.params.fileId)
/* eslint eqeqeq: 0 */

return id
let fileID = this.props.match.params.fileId
let parseID = parseInt(fileID, 10)

// To distinct different fileIDs. For example, "72215" and "1_1.sql".
// {ORG_URL}/reports/268/files/72215/md
// {ORG_URL}/reports/268/files/1_1.sql/sql?raw
return (fileID.toString() == parseID.toString()) ? parseID : fileID
}

componentDidMount() {
Expand Down

0 comments on commit e7e7dac

Please sign in to comment.