Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feat/add_function_trace' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed Apr 30, 2024
2 parents 4669893 + fdae2a0 commit 976f1de
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const FeatureArea: FC = () => {

const handleClickFunction = () => {
const isEmptyTeam = getIsEmptyTeam(store.getState())
TipisTrack.track("click_function_entry")
TipisTrack.track("click_function_dashboard_tab")

if (isEmptyTeam) {
TipisTrack.track("click_create_team_entry", {
Expand Down
9 changes: 5 additions & 4 deletions apps/agent/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "@/i18n"
import { initI18n } from "@/i18n"
import App from "./App.tsx"
import store from "./redux/store.ts"
import { TIPISStorage } from "./utils/storage/index.ts"

if (import.meta.env.ILLA_APP_ENV === "production") {
Sentry.init({
Expand All @@ -21,16 +22,16 @@ if (import.meta.env.ILLA_APP_ENV === "production") {
if (import.meta.env.ILLA_MUI_LICENSE) {
LicenseInfo.setLicenseKey(import.meta.env.ILLA_MUI_LICENSE)
}

initGTMConfig()
initI18n().then(() => {
createRoot(document.getElementById("root")!).render(
<StrictMode>
<PostHogProvider
apiKey={
import.meta.env.ILLA_APP_ENV !== "production"
? ""
: import.meta.env.ILLA_POSTHOG_KEY
import.meta.env.ILLA_APP_ENV === "production" ||
TIPISStorage.getSessionStorage("openPostHog") === true
? import.meta.env.ILLA_POSTHOG_KEY
: ""
}
>
<Provider store={store}>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PenIcon,
PlusIcon,
} from "@illa-public/icon"
import { TipisTrack } from "@illa-public/track-utils"
import { ErrorText } from "@/Layout/Form/ErrorText"
import LayoutBlock from "@/Layout/Function/LayoutBlock"
import IntegrationSelectorModal from "@/Modules/Integration/CreateOrSelectIntegration/modal"
Expand All @@ -33,9 +34,10 @@ import {
const IntegrationEditor = memo(() => {
const { t } = useTranslation()
const { control } = useFormContext<IFunctionForm>()
const integrationType = useWatch({

const [integrationType, aiToolID] = useWatch({
control,
name: "resourceType",
name: ["resourceType", "aiToolID"],
})

const currentTeamInfo = useGetCurrentTeamInfo()!
Expand Down Expand Up @@ -71,6 +73,12 @@ const IntegrationEditor = memo(() => {
CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP,
SELECT_INTEGRATION_STEP.SELECT_OR_CREATE,
)
TipisTrack.track("function_add_integration", {
parameter1: aiToolID
? "edit_function"
: "create_function",
parameter2: integrationType,
})
setCreateOrSelectModalShow(true)
}}
>
Expand All @@ -86,6 +94,12 @@ const IntegrationEditor = memo(() => {
CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP,
SELECT_INTEGRATION_STEP.SELECT_OR_CREATE,
)
TipisTrack.track("function_change_integration", {
parameter1: aiToolID
? "edit_function"
: "create_function",
parameter2: integrationType,
})
setCreateOrSelectModalShow(true)
}}
>
Expand All @@ -104,6 +118,12 @@ const IntegrationEditor = memo(() => {
<div
css={buttonStyle}
onClick={() => {
TipisTrack.track("function_edit_integration", {
parameter1: aiToolID
? "edit_function"
: "create_function",
parameter2: integrationType,
})
IntegrationEventEmitter.emit(
CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP,
SELECT_INTEGRATION_STEP.EDIT,
Expand All @@ -124,6 +144,10 @@ const IntegrationEditor = memo(() => {
changeOpen={setCreateOrSelectModalShow}
integrationType={integrationType}
onConfirm={async (integrationID) => {
TipisTrack.track("integration_save", {
parameter1: aiToolID ? "edit_function" : "create_function",
parameter2: integrationType,
})
try {
const integrationList = await dispatch(
integrationAPI.endpoints.getIntegrationList.initiate(
Expand Down
5 changes: 5 additions & 0 deletions apps/agent/src/page/WorkSpace/Function/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next"
import { useBeforeUnload, useParams } from "react-router-dom"
import { getFunctionInitDataByType } from "@illa-public/public-configs"
import { IBaseFunction, TIntegrationType } from "@illa-public/public-types"
import { TipisTrack } from "@illa-public/track-utils"
import { getCurrentId } from "@illa-public/user-data"
import WorkspacePCHeaderLayout from "@/Layout/Workspace/pc/components/Header"
import { useCreateAIToolMutation } from "@/redux/services/aiToolsAPI"
Expand Down Expand Up @@ -75,6 +76,10 @@ const CreateFunction: FC = () => {
}, [values])

const createFunctionWhenSubmit = async (data: IFunctionForm) => {
TipisTrack.track("create_function", {
parameter1: "edit_function",
parameter2: data.resourceType,
})
const icon = data.config.icon

const aiTool: IBaseFunction = {
Expand Down
5 changes: 5 additions & 0 deletions apps/agent/src/page/WorkSpace/Function/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FormProvider, useForm, useWatch } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { useBeforeUnload, useParams } from "react-router-dom"
import { IBaseFunction } from "@illa-public/public-types"
import { TipisTrack } from "@illa-public/track-utils"
import { getCurrentId } from "@illa-public/user-data"
import WorkspacePCHeaderLayout from "@/Layout/Workspace/pc/components/Header"
import FullSectionLoading from "@/components/FullSectionLoading"
Expand Down Expand Up @@ -157,6 +158,10 @@ const EditFunction: FC<IEditFunctionProps> = ({ originData, cacheData }) => {
}, [currentTeamInfo.id, functionID, values])

const updateFunctionWhenSubmit = async (data: IFunctionForm) => {
TipisTrack.track("function_save", {
parameter1: "edit_function",
parameter2: data.resourceType,
})
const icon = data.config.icon

const aiTool: IBaseFunction = {
Expand Down
2 changes: 2 additions & 0 deletions apps/agent/src/page/WorkSpace/Function/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ export interface IIntegrationInfo {

export interface ITencentCosFunctionForm
extends Omit<ITencentCosFunction, "resourceID"> {
aiToolID: string
integrationInfo: IIntegrationInfo
}

export interface ILarkBotFunctionForm
extends Omit<IFunctionInterface, "resourceID"> {
aiToolID: string
integrationInfo: IIntegrationInfo
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { List } from "antd"
import Fuse from "fuse.js"
import { FC, useContext } from "react"
import { TipisTrack } from "@illa-public/track-utils"
import FullSectionLoading from "@/components/FullSectionLoading"
import TeamNoData from "@/components/TeamNoData"
import { useGetAllAIToolsListQuery } from "@/redux/services/aiToolsAPI"
Expand All @@ -22,6 +23,9 @@ const TeamCardList: FC<ITeamCardListProps> = (props) => {
const { data, isLoading } = useGetAllAIToolsListQuery(currentTeamInfo.id)

const handleClickCreateTipis = () => {
TipisTrack.track("click_create_function_entry", {
parameter1: "dashboard_create",
})
changeCreateFunctionModal(true)
}

Expand Down Expand Up @@ -67,6 +71,7 @@ const TeamCardList: FC<ITeamCardListProps> = (props) => {
description={item.description}
publishToMarketplace={item.publishedToMarketplace}
id={item.aiToolID}
type={item.resourceType}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { ComponentType } from "react"
import { TIntegrationType } from "@illa-public/public-types"

export interface ITeamCardListItemProps {
icon: string
title: string
publishToMarketplace: boolean
description: string
id: string
type: TIntegrationType
}

export interface ITeamCardListProps {
RenderItem: ComponentType<ITeamCardListItemProps>
}
3 changes: 1 addition & 2 deletions apps/agent/src/page/WorkSpace/FunctionDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { FC, lazy, useEffect } from "react"
import { LayoutAutoChange } from "@illa-public/layout-auto-change"
import { useAddExploreFunctionsTab } from "@/utils/recentTabs/hook"
import { FunctionDashboardUIStateProvider } from "./context/functionDashboard"
import FunctionsMobileDashboard from "./mobile"

const FunctionsPCDashboard = lazy(() => import("./pc"))
// const TipisMobileDashboard = lazy(() => import("./mobile"))
const FunctionsMobileDashboard = lazy(() => import("./mobile"))

const FunctionsDashboard: FC = () => {
const addExploreFunctionTab = useAddExploreFunctionsTab()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Icon from "@ant-design/icons"
import { Button, Input } from "antd"
import { FC, useContext } from "react"
import { PlusIcon, SearchIcon } from "@illa-public/icon"
import { TipisTrack } from "@illa-public/track-utils"
import { useSearchFunctionDashboard } from "../../../utils"
import { FunctionDashboardContext } from "../../context"
import { headerToolsContainerStyle } from "./style"
Expand All @@ -11,6 +12,10 @@ const HeaderTools: FC = () => {
const { searchValue, handleChangeSearchValue } = useSearchFunctionDashboard()

const handleClickCreateFunction = () => {
TipisTrack.track("click_create_function_entry", {
parameter1: "dashboard_create",
})

changeCreateFunctionModal(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { App, Button, Dropdown, List, MenuProps, Tag } from "antd"
import { FC, MouseEventHandler, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
import { CopyIcon, DeleteIcon, MoreIcon, PenIcon } from "@illa-public/icon"
import { TipisTrack } from "@illa-public/track-utils"
import PCTeamCard from "@/components/TeamCard/pc"
import {
useDeleteAIToolByIDMutation,
Expand All @@ -12,10 +13,10 @@ import { canShowCreateFunction } from "@/utils/UIHelper/functions"
import { canShownCreateTipi } from "@/utils/UIHelper/tipis"
import { useNavigateToEditFunction } from "@/utils/routeHelper/hook"
import { useGetCurrentTeamInfo } from "@/utils/team"
import { ITeamCardListItemProps } from "./interface"
import { ITeamCardListItemProps } from "../../../components/TeamCardList/interface"

const TeamCardListItem: FC<ITeamCardListItemProps> = (props) => {
const { icon, title, description, id, publishToMarketplace } = props
const { icon, title, description, id, publishToMarketplace, type } = props
const { modal, message } = App.useApp()

const { t } = useTranslation()
Expand Down Expand Up @@ -94,10 +95,13 @@ const TeamCardListItem: FC<ITeamCardListItemProps> = (props) => {
}
}

const onClickCard = () => {}

const onClickEditButton: MouseEventHandler<HTMLElement> = async (e) => {
e.stopPropagation()
TipisTrack.track("click_function_card_edit", {
parameter1: "dashboard_edit",
parameter2: type,
})

await navigateToEditFunction({
functionName: title,
functionID: id,
Expand All @@ -116,7 +120,6 @@ const TeamCardListItem: FC<ITeamCardListItemProps> = (props) => {
title={title}
description={description}
tags={tags}
onClickCard={onClickCard}
moreButton={
menuItems.length > 0 && (
<Dropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
export interface ITeamCardListItemProps {
icon: string
title: string
publishToMarketplace: boolean
description: string
id: string
}

0 comments on commit 976f1de

Please sign in to comment.