|
|
@@ -17,6 +17,12 @@ import { |
|
|
} from '@/services/developmentEnvironment'; |
|
|
} from '@/services/developmentEnvironment'; |
|
|
import themes from '@/styles/theme.less'; |
|
|
import themes from '@/styles/theme.less'; |
|
|
import { parseJsonText } from '@/utils'; |
|
|
import { parseJsonText } from '@/utils'; |
|
|
|
|
|
import { |
|
|
|
|
|
formatCodeConfig, |
|
|
|
|
|
formatDataset, |
|
|
|
|
|
formatModel, |
|
|
|
|
|
type SelectedCodeConfig, |
|
|
|
|
|
} from '@/utils/format'; |
|
|
import { openAntdModal } from '@/utils/modal'; |
|
|
import { openAntdModal } from '@/utils/modal'; |
|
|
import { to } from '@/utils/promise'; |
|
|
import { to } from '@/utils/promise'; |
|
|
import SessionStorage from '@/utils/sessionStorage'; |
|
|
import SessionStorage from '@/utils/sessionStorage'; |
|
|
@@ -49,6 +55,7 @@ export type EditorData = { |
|
|
dataset?: string | DatasetData; |
|
|
dataset?: string | DatasetData; |
|
|
model?: string | ModelData; |
|
|
model?: string | ModelData; |
|
|
image?: string; |
|
|
image?: string; |
|
|
|
|
|
code_config?: string | SelectedCodeConfig; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function EditorList() { |
|
|
function EditorList() { |
|
|
@@ -78,6 +85,8 @@ function EditorList() { |
|
|
item.dataset = typeof item.dataset === 'string' ? parseJsonText(item.dataset) : null; |
|
|
item.dataset = typeof item.dataset === 'string' ? parseJsonText(item.dataset) : null; |
|
|
item.model = typeof item.model === 'string' ? parseJsonText(item.model) : null; |
|
|
item.model = typeof item.model === 'string' ? parseJsonText(item.model) : null; |
|
|
item.image = typeof item.image === 'string' ? parseJsonText(item.image) : null; |
|
|
item.image = typeof item.image === 'string' ? parseJsonText(item.image) : null; |
|
|
|
|
|
item.code_config = |
|
|
|
|
|
typeof item.code_config === 'string' ? parseJsonText(item.code_config) : null; |
|
|
}); |
|
|
}); |
|
|
setTableData(content); |
|
|
setTableData(content); |
|
|
setTotal(totalElements); |
|
|
setTotal(totalElements); |
|
|
@@ -159,13 +168,54 @@ function EditorList() { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 跳转编辑器页面 |
|
|
// 跳转编辑器页面 |
|
|
const gotoEditorPage = (e: React.MouseEvent, record: EditorData) => { |
|
|
|
|
|
|
|
|
const gotoEditorPage = (record: EditorData, e: React.MouseEvent) => { |
|
|
e.stopPropagation(); |
|
|
e.stopPropagation(); |
|
|
SessionStorage.setItem(SessionStorage.editorUrlKey, record.url); |
|
|
|
|
|
navigate(`/developmentEnvironment/editor`); |
|
|
|
|
|
|
|
|
|
|
|
setCacheState({ |
|
|
setCacheState({ |
|
|
pagination, |
|
|
pagination, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
SessionStorage.setItem(SessionStorage.editorUrlKey, record.url); |
|
|
|
|
|
navigate(`/developmentEnvironment/editor`); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 去数据集 |
|
|
|
|
|
const gotoDataset = (record: EditorData, e: React.MouseEvent) => { |
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
const dataset = record.dataset as DatasetData; |
|
|
|
|
|
const link = formatDataset(dataset)?.link; |
|
|
|
|
|
if (link) { |
|
|
|
|
|
setCacheState({ |
|
|
|
|
|
pagination, |
|
|
|
|
|
}); |
|
|
|
|
|
navigate(link); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 去模型 |
|
|
|
|
|
const gotoModel = (record: EditorData, e: React.MouseEvent) => { |
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
const model = record.model as ModelData; |
|
|
|
|
|
const link = formatModel(model)?.link; |
|
|
|
|
|
if (link) { |
|
|
|
|
|
setCacheState({ |
|
|
|
|
|
pagination, |
|
|
|
|
|
}); |
|
|
|
|
|
navigate(link); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 打开代码配置仓库 |
|
|
|
|
|
const gotoCodeConfig = (record: EditorData, e: React.MouseEvent) => { |
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
const codeConfig = record.code_config as SelectedCodeConfig; |
|
|
|
|
|
const url = formatCodeConfig(codeConfig)?.url; |
|
|
|
|
|
if (url) { |
|
|
|
|
|
window.open(url, '_blank'); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 分页切换 |
|
|
// 分页切换 |
|
|
@@ -185,11 +235,11 @@ function EditorList() { |
|
|
title: '编辑器名称', |
|
|
title: '编辑器名称', |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
|
key: 'name', |
|
|
key: 'name', |
|
|
width: '16%', |
|
|
|
|
|
|
|
|
width: '12%', |
|
|
render: (text, record, index) => |
|
|
render: (text, record, index) => |
|
|
record.url && record.status === DevEditorStatus.Running |
|
|
record.url && record.status === DevEditorStatus.Running |
|
|
? tableCellRender<EditorData>(true, TableCellValueType.Link, { |
|
|
? tableCellRender<EditorData>(true, TableCellValueType.Link, { |
|
|
onClick: (record, e) => gotoEditorPage(e, record), |
|
|
|
|
|
|
|
|
onClick: gotoEditorPage, |
|
|
})(text, record, index) |
|
|
})(text, record, index) |
|
|
: tableCellRender<EditorData>(true, TableCellValueType.Text)(text, record, index), |
|
|
: tableCellRender<EditorData>(true, TableCellValueType.Text)(text, record, index), |
|
|
}, |
|
|
}, |
|
|
@@ -197,14 +247,14 @@ function EditorList() { |
|
|
title: '计算资源', |
|
|
title: '计算资源', |
|
|
dataIndex: 'computing_resource', |
|
|
dataIndex: 'computing_resource', |
|
|
key: 'computing_resource', |
|
|
key: 'computing_resource', |
|
|
width: '12%', |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
render: tableCellRender(), |
|
|
render: tableCellRender(), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '资源规格', |
|
|
title: '资源规格', |
|
|
dataIndex: 'computing_resource_id', |
|
|
dataIndex: 'computing_resource_id', |
|
|
key: 'computing_resource_id', |
|
|
key: 'computing_resource_id', |
|
|
width: '12%', |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
render: tableCellRender(true, TableCellValueType.Custom, { |
|
|
render: tableCellRender(true, TableCellValueType.Custom, { |
|
|
format: getResourceDescription, |
|
|
format: getResourceDescription, |
|
|
}), |
|
|
}), |
|
|
@@ -213,42 +263,55 @@ function EditorList() { |
|
|
title: '数据集', |
|
|
title: '数据集', |
|
|
dataIndex: ['dataset', 'showValue'], |
|
|
dataIndex: ['dataset', 'showValue'], |
|
|
key: 'dataset', |
|
|
key: 'dataset', |
|
|
width: '12%', |
|
|
|
|
|
render: tableCellRender(true), |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
|
|
|
render: tableCellRender(true, TableCellValueType.Link, { |
|
|
|
|
|
onClick: gotoDataset, |
|
|
|
|
|
}), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '模型', |
|
|
title: '模型', |
|
|
dataIndex: ['model', 'showValue'], |
|
|
dataIndex: ['model', 'showValue'], |
|
|
key: 'model', |
|
|
key: 'model', |
|
|
width: '12%', |
|
|
|
|
|
render: tableCellRender(true), |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
|
|
|
render: tableCellRender(true, TableCellValueType.Link, { |
|
|
|
|
|
onClick: gotoModel, |
|
|
|
|
|
}), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '代码配置', |
|
|
|
|
|
dataIndex: ['code_config', 'showValue'], |
|
|
|
|
|
key: 'code_config', |
|
|
|
|
|
width: '11%', |
|
|
|
|
|
render: tableCellRender(true, TableCellValueType.Link, { |
|
|
|
|
|
onClick: gotoCodeConfig, |
|
|
|
|
|
}), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '镜像', |
|
|
title: '镜像', |
|
|
dataIndex: ['image', 'showValue'], |
|
|
dataIndex: ['image', 'showValue'], |
|
|
key: 'image', |
|
|
key: 'image', |
|
|
width: '12%', |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
render: tableCellRender(true), |
|
|
render: tableCellRender(true), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '创建者', |
|
|
title: '创建者', |
|
|
dataIndex: 'update_by', |
|
|
dataIndex: 'update_by', |
|
|
key: 'update_by', |
|
|
key: 'update_by', |
|
|
width: '12%', |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
render: tableCellRender(true), |
|
|
render: tableCellRender(true), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '创建时间', |
|
|
title: '创建时间', |
|
|
dataIndex: 'create_time', |
|
|
dataIndex: 'create_time', |
|
|
key: 'create_time', |
|
|
key: 'create_time', |
|
|
width: '12%', |
|
|
|
|
|
|
|
|
width: '11%', |
|
|
render: tableCellRender(true, TableCellValueType.Date), |
|
|
render: tableCellRender(true, TableCellValueType.Date), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '状态', |
|
|
title: '状态', |
|
|
dataIndex: 'status', |
|
|
dataIndex: 'status', |
|
|
key: 'status', |
|
|
key: 'status', |
|
|
width: 80, |
|
|
|
|
|
|
|
|
width: 100, |
|
|
render: EditorStatusCell, |
|
|
render: EditorStatusCell, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
|