diff --git a/webapp/packages/supersonic-fe/src/app.tsx b/webapp/packages/supersonic-fe/src/app.tsx index 59e2040c0..2af0917f7 100644 --- a/webapp/packages/supersonic-fe/src/app.tsx +++ b/webapp/packages/supersonic-fe/src/app.tsx @@ -126,6 +126,11 @@ export async function patchRoutes({ routes }) { } } +export function onRouteChange() { + const title = window.document.title.split('-SuperSonic')[0]; + window.document.title = `${title}-SuperSonic`; +} + export const layout: RunTimeLayoutConfig = (params) => { const { initialState } = params as any; return { diff --git a/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSetting.tsx b/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSetting.tsx index 3cd46ffa0..28a378997 100644 --- a/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSetting.tsx +++ b/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSetting.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { connect, Helmet } from 'umi'; +import { connect } from 'umi'; import type { StateType } from '../model'; import OverviewContainer from '../OverviewContainer'; import type { Dispatch } from 'umi'; @@ -11,7 +11,6 @@ type Props = { const ChatSetting: React.FC = () => { return ( <> - ); diff --git a/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSettingSection.tsx b/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSettingSection.tsx index 6edc9f16b..eb3dbfa68 100644 --- a/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSettingSection.tsx +++ b/webapp/packages/supersonic-fe/src/pages/SemanticModel/ChatSetting/ChatSettingSection.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { connect } from 'umi'; import type { StateType } from '../model'; import ProCard from '@ant-design/pro-card'; @@ -12,13 +12,27 @@ type Props = { }; const ChatSettingSection: React.FC = () => { + const metricRef = useRef(); + const tagRef = useRef(); return (
- + { + tagRef.current.refreshConfigData(); + }} + /> - + { + metricRef.current.refreshConfigData(); + }} + />
); diff --git a/webapp/packages/supersonic-fe/src/pages/SemanticModel/DomainManager.tsx b/webapp/packages/supersonic-fe/src/pages/SemanticModel/DomainManager.tsx index bcd922468..ef837c842 100644 --- a/webapp/packages/supersonic-fe/src/pages/SemanticModel/DomainManager.tsx +++ b/webapp/packages/supersonic-fe/src/pages/SemanticModel/DomainManager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { connect, Helmet } from 'umi'; +import { connect } from 'umi'; import type { StateType } from './model'; import OverviewContainer from './OverviewContainer'; import type { Dispatch } from 'umi'; @@ -11,7 +11,6 @@ type Props = { const DomainManager: React.FC = () => { return ( <> - ); diff --git a/webapp/packages/supersonic-fe/src/pages/SemanticModel/OverviewContainer.tsx b/webapp/packages/supersonic-fe/src/pages/SemanticModel/OverviewContainer.tsx index 0b0ac789e..2be53f786 100644 --- a/webapp/packages/supersonic-fe/src/pages/SemanticModel/OverviewContainer.tsx +++ b/webapp/packages/supersonic-fe/src/pages/SemanticModel/OverviewContainer.tsx @@ -1,6 +1,6 @@ import { Popover, message, Space } from 'antd'; import React, { useEffect, useState } from 'react'; -import { connect, Helmet, history, useParams } from 'umi'; +import { connect, history, useParams } from 'umi'; import DomainListTree from './components/DomainList'; import styles from './components/style.less'; @@ -199,7 +199,6 @@ const OverviewContainer: React.FC = ({ mode, domainManger, dispatch }) => return (
-
diff --git a/webapp/packages/supersonic-fe/src/pages/SemanticModel/components/Entity/DefaultSettingForm.tsx b/webapp/packages/supersonic-fe/src/pages/SemanticModel/components/Entity/DefaultSettingForm.tsx index 24e01cc46..04745ce2b 100644 --- a/webapp/packages/supersonic-fe/src/pages/SemanticModel/components/Entity/DefaultSettingForm.tsx +++ b/webapp/packages/supersonic-fe/src/pages/SemanticModel/components/Entity/DefaultSettingForm.tsx @@ -27,6 +27,12 @@ type Props = { const FormItem = Form.Item; const Option = Select.Option; +const formDefaultValue = { + unit: 7, + period: 'DAY', + timeMode: 'LAST', +}; + const DefaultSettingForm: ForwardRefRenderFunction = ( { metricList, dimensionList, entityData, chatConfigKey, chatConfigType, onSubmit }, ref, @@ -44,11 +50,12 @@ const DefaultSettingForm: ForwardRefRenderFunction = ( useEffect(() => { form.resetFields(); - if (!entityData?.chatDefaultConfig) { + if (!(entityData?.id && entityData?.chatDefaultConfig)) { return; } const { chatDefaultConfig, id } = formatEntityData; form.setFieldsValue({ + ...formDefaultValue, ...chatDefaultConfig, id, }); @@ -152,11 +159,7 @@ const DefaultSettingForm: ForwardRefRenderFunction = ( form={form} layout="vertical" className={styles.form} - initialValues={{ - unit: 7, - period: 'DAY', - timeMode: 'LAST', - }} + initialValues={formDefaultValue} >