mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
[improvement][semantic-fe] Add time granularity setting in the data source configuration. (#70)
* [improvement][semantic-fe] Add model alias setting & Add view permission restrictions to the model permission management tab. [improvement][semantic-fe] Add permission control to the action buttons for the main domain; apply high sensitivity filtering to the authorization of metrics/dimensions. [improvement][semantic-fe] Optimize the editing mode in the dimension/metric/datasource components to use the modelId stored in the database for data, instead of relying on the data from the state manager. * [improvement][semantic-fe] Add time granularity setting in the data source configuration.
This commit is contained in:
@@ -53,6 +53,7 @@ const ROUTES = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/database',
|
path: '/database',
|
||||||
name: 'database',
|
name: 'database',
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ import TableTitleTooltips from '../../components/TableTitleTooltips';
|
|||||||
import { isUndefined } from 'lodash';
|
import { isUndefined } from 'lodash';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||||
import Marquee from 'react-fast-marquee';
|
import Marquee from 'react-fast-marquee';
|
||||||
import { TYPE_OPTIONS, DATE_FORMATTER, AGG_OPTIONS, EnumDataSourceType } from '../constants';
|
import {
|
||||||
|
TYPE_OPTIONS,
|
||||||
|
DATE_FORMATTER,
|
||||||
|
AGG_OPTIONS,
|
||||||
|
EnumDataSourceType,
|
||||||
|
DATE_OPTIONS,
|
||||||
|
} from '../constants';
|
||||||
import styles from '../style.less';
|
import styles from '../style.less';
|
||||||
|
|
||||||
type FieldItem = {
|
type FieldItem = {
|
||||||
@@ -15,6 +21,7 @@ type FieldItem = {
|
|||||||
agg?: string;
|
agg?: string;
|
||||||
checked?: number;
|
checked?: number;
|
||||||
dateFormat?: string;
|
dateFormat?: string;
|
||||||
|
timeGranularity?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -106,7 +113,7 @@ const FieldForm: React.FC<Props> = ({ fields, onFieldChange }) => {
|
|||||||
{
|
{
|
||||||
title: '扩展配置',
|
title: '扩展配置',
|
||||||
dataIndex: 'extender',
|
dataIndex: 'extender',
|
||||||
width: 100,
|
width: 180,
|
||||||
render: (_: any, record: FieldItem) => {
|
render: (_: any, record: FieldItem) => {
|
||||||
const { type } = record;
|
const { type } = record;
|
||||||
if (type === EnumDataSourceType.MEASURES) {
|
if (type === EnumDataSourceType.MEASURES) {
|
||||||
@@ -131,6 +138,9 @@ const FieldForm: React.FC<Props> = ({ fields, onFieldChange }) => {
|
|||||||
}
|
}
|
||||||
if (type === EnumDataSourceType.TIME) {
|
if (type === EnumDataSourceType.TIME) {
|
||||||
const dateFormat = fields.find((field) => field.bizName === record.bizName)?.dateFormat;
|
const dateFormat = fields.find((field) => field.bizName === record.bizName)?.dateFormat;
|
||||||
|
const timeGranularity = fields.find(
|
||||||
|
(field) => field.bizName === record.bizName,
|
||||||
|
)?.timeGranularity;
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
<Select
|
<Select
|
||||||
@@ -140,7 +150,7 @@ const FieldForm: React.FC<Props> = ({ fields, onFieldChange }) => {
|
|||||||
handleFieldChange(record, 'dateFormat', value);
|
handleFieldChange(record, 'dateFormat', value);
|
||||||
}}
|
}}
|
||||||
defaultValue={DATE_FORMATTER[0]}
|
defaultValue={DATE_FORMATTER[0]}
|
||||||
style={{ minWidth: 180 }}
|
style={{ minWidth: 150 }}
|
||||||
>
|
>
|
||||||
{DATE_FORMATTER.map((item) => (
|
{DATE_FORMATTER.map((item) => (
|
||||||
<Option key={item} value={item}>
|
<Option key={item} value={item}>
|
||||||
@@ -151,6 +161,22 @@ const FieldForm: React.FC<Props> = ({ fields, onFieldChange }) => {
|
|||||||
<Tooltip title="请选择数据库中时间字段对应格式">
|
<Tooltip title="请选择数据库中时间字段对应格式">
|
||||||
<ExclamationCircleOutlined />
|
<ExclamationCircleOutlined />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<span>时间粒度:</span>
|
||||||
|
<Select
|
||||||
|
placeholder="时间粒度"
|
||||||
|
value={timeGranularity}
|
||||||
|
onChange={(value) => {
|
||||||
|
handleFieldChange(record, 'timeGranularity', value);
|
||||||
|
}}
|
||||||
|
defaultValue={DATE_OPTIONS[0]}
|
||||||
|
style={{ minWidth: 50 }}
|
||||||
|
>
|
||||||
|
{DATE_OPTIONS.map((item) => (
|
||||||
|
<Option key={item} value={item}>
|
||||||
|
{item}
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user