Skip to content

Commit

Permalink
Merge pull request #3663 from illacloud/Release/4.4.2
Browse files Browse the repository at this point in the history
Release/4.4.2
  • Loading branch information
Wangtaofeng authored Jan 30, 2024
2 parents cf99751 + 376cde9 commit cda9041
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 51 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
env:
ILLA_GOOGLE_MAP_KEY: ${{ secrets.ILLA_GOOGLE_MAP_KEY }}
ILLA_MIXPANEL_API_KEY: ${{ secrets.ILLA_MIXPANEL_API_KEY }}
ILLA_AMPLITUDE_API_KEY: ${{ secrets.ILLA_AMPLITUDE_API_KEY }}
ILLA_MUI_LICENSE: ${{ secrets.ILLA_MUI_LICENSE }}
ILLA_SENTRY_AUTH_TOKEN: ${{ secrets.ILLA_SENTRY_AUTH_TOKEN }}
DO_CLUSTER: ${{ secrets.DO_CLUSTER }}
Expand Down
1 change: 1 addition & 0 deletions apps/builder/.env.cloud
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ILLA_APP_VERSION=0.0.0
ILLA_APP_ENV=production
ILLA_GOOGLE_MAP_KEY=google_map_key
ILLA_MIXPANEL_API_KEY=0
ILLA_AMPLITUDE_API_KEY=0
ILLA_BUILDER_URL=BUILDER_PATH
ILLA_MARKET_URL=MARKET_PATH
ILLA_SENTRY_AUTH_TOKEN=SENTRY_AUTH_TOKEN
2 changes: 1 addition & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "ILLA Cloud <[email protected]>",
"license": "Apache-2.0",
"version": "4.4.1",
"version": "4.4.2",
"scripts": {
"dev": "vite --strictPort --force",
"build-cloud": "NODE_OPTIONS=--max-old-space-size=12288 vite build --mode cloud",
Expand Down
78 changes: 44 additions & 34 deletions apps/builder/src/page/AI/components/MarkdownMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ReactMarkdown from "react-markdown"
import rehypeRaw from "rehype-raw"
import rehypeSanitize from "rehype-sanitize"
import remarkGfm from "remark-gfm"
import { Link, Paragraph } from "@illa-design/react"
import { Heading, Link, Paragraph, Typography } from "@illa-design/react"
import { MarkdownMessageProps } from "@/page/AI/components/MarkdownMessage/interface"
import { markdownMessageStyle } from "@/page/AI/components/MarkdownMessage/style"
import { HTMLTags } from "@/widgetLibrary/TextWidget/constans"
Expand All @@ -29,39 +29,49 @@ export const MarkdownMessage: FC<MarkdownMessageProps> = (props) => {

return (
<StyledEngineProvider injectFirst>
<ReactMarkdown
css={markdownMessageStyle}
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, [rehypeSanitize, sanitizeOptions]]}
components={{
a: ({ href, children }) => (
<Link href={href} target="_blank" colorScheme="blue">
{children}
</Link>
),
p: ({ children }) => <Paragraph>{children}</Paragraph>,
tr: ({ children }) => <TableRow>{children}</TableRow>,
th: ({ children }) => (
<TableCell align="center">{children}</TableCell>
),
td: ({ children }) => <TableCell align="left">{children}</TableCell>,
thead: ({ children }) => <TableHead>{children}</TableHead>,
tbody: ({ children }) => <TableBody>{children}</TableBody>,
tfoot: ({ children }) => <TableFooter>{children}</TableFooter>,
table: ({ children }) => (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }}>{children}</Table>
</TableContainer>
),
code: ({ children }) => (
<pre>
<CodeBlock theme={github} language="jsx" text={`${children}`} />
</pre>
),
}}
>
{children ?? ""}
</ReactMarkdown>
<Typography>
<ReactMarkdown
css={markdownMessageStyle}
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, [rehypeSanitize, sanitizeOptions]]}
components={{
h1: ({ children }) => <Heading level="h1">{children}</Heading>,
h2: ({ children }) => <Heading level="h2">{children}</Heading>,
h3: ({ children }) => <Heading level="h3">{children}</Heading>,
h4: ({ children }) => <Heading level="h4">{children}</Heading>,
h5: ({ children }) => <Heading level="h5">{children}</Heading>,
h6: ({ children }) => <Heading level="h6">{children}</Heading>,
a: ({ href, children }) => (
<Link href={href} target="_blank" colorScheme="blue">
{children}
</Link>
),
p: ({ children }) => <Paragraph>{children}</Paragraph>,
tr: ({ children }) => <TableRow>{children}</TableRow>,
th: ({ children }) => (
<TableCell align="center">{children}</TableCell>
),
td: ({ children }) => (
<TableCell align="left">{children}</TableCell>
),
thead: ({ children }) => <TableHead>{children}</TableHead>,
tbody: ({ children }) => <TableBody>{children}</TableBody>,
tfoot: ({ children }) => <TableFooter>{children}</TableFooter>,
table: ({ children }) => (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }}>{children}</Table>
</TableContainer>
),
code: ({ children }) => (
<pre>
<CodeBlock theme={github} language="jsx" text={`${children}`} />
</pre>
),
}}
>
{children ?? ""}
</ReactMarkdown>
</Typography>
</StyledEngineProvider>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { isObject, isString } from "lodash-es"
import { v4 } from "uuid"
import { isNumber } from "@illa-design/react"
import { JSToString, stringToJS } from "@/utils/evaluateDynamicString/utils"
import { UNIQUE_ID_NAME } from "@/widgetLibrary/DataGridWidget/constants"

export function dealRawData2ArrayData(rawData: unknown): object[] {
export function dealRawData2ArrayData(
rawData: unknown,
enableServerSidePagination?: boolean,
serverSideOffset?: number,
): object[] {
if (rawData === undefined || rawData === "" || rawData === null) {
return []
}
Expand All @@ -13,33 +16,45 @@ export function dealRawData2ArrayData(rawData: unknown): object[] {
return []
} else {
if (isObject(rawData[0])) {
return rawData.map((item) => {
return rawData.map((item, i) => {
let uniqueID = i
if (enableServerSidePagination && serverSideOffset) {
uniqueID = serverSideOffset + i
}
return {
[UNIQUE_ID_NAME]: v4(),
[UNIQUE_ID_NAME]: uniqueID,
...item,
}
})
} else {
return rawData.map((item) => {
return rawData.map((item, i) => {
let uniqueID = i
if (enableServerSidePagination && serverSideOffset) {
uniqueID = serverSideOffset + i
}
return {
[UNIQUE_ID_NAME]: v4(),
[UNIQUE_ID_NAME]: uniqueID,
field: item,
}
})
}
}
} else {
let uniqueID = 0
if (enableServerSidePagination && serverSideOffset) {
uniqueID = serverSideOffset
}
if (isObject(rawData)) {
return [
{
[UNIQUE_ID_NAME]: v4(),
[UNIQUE_ID_NAME]: uniqueID,
...rawData,
},
]
} else {
return [
{
[UNIQUE_ID_NAME]: v4(),
[UNIQUE_ID_NAME]: uniqueID,
field: rawData,
},
]
Expand Down
8 changes: 4 additions & 4 deletions apps/builder/src/router/loader/cloudAuthLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
} from "@illa-public/user-data"
import { canAccessManage } from "@illa-public/user-role-utils"
import {
getAuthToken,
getILLACloudURL,
isCloudVersion,
sendConfigEvent,
setAuthToken,
} from "@illa-public/utils"
import { getAuthToken } from "@illa-public/utils"
import { LoaderFunction, redirect } from "react-router-dom"
import i18n from "@/i18n/config"
import { fetchMyTeamsInfo } from "@/services/team"
Expand Down Expand Up @@ -52,16 +52,16 @@ export const getUserInfoLoader: LoaderFunction = async () => {
i18n.changeLanguage(lng)
window.location.reload()
}
ILLAMixpanel.getMixpanelInstance()?.identify(response.data.userID)
ILLAMixpanel.setUserID(response.data.userID)
const reportedUserInfo: Record<string, any> = {}
Object.entries(response.data).forEach(([key, value]) => {
reportedUserInfo[`illa_${key}`] = value
})
ILLAMixpanel.getMixpanelInstance()?.people.set(reportedUserInfo)
ILLAMixpanel.setUserProperties(reportedUserInfo)
store.dispatch(currentUserActions.updateCurrentUserReducer(response.data))
return null
} catch (e) {
ILLAMixpanel.getMixpanelInstance()?.reset()
ILLAMixpanel.reset()
return redirect("/403")
}
}
Expand Down
10 changes: 8 additions & 2 deletions apps/builder/src/widgetLibrary/DataGridWidget/dataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ export const DataGridWidget: FC<BaseDataGridProps> = (props) => {
} = props

const rawData = dataSourceMode === "dynamic" ? dataSourceJS : dataSource
const serverSideOffset = (page ?? 0) * (pageSize ?? 10)

const arrayData: object[] = useMemo(
() => dealRawData2ArrayData(rawData),
[rawData],
() =>
dealRawData2ArrayData(
rawData,
enableServerSidePagination,
serverSideOffset,
),
[rawData, enableServerSidePagination, serverSideOffset],
)

const ref = useRef<GridApiPremium>(null) as MutableRefObject<GridApiPremium>
Expand Down
27 changes: 26 additions & 1 deletion apps/builder/src/widgetLibrary/TextWidget/text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { FC, useEffect, useLayoutEffect, useRef } from "react"
import {
Table,
TableBody,
TableCell,
TableContainer,
TableFooter,
TableHead,
TableRow,
} from "@mui/material"
import Paper from "@mui/material/Paper"
import React, { FC, useEffect, useLayoutEffect, useRef } from "react"
import ReactMarkdown from "react-markdown"
import rehypeRaw from "rehype-raw"
import rehypeSanitize from "rehype-sanitize"
Expand Down Expand Up @@ -95,6 +105,21 @@ export const Text: FC<TextProps> = (props) => {
{children}
</Heading>
),
tr: ({ children }) => <TableRow>{children}</TableRow>,
th: ({ children }) => (
<TableCell align="center">{children}</TableCell>
),
td: ({ children }) => (
<TableCell align="left">{children}</TableCell>
),
thead: ({ children }) => <TableHead>{children}</TableHead>,
tbody: ({ children }) => <TableBody>{children}</TableBody>,
tfoot: ({ children }) => <TableFooter>{children}</TableFooter>,
table: ({ children }) => (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }}>{children}</Table>
</TableContainer>
),
}}
>
{value ?? ""}
Expand Down
2 changes: 1 addition & 1 deletion packages/illa-public-component
55 changes: 55 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cda9041

Please sign in to comment.