Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimization] [web] move url to constants #3271

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
*/

import { handleGetOption, queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { l } from '@/utils/intl';

/*--- 刷新 元数据表 ---*/
export async function showDataSourceTable(id: number) {
try {
const result = await handleGetOption(
'api/database/getSchemasAndTables',
API_CONSTANTS.DATASOURCE_GET_SCHEMA_TABLES,
l('pages.metadata.DataSearch'),
{ id: id }
);
Expand All @@ -37,8 +38,8 @@ export async function showDataSourceTable(id: number) {

/*--- 清理 元数据表缓存 ---*/
export function clearDataSourceTable(id: number) {
return queryDataByParams('api/database/unCacheSchemasAndTables', { id: id });
return queryDataByParams(API_CONSTANTS.DATASOURCE_UN_CACHE_SCHEMA_TABLES, { id: id });
}
export function getDataSourceList() {
return queryDataByParams('api/database/listEnabledAll');
return queryDataByParams(API_CONSTANTS.DATASOURCE_LIST_ENABLE_ALL);
}
2 changes: 2 additions & 0 deletions dinky-web/src/services/endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export enum API_CONSTANTS {
DATASOURCE_CHECK_HEARTBEAT_BY_ID = '/api/database/checkHeartBeatByDataSourceId',
DATASOURCE_COPY = '/api/database/copyDatabase',
DATASOURCE_GET_SCHEMA_TABLES = '/api/database/getSchemasAndTables',
DATASOURCE_UN_CACHE_SCHEMA_TABLES = '/api/database/unCacheSchemasAndTables',
DATASOURCE_LIST_ENABLE_ALL = '/api/database/listEnabledAll',
DATASOURCE_GET_COLUMNS_BY_TABLE = '/api/database/listColumns',
DATASOURCE_GET_GEN_SQL = '/api/database/getSqlGeneration',
DATASOURCE_QUERY_DATA = '/api/database/queryData',
Expand Down
Loading