mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +00:00
(feature)(webapp) modify model to view (#719)
This commit is contained in:
@@ -28,7 +28,7 @@ export type ModelInfoType = {
|
||||
};
|
||||
|
||||
export type EntityInfoType = {
|
||||
modelInfo: ModelInfoType;
|
||||
viewInfo: ModelInfoType;
|
||||
dimensions: FieldType[];
|
||||
metrics: FieldType[];
|
||||
entityId: number;
|
||||
@@ -83,7 +83,7 @@ export type ChatContextType = {
|
||||
aggType: string;
|
||||
modelId: number;
|
||||
modelName: string;
|
||||
model: ModelType;
|
||||
view: ModelType;
|
||||
dateInfo: DateInfoType;
|
||||
dimensions: FieldType[];
|
||||
metrics: FieldType[];
|
||||
|
||||
@@ -89,7 +89,7 @@ const ParseTip: React.FC<Props> = ({
|
||||
|
||||
const {
|
||||
modelId,
|
||||
model,
|
||||
view,
|
||||
dimensions,
|
||||
metrics,
|
||||
aggType,
|
||||
@@ -148,12 +148,8 @@ const ParseTip: React.FC<Props> = ({
|
||||
</div>
|
||||
) : (
|
||||
<div className={`${prefixCls}-tip-item`}>
|
||||
<div className={`${prefixCls}-tip-item-name`}>数据模型:</div>
|
||||
<div className={itemValueClass}>
|
||||
{model?.modelNames?.length === 1
|
||||
? model.modelNames[0]
|
||||
: model?.modelNames?.map(modelName => <Tag key={modelName}>{modelName}</Tag>)}
|
||||
</div>
|
||||
<div className={`${prefixCls}-tip-item-name`}>数据视图:</div>
|
||||
<div className={itemValueClass}>{view?.name}</div>
|
||||
</div>
|
||||
)}
|
||||
{(queryType === 'METRIC' || queryType === 'METRIC_TAG' || queryType === 'TAG') && (
|
||||
|
||||
@@ -84,7 +84,7 @@ const ChatItem: React.FC<Props> = ({
|
||||
let data: MsgDataType | undefined = undefined;
|
||||
const { queryColumns, queryResults, queryState, queryMode, response, chatContext } =
|
||||
res.data || {};
|
||||
if (res.code === 401 || res.code === 412) {
|
||||
if (res.code === 400 || res.code === 401 || res.code === 412) {
|
||||
tip = res.msg;
|
||||
} else if (res.code !== 200) {
|
||||
tip = SEARCH_EXCEPTION_TIP;
|
||||
|
||||
@@ -141,7 +141,7 @@ const BarChart: React.FC<Props> = ({ data, triggerResize, loading, onApplyAuth }
|
||||
if (metricColumn && !metricColumn?.authorized) {
|
||||
return (
|
||||
<NoPermissionChart
|
||||
model={entityInfo?.modelInfo.name || ''}
|
||||
model={entityInfo?.viewInfo.name || ''}
|
||||
chartType="barChart"
|
||||
onApplyAuth={onApplyAuth}
|
||||
/>
|
||||
|
||||
@@ -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?.modelInfo.name || ''} onApplyAuth={onApplyAuth} />
|
||||
<ApplyAuth model={entityInfo?.viewInfo.name || ''} onApplyAuth={onApplyAuth} />
|
||||
) : (
|
||||
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
|
||||
<div className={`${prefixCls}-indicator-value`}>
|
||||
|
||||
@@ -109,7 +109,7 @@ const MetricTrend: React.FC<Props> = ({
|
||||
/>
|
||||
) : (
|
||||
<MetricTrendChart
|
||||
model={entityInfo?.modelInfo.name}
|
||||
model={entityInfo?.viewInfo.name}
|
||||
dateColumnName={dateColumnName}
|
||||
categoryColumnName={categoryColumnName}
|
||||
metricField={currentMetricField}
|
||||
|
||||
@@ -26,7 +26,7 @@ const Table: React.FC<Props> = ({ data, size, loading, onApplyAuth }) => {
|
||||
title: name || nameEn,
|
||||
render: (value: string | number) => {
|
||||
if (!authorized) {
|
||||
return <ApplyAuth model={entityInfo?.modelInfo.name || ''} onApplyAuth={onApplyAuth} />;
|
||||
return <ApplyAuth model={entityInfo?.viewInfo.name || ''} onApplyAuth={onApplyAuth} />;
|
||||
}
|
||||
if (dataFormatType === 'percent') {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { createProxyMiddleware } = require('http-proxy-middleware');
|
||||
|
||||
module.exports = function(app) {
|
||||
module.exports = function (app) {
|
||||
app.use(
|
||||
'/api',
|
||||
createProxyMiddleware({
|
||||
@@ -15,4 +15,4 @@ module.exports = function(app) {
|
||||
changeOrigin: true,
|
||||
})
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user