mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 20:51:48 +00:00
Fix/ts errors in fe (#2218)
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { ProLayoutProps } from '@ant-design/pro-components';
|
import { ProLayoutProps } from '@ant-design/pro-components';
|
||||||
|
export type DefaultSetting = ProLayoutProps & {
|
||||||
const Settings: ProLayoutProps & {
|
|
||||||
pwa?: boolean;
|
pwa?: boolean;
|
||||||
logo?: string;
|
logo?: string;
|
||||||
} = {
|
};
|
||||||
|
const Settings: DefaultSetting = {
|
||||||
navTheme: 'light',
|
navTheme: 'light',
|
||||||
colorPrimary: '#296DF3',
|
colorPrimary: '#296DF3',
|
||||||
layout: 'top',
|
layout: 'top',
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import RightContent from '@/components/RightContent';
|
import RightContent from '@/components/RightContent';
|
||||||
import S2Icon, { ICON } from '@/components/S2Icon';
|
import S2Icon, { ICON } from '@/components/S2Icon';
|
||||||
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
|
|
||||||
import { Space, Spin, ConfigProvider } from 'antd';
|
import { Space, Spin, ConfigProvider } from 'antd';
|
||||||
import ScaleLoader from 'react-spinners/ScaleLoader';
|
import ScaleLoader from 'react-spinners/ScaleLoader';
|
||||||
import { history, RunTimeLayoutConfig } from '@umijs/max';
|
import { history, RunTimeLayoutConfig } from '@umijs/max';
|
||||||
@@ -9,6 +8,7 @@ import settings from '../config/themeSettings';
|
|||||||
import { queryCurrentUser } from './services/user';
|
import { queryCurrentUser } from './services/user';
|
||||||
import { deleteUrlQuery, isMobile, getToken } from '@/utils/utils';
|
import { deleteUrlQuery, isMobile, getToken } from '@/utils/utils';
|
||||||
import { publicPath } from '../config/defaultSettings';
|
import { publicPath } from '../config/defaultSettings';
|
||||||
|
import type { DefaultSetting } from '../config/defaultSettings';
|
||||||
import { Copilot } from 'supersonic-chat-sdk';
|
import { Copilot } from 'supersonic-chat-sdk';
|
||||||
import { configProviderTheme } from '../config/themeSettings';
|
import { configProviderTheme } from '../config/themeSettings';
|
||||||
export { request } from './services/request';
|
export { request } from './services/request';
|
||||||
@@ -42,7 +42,7 @@ const getAuthCodes = (params: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function getInitialState(): Promise<{
|
export async function getInitialState(): Promise<{
|
||||||
settings?: LayoutSettings;
|
settings?: DefaultSetting;
|
||||||
currentUser?: API.CurrentUser;
|
currentUser?: API.CurrentUser;
|
||||||
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
|
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
|
||||||
codeList?: string[];
|
codeList?: string[];
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { LogoutOutlined, KeyOutlined, UnlockOutlined } from '@ant-design/icons';
|
import { LogoutOutlined, KeyOutlined, UnlockOutlined } from '@ant-design/icons';
|
||||||
import { useModel } from 'umi';
|
import { useModel } from '@umijs/max';
|
||||||
import HeaderDropdown from '../HeaderDropdown';
|
import HeaderDropdown from '../HeaderDropdown';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import TMEAvatar from '../TMEAvatar';
|
import TMEAvatar from '../TMEAvatar';
|
||||||
import { AUTH_TOKEN_KEY } from '@/common/constants';
|
import { AUTH_TOKEN_KEY } from '@/common/constants';
|
||||||
import ChangePasswordModal, { IRef as IRefChangePasswordModal } from './ChangePasswordModal';
|
import ChangePasswordModal, { IRef as IRefChangePasswordModal } from './ChangePasswordModal';
|
||||||
import AccessTokensModal, { IRef as IAccessTokensModalRef } from './AccessTokensModal';
|
import AccessTokensModal, { IRef as IAccessTokensModalRef } from './AccessTokensModal';
|
||||||
import { history } from 'umi';
|
import { history } from '@umijs/max';
|
||||||
|
|
||||||
export type GlobalHeaderRightProps = {
|
export type GlobalHeaderRightProps = {
|
||||||
menu?: boolean;
|
menu?: boolean;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { request } from 'umi';
|
import { request } from '@umijs/max';
|
||||||
|
|
||||||
export async function getUserByDeptid(id: any) {
|
export async function getUserByDeptid(id: any) {
|
||||||
return request<any>(`${process.env.AUTH_API_BASE_URL}user/getUserByOrg/${id}`, {
|
return request<any>(`${process.env.AUTH_API_BASE_URL}user/getUserByOrg/${id}`, {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Button, message, notification } from 'antd';
|
import { Button, message, notification } from 'antd';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useIntl } from 'umi';
|
import { useIntl } from '@umijs/max';
|
||||||
import defaultSettings from '../config/defaultSettings';
|
import defaultSettings from '../config/defaultSettings';
|
||||||
|
|
||||||
const { pwa } = defaultSettings;
|
const { pwa } = defaultSettings;
|
||||||
@@ -37,7 +37,7 @@ if (pwa) {
|
|||||||
worker.postMessage({ type: 'skip-waiting' }, [channel.port2]);
|
worker.postMessage({ type: 'skip-waiting' }, [channel.port2]);
|
||||||
});
|
});
|
||||||
// Refresh current page to use the updated HTML and other assets after SW has skiped waiting
|
// Refresh current page to use the updated HTML and other assets after SW has skiped waiting
|
||||||
window.location.reload(true);
|
(window.location.reload as (forceReload?: boolean) => void)(true); //兼容老版IE,现在浏览器中此方法均不再接收参数
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const key = `open${Date.now()}`;
|
const key = `open${Date.now()}`;
|
||||||
@@ -75,7 +75,7 @@ if (pwa) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// remove all caches
|
// remove all caches
|
||||||
if (window.caches && window.caches.keys) {
|
if ('caches' in window) {
|
||||||
caches.keys().then((keys) => {
|
caches.keys().then((keys) => {
|
||||||
keys.forEach((key) => {
|
keys.forEach((key) => {
|
||||||
caches.delete(key);
|
caches.delete(key);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Button, Result } from 'antd';
|
import { Button, Result } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { history } from 'umi';
|
import { history } from '@umijs/max';
|
||||||
|
|
||||||
const NoAuthPage: React.FC = () => (
|
const NoAuthPage: React.FC = () => (
|
||||||
<Result
|
<Result
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Button, Result } from 'antd';
|
import { Button, Result } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { history } from 'umi';
|
import { history } from '@umijs/max';
|
||||||
|
|
||||||
const NoFoundPage: React.FC = () => (
|
const NoFoundPage: React.FC = () => (
|
||||||
<Result
|
<Result
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { request } from 'umi';
|
import { request } from '@umijs/max';
|
||||||
import { AgentType, MemoryType, MetricType, ModelType } from './type';
|
import { AgentType, MemoryType, MetricType, ModelType } from './type';
|
||||||
|
|
||||||
export function getAgentList() {
|
export function getAgentList() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { request } from 'umi';
|
import { request } from '@umijs/max';
|
||||||
import { DimensionType, ModelType, PluginType } from './type';
|
import { DimensionType, ModelType, PluginType } from './type';
|
||||||
|
|
||||||
export function savePlugin(params: Partial<PluginType>) {
|
export function savePlugin(params: Partial<PluginType>) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { XFlowGraphCommands, XFlowNodeCommands, XFlowEdgeCommands } from '@antv/
|
|||||||
import { CanvasMiniMap, CanvasScaleToolbar, CanvasSnapline } from '@antv/xflow';
|
import { CanvasMiniMap, CanvasScaleToolbar, CanvasSnapline } from '@antv/xflow';
|
||||||
import { MODELS } from '@antv/xflow';
|
import { MODELS } from '@antv/xflow';
|
||||||
import GraphToolbar from './GraphToolbar/index';
|
import GraphToolbar from './GraphToolbar/index';
|
||||||
import { connect } from 'umi';
|
import { connect } from '@umijs/max';
|
||||||
|
|
||||||
/** 配置画布 */
|
/** 配置画布 */
|
||||||
import { useGraphConfig } from './config-graph';
|
import { useGraphConfig } from './config-graph';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { message, Tabs, Button, Space } from 'antd';
|
import { message, Tabs, Button, Space } from 'antd';
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { getTagData } from '../service';
|
import { getTagData } from '../service';
|
||||||
import { useParams, history } from 'umi';
|
import { useParams, history } from '@umijs/max';
|
||||||
import styles from './style.less';
|
import styles from './style.less';
|
||||||
import { ArrowLeftOutlined } from '@ant-design/icons';
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
||||||
import TagTrendSection from './components/TagTrendSection';
|
import TagTrendSection from './components/TagTrendSection';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
|||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { message, Space, Popconfirm } from 'antd';
|
import { message, Space, Popconfirm } from 'antd';
|
||||||
import React, { useRef, useState, useEffect } from 'react';
|
import React, { useRef, useState, useEffect } from 'react';
|
||||||
import { useModel } from 'umi';
|
import { useModel } from '@umijs/max';
|
||||||
import { SENSITIVE_LEVEL_ENUM } from '../constant';
|
import { SENSITIVE_LEVEL_ENUM } from '../constant';
|
||||||
import { getTagList, deleteTag, batchDeleteTag, getTagObjectList } from '../service';
|
import { getTagList, deleteTag, batchDeleteTag, getTagObjectList } from '../service';
|
||||||
import TagFilter from './components/TagFilter';
|
import TagFilter from './components/TagFilter';
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import TableTitleTooltips from '../../components/TableTitleTooltips';
|
|||||||
import { createMetric, updateMetric, mockMetricAlias, getMetricTags } from '../../service';
|
import { createMetric, updateMetric, mockMetricAlias, getMetricTags } from '../../service';
|
||||||
import { MetricSettingKey, MetricSettingWording } from '../constants';
|
import { MetricSettingKey, MetricSettingWording } from '../constants';
|
||||||
import { ISemantic } from '../../data';
|
import { ISemantic } from '../../data';
|
||||||
import { history } from 'umi';
|
import { history } from '@umijs/max';
|
||||||
|
|
||||||
export type CreateFormProps = {
|
export type CreateFormProps = {
|
||||||
datasourceId?: number;
|
datasourceId?: number;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState, useRef } from 'react';
|
import React, { useEffect, useState, useRef } from 'react';
|
||||||
import { useModel } from 'umi';
|
import { useModel } from '@umijs/max';
|
||||||
import {
|
import {
|
||||||
typeConfigs,
|
typeConfigs,
|
||||||
formatterRelationData,
|
formatterRelationData,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// import { Radio } from 'antd';
|
// import { Radio } from 'antd';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { connect } from 'umi';
|
import { connect } from '@umijs/max';
|
||||||
import styles from './components/style.less';
|
import styles from './components/style.less';
|
||||||
import type { StateType } from './model';
|
import type { StateType } from './model';
|
||||||
import { SemanticNodeType } from './enum';
|
import { SemanticNodeType } from './enum';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState, useRef } from 'react';
|
import React, { useEffect, useState, useRef } from 'react';
|
||||||
import { Button, message, Form, Space, Drawer, Input } from 'antd';
|
import { Button, message, Form, Space, Drawer, Input } from 'antd';
|
||||||
import { ProCard } from '@ant-design/pro-components';
|
import { ProCard } from '@ant-design/pro-components';
|
||||||
import { useModel } from 'umi';
|
import { useModel } from '@umijs/max';
|
||||||
import { createGroupAuth, updateGroupAuth } from '../../service';
|
import { createGroupAuth, updateGroupAuth } from '../../service';
|
||||||
import PermissionCreateForm from './PermissionCreateForm';
|
import PermissionCreateForm from './PermissionCreateForm';
|
||||||
import type { StateType } from '../../model';
|
import type { StateType } from '../../model';
|
||||||
|
|||||||
472
webapp/packages/supersonic-fe/src/services/API.d.ts
vendored
472
webapp/packages/supersonic-fe/src/services/API.d.ts
vendored
@@ -1,241 +1,243 @@
|
|||||||
import type { SqlParamsItem } from '@/pages/data-explore/data';
|
import type { SqlParamsItem } from '@/pages/data-explore/data';
|
||||||
|
declare global {
|
||||||
|
namespace API {
|
||||||
|
// export type CurrentUser = {
|
||||||
|
// avatar?: string;
|
||||||
|
// name?: string;
|
||||||
|
// title?: string;
|
||||||
|
// group?: string;
|
||||||
|
// signature?: string;
|
||||||
|
// tags?: {
|
||||||
|
// key: string;
|
||||||
|
// label: string;
|
||||||
|
// }[];
|
||||||
|
// userid?: string;
|
||||||
|
// access?: 'user' | 'guest' | 'admin';
|
||||||
|
// unreadCount?: number;
|
||||||
|
// };
|
||||||
|
|
||||||
declare namespace API {
|
export type CurrentUser = {
|
||||||
// export type CurrentUser = {
|
staffid: string;
|
||||||
// avatar?: string;
|
staffName: string | undefined;
|
||||||
// name?: string;
|
orgName: string;
|
||||||
// title?: string;
|
access?: 'user' | 'guest' | 'admin';
|
||||||
// group?: string;
|
name?:string;
|
||||||
// signature?: string;
|
};
|
||||||
// tags?: {
|
|
||||||
// key: string;
|
|
||||||
// label: string;
|
|
||||||
// }[];
|
|
||||||
// userid?: string;
|
|
||||||
// access?: 'user' | 'guest' | 'admin';
|
|
||||||
// unreadCount?: number;
|
|
||||||
// };
|
|
||||||
|
|
||||||
export type CurrentUser = {
|
export interface UserItem {
|
||||||
staffid: string;
|
id: number;
|
||||||
staffName: string;
|
name: string;
|
||||||
orgName: string;
|
displayName: string;
|
||||||
access?: 'user' | 'guest' | 'admin';
|
email: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export interface UserItem {
|
export interface UserAccessToken {
|
||||||
id: number;
|
createDate: string;
|
||||||
name: string;
|
expireDate: string;
|
||||||
displayName: string;
|
expireTime: number;
|
||||||
email: string;
|
id: number;
|
||||||
|
name: string;
|
||||||
|
token: string;
|
||||||
|
userName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LoginStateType = {
|
||||||
|
status?: 'ok' | 'error';
|
||||||
|
type?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NoticeIconData = {
|
||||||
|
id: string;
|
||||||
|
key: string;
|
||||||
|
avatar: string;
|
||||||
|
title: string;
|
||||||
|
datetime: string;
|
||||||
|
type: string;
|
||||||
|
read?: boolean;
|
||||||
|
description: string;
|
||||||
|
clickClose?: boolean;
|
||||||
|
extra: any;
|
||||||
|
status: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type FieldItem = {
|
||||||
|
fieldname: string; // 字段名
|
||||||
|
fieldtype: string; // 字段类型
|
||||||
|
fieldcomment: string; // 释义
|
||||||
|
dimensionorindex: '0' | '1'; // 维度-0 指标-1
|
||||||
|
rname: string; // 绑定现有维度/指标 -- name
|
||||||
|
rguid: string; // 绑定现有维度/指标 -- guid
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QueryChangeLogParams = Pagination & {
|
||||||
|
typeId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChangeLogItem = {
|
||||||
|
typeId: string;
|
||||||
|
typeName: string;
|
||||||
|
changeTime: string; // 变更时间
|
||||||
|
owner: string; // 操作人
|
||||||
|
comment: string; // 变更说明
|
||||||
|
changeDetail: string; // 操作详情
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChangeLogRes = PaginationResponse<ChangeLogItem>;
|
||||||
|
|
||||||
|
export type SearchParams = {
|
||||||
|
name?: string; // 数据集名称
|
||||||
|
description?: string; // 数据集描述
|
||||||
|
bizcodes?: string[]; // 所属项目
|
||||||
|
dsowner?: string; // 负责人
|
||||||
|
startEndtime?: sting[]; // 开始-结束时间
|
||||||
|
assetStatus?: number[]; // 数据集状态
|
||||||
|
sensitivities?: number[]; // 敏感度
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DataSetListParams = Pagination & SearchParams;
|
||||||
|
|
||||||
|
export type DataSetItem = {
|
||||||
|
guid: string;
|
||||||
|
longid: number;
|
||||||
|
name: string; // 数据集名称
|
||||||
|
description: string; // 数据集描述
|
||||||
|
datasouce: string; // 数据源名称
|
||||||
|
datasouceId: number; // 数据源id
|
||||||
|
tables: string; // 表名
|
||||||
|
projectId: string; // 业务名称
|
||||||
|
projectIdStr: string;
|
||||||
|
owner: string; // 负责人
|
||||||
|
updateperiod: string; // 更新周期
|
||||||
|
updateperiodStr: string; // 更新周期
|
||||||
|
opsource: number; // 来源
|
||||||
|
createTimeStr: string;
|
||||||
|
updateTimeStr: string;
|
||||||
|
assetStatusStr: string; // 上线/下线
|
||||||
|
isAsset: number; // 是否资产
|
||||||
|
sensitivity: number;
|
||||||
|
sensitivityStr: string; // 敏感度
|
||||||
|
sql: string; // 技术口径
|
||||||
|
sensitivity: number; // 数据敏感度:1-底 2-中 3-高
|
||||||
|
variables: SqlParamsItem[]; // 数据集归属脚本参数
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DataSetListRes = PaginationResponse<DataSetItem>;
|
||||||
|
export type DataSetBasicInfo = DataSetItem;
|
||||||
|
|
||||||
|
export type DimensionListSearchParams = {
|
||||||
|
name: string; // 中文名
|
||||||
|
dimensionSource: string[]; // 来源
|
||||||
|
projectIds: string[]; // 所属项目
|
||||||
|
dimensionbizName: string; // 英文名
|
||||||
|
description: string; // 描述
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QueryFieldListParams = Pagination & {
|
||||||
|
guid: string;
|
||||||
|
name?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DataSetFieldItem = {
|
||||||
|
columnXh: number; // 顺序标记:从0开始
|
||||||
|
name: string; // 字段名
|
||||||
|
fieldtype: string; // 字段类型
|
||||||
|
description: string; // 释义
|
||||||
|
dimensionorindex: '0' | '1'; // 维度-0 指标-1
|
||||||
|
assetStatusStr: string; // 状态
|
||||||
|
rname: string; // 绑定现有维度/指标 -- name
|
||||||
|
rguid: string; // 绑定现有维度/指标 -- guid
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DataSetFieldListRes = PaginationResponse<DataSetFieldItem>;
|
||||||
|
|
||||||
|
// 搜索条件
|
||||||
|
export type DataTableSearchParams = {
|
||||||
|
name: string; // 表名
|
||||||
|
description: string; // 描述详情
|
||||||
|
extDatasouceenums: string[]; // 数据库类型
|
||||||
|
extDwlayerenums: string[]; // 数仓分层
|
||||||
|
extBizenums: string[]; // 所属项目
|
||||||
|
queryRanges: string[]; // 查看范围
|
||||||
|
storagesize: string; // 存储大小
|
||||||
|
owner: string; // 所有者
|
||||||
|
createtime: string; // 创建时间
|
||||||
|
};
|
||||||
|
export type DataTableListParams = Pagination & DataTableSearchParams;
|
||||||
|
|
||||||
|
// 数据表列表
|
||||||
|
export type DataTableListItem = {
|
||||||
|
guid: string;
|
||||||
|
name: string; // 表名
|
||||||
|
description: string; // 描述
|
||||||
|
projectFullName: string; // 所属项目
|
||||||
|
isSpeedStr: string; // 是否加速
|
||||||
|
dbName: string; // 库名
|
||||||
|
dwLayer: string; // 数据分层
|
||||||
|
assetSensitivityStr: string; // 数据敏感度
|
||||||
|
storageSize: string; // 储存大小
|
||||||
|
owner: string; // 所有者
|
||||||
|
createTime: string; // 创建时间
|
||||||
|
dbTableName: string; // 库名::表名
|
||||||
|
};
|
||||||
|
// 数据表列表
|
||||||
|
export type DataTableListRes = PaginationResponse<DataTableListItem>;
|
||||||
|
|
||||||
|
// 业务项目对象
|
||||||
|
export type ProjectItem = AuthSdkType.AuthCodesItem & {
|
||||||
|
projectId: string; // 项目ID
|
||||||
|
projectIncreId: number; // 项目自增ID
|
||||||
|
projectName: string; // 项目名
|
||||||
|
projectParentId: string; // 父项目ID
|
||||||
|
projectFullName: string; // 父项目-子项目
|
||||||
|
projectLevel: number; // 项目层级
|
||||||
|
comment: string; // 项目描述
|
||||||
|
creator: string; // 项目创建人
|
||||||
|
projectType: number; // 项目类别 0-为私有项目 1-为公共项目
|
||||||
|
childDomainList?: DomainList;
|
||||||
|
children?: DomainList;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DomainList = ProjectItem[];
|
||||||
|
|
||||||
|
// 数据实例详情
|
||||||
|
export type DataInstanceDetail = {
|
||||||
|
type: string; // 类型 mysql、tdw
|
||||||
|
id: string; // id
|
||||||
|
name: string; // 名称
|
||||||
|
description: string; // 描述
|
||||||
|
ip?: string; // ip
|
||||||
|
port?: string; // 端口
|
||||||
|
bootstrap?: string; // 连接地址
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AuthCodeItem = {
|
||||||
|
code: string; // 权限码
|
||||||
|
approverLevel: number;
|
||||||
|
ext: string;
|
||||||
|
isMenu: number;
|
||||||
|
isVisible: number;
|
||||||
|
no: number;
|
||||||
|
pcode: string;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 数据库查询参数
|
||||||
|
export type DatabaseParams = {
|
||||||
|
bindSourceId: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 数据库列表子项
|
||||||
|
export type DatabaseItem = {
|
||||||
|
dbName: string; // 数据库名
|
||||||
|
cnt: number; // 库中有权限表数量
|
||||||
|
};
|
||||||
|
// 数据类型
|
||||||
|
export type DataInstanceItem = {
|
||||||
|
sourceInstanceId: number; // 数据实例id
|
||||||
|
sourceInstanceName: string; // 数据实例名
|
||||||
|
defaultSourceId: number; // 查询表需要的默认datasource id
|
||||||
|
bindSourceId: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserAccessToken {
|
|
||||||
createDate: string;
|
|
||||||
expireDate: string;
|
|
||||||
expireTime: number;
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
token: string;
|
|
||||||
userName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LoginStateType = {
|
|
||||||
status?: 'ok' | 'error';
|
|
||||||
type?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type NoticeIconData = {
|
|
||||||
id: string;
|
|
||||||
key: string;
|
|
||||||
avatar: string;
|
|
||||||
title: string;
|
|
||||||
datetime: string;
|
|
||||||
type: string;
|
|
||||||
read?: boolean;
|
|
||||||
description: string;
|
|
||||||
clickClose?: boolean;
|
|
||||||
extra: any;
|
|
||||||
status: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FieldItem = {
|
|
||||||
fieldname: string; // 字段名
|
|
||||||
fieldtype: string; // 字段类型
|
|
||||||
fieldcomment: string; // 释义
|
|
||||||
dimensionorindex: '0' | '1'; // 维度-0 指标-1
|
|
||||||
rname: string; // 绑定现有维度/指标 -- name
|
|
||||||
rguid: string; // 绑定现有维度/指标 -- guid
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QueryChangeLogParams = Pagination & {
|
|
||||||
typeId: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ChangeLogItem = {
|
|
||||||
typeId: string;
|
|
||||||
typeName: string;
|
|
||||||
changeTime: string; // 变更时间
|
|
||||||
owner: string; // 操作人
|
|
||||||
comment: string; // 变更说明
|
|
||||||
changeDetail: string; // 操作详情
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ChangeLogRes = PaginationResponse<ChangeLogItem>;
|
|
||||||
|
|
||||||
export type SearchParams = {
|
|
||||||
name?: string; // 数据集名称
|
|
||||||
description?: string; // 数据集描述
|
|
||||||
bizcodes?: string[]; // 所属项目
|
|
||||||
dsowner?: string; // 负责人
|
|
||||||
startEndtime?: sting[]; // 开始-结束时间
|
|
||||||
assetStatus?: number[]; // 数据集状态
|
|
||||||
sensitivities?: number[]; // 敏感度
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DataSetListParams = Pagination & SearchParams;
|
|
||||||
|
|
||||||
export type DataSetItem = {
|
|
||||||
guid: string;
|
|
||||||
longid: number;
|
|
||||||
name: string; // 数据集名称
|
|
||||||
description: string; // 数据集描述
|
|
||||||
datasouce: string; // 数据源名称
|
|
||||||
datasouceId: number; // 数据源id
|
|
||||||
tables: string; // 表名
|
|
||||||
projectId: string; // 业务名称
|
|
||||||
projectIdStr: string;
|
|
||||||
owner: string; // 负责人
|
|
||||||
updateperiod: string; // 更新周期
|
|
||||||
updateperiodStr: string; // 更新周期
|
|
||||||
opsource: number; // 来源
|
|
||||||
createTimeStr: string;
|
|
||||||
updateTimeStr: string;
|
|
||||||
assetStatusStr: string; // 上线/下线
|
|
||||||
isAsset: number; // 是否资产
|
|
||||||
sensitivity: number;
|
|
||||||
sensitivityStr: string; // 敏感度
|
|
||||||
sql: string; // 技术口径
|
|
||||||
sensitivity: number; // 数据敏感度:1-底 2-中 3-高
|
|
||||||
variables: SqlParamsItem[]; // 数据集归属脚本参数
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DataSetListRes = PaginationResponse<DataSetItem>;
|
|
||||||
export type DataSetBasicInfo = DataSetItem;
|
|
||||||
|
|
||||||
export type DimensionListSearchParams = {
|
|
||||||
name: string; // 中文名
|
|
||||||
dimensionSource: string[]; // 来源
|
|
||||||
projectIds: string[]; // 所属项目
|
|
||||||
dimensionbizName: string; // 英文名
|
|
||||||
description: string; // 描述
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QueryFieldListParams = Pagination & {
|
|
||||||
guid: string;
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DataSetFieldItem = {
|
|
||||||
columnXh: number; // 顺序标记:从0开始
|
|
||||||
name: string; // 字段名
|
|
||||||
fieldtype: string; // 字段类型
|
|
||||||
description: string; // 释义
|
|
||||||
dimensionorindex: '0' | '1'; // 维度-0 指标-1
|
|
||||||
assetStatusStr: string; // 状态
|
|
||||||
rname: string; // 绑定现有维度/指标 -- name
|
|
||||||
rguid: string; // 绑定现有维度/指标 -- guid
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DataSetFieldListRes = PaginationResponse<DataSetFieldItem>;
|
|
||||||
|
|
||||||
// 搜索条件
|
|
||||||
export type DataTableSearchParams = {
|
|
||||||
name: string; // 表名
|
|
||||||
description: string; // 描述详情
|
|
||||||
extDatasouceenums: string[]; // 数据库类型
|
|
||||||
extDwlayerenums: string[]; // 数仓分层
|
|
||||||
extBizenums: string[]; // 所属项目
|
|
||||||
queryRanges: string[]; // 查看范围
|
|
||||||
storagesize: string; // 存储大小
|
|
||||||
owner: string; // 所有者
|
|
||||||
createtime: string; // 创建时间
|
|
||||||
};
|
|
||||||
export type DataTableListParams = Pagination & DataTableSearchParams;
|
|
||||||
|
|
||||||
// 数据表列表
|
|
||||||
export type DataTableListItem = {
|
|
||||||
guid: string;
|
|
||||||
name: string; // 表名
|
|
||||||
description: string; // 描述
|
|
||||||
projectFullName: string; // 所属项目
|
|
||||||
isSpeedStr: string; // 是否加速
|
|
||||||
dbName: string; // 库名
|
|
||||||
dwLayer: string; // 数据分层
|
|
||||||
assetSensitivityStr: string; // 数据敏感度
|
|
||||||
storageSize: string; // 储存大小
|
|
||||||
owner: string; // 所有者
|
|
||||||
createTime: string; // 创建时间
|
|
||||||
dbTableName: string; // 库名::表名
|
|
||||||
};
|
|
||||||
// 数据表列表
|
|
||||||
export type DataTableListRes = PaginationResponse<DataTableListItem>;
|
|
||||||
|
|
||||||
// 业务项目对象
|
|
||||||
export type ProjectItem = AuthSdkType.AuthCodesItem & {
|
|
||||||
projectId: string; // 项目ID
|
|
||||||
projectIncreId: number; // 项目自增ID
|
|
||||||
projectName: string; // 项目名
|
|
||||||
projectParentId: string; // 父项目ID
|
|
||||||
projectFullName: string; // 父项目-子项目
|
|
||||||
projectLevel: number; // 项目层级
|
|
||||||
comment: string; // 项目描述
|
|
||||||
creator: string; // 项目创建人
|
|
||||||
projectType: number; // 项目类别 0-为私有项目 1-为公共项目
|
|
||||||
childDomainList?: DomainList;
|
|
||||||
children?: DomainList;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DomainList = ProjectItem[];
|
|
||||||
|
|
||||||
// 数据实例详情
|
|
||||||
export type DataInstanceDetail = {
|
|
||||||
type: string; // 类型 mysql、tdw
|
|
||||||
id: string; // id
|
|
||||||
name: string; // 名称
|
|
||||||
description: string; // 描述
|
|
||||||
ip?: string; // ip
|
|
||||||
port?: string; // 端口
|
|
||||||
bootstrap?: string; // 连接地址
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AuthCodeItem = {
|
|
||||||
code: string; // 权限码
|
|
||||||
approverLevel: number;
|
|
||||||
ext: string;
|
|
||||||
isMenu: number;
|
|
||||||
isVisible: number;
|
|
||||||
no: number;
|
|
||||||
pcode: string;
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 数据库查询参数
|
|
||||||
export type DatabaseParams = {
|
|
||||||
bindSourceId: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 数据库列表子项
|
|
||||||
export type DatabaseItem = {
|
|
||||||
dbName: string; // 数据库名
|
|
||||||
cnt: number; // 库中有权限表数量
|
|
||||||
};
|
|
||||||
// 数据类型
|
|
||||||
export type DataInstanceItem = {
|
|
||||||
sourceInstanceId: number; // 数据实例id
|
|
||||||
sourceInstanceName: string; // 数据实例名
|
|
||||||
defaultSourceId: number; // 查询表需要的默认datasource id
|
|
||||||
bindSourceId: number;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ export const TOKEN_KEY = AUTH_TOKEN_KEY;
|
|||||||
const authHeaderInterceptor = (url: string, options: RequestOptionsInit) => {
|
const authHeaderInterceptor = (url: string, options: RequestOptionsInit) => {
|
||||||
const headers: any = {};
|
const headers: any = {};
|
||||||
const query = queryString.parse(history.location.search) || {};
|
const query = queryString.parse(history.location.search) || {};
|
||||||
const token = query[TOKEN_KEY] || localStorage.getItem(TOKEN_KEY);
|
|
||||||
|
const rawToken = query[TOKEN_KEY];
|
||||||
|
const token = (typeof rawToken === 'string' ? rawToken : null) || localStorage.getItem(TOKEN_KEY);
|
||||||
if (token) {
|
if (token) {
|
||||||
headers.Authorization = `Bearer ${token}`;
|
headers.Authorization = `Bearer ${token}`;
|
||||||
headers.auth = `Bearer ${token}`;
|
headers.auth = `Bearer ${token}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user