(feature)(webapp) modify view to dataSet

This commit is contained in:
williamhliu
2024-03-04 10:30:13 +08:00
parent 32338070cc
commit b29e429271
15 changed files with 35 additions and 92 deletions

View File

@@ -5,14 +5,12 @@ import { AgentType, ModelType } from './type';
const prefix = isMobile ? '/openapi' : '/api';
export function saveConversation(chatName: string, agentId: number) {
return axios.post<any>(
`${prefix}/chat/manage/save?chatName=${chatName}&agentId=${agentId}`
);
return axios.post<any>(`${prefix}/chat/manage/save?chatName=${chatName}&agentId=${agentId}`);
}
export function updateConversationName(chatName: string, chatId: number = 0) {
return axios.post<any>(
`${prefix}/chat/manage/updateChatName?chatName=${chatName}&chatId=${chatId}`,
`${prefix}/chat/manage/updateChatName?chatName=${chatName}&chatId=${chatId}`
);
}
@@ -25,12 +23,12 @@ export function getAllConversations(agentId?: number) {
}
export function getModelList() {
return axios.get<ModelType[]>(`${prefix}/chat/conf/modelList/view`);
return axios.get<ModelType[]>(`${prefix}/chat/conf/modelList/dataSet`);
}
export function updateQAFeedback(questionId: number, score: number) {
return axios.post<any>(
`${prefix}/chat/manage/updateQAFeedback?id=${questionId}&score=${score}&feedback=`,
`${prefix}/chat/manage/updateQAFeedback?id=${questionId}&score=${score}&feedback=`
);
}

View File

@@ -28,7 +28,7 @@ export type ModelInfoType = {
};
export type EntityInfoType = {
viewInfo: ModelInfoType;
dataSetInfo: ModelInfoType;
dimensions: FieldType[];
metrics: FieldType[];
entityId: number;
@@ -51,6 +51,7 @@ export type FilterItemType = {
operator?: string;
type?: string;
value: any;
entityName?: string;
};
export type ModelType = {
@@ -83,7 +84,7 @@ export type ChatContextType = {
aggType: string;
modelId: number;
modelName: string;
view: ModelType;
dataSet: ModelType;
dateInfo: DateInfoType;
dimensions: FieldType[];
metrics: FieldType[];
@@ -92,7 +93,7 @@ export type ChatContextType = {
elementMatches: any[];
nativeQuery: boolean;
queryMode: string;
queryType: 'METRIC' | 'METRIC_TAG' | 'TAG' | 'OTHER';
queryType: 'METRIC' | 'METRIC_TAG' | 'ID' | 'TAG' | 'OTHER';
dimensionFilters: FilterItemType[];
properties: any;
sqlInfo: SqlInfoType;

View File

@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react';
import { AGG_TYPE_MAP, PREFIX_CLS } from '../../common/constants';
import { ChatContextType, DateInfoType, EntityInfoType, FilterItemType } from '../../common/type';
import { Button, DatePicker, Tag } from 'antd';
import { Button, DatePicker } from 'antd';
import { CheckCircleFilled, ReloadOutlined } from '@ant-design/icons';
import Loading from './Loading';
import FilterItem from './FilterItem';
@@ -89,7 +89,7 @@ const ParseTip: React.FC<Props> = ({
const {
modelId,
view,
dataSet,
dimensions,
metrics,
aggType,
@@ -148,8 +148,8 @@ const ParseTip: React.FC<Props> = ({
</div>
) : (
<div className={`${prefixCls}-tip-item`}>
<div className={`${prefixCls}-tip-item-name`}></div>
<div className={itemValueClass}>{view?.name}</div>
<div className={`${prefixCls}-tip-item-name`}></div>
<div className={itemValueClass}>{dataSet?.name}</div>
</div>
)}
{(queryType === 'METRIC' || queryType === 'METRIC_TAG' || queryType === 'TAG') && (
@@ -167,7 +167,7 @@ const ParseTip: React.FC<Props> = ({
<div className={`${prefixCls}-tip-item`}>
<div className={`${prefixCls}-tip-item-name`}></div>
<div className={itemValueClass}>
{queryType === 'METRIC' || queryType === 'METRIC_TAG'
{queryType === 'METRIC' || queryType === 'ID'
? metrics[0].name
: metrics.map(metric => metric.name).join('、')}
</div>

View File

@@ -163,7 +163,7 @@ const BarChart: React.FC<Props> = ({ data, triggerResize, loading, metricField,
if (metricColumn && !metricColumn?.authorized) {
return (
<NoPermissionChart
model={entityInfo?.viewInfo.name || ''}
model={entityInfo?.dataSetInfo.name || ''}
chartType="barChart"
onApplyAuth={onApplyAuth}
/>

View File

@@ -48,7 +48,7 @@ const MetricCard: React.FC<Props> = ({ data, loading, onApplyAuth }) => {
<Spin spinning={loading}>
<div className={`${prefixCls}-indicator`}>
{indicatorColumn && !indicatorColumn?.authorized ? (
<ApplyAuth model={entityInfo?.viewInfo.name || ''} onApplyAuth={onApplyAuth} />
<ApplyAuth model={entityInfo?.dataSetInfo.name || ''} onApplyAuth={onApplyAuth} />
) : (
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<div className={`${prefixCls}-indicator-value`}>

View File

@@ -109,7 +109,7 @@ const MetricTrend: React.FC<Props> = ({
/>
) : (
<MetricTrendChart
model={entityInfo?.viewInfo.name}
model={entityInfo?.dataSetInfo.name}
dateColumnName={dateColumnName}
categoryColumnName={categoryColumnName}
metricField={currentMetricField}

View File

@@ -26,7 +26,9 @@ const Table: React.FC<Props> = ({ data, size, loading, onApplyAuth }) => {
title: name || nameEn,
render: (value: string | number) => {
if (!authorized) {
return <ApplyAuth model={entityInfo?.viewInfo.name || ''} onApplyAuth={onApplyAuth} />;
return (
<ApplyAuth model={entityInfo?.dataSetInfo.name || ''} onApplyAuth={onApplyAuth} />
);
}
if (dataFormatType === 'percent') {
return (

View File

@@ -1,7 +1,7 @@
import { createFromIconfontCN } from '@ant-design/icons';
const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/c/font_4120566_8i352njvpoi.js',
scriptUrl: '//at.alicdn.com/t/c/font_4120566_7rwv3aw6wep.js',
});
export default IconFont;

View File

@@ -51,7 +51,7 @@ export function chatParse(
return axios.post<ParseDataType>(`${prefix}/chat/query/parse`, {
queryText,
chatId: chatId || DEFAULT_CHAT_ID,
modelId,
dataSetId: modelId,
agentId,
queryFilters: filters
? {