Merge remote-tracking branch 'origin/dev-opt' into dev-opt
This commit is contained in:
commit
b82e38431e
|
|
@ -6,8 +6,6 @@ import routes from './routes';
|
|||
|
||||
const { REACT_APP_ENV = 'dev' } = process.env;
|
||||
|
||||
const huoshiBaseUrl = 'https://192.168.20.156:30016';
|
||||
|
||||
export default defineConfig({
|
||||
/**
|
||||
* @name 开启 hash 模式
|
||||
|
|
@ -179,28 +177,22 @@ export default defineConfig({
|
|||
apps: process.env.UMI_APP_HUO_SHI
|
||||
? [
|
||||
{
|
||||
name: 'flint-data', // 数据服务微应用
|
||||
name: 'flint', // 数据服务微应用
|
||||
// entry: 'http://localhost:8083', // 开发环境地址
|
||||
entry: '/flint', // 生产环境地址
|
||||
activeRule: '/flint', // 激活规则
|
||||
},
|
||||
{
|
||||
name: 'trainfer', // 服务管理
|
||||
// entry: 'http://localhost:8081', // 开发环境地址
|
||||
entry: `${huoshiBaseUrl}/flint-data/`, // 生产环境地址
|
||||
activeRule: '/flint-data', // 激活规则
|
||||
entry: '/trainfer', // 生产环境地址
|
||||
activeRule: '/trainfer', // 激活规则
|
||||
},
|
||||
{
|
||||
name: 'flint-bml', // 训练模块微应用
|
||||
// entry: 'http://localhost:8082',
|
||||
entry: `${huoshiBaseUrl}/flint-bml/`,
|
||||
activeRule: '/pipeline/flint-bml',
|
||||
},
|
||||
{
|
||||
name: 'flint-console', // 集群管理
|
||||
// entry: 'http://localhost:8083',
|
||||
entry: `${huoshiBaseUrl}/flint-console/`,
|
||||
activeRule: '/dataset/flint-console',
|
||||
},
|
||||
{
|
||||
name: 'flint-service', // 服务模块微应用
|
||||
// entry: 'http://localhost:8085',
|
||||
entry: `${huoshiBaseUrl}/flint-service/`,
|
||||
activeRule: '/dataset/flint-service',
|
||||
name: 'portal', // 服务管理
|
||||
// entry: 'http://localhost:8082', // 开发环境地址
|
||||
entry: '/portal', // 生产环境地址
|
||||
activeRule: '/portal', // 激活规则
|
||||
},
|
||||
]
|
||||
: [],
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ export default {
|
|||
// 如果需要自定义本地开发服务器 请取消注释按需调整
|
||||
dev: {
|
||||
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
||||
'/proxyApi/': {
|
||||
target: 'https://172.29.246.110:30016',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
// target: 'http://172.31.164.103:30009/',
|
||||
},
|
||||
'/api/': {
|
||||
// 要代理的地址
|
||||
target: 'http://172.20.32.121:31213/', // 开发环境
|
||||
|
|
@ -60,7 +66,7 @@ export default {
|
|||
},
|
||||
'/huoshiProxyApi/': {
|
||||
// target: 'http:///218.77.58.19:31213', // 公网环境
|
||||
target: 'http://218.77.58.19:30009/', // 火石环境
|
||||
target: 'https://172.29.246.110:30016', // 火石环境
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '^/huoshiProxyApi': '' },
|
||||
secure: false,
|
||||
|
|
@ -75,10 +81,7 @@ export default {
|
|||
// target: 'http://172.31.164.103:30009/',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/proxyApi/': {
|
||||
target: 'http://192.168.60.11:30009/',
|
||||
// target: 'http://172.31.164.103:30009/',
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -775,237 +775,255 @@ export default [
|
|||
},
|
||||
...(process.env.UMI_APP_HUO_SHI
|
||||
? [
|
||||
{
|
||||
path: '/flint/*',
|
||||
name: '数据管理',
|
||||
microApp: 'flint',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/trainfer/*',
|
||||
name: '火石服务',
|
||||
microApp: 'trainfer',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/portal/*',
|
||||
name: '火石服务',
|
||||
microApp: 'portal',
|
||||
layout: true,
|
||||
},
|
||||
// 数据标注页面 - 使用自定义组件包装微应用
|
||||
{
|
||||
path: '/flint-data/mark/list',
|
||||
name: '数据标注',
|
||||
component: './DatasetPreparation/mark/index',
|
||||
layout: true,
|
||||
},
|
||||
// 数据服务子路径 - 直接路由到微应用(排除 mark/list)
|
||||
{
|
||||
path: '/flint-data/*',
|
||||
name: '数据服务',
|
||||
microApp: 'flint-data',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/training/flint-bml/*',
|
||||
name: '训练模块',
|
||||
microApp: 'flint-bml',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/flint-console/*',
|
||||
name: '集群管理',
|
||||
microApp: 'flint-console',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/dataset/flint-service/*',
|
||||
name: '服务模块',
|
||||
microApp: 'flint-service',
|
||||
layout: true,
|
||||
},
|
||||
{
|
||||
path: '/training',
|
||||
name: '模型训练',
|
||||
routes: [
|
||||
{
|
||||
name: '小模型训练',
|
||||
path: 'pipeline',
|
||||
routes: [
|
||||
{
|
||||
path: '',
|
||||
redirect: 'template',
|
||||
},
|
||||
{
|
||||
name: '流水线模板',
|
||||
path: 'template',
|
||||
routes: [
|
||||
{
|
||||
name: '流水线模板',
|
||||
path: '',
|
||||
component: './Pipeline/index',
|
||||
},
|
||||
{
|
||||
name: '流水线详情',
|
||||
path: 'info/:id',
|
||||
component: './Pipeline/Info/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '实验',
|
||||
path: 'experiment',
|
||||
routes: [
|
||||
{
|
||||
name: '实验',
|
||||
path: '',
|
||||
component: './Experiment/index',
|
||||
},
|
||||
{
|
||||
name: '实验实例',
|
||||
path: 'instance/:workflowId/:id',
|
||||
component: './Experiment/Info/index',
|
||||
},
|
||||
{
|
||||
name: '实验对比',
|
||||
path: 'compare',
|
||||
routes: [
|
||||
{
|
||||
name: '实验对比',
|
||||
path: '',
|
||||
component: './Experiment/Comparison/index',
|
||||
},
|
||||
{
|
||||
name: '可视化对比',
|
||||
path: 'compare-visual',
|
||||
component: './Experiment/Aim/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '可视化',
|
||||
path: 'visual',
|
||||
component: './Experiment/Tensorboard/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '自动机器学习',
|
||||
path: 'automl',
|
||||
routes: [
|
||||
{
|
||||
name: '自动机器学习',
|
||||
path: '',
|
||||
component: './AutoML/List/index',
|
||||
},
|
||||
{
|
||||
name: '实验详情',
|
||||
path: 'info/:id',
|
||||
component: './AutoML/Info/index',
|
||||
},
|
||||
{
|
||||
name: '创建实验',
|
||||
path: 'create',
|
||||
component: './AutoML/Create/index',
|
||||
},
|
||||
{
|
||||
name: '编辑实验',
|
||||
path: 'edit/:id',
|
||||
component: './AutoML/Create/index',
|
||||
},
|
||||
{
|
||||
name: '复制实验',
|
||||
path: 'copy/:id',
|
||||
component: './AutoML/Create/index',
|
||||
},
|
||||
{
|
||||
name: '实验实例详情',
|
||||
path: 'instance/:experimentId/:id',
|
||||
component: './AutoML/Instance/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '超参数自动寻优',
|
||||
path: 'hyperparameter',
|
||||
routes: [
|
||||
{
|
||||
name: '超参数寻优',
|
||||
path: '',
|
||||
component: './HyperParameter/List/index',
|
||||
},
|
||||
{
|
||||
name: '实验详情',
|
||||
path: 'info/:id',
|
||||
component: './HyperParameter/Info/index',
|
||||
},
|
||||
{
|
||||
name: '创建实验',
|
||||
path: 'create',
|
||||
component: './HyperParameter/Create/index',
|
||||
},
|
||||
{
|
||||
name: '编辑实验',
|
||||
path: 'edit/:id',
|
||||
component: './HyperParameter/Create/index',
|
||||
},
|
||||
{
|
||||
name: '复制实验',
|
||||
path: 'copy/:id',
|
||||
component: './HyperParameter/Create/index',
|
||||
},
|
||||
{
|
||||
name: '实验实例详情',
|
||||
path: 'instance/:experimentId/:id',
|
||||
routes: [
|
||||
{
|
||||
name: '实验实例详情',
|
||||
path: '',
|
||||
component: './HyperParameter/Instance/index',
|
||||
},
|
||||
{
|
||||
name: '可视化对比',
|
||||
path: 'compare-visual',
|
||||
component: './Experiment/Aim/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '主动学习',
|
||||
path: 'active-learn',
|
||||
routes: [
|
||||
{
|
||||
name: '主动学习',
|
||||
path: '',
|
||||
component: './ActiveLearn/List/index',
|
||||
},
|
||||
{
|
||||
name: '实验详情',
|
||||
path: 'info/:id',
|
||||
component: './ActiveLearn/Info/index',
|
||||
},
|
||||
{
|
||||
name: '创建实验',
|
||||
path: 'create',
|
||||
component: './ActiveLearn/Create/index',
|
||||
},
|
||||
{
|
||||
name: '编辑实验',
|
||||
path: 'edit/:id',
|
||||
component: './ActiveLearn/Create/index',
|
||||
},
|
||||
{
|
||||
name: '复制实验',
|
||||
path: 'copy/:id',
|
||||
component: './ActiveLearn/Create/index',
|
||||
},
|
||||
{
|
||||
name: '实验实例详情',
|
||||
path: 'instance/:experimentId/:id',
|
||||
routes: [
|
||||
{
|
||||
name: '实验实例详情',
|
||||
path: '',
|
||||
component: './ActiveLearn/Instance/index',
|
||||
},
|
||||
{
|
||||
name: '数据标注',
|
||||
path: 'label',
|
||||
component: './ActiveLearn/Label/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// path: '/flint-data/mark/list',
|
||||
// name: '数据标注',
|
||||
// component: './DatasetPreparation/mark/index',
|
||||
// layout: true,
|
||||
// },
|
||||
// // 数据服务子路径 - 直接路由到微应用(排除 mark/list)
|
||||
// {
|
||||
// path: '/flint-data/*',
|
||||
// name: '数据服务',
|
||||
// microApp: 'flint-data',
|
||||
// layout: true,
|
||||
// },
|
||||
// {
|
||||
// path: '/training/flint-bml/*',
|
||||
// name: '训练模块',
|
||||
// microApp: 'flint-bml',
|
||||
// layout: true,
|
||||
// },
|
||||
// {
|
||||
// path: '/flint-console/*',
|
||||
// name: '集群管理',
|
||||
// microApp: 'flint-console',
|
||||
// layout: true,
|
||||
// },
|
||||
// {
|
||||
// path: '/dataset/flint-service/*',
|
||||
// name: '服务模块',
|
||||
// microApp: 'flint-service',
|
||||
// layout: true,
|
||||
// },
|
||||
// {
|
||||
// path: '/training',
|
||||
// name: '模型训练',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '小模型训练',
|
||||
// path: 'pipeline',
|
||||
// routes: [
|
||||
// {
|
||||
// path: '',
|
||||
// redirect: 'template',
|
||||
// },
|
||||
// {
|
||||
// name: '流水线模板',
|
||||
// path: 'template',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '流水线模板',
|
||||
// path: '',
|
||||
// component: './Pipeline/index',
|
||||
// },
|
||||
// {
|
||||
// name: '流水线详情',
|
||||
// path: 'info/:id',
|
||||
// component: './Pipeline/Info/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// name: '实验',
|
||||
// path: 'experiment',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '实验',
|
||||
// path: '',
|
||||
// component: './Experiment/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验实例',
|
||||
// path: 'instance/:workflowId/:id',
|
||||
// component: './Experiment/Info/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验对比',
|
||||
// path: 'compare',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '实验对比',
|
||||
// path: '',
|
||||
// component: './Experiment/Comparison/index',
|
||||
// },
|
||||
// {
|
||||
// name: '可视化对比',
|
||||
// path: 'compare-visual',
|
||||
// component: './Experiment/Aim/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// name: '可视化',
|
||||
// path: 'visual',
|
||||
// component: './Experiment/Tensorboard/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// name: '自动机器学习',
|
||||
// path: 'automl',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '自动机器学习',
|
||||
// path: '',
|
||||
// component: './AutoML/List/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验详情',
|
||||
// path: 'info/:id',
|
||||
// component: './AutoML/Info/index',
|
||||
// },
|
||||
// {
|
||||
// name: '创建实验',
|
||||
// path: 'create',
|
||||
// component: './AutoML/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '编辑实验',
|
||||
// path: 'edit/:id',
|
||||
// component: './AutoML/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '复制实验',
|
||||
// path: 'copy/:id',
|
||||
// component: './AutoML/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验实例详情',
|
||||
// path: 'instance/:experimentId/:id',
|
||||
// component: './AutoML/Instance/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// name: '超参数自动寻优',
|
||||
// path: 'hyperparameter',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '超参数寻优',
|
||||
// path: '',
|
||||
// component: './HyperParameter/List/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验详情',
|
||||
// path: 'info/:id',
|
||||
// component: './HyperParameter/Info/index',
|
||||
// },
|
||||
// {
|
||||
// name: '创建实验',
|
||||
// path: 'create',
|
||||
// component: './HyperParameter/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '编辑实验',
|
||||
// path: 'edit/:id',
|
||||
// component: './HyperParameter/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '复制实验',
|
||||
// path: 'copy/:id',
|
||||
// component: './HyperParameter/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验实例详情',
|
||||
// path: 'instance/:experimentId/:id',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '实验实例详情',
|
||||
// path: '',
|
||||
// component: './HyperParameter/Instance/index',
|
||||
// },
|
||||
// {
|
||||
// name: '可视化对比',
|
||||
// path: 'compare-visual',
|
||||
// component: './Experiment/Aim/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// name: '主动学习',
|
||||
// path: 'active-learn',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '主动学习',
|
||||
// path: '',
|
||||
// component: './ActiveLearn/List/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验详情',
|
||||
// path: 'info/:id',
|
||||
// component: './ActiveLearn/Info/index',
|
||||
// },
|
||||
// {
|
||||
// name: '创建实验',
|
||||
// path: 'create',
|
||||
// component: './ActiveLearn/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '编辑实验',
|
||||
// path: 'edit/:id',
|
||||
// component: './ActiveLearn/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '复制实验',
|
||||
// path: 'copy/:id',
|
||||
// component: './ActiveLearn/Create/index',
|
||||
// },
|
||||
// {
|
||||
// name: '实验实例详情',
|
||||
// path: 'instance/:experimentId/:id',
|
||||
// routes: [
|
||||
// {
|
||||
// name: '实验实例详情',
|
||||
// path: '',
|
||||
// component: './ActiveLearn/Instance/index',
|
||||
// },
|
||||
// {
|
||||
// name: '数据标注',
|
||||
// path: 'label',
|
||||
// component: './ActiveLearn/Label/index',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
]
|
||||
: []),
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
"build-with-huoshi": "cross-env UMI_APP_HUO_SHI=true max build",
|
||||
"deploy": "npm run build && npm run gh-pages",
|
||||
"dev": "npm run start:dev",
|
||||
"dev-no-sso": "cross-env NO_SSO=true npm run start:mock",
|
||||
"dev-with-huoshi": "cross-env NO_SSO=true UMI_APP_HUO_SHI=true npm run start:mock",
|
||||
"dev-no-sso": "cross-env NO_SSO=true npm run start:dev",
|
||||
"dev-with-huoshi": "cross-env NO_SSO=true UMI_APP_HUO_SHI=true npm run start:dev",
|
||||
"docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
|
||||
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
|
||||
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
"test:coverage": "npm run jest -- --coverage",
|
||||
"test:update": "npm run jest -- -u",
|
||||
"tsc": "tsc --noEmit",
|
||||
"git-merge": "node ./scripts/git-merge.js"
|
||||
"pr": "node ./scripts/git-merge.js"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import { addAlpha } from './utils/color';
|
|||
import { HomeUrl } from './utils/constant';
|
||||
import { closeAllModals } from './utils/modal';
|
||||
import { gotoHomePage } from './utils/ui';
|
||||
import '@/huoshi.less'
|
||||
export { requestConfig as request } from './requestConfig';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ const convertResourceVersionToTreeData = (
|
|||
list: ResourceVersionData[],
|
||||
): TreeDataNode[] => {
|
||||
return list.map((item: ResourceVersionData) => ({
|
||||
...pick(info, ['id', 'name', 'owner', 'identifier', 'is_public']),
|
||||
...pick(info, ['id', 'name', 'owner', 'identifier', 'is_public', 'git_id']),
|
||||
key: `${parentId}-${item.name}`,
|
||||
title: item.name,
|
||||
version: item.name,
|
||||
|
|
@ -130,7 +130,15 @@ export class DatasetSelector implements SelectorTypeInfo {
|
|||
}
|
||||
|
||||
async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) {
|
||||
const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version', 'is_public']);
|
||||
const params = pick(parentNode, [
|
||||
'owner',
|
||||
'identifier',
|
||||
'id',
|
||||
'name',
|
||||
'version',
|
||||
'is_public',
|
||||
'git_id',
|
||||
]);
|
||||
const res = await getDatasetInfo(params);
|
||||
if (res && res.data) {
|
||||
const dataset = res.data as DatasetData;
|
||||
|
|
@ -192,7 +200,15 @@ export class ModelSelector implements SelectorTypeInfo {
|
|||
}
|
||||
|
||||
async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) {
|
||||
const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version', 'is_public']);
|
||||
const params = pick(parentNode, [
|
||||
'owner',
|
||||
'identifier',
|
||||
'id',
|
||||
'name',
|
||||
'version',
|
||||
'is_public',
|
||||
'git_id',
|
||||
]);
|
||||
const res = await getModelInfo(params);
|
||||
if (res && res.data) {
|
||||
const model = res.data as ModelData;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export { ResourceSelectorType, selectorTypeConfig };
|
|||
export type ResourceSelectorResponse = {
|
||||
activeTab: CommonTabKeys; // 是我的还是公开的
|
||||
id: string; // 数据集\模型 id
|
||||
git_id: number; // 数据集\模型 git id
|
||||
name: string; // 数据集\模型 name
|
||||
identifier: string; // 数据集\模型 identifier
|
||||
owner: string; // 数据集\模型 owner
|
||||
|
|
@ -243,6 +244,7 @@ function ResourceSelectorModal({
|
|||
const name = (treeNode?.title ?? '') as string;
|
||||
const identifier = (treeNode?.identifier ?? '') as string;
|
||||
const owner = (treeNode?.owner ?? '') as string;
|
||||
const gitId = (treeNode?.git_id ?? '') as number;
|
||||
const childNode = treeNode.children.filter((v: TreeDataNode) => v.key === last)[0];
|
||||
const res =
|
||||
type === ResourceSelectorType.Mirror
|
||||
|
|
@ -258,6 +260,7 @@ function ResourceSelectorModal({
|
|||
version,
|
||||
identifier,
|
||||
owner,
|
||||
git_id: gitId,
|
||||
};
|
||||
onOk?.(res);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
border: 1px dashed rgba(81, 76, 249, 0.5);
|
||||
border-radius: 6px;
|
||||
|
||||
&--error {
|
||||
border: 1px dashed @error-color !important;
|
||||
}
|
||||
|
||||
&__img {
|
||||
width: 24px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* @Description: 上传组件的提示信息
|
||||
*/
|
||||
|
||||
import { Form } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import './index.less';
|
||||
|
||||
|
|
@ -22,8 +23,18 @@ type UploadBlockProps = {
|
|||
* 上传组件的提示信息
|
||||
*/
|
||||
function UploadBlock({ desc, image, className, style }: UploadBlockProps) {
|
||||
const { status } = Form.Item.useStatus();
|
||||
return (
|
||||
<div className={classNames('kf-upload-block', className)} style={style}>
|
||||
<div
|
||||
className={classNames(
|
||||
'kf-upload-block',
|
||||
{
|
||||
['kf-upload-block--error']: status === 'error',
|
||||
},
|
||||
className,
|
||||
)}
|
||||
style={style}
|
||||
>
|
||||
<img
|
||||
className="kf-upload-block__img"
|
||||
src={image ?? require('@/assets/img/upload-file.png')}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,374 @@
|
|||
.wrapper {
|
||||
width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.flexCBox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.flexMBox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.flexCenter {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.textCenter {
|
||||
text-align: center;
|
||||
}
|
||||
.noData {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
color: #999;
|
||||
}
|
||||
.pd-right-24 {
|
||||
padding-right: 24px;
|
||||
}
|
||||
.mg-right-24 {
|
||||
margin-right: 24px;
|
||||
}
|
||||
/*
|
||||
文字溢出
|
||||
*/
|
||||
/* 单行溢出 */
|
||||
.single-over {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
/* 多行溢出 */
|
||||
.multi-over2, .multi-over3, .multi-over4, .multi-over5 {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.multi-over2 {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
.multi-over3 {
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
.multi-over4 {
|
||||
-webkit-line-clamp: 4;
|
||||
}
|
||||
.multi-over5 {
|
||||
-webkit-line-clamp: 5;
|
||||
}
|
||||
// common 统一样式
|
||||
.mouse-clazz {
|
||||
font-size: 14px;
|
||||
}
|
||||
.can-click {
|
||||
color: var(--el-color-primary);
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: var(--el-color-primary-light-3);
|
||||
}
|
||||
}
|
||||
.text-click {
|
||||
cursor: pointer;
|
||||
transition: all .2s ease;
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
.right-box {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.input-item {
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-right: 24px;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.common-input {
|
||||
// 设计是 224px
|
||||
width: 220px;
|
||||
}
|
||||
.input-label {
|
||||
display: inline-block;
|
||||
max-width: 86px;
|
||||
min-width: 70px;
|
||||
text-align: right;
|
||||
}
|
||||
.input-box {
|
||||
margin-top: 14px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
&:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.flex-between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.m-dropdown-content {
|
||||
position: relative;
|
||||
.m-dropdown {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
right: -8px;
|
||||
min-width: 120px;
|
||||
line-height: 1;
|
||||
padding-top: 10px;
|
||||
.icon-sanjiao {
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 40px;
|
||||
border-left: 8px solid transparent;
|
||||
border-right: 8px solid transparent;
|
||||
border-bottom: 8px solid #fff;
|
||||
}
|
||||
li {
|
||||
background-color: #fff;
|
||||
line-height: 40px;
|
||||
color: var(--main-color);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
box-shadow: 0px 0px 10px 2px #d1dce5;
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
.m-dropdown {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-button--primary.el-button:focus {
|
||||
color: var(--el-button-text-color);
|
||||
border-color: var(--el-button-border-color);
|
||||
background-color: var(--el-button-bg-color);
|
||||
outline: none;
|
||||
outline-offset: 0;
|
||||
}
|
||||
.el-dialog__title {
|
||||
font-size: var(--font-16);
|
||||
}
|
||||
// .tl-divider {
|
||||
// width 100vw
|
||||
// }
|
||||
.custom-fullscreen-dialog {
|
||||
.is-fullscreen {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
.el-dialog__header {
|
||||
// padding: var(--el-dialog-padding-primary);
|
||||
// box-sizing: border-box;
|
||||
// height: 65px;
|
||||
// line-height: 22px;
|
||||
padding: 0;
|
||||
// height: 64px;
|
||||
height: 0;
|
||||
line-height: 64px;
|
||||
background: linear-gradient(180deg, #e4eaff, #eaf1fa 48%, #eef2fb);
|
||||
border-radius: 1px;
|
||||
position: relative;
|
||||
border-bottom: none;
|
||||
// border-bottom 1px solid rgba(255,255,255,0.8)
|
||||
.el-dialog__headerbtn {
|
||||
left: 24px;
|
||||
display: flex;
|
||||
height: auto;
|
||||
width: 64px;
|
||||
top: 20px;
|
||||
// top 50%
|
||||
// transform: translateY(-50%);
|
||||
align-items: center;
|
||||
.el-dialog__close {
|
||||
font-size: 17px;
|
||||
color: var(--el-color-primary);
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
background: rgba(255, 255, 255, 0.69);
|
||||
border: 1px solid rgba(255, 255, 255, 0.31);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
&::after {
|
||||
content: '返回';
|
||||
font-size: 14px;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #323233;
|
||||
line-height: 20px;
|
||||
margin-left: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-dialog__body {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
// overflow: auto
|
||||
}
|
||||
}
|
||||
}
|
||||
.message-drawer-container {
|
||||
.el-drawer__header {
|
||||
font-family: PingFangSC, PingFangSC-Medium;
|
||||
border-radius: 3px 3px 0px 0px;
|
||||
border: 1px solid #e2e7ee;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 20px;
|
||||
.title {
|
||||
font-weight: var(--font-weight-bold);
|
||||
color: #323233;
|
||||
font-size: 15px;
|
||||
line-height: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.goBox {
|
||||
margin-left: 24px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// img {
|
||||
// vertical-align bottom
|
||||
// }
|
||||
}
|
||||
}
|
||||
.el-drawer__body {
|
||||
padding: 16px 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 表格公共样式
|
||||
.t-table, .f-table-com {
|
||||
--el-table-header-bg-color: #fff;
|
||||
.el-table {
|
||||
&.is-scrolling-left {
|
||||
th {
|
||||
&.el-table-fixed-column--left {
|
||||
background-color: #fff;
|
||||
}
|
||||
&.el-table-fixed-column--right {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.is-scrolling-none {
|
||||
th {
|
||||
&.el-table-fixed-column--left {
|
||||
background-color: #fff;
|
||||
}
|
||||
&.el-table-fixed-column--right {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-table__header {
|
||||
thead.is-group {
|
||||
th {
|
||||
&.el-table-fixed-column--right {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
&.el-table-fixed-column--left {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
}
|
||||
}
|
||||
th {
|
||||
height: 45px;
|
||||
background-color: #fff;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
letter-spacing: -0.2px;
|
||||
.cell {
|
||||
padding: 0 8px;
|
||||
}
|
||||
&.el-table-fixed-column--right {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-table__body {
|
||||
.el-table__cell {
|
||||
cursor: default;
|
||||
height: 50px;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 12px;
|
||||
.cell {
|
||||
// width: calc(100% - 2px) !important;
|
||||
padding: 0 8px;
|
||||
.table-handle-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin-left: -8px;
|
||||
& > .handle-span {
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
color: var(--el-color-primary);
|
||||
cursor: pointer;
|
||||
&.is-disabled {
|
||||
color: var(--el-color-primary-light-5);
|
||||
}
|
||||
}
|
||||
& > .el-dropdown {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-pagination.is-background {
|
||||
position: relative;
|
||||
justify-content: flex-end;
|
||||
.el-pager {
|
||||
li {
|
||||
&.is-active {
|
||||
background-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 解决el-tabs__headers排列在l-tabs__content下面的问题
|
||||
.el-tabs {
|
||||
&.el-tabs--top {
|
||||
flex-direction: column !important;
|
||||
}
|
||||
.el-tabs__header {
|
||||
order: 1;
|
||||
}
|
||||
.el-tabs__content {
|
||||
order: 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 覆盖aicc-theme样式
|
||||
.aicc-theme .el-checkbox__inner::after {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.aicc-theme .el-radio__inner::after {
|
||||
width: 6px !important;
|
||||
height: 6px !important;
|
||||
}
|
||||
|
||||
.qiankun-micro-app-container{
|
||||
padding: 70px 24px 24px;
|
||||
}
|
||||
|
|
@ -130,6 +130,7 @@ function AppExecute() {
|
|||
const [searchParams] = useSearchParams();
|
||||
const isView = searchParams.get('from') === 'view'; // 查看任务详情
|
||||
const taskId = searchParams.get('id'); // 任务详情
|
||||
const source = searchParams.get('source'); // 来源
|
||||
const [inputParameters, setInputParameters] = useState<Record<string, TaskInputParameter>>();
|
||||
const [taskName, setTaskName] = useState<string>();
|
||||
const [activeTab, setActiveTab] = useState<TaskTabKey>(TaskTabKey.Result);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
import KFDefaultEmpty from '@/components/KFDefaultEmpty';
|
||||
import KFModal from '@/components/KFModal';
|
||||
import { ServiceRunStatus } from '@/enums';
|
||||
import { ApplicationSource, ServiceVersionData } from '@/pages/Application/types';
|
||||
import { getServiceVersionsReq } from '@/services/modelDeployment';
|
||||
import { to } from '@/utils/promise';
|
||||
import { Flex, type ModalProps } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { ServiceVersionData } from '../../../types';
|
||||
import styles from './index.less';
|
||||
|
||||
interface PublishModalProps extends Omit<ModalProps, 'onOk'> {
|
||||
serviceId: number;
|
||||
serviceSource: ApplicationSource; // 应用来源
|
||||
onOk?: (id: number) => void;
|
||||
}
|
||||
|
||||
function PublishModal({ serviceId, onOk, ...rest }: PublishModalProps) {
|
||||
function PublishModal({ serviceId, serviceSource, onOk, ...rest }: PublishModalProps) {
|
||||
const [versions, setVersions] = useState<ServiceVersionData[]>([]);
|
||||
const [selectedVersion, setSelectedVersion] = useState<number>();
|
||||
|
||||
|
|
@ -24,13 +25,14 @@ function PublishModal({ serviceId, onOk, ...rest }: PublishModalProps) {
|
|||
size: 100,
|
||||
run_state: ServiceRunStatus.Running,
|
||||
service_id: serviceId,
|
||||
source: serviceSource,
|
||||
};
|
||||
const [res] = await to(getServiceVersionsReq(params));
|
||||
if (res && res.data) {
|
||||
const { content = [] } = res.data;
|
||||
setVersions(content);
|
||||
}
|
||||
}, [serviceId]);
|
||||
}, [serviceId, serviceSource]);
|
||||
|
||||
useEffect(() => {
|
||||
getVersions();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import KFIcon from '@/components/KFIcon';
|
||||
import { AppRunStatus, appStatusOptions } from '@/enums';
|
||||
import { ServiceTaskData } from '@/pages/Application/types';
|
||||
import { ApplicationSource, ServiceTaskData } from '@/pages/Application/types';
|
||||
import { deleteTaskInfoReq, getTaskListReq } from '@/services/modelDeployment';
|
||||
import { elapsedTime } from '@/utils/date';
|
||||
import { to } from '@/utils/promise';
|
||||
|
|
@ -33,10 +33,11 @@ const allServiceStatusOptions = [{ label: '全部', value: '' }, ...appStatusOpt
|
|||
type VersionListProps = {
|
||||
isMine: boolean;
|
||||
serviceId: number;
|
||||
serviceSource: ApplicationSource; // 应用来源
|
||||
onNavigate: (url: string) => void;
|
||||
};
|
||||
|
||||
function VersionList({ isMine, serviceId, onNavigate }: VersionListProps) {
|
||||
function VersionList({ isMine, serviceId, serviceSource, onNavigate }: VersionListProps) {
|
||||
const { message } = App.useApp();
|
||||
const [searchstatus, setSearchStatus] = useState<string>(); // 查询状态
|
||||
const [searchTaskName, setSearchTaskName] = useState<string>(); // 查询版本
|
||||
|
|
@ -56,6 +57,7 @@ function VersionList({ isMine, serviceId, onNavigate }: VersionListProps) {
|
|||
task_name: searchTaskName || undefined,
|
||||
status: searchstatus || undefined,
|
||||
service_id: serviceId,
|
||||
source: serviceSource,
|
||||
};
|
||||
const [res] = await to(getTaskListReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
@ -63,7 +65,7 @@ function VersionList({ isMine, serviceId, onNavigate }: VersionListProps) {
|
|||
setTableData(content);
|
||||
setTotal(totalElements);
|
||||
}
|
||||
}, [pagination, searchstatus, searchTaskName, serviceId]);
|
||||
}, [pagination, searchstatus, searchTaskName, serviceId, serviceSource]);
|
||||
|
||||
useEffect(() => {
|
||||
getTaskList();
|
||||
|
|
@ -119,9 +121,11 @@ function VersionList({ isMine, serviceId, onNavigate }: VersionListProps) {
|
|||
});
|
||||
};
|
||||
|
||||
// 查看详情
|
||||
// 查看任务详情
|
||||
const toDetail = (record: ServiceTaskData) => {
|
||||
onNavigate(`execute/${record.service_version_id}?id=${record.id}&from=view`);
|
||||
onNavigate(
|
||||
`execute/${record.service_version_id}?source=${serviceSource}id=${record.id}&from=view`,
|
||||
);
|
||||
};
|
||||
|
||||
// 分页切换
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ function VersionList({
|
|||
version: searchVersion || undefined,
|
||||
run_state: searchStatus || undefined,
|
||||
service_id: serviceId,
|
||||
source: serviceSource,
|
||||
};
|
||||
const [res] = await to(getServiceVersionsReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
@ -133,7 +134,7 @@ function VersionList({
|
|||
setTableData(content);
|
||||
setTotal(totalElements);
|
||||
}
|
||||
}, [pagination, searchStatus, searchVersion, serviceId]);
|
||||
}, [pagination, searchStatus, searchVersion, serviceId, serviceSource]);
|
||||
|
||||
useEffect(() => {
|
||||
getServiceVersions();
|
||||
|
|
@ -141,7 +142,7 @@ function VersionList({
|
|||
|
||||
// 删除模型部署
|
||||
const deleteServiceVersion = async (record: ServiceVersionData) => {
|
||||
const [res] = await to(deleteServiceVersionReq(record.id));
|
||||
const [res] = await to(deleteServiceVersionReq(serviceSource, record.id));
|
||||
if (res) {
|
||||
message.success('删除成功');
|
||||
// 如果是一页的唯一数据,删除后,请求第一页的数据
|
||||
|
|
@ -157,7 +158,7 @@ function VersionList({
|
|||
|
||||
// 停止模型部署
|
||||
const stopServiceVersion = async (record: ServiceVersionData) => {
|
||||
const [res] = await to(stopServiceVersionReq(record.id));
|
||||
const [res] = await to(stopServiceVersionReq(serviceSource, record.id));
|
||||
if (res) {
|
||||
message.success('操作成功');
|
||||
getServiceVersions();
|
||||
|
|
@ -229,12 +230,12 @@ function VersionList({
|
|||
|
||||
// 查看详情
|
||||
const toDetail = (record: ServiceVersionData) => {
|
||||
onNavigate(`versionInfo/${record.id}`);
|
||||
onNavigate(`versionInfo/${record.id}?source=${serviceSource}`);
|
||||
};
|
||||
|
||||
// 测试运行
|
||||
const toRun = (record: ServiceVersionData) => {
|
||||
onNavigate(`execute/${record.id}`);
|
||||
onNavigate(`execute/${record.id}?source=${serviceSource}`);
|
||||
};
|
||||
|
||||
// 分页切换
|
||||
|
|
@ -259,6 +260,7 @@ function VersionList({
|
|||
openAntdModal(VersionCompareModal, {
|
||||
version1: selectedRowKeys[0] as string,
|
||||
version2: selectedRowKeys[1] as string,
|
||||
serviceSource: serviceSource,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -273,7 +275,7 @@ function VersionList({
|
|||
},
|
||||
};
|
||||
|
||||
// 去模型
|
||||
// 去模型页
|
||||
const gotoModel = (record: ServiceVersionData, e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
|
|
@ -448,7 +450,7 @@ function VersionList({
|
|||
dataIndex: 'template',
|
||||
key: 'template',
|
||||
width: '20%',
|
||||
render: tableCellRender(true),
|
||||
render: () => <div>{}</div>,
|
||||
},
|
||||
{
|
||||
title: '应用描述',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
import KFIcon from '@/components/KFIcon';
|
||||
import KFMdEditor from '@/components/KFMdEditor';
|
||||
import { useCacheState } from '@/hooks/useCacheState';
|
||||
import { ApplicationSource, appSourceOptions } from '@/pages/Application/types';
|
||||
import { ApplicationSource, appSourceOptions, ServiceData } from '@/pages/Application/types';
|
||||
import {
|
||||
cancelFavoriteServiceReq,
|
||||
deleteServiceReq,
|
||||
|
|
@ -161,6 +161,7 @@ function AppInfo() {
|
|||
if (is_public) {
|
||||
const { close } = openAntdModal(PublishModal, {
|
||||
serviceId: serviceId,
|
||||
serviceSource: serviceInfo!.source,
|
||||
onOk: (publishVersion) => {
|
||||
close();
|
||||
updateService({
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import VersionBasicInfo from '@/pages/Application/components/VersionBasicInfo';
|
||||
import { getServiceVersionInfoReq } from '@/services/modelDeployment';
|
||||
import { to } from '@/utils/promise';
|
||||
import { useParams } from '@umijs/max';
|
||||
import { useParams, useSearchParams } from '@umijs/max';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ServiceVersionData } from '../types';
|
||||
import styles from './index.less';
|
||||
|
|
@ -15,11 +15,13 @@ function ServiceVersionInfo() {
|
|||
const [versionInfo, setVersionInfo] = useState<ServiceVersionData | undefined>(undefined);
|
||||
const params = useParams();
|
||||
const id = params.versionId;
|
||||
const [searchParams] = useSearchParams();
|
||||
const source = searchParams.get('source');
|
||||
|
||||
useEffect(() => {
|
||||
// 获取服务版本详情
|
||||
const getServiceVersionInfo = async () => {
|
||||
const [res] = await to(getServiceVersionInfoReq(id));
|
||||
const [res] = await to(getServiceVersionInfoReq(Number(source), id!));
|
||||
if (res && res.data) {
|
||||
setVersionInfo(res.data);
|
||||
}
|
||||
|
|
@ -28,7 +30,7 @@ function ServiceVersionInfo() {
|
|||
if (id) {
|
||||
getServiceVersionInfo();
|
||||
}
|
||||
}, [id]);
|
||||
}, [id, source]);
|
||||
|
||||
return (
|
||||
<div className={styles['service-version-info']}>
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ function CreateAppModal({ serviceId, onOk, ...rest }: CreateAppModalModalProps)
|
|||
source === ApplicationSource.SuperCompute && (
|
||||
<Form.Item
|
||||
label="应用模板"
|
||||
name="service_template"
|
||||
name="service_temp_id"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {
|
|||
ServiceVersionData,
|
||||
} from '@/pages/Application/types';
|
||||
import { createServiceVersionReq, updateServiceVersionReq } from '@/services/modelDeployment';
|
||||
import { changePropertyName } from '@/utils';
|
||||
import { to } from '@/utils/promise';
|
||||
import { Form, Input, message, type ModalProps } from 'antd';
|
||||
import { omit } from 'lodash';
|
||||
|
|
@ -66,13 +65,7 @@ function CreateAppVersionModal({
|
|||
|
||||
useEffect(() => {
|
||||
if (versionInfo) {
|
||||
let model, envVariables;
|
||||
// 模型
|
||||
if (versionInfo.model && typeof versionInfo.model === 'object') {
|
||||
model = changePropertyName(versionInfo.model, { show_value: 'showValue' });
|
||||
// 接口返回是数据没有 value 值,但是 form 需要 value
|
||||
// model.value = model.showValue;
|
||||
}
|
||||
let envVariables;
|
||||
// 环境变量
|
||||
if (versionInfo.env_variables && typeof versionInfo.env_variables === 'object') {
|
||||
envVariables = Object.entries(versionInfo.env_variables).map(([key, value]) => ({
|
||||
|
|
@ -81,8 +74,7 @@ function CreateAppVersionModal({
|
|||
}));
|
||||
}
|
||||
const formData = {
|
||||
...omit(versionInfo, 'model', 'env_variables'),
|
||||
model: model,
|
||||
...omit(versionInfo, 'env_variables'),
|
||||
env_variables: envVariables,
|
||||
service_name: serviceName,
|
||||
};
|
||||
|
|
@ -101,9 +93,13 @@ function CreateAppVersionModal({
|
|||
// 根据后台要求,修改表单数据
|
||||
const object = {
|
||||
...omit(formData, ['replicas', 'env_variables']),
|
||||
replicas: Number(formData.replicas),
|
||||
replicas:
|
||||
formData.replicas !== undefined && formData.replicas !== null
|
||||
? Number(formData.replicas)
|
||||
: undefined,
|
||||
env_variables: envVariables,
|
||||
service_id: serviceId,
|
||||
source: serviceSource,
|
||||
};
|
||||
|
||||
const params =
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import KFModal from '@/components/KFModal';
|
||||
import { ServiceRunStatus } from '@/enums';
|
||||
import { useSystemResource } from '@/hooks/useComputingResource';
|
||||
import { type ServiceVersionData } from '@/pages/Application/types';
|
||||
import { ApplicationSource, type ServiceVersionData } from '@/pages/Application/types';
|
||||
import { getServiceVersionCompareReq } from '@/services/modelDeployment';
|
||||
import { isEmpty } from '@/utils';
|
||||
import { to } from '@/utils/promise';
|
||||
|
|
@ -28,6 +28,7 @@ type FiledType = {
|
|||
interface VersionCompareModalProps extends Omit<ModalProps, 'onOk'> {
|
||||
version1: string;
|
||||
version2: string;
|
||||
serviceSource: ApplicationSource; // 应用来源
|
||||
}
|
||||
|
||||
// 格式化环境变量
|
||||
|
|
@ -40,7 +41,12 @@ const formatEnvText = (env: Record<string, string>) => {
|
|||
.join(',');
|
||||
};
|
||||
|
||||
function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModalProps) {
|
||||
function VersionCompareModal({
|
||||
version1,
|
||||
version2,
|
||||
serviceSource,
|
||||
...rest
|
||||
}: VersionCompareModalProps) {
|
||||
const [compareData, setCompareData] = useState<CompareData | undefined>(undefined);
|
||||
const getResourceDescription = useSystemResource();
|
||||
|
||||
|
|
@ -61,21 +67,21 @@ function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModa
|
|||
key: 'image',
|
||||
text: '镜像',
|
||||
format: (data: any) => {
|
||||
return data?.path;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'code_config',
|
||||
text: '代码配置',
|
||||
format: (data: any) => {
|
||||
return data?.show_value;
|
||||
return data?.showValue;
|
||||
},
|
||||
},
|
||||
// {
|
||||
// key: 'code_config',
|
||||
// text: '代码配置',
|
||||
// format: (data: any) => {
|
||||
// return data?.showValue;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
key: 'model',
|
||||
text: '模型',
|
||||
format: (data: any) => {
|
||||
return data?.show_value;
|
||||
return data?.showValue;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -114,6 +120,7 @@ function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModa
|
|||
const params = {
|
||||
id1: version1,
|
||||
id2: version2,
|
||||
source: serviceSource,
|
||||
};
|
||||
const [res] = await to(getServiceVersionCompareReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
@ -122,7 +129,7 @@ function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModa
|
|||
};
|
||||
|
||||
getServiceVersionCompare();
|
||||
}, [version1, version2]);
|
||||
}, [version1, version2, serviceSource]);
|
||||
|
||||
const {
|
||||
version1: v1 = {} as ServiceVersionData,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export type ServiceData = {
|
|||
public_version_id?: number; // 发布的版本id
|
||||
tag?: string;
|
||||
comment_count: number;
|
||||
source?: ApplicationSource; // 来源
|
||||
source: ApplicationSource; // 来源
|
||||
};
|
||||
|
||||
// 服务版本数据类型
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// src/contexts/SourceContext.tsx
|
||||
import { createContext, ReactNode, useContext, useState } from 'react';
|
||||
import { ApplicationSource } from './types';
|
||||
|
||||
// 1. 定义 Context 值的类型
|
||||
interface SourceContextType<T = any> {
|
||||
source: T | null;
|
||||
setSource: (value: T | null) => void;
|
||||
}
|
||||
|
||||
// 2. 创建 Context,指定默认值为 undefined(更好的类型安全)
|
||||
const SourceContext = createContext<SourceContextType | undefined>(undefined);
|
||||
|
||||
// 3. 定义 Provider 组件的 Props 类型
|
||||
interface SourceProviderProps<T> {
|
||||
children: ReactNode;
|
||||
initialValue?: T | null;
|
||||
}
|
||||
|
||||
// 4. 创建泛型 Provider 组件
|
||||
export function SourceProvider<T>({ children, initialValue = null }: SourceProviderProps<T>) {
|
||||
const [source, setSource] = useState<T | null>(initialValue as T | null);
|
||||
|
||||
// 优化性能
|
||||
const contextValue = {
|
||||
source,
|
||||
setSource,
|
||||
};
|
||||
|
||||
return <SourceContext.Provider value={contextValue}>{children}</SourceContext.Provider>;
|
||||
}
|
||||
|
||||
// 5. 创建自定义 Hook(支持泛型)
|
||||
export function useSourceContext<T = any>(): SourceContextType<T> {
|
||||
const context = useContext(SourceContext);
|
||||
|
||||
if (context === undefined) {
|
||||
throw new Error('useSourceContext must be used within a SourceProvider');
|
||||
}
|
||||
|
||||
return context as SourceContextType<T>;
|
||||
}
|
||||
|
||||
export function useTypedSourceContext() {
|
||||
return useSourceContext<ApplicationSource>();
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ import KFModal from '@/components/KFModal';
|
|||
import { ModelType } from '@/enums';
|
||||
import { useTags } from '@/hooks/useTags';
|
||||
import { CategoryData, DataSource, UniResourceData } from '@/pages/Dataset/config';
|
||||
import { createBigDatasetReq, getBigDatasetAllLabelReq } from '@/services/bigModel';
|
||||
import { getBigDatasetAllLabelReq } from '@/services/bigModel';
|
||||
import { addDataset, editDatasetReq, getAssetIcon } from '@/services/dataset/index.js';
|
||||
import { to } from '@/utils/promise';
|
||||
import {
|
||||
|
|
@ -22,7 +22,7 @@ import styles from './index.less';
|
|||
interface FormData {
|
||||
name: string;
|
||||
type: ModelType;
|
||||
labelId?: string;
|
||||
label_id?: string;
|
||||
data_type: string[];
|
||||
data_tag: string[];
|
||||
preview_url: string;
|
||||
|
|
@ -86,6 +86,13 @@ function AddDatasetModal({ info, onOk, ...rest }: AddDatasetModalProps) {
|
|||
const [res] = await to(getBigDatasetAllLabelReq());
|
||||
if (res && res.data) {
|
||||
setSceneOptions(res.data);
|
||||
} else {
|
||||
setSceneOptions([
|
||||
{
|
||||
id: 1,
|
||||
name: 'test',
|
||||
},
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -95,29 +102,19 @@ function AddDatasetModal({ info, onOk, ...rest }: AddDatasetModalProps) {
|
|||
const isBigDataset = type === ModelType.Big;
|
||||
const data_type = dataTypes?.join(',');
|
||||
const data_tag = dataTags?.join(',');
|
||||
const reqParams = isBigDataset
|
||||
? {
|
||||
name: rest.name,
|
||||
description: rest.description,
|
||||
previewUrl: rest.preview_url,
|
||||
labelId: rest.labelId,
|
||||
dataType: data_type,
|
||||
dataTag: data_tag,
|
||||
source: DataSource.Create,
|
||||
public: false,
|
||||
}
|
||||
: {
|
||||
...rest,
|
||||
dataset_source: DataSource.Create,
|
||||
data_type,
|
||||
data_tag,
|
||||
is_public: false,
|
||||
};
|
||||
const reqParams = {
|
||||
...rest,
|
||||
dataset_source: DataSource.Create,
|
||||
data_type,
|
||||
data_tag,
|
||||
is_public: false,
|
||||
is_hot_stone: isBigDataset,
|
||||
};
|
||||
|
||||
const reqBody = info
|
||||
? { ...info, ...omit(reqParams, ['dataset_source', 'is_public', 'source', 'public']) }
|
||||
? { ...info, ...omit(reqParams, ['dataset_source', 'is_public', 'is_hot_stone']) }
|
||||
: reqParams;
|
||||
const request = isBigDataset ? createBigDatasetReq : info ? editDatasetReq : addDataset;
|
||||
const request = info ? editDatasetReq : addDataset;
|
||||
const [res] = await to(request(reqBody));
|
||||
if (res) {
|
||||
onOk?.(isBigDataset, res.data);
|
||||
|
|
@ -193,7 +190,7 @@ function AddDatasetModal({ info, onOk, ...rest }: AddDatasetModalProps) {
|
|||
return (
|
||||
<Form.Item
|
||||
label="场景分类"
|
||||
name="labelId"
|
||||
name="label_id"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
|
|
@ -272,6 +269,19 @@ function AddDatasetModal({ info, onOk, ...rest }: AddDatasetModalProps) {
|
|||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="选择图片"
|
||||
name="preview_pic"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择图片或上传图片',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ImagePicker serverType={ImagePickerServerType.App} uuid={uuid}></ImagePicker>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item noStyle dependencies={['type']}>
|
||||
{({ getFieldValue }) => {
|
||||
const type = getFieldValue('type');
|
||||
|
|
@ -294,21 +304,7 @@ function AddDatasetModal({ info, onOk, ...rest }: AddDatasetModalProps) {
|
|||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
) : (
|
||||
<Form.Item
|
||||
label="选择图片"
|
||||
name="preview_pic"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择图片或上传图片',
|
||||
},
|
||||
]}
|
||||
style={{ marginBottom: 0 }}
|
||||
>
|
||||
<ImagePicker serverType={ImagePickerServerType.App} uuid={uuid}></ImagePicker>
|
||||
</Form.Item>
|
||||
);
|
||||
) : null;
|
||||
}}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import KFModal from '@/components/KFModal';
|
|||
import { ModelType } from '@/enums';
|
||||
import { useTags } from '@/hooks/useTags';
|
||||
import { CategoryData, DataSource, UniResourceData } from '@/pages/Dataset/config';
|
||||
import { createBigModelReq } from '@/services/bigModel';
|
||||
import { addModel, editModelReq, getAssetIcon } from '@/services/dataset/index.js';
|
||||
import { to } from '@/utils/promise';
|
||||
import { Form, Input, Radio, Select, TreeSelect, type ModalProps } from 'antd';
|
||||
|
|
@ -71,28 +70,18 @@ function AddModelModal({ info, onOk, ...rest }: AddModelModalProps) {
|
|||
const isBigModel = type === ModelType.Big;
|
||||
const model_type = modelTypes?.join(',');
|
||||
const model_tag = modelTags?.join(',');
|
||||
const reqParams = isBigModel
|
||||
? {
|
||||
name: rest.name,
|
||||
description: rest.description,
|
||||
// previewUrl: rest.preview_url,
|
||||
modelType: model_type,
|
||||
modelTag: model_tag,
|
||||
source: '第三方模型',
|
||||
sourceMmp: DataSource.Create,
|
||||
isPublic: false,
|
||||
}
|
||||
: {
|
||||
...rest,
|
||||
model_type,
|
||||
model_tag,
|
||||
model_source: DataSource.Create,
|
||||
is_public: false,
|
||||
};
|
||||
const reqParams = {
|
||||
...rest,
|
||||
model_type,
|
||||
model_tag,
|
||||
model_source: DataSource.Create,
|
||||
is_public: false,
|
||||
is_hot_stone: isBigModel,
|
||||
};
|
||||
const reqBody = info
|
||||
? { ...info, ...omit(reqParams, ['model_source', 'is_public', 'source', 'isPublic']) }
|
||||
? { ...info, ...omit(reqParams, ['model_source', 'is_public', 'is_hot_stone']) }
|
||||
: reqParams;
|
||||
const request = isBigModel ? createBigModelReq : info ? editModelReq : addModel;
|
||||
const request = info ? editModelReq : addModel;
|
||||
const [res] = await to(request(reqBody));
|
||||
if (res) {
|
||||
onOk?.(isBigModel, res.data);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { useEffect, useState } from 'react';
|
|||
interface AddVersionModalProps extends Omit<ModalProps, 'onOk'> {
|
||||
resourceType: ResourceType;
|
||||
resourceId: number;
|
||||
gitId: number;
|
||||
resoureName: string;
|
||||
owner: string;
|
||||
identifier: string;
|
||||
|
|
@ -22,6 +23,7 @@ interface AddVersionModalProps extends Omit<ModalProps, 'onOk'> {
|
|||
function AddVersionModal({
|
||||
resourceType,
|
||||
resourceId,
|
||||
gitId,
|
||||
resoureName,
|
||||
owner,
|
||||
identifier,
|
||||
|
|
@ -85,6 +87,7 @@ function AddVersionModal({
|
|||
};
|
||||
});
|
||||
const params = {
|
||||
git_id: gitId,
|
||||
id: resourceId,
|
||||
identifier,
|
||||
is_public,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import {
|
|||
import GraphLegend from '@/pages/Model/components/GraphLegend';
|
||||
import ModelEvolution from '@/pages/Model/components/ModelEvolution';
|
||||
import ModelMetrics from '@/pages/Model/components/ModelMetrics';
|
||||
import { praiseResourceReq, unpraiseResourceReq } from '@/services/dataset';
|
||||
import { changePropertyName } from '@/utils';
|
||||
import { ResourceCreatedMessage, VersionChangedMessage } from '@/utils/constant';
|
||||
import { openAntdModal } from '@/utils/modal';
|
||||
|
|
@ -52,8 +51,9 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
const [versionInfo, setVersionInfo] = useState<ResourceData>({} as ResourceData); // 版本详情
|
||||
const locationParams = useParams();
|
||||
const [searchParams] = useSearchParams();
|
||||
const resourceIdStr = locationParams.id ?? ''; // 大模型是字符串
|
||||
const resourceId = Number(resourceIdStr); // 小模型是整型
|
||||
const resourceId = Number(locationParams.id ?? ''); // 数据库 id
|
||||
const gitId = Number(searchParams.get('gitId')); // git id
|
||||
const hotStoneId = searchParams.get('hotStoneId') ?? ''; // 火石 id
|
||||
// 模型演化传入的 tab
|
||||
const defaultTab = searchParams.get('tab') || ResourceInfoTabKeys.Introduction;
|
||||
// 模型演化传入的版本
|
||||
|
|
@ -84,7 +84,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
const getResourceDetail = useCallback(
|
||||
async (version?: string) => {
|
||||
const params = {
|
||||
id: resourceId,
|
||||
git_id: gitId,
|
||||
owner,
|
||||
name,
|
||||
identifier,
|
||||
|
|
@ -101,13 +101,13 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
}
|
||||
}
|
||||
},
|
||||
[config, resourceId, owner, name, identifier, is_public],
|
||||
[config, gitId, owner, name, identifier, is_public],
|
||||
);
|
||||
|
||||
// 获取大模型详情
|
||||
const getBigModelResourceDetail = useCallback(async () => {
|
||||
const request = config.getBigInfo;
|
||||
const [res] = await to(request(resourceIdStr));
|
||||
const [res] = await to(request(hotStoneId));
|
||||
if (res && res.data) {
|
||||
if (resourceType === ResourceType.Dataset) {
|
||||
const data = changePropertyName(res.data.content[0], {
|
||||
|
|
@ -131,7 +131,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
setResourceInfo(data as UniResourceData);
|
||||
}
|
||||
}
|
||||
}, [config, resourceType, resourceIdStr]);
|
||||
}, [config, resourceType, hotStoneId]);
|
||||
|
||||
// 获取大模型版本详情
|
||||
const getBigModelResourceVersionDetail = useCallback(
|
||||
|
|
@ -165,7 +165,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
|
||||
if (isBigModel) {
|
||||
const request = config.getBigVersions;
|
||||
const [res] = await to(request(resourceIdStr));
|
||||
const [res] = await to(request(hotStoneId));
|
||||
if (res && res.data) {
|
||||
const content =
|
||||
resourceType === ResourceType.Dataset ? res.data : res.data.flintModelRepoDTOList;
|
||||
|
|
@ -207,7 +207,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
}
|
||||
}
|
||||
},
|
||||
[isBigModel, resourceIdStr, config, owner, identifier, versionParam, resourceType],
|
||||
[isBigModel, hotStoneId, config, owner, identifier, versionParam, resourceType],
|
||||
);
|
||||
|
||||
// 获取详情
|
||||
|
|
@ -249,7 +249,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
if (resourceType === ResourceType.Dataset) {
|
||||
const { close } = openAntdModal(AddBigDatasetVersionModal, {
|
||||
resourceType: resourceType,
|
||||
resourceId: resourceIdStr,
|
||||
resourceId: hotStoneId,
|
||||
resoureName: name,
|
||||
onOk: () => {
|
||||
getVersionList(true);
|
||||
|
|
@ -262,7 +262,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
tenantId: tenantId ?? resourceInfo.tenantId ?? '',
|
||||
username: currentUser?.userName ?? '',
|
||||
resourceType: resourceType,
|
||||
resourceId: resourceIdStr,
|
||||
resourceId: hotStoneId,
|
||||
resoureName: name,
|
||||
onOk: () => {
|
||||
getVersionList(true);
|
||||
|
|
@ -275,6 +275,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
const { close } = openAntdModal(AddVersionModal, {
|
||||
resourceType: resourceType,
|
||||
resourceId: resourceId,
|
||||
gitId: gitId,
|
||||
resoureName: name,
|
||||
owner: owner,
|
||||
identifier: identifier,
|
||||
|
|
@ -291,7 +292,8 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
isBigModel,
|
||||
resourceType,
|
||||
resourceId,
|
||||
resourceIdStr,
|
||||
hotStoneId,
|
||||
gitId,
|
||||
owner,
|
||||
identifier,
|
||||
is_public,
|
||||
|
|
@ -332,7 +334,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
openAntdModal(VersionCompareModal, {
|
||||
versions: versionList!.map((v) => v.name),
|
||||
resourceType: resourceType,
|
||||
repo_id: resourceId,
|
||||
repo_id: gitId,
|
||||
owner,
|
||||
identifier,
|
||||
is_public: is_public,
|
||||
|
|
@ -358,7 +360,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
} else {
|
||||
const request = config.deleteVersion;
|
||||
const params = {
|
||||
id: resourceId,
|
||||
git_id: gitId,
|
||||
owner,
|
||||
identifier,
|
||||
relative_paths: versionInfo.relative_paths,
|
||||
|
|
@ -396,15 +398,8 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const request =
|
||||
resourceInfo.praised === true
|
||||
? isBigModel
|
||||
? config.unpraiseBigModel
|
||||
: unpraiseResourceReq
|
||||
: isBigModel
|
||||
? config.praiseBigModel
|
||||
: praiseResourceReq;
|
||||
const [res] = await to(request(resourceInfo.id));
|
||||
const request = resourceInfo.praised === true ? config.unpraiseReq : config.praiseReq;
|
||||
const [res] = await to(request(resourceId));
|
||||
if (res) {
|
||||
message.success('操作成功');
|
||||
setResourceInfo((prev) => ({
|
||||
|
|
@ -450,11 +445,8 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
const publishResource = async () => {
|
||||
const request = config.publish;
|
||||
const params = {
|
||||
id: isBigModel ? resourceIdStr : resourceId,
|
||||
owner,
|
||||
id: resourceId,
|
||||
name,
|
||||
identifier,
|
||||
is_hot_stone: isBigModel ? ModelType.Big : ModelType.Small,
|
||||
};
|
||||
const [res] = await to(request(params));
|
||||
if (res) {
|
||||
|
|
@ -471,13 +463,13 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
};
|
||||
|
||||
// 编辑简介
|
||||
const handleEditIntro = async (id: number, identifier: string, description: string) => {
|
||||
const handleEditIntro = async (gitId: number, identifier: string, description: string) => {
|
||||
if (isBigModel) {
|
||||
return;
|
||||
} else {
|
||||
const request = config.editIntro;
|
||||
const params = {
|
||||
id,
|
||||
git_id: gitId,
|
||||
identifier,
|
||||
description,
|
||||
};
|
||||
|
|
@ -500,7 +492,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
<ResourceIntro
|
||||
resourceType={resourceType}
|
||||
info={versionInfo}
|
||||
resourceId={resourceId}
|
||||
gitId={gitId}
|
||||
identifier={identifier}
|
||||
name={name}
|
||||
description={description}
|
||||
|
|
@ -531,7 +523,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
label: `指标参数`,
|
||||
children: (
|
||||
<ModelMetrics
|
||||
resourceId={resourceId}
|
||||
gitId={gitId}
|
||||
identifier={identifier}
|
||||
owner={owner}
|
||||
version={version!}
|
||||
|
|
@ -544,6 +536,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
children: (
|
||||
<ModelEvolution
|
||||
resourceId={resourceId}
|
||||
gitId={gitId}
|
||||
version={version}
|
||||
identifier={identifier}
|
||||
isActive={activeTab === ResourceInfoTabKeys.Evolution}
|
||||
|
|
@ -691,7 +684,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => {
|
|||
<ResourceIntro
|
||||
resourceType={resourceType}
|
||||
info={versionInfo}
|
||||
resourceId={resourceId}
|
||||
gitId={gitId}
|
||||
identifier={identifier}
|
||||
name={name}
|
||||
description={description}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import styles from './index.less';
|
|||
type ResourceIntroProps = {
|
||||
resourceType: ResourceType;
|
||||
info: DatasetData | ModelData;
|
||||
resourceId: number;
|
||||
gitId: number;
|
||||
identifier: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
|
|
@ -242,7 +242,7 @@ const getModelDatas = (isBigModel: boolean, data: ModelData): BasicInfoData[] =>
|
|||
function ResourceIntro({
|
||||
resourceType,
|
||||
info,
|
||||
resourceId,
|
||||
gitId,
|
||||
identifier,
|
||||
// name,
|
||||
description,
|
||||
|
|
@ -321,7 +321,7 @@ function ResourceIntro({
|
|||
noDataTitle={isMine ? `请编辑${config.name}介绍` : `暂无${config.name}介绍`}
|
||||
placeholder="请输入"
|
||||
editBtnTitle="编辑简介"
|
||||
onChange={(value) => onEditIntro?.(resourceId, identifier, value)}
|
||||
onChange={(value) => onEditIntro?.(gitId, identifier, value)}
|
||||
></KFMdEditor>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { to } from '@/utils/promise';
|
|||
import { modalConfirm } from '@/utils/ui';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { App, Button, Pagination, PaginationProps } from 'antd';
|
||||
import { pick } from 'lodash';
|
||||
import { Ref, forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
||||
import { ResourceData, ResourceType, resourceConfig } from '../../config';
|
||||
import AddDatasetModal from '../AddDatasetModal';
|
||||
|
|
@ -105,17 +104,9 @@ function ResourceList(
|
|||
);
|
||||
|
||||
// 删除请求
|
||||
const deleteRecord = async (params: {
|
||||
owner: string;
|
||||
identifier: string;
|
||||
id: number | string;
|
||||
is_public: boolean;
|
||||
is_hot_stone: number;
|
||||
}) => {
|
||||
const { is_hot_stone, ...rest } = params;
|
||||
const isBigModel = is_hot_stone;
|
||||
const request = is_hot_stone ? config.deleteBigModel : config.deleteRecord;
|
||||
const [res] = await to(request(isBigModel ? rest.id : rest));
|
||||
const deleteRecord = async (id: number) => {
|
||||
const request = config.deleteRecord;
|
||||
const [res] = await to(request(id));
|
||||
if (res) {
|
||||
message.success('删除成功');
|
||||
// 如果是一页的唯一数据,删除后,请求第一页的数据
|
||||
|
|
@ -146,7 +137,7 @@ function ResourceList(
|
|||
title: config.deleteModalTitle,
|
||||
content: '删除后将不可恢复,请谨慎操作!',
|
||||
onOk: () => {
|
||||
deleteRecord(pick(record, ['owner', 'identifier', 'id', 'is_public', 'is_hot_stone']));
|
||||
deleteRecord(record.id);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -162,10 +153,12 @@ function ResourceList(
|
|||
const prefix = config.prefix;
|
||||
if (!record.is_hot_stone) {
|
||||
navigate(
|
||||
`/dataset/${prefix}/info/${record.id}?name=${record.name}&owner=${record.owner}&identifier=${record.identifier}&is_public=${record.is_public}&source=${ModelType.Small}`,
|
||||
`/dataset/${prefix}/info/${record.id}?gitId=${record.git_id}&name=${record.name}&owner=${record.owner}&identifier=${record.identifier}&is_public=${record.is_public}&source=${ModelType.Small}`,
|
||||
);
|
||||
} else {
|
||||
navigate(`/dataset/${prefix}/info/${record.id}?name=${record.name}&source=${ModelType.Big}`);
|
||||
navigate(
|
||||
`/dataset/${prefix}/info/${record.id}?hotStoneId=${record.hot_stone_id}&name=${record.name}&source=${ModelType.Big}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -192,11 +185,11 @@ function ResourceList(
|
|||
const prefix = config.prefix;
|
||||
if (!isBig) {
|
||||
navigate(
|
||||
`/dataset/${prefix}/info/${record.id}?name=${record.name}&owner=${record.owner}&identifier=${record.identifier}&is_public=false&source=${ModelType.Small}`,
|
||||
`/dataset/${prefix}/info/${record.id}?gitId=${record.git_id}&name=${record.name}&owner=${record.owner}&identifier=${record.identifier}&is_public=false&source=${ModelType.Small}`,
|
||||
);
|
||||
} else {
|
||||
navigate(
|
||||
`/dataset/${prefix}/info/${record.id}?name=${record.name}&source=${ModelType.Big}`,
|
||||
`/dataset/${prefix}/info/${record.id}?hotStoneId=${record.hot_stone_id}&name=${record.name}&source=${ModelType.Big}`,
|
||||
);
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ function ResourceVersion({ resourceType, info, isBig }: ResourceVersionProps) {
|
|||
const url = config.downloadAllAction;
|
||||
downLoadZip(url, {
|
||||
name: info.name,
|
||||
id: info.id,
|
||||
git_id: info.git_id,
|
||||
version: info.version,
|
||||
identifier: info.identifier,
|
||||
owner: info.owner,
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ import {
|
|||
getBigModelListReq,
|
||||
getBigModelVersionInfoReq,
|
||||
getBigModelVersionsReq,
|
||||
praiseBigDatesetReq,
|
||||
praiseBigDatasetReq,
|
||||
praiseBigModelReq,
|
||||
unpraiseBigDatesetReq,
|
||||
unpraiseBigDatasetReq,
|
||||
unpraiseBigModelReq,
|
||||
} from '@/services/bigModel';
|
||||
import {
|
||||
|
|
@ -41,8 +41,12 @@ import {
|
|||
getModelList,
|
||||
getModelNextVersionReq,
|
||||
getModelVersionList,
|
||||
praiseDatasetReq,
|
||||
praiseModelReq,
|
||||
publishDatasetReq,
|
||||
publishModelReq,
|
||||
unpraiseDatasetReq,
|
||||
unpraiseModelReq,
|
||||
} from '@/services/dataset/index.js';
|
||||
import { Response } from '@/types';
|
||||
import { formatDate } from '@/utils/date';
|
||||
|
|
@ -71,6 +75,8 @@ type ResourceTypeInfo = {
|
|||
getInfo: (params: any) => Promise<any>; // 获取详情
|
||||
compareVersion: (params: any) => Promise<any>; // 版本对比
|
||||
getNextVersion: (params: any) => Promise<any>; // 获取下一个版本
|
||||
praiseReq: (params: any) => Promise<any>; // 点赞
|
||||
unpraiseReq: (params: any) => Promise<any>; // 取消点赞
|
||||
getBigList: (params: any) => Promise<any>; // 获取大模型列表
|
||||
getBigInfo: (params: any) => Promise<any>; // 获取大模型详情
|
||||
getBigVersions: (params: any) => Promise<any>; // 获取大模型版本列表
|
||||
|
|
@ -112,14 +118,16 @@ export const resourceConfig: Record<ResourceType, ResourceTypeInfo> = {
|
|||
getInfo: getDatasetInfo,
|
||||
compareVersion: compareDatasetVersion,
|
||||
getNextVersion: getDatasetNextVersionReq,
|
||||
praiseReq: praiseDatasetReq,
|
||||
unpraiseReq: unpraiseDatasetReq,
|
||||
getBigList: getBigDatasetListReq,
|
||||
getBigInfo: getBigDatasetInfoReq,
|
||||
getBigVersions: getBigDatasetVersionsReq,
|
||||
getBigVersionInfo: getBigDatasetVersionInfoReq,
|
||||
deleteBigVersion: deleteBigDatasetVersionReq,
|
||||
deleteBigModel: deleteBigDatasetReq,
|
||||
praiseBigModel: praiseBigDatesetReq,
|
||||
unpraiseBigModel: unpraiseBigDatesetReq,
|
||||
praiseBigModel: praiseBigDatasetReq,
|
||||
unpraiseBigModel: unpraiseBigDatasetReq,
|
||||
publish: publishDatasetReq,
|
||||
getFileUrl: getDatasetFileUrlReq,
|
||||
editIntro: editDatasetIntroReq,
|
||||
|
|
@ -162,6 +170,8 @@ export const resourceConfig: Record<ResourceType, ResourceTypeInfo> = {
|
|||
getInfo: getModelInfo,
|
||||
compareVersion: compareModelVersion,
|
||||
getNextVersion: getModelNextVersionReq,
|
||||
praiseReq: praiseModelReq,
|
||||
unpraiseReq: unpraiseModelReq,
|
||||
getBigList: getBigModelListReq,
|
||||
getBigInfo: getBigModelInfoReq,
|
||||
getBigVersions: getBigModelVersionsReq,
|
||||
|
|
@ -219,7 +229,9 @@ export interface CategoryData {
|
|||
// 数据集、模型列表数据
|
||||
export interface ResourceData {
|
||||
resourceType: ResourceType.Dataset | ResourceType.Model; // 用于 ts 类型判断
|
||||
id: number | string;
|
||||
id: number;
|
||||
git_id: number;
|
||||
hot_stone_id: string;
|
||||
name: string;
|
||||
identifier: string;
|
||||
owner: string;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ function ExportModelModal({
|
|||
const resource = getSelectedResource(id);
|
||||
const params = {
|
||||
...formData,
|
||||
git_id: resource?.git_id,
|
||||
identifier: resource?.identifier,
|
||||
owner: resource?.owner,
|
||||
is_public: resource?.is_public,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
|
||||
type modeModelEvolutionProps = {
|
||||
resourceId: number;
|
||||
gitId: number;
|
||||
identifier: string;
|
||||
version?: string;
|
||||
isActive: boolean;
|
||||
|
|
@ -34,6 +35,7 @@ type modeModelEvolutionProps = {
|
|||
let graph: Graph;
|
||||
function ModelEvolution({
|
||||
resourceId,
|
||||
gitId,
|
||||
identifier,
|
||||
version,
|
||||
isActive,
|
||||
|
|
@ -90,6 +92,7 @@ function ModelEvolution({
|
|||
|
||||
const params = {
|
||||
id: resourceId,
|
||||
git_id: gitId,
|
||||
identifier,
|
||||
version,
|
||||
};
|
||||
|
|
@ -108,7 +111,7 @@ function ModelEvolution({
|
|||
} else {
|
||||
clearGraphData();
|
||||
}
|
||||
}, [resourceId, identifier, version]);
|
||||
}, [resourceId, gitId, identifier, version]);
|
||||
|
||||
useEffectWhen(getModelAtlas, isActive, [resourceId, identifier, version]);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ type TableData = {
|
|||
};
|
||||
|
||||
type ModelMetricsProps = {
|
||||
resourceId: number;
|
||||
gitId: number;
|
||||
identifier: string;
|
||||
owner: string;
|
||||
version: string; // 当前版本
|
||||
};
|
||||
|
||||
function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsProps) {
|
||||
function ModelMetrics({ gitId, identifier, owner, version }: ModelMetricsProps) {
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -134,7 +134,7 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr
|
|||
metrics: selectedMetrics,
|
||||
type: MetricsType.Train,
|
||||
identifier: identifier,
|
||||
repo_id: resourceId,
|
||||
repo_id: gitId,
|
||||
};
|
||||
const [res] = await to(getModelVersionsMetricsReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
@ -147,7 +147,7 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr
|
|||
} else {
|
||||
setChartData(undefined);
|
||||
}
|
||||
}, [selectedMetrics, selectedRowKeys, identifier, resourceId]);
|
||||
}, [selectedMetrics, selectedRowKeys, identifier, gitId]);
|
||||
|
||||
// 分页切换
|
||||
const handleTableChange: TableProps<TableData>['onChange'] = (
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import ResourceSelect, {
|
|||
type ParameterInputObject,
|
||||
} from '@/components/ResourceSelect';
|
||||
import SubAreaTitle from '@/components/SubAreaTitle';
|
||||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import {
|
||||
createServiceVersionReq,
|
||||
getServiceInfoReq,
|
||||
|
|
@ -128,6 +129,7 @@ function CreateServiceVersion() {
|
|||
replicas: Number(formData.replicas),
|
||||
env_variables: envVariables,
|
||||
service_id: serviceId,
|
||||
source: ApplicationSource.Platform,
|
||||
};
|
||||
|
||||
const params =
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import SubAreaTitle from '@/components/SubAreaTitle';
|
|||
import { ServiceRunStatus, serviceStatusOptions } from '@/enums';
|
||||
import { useCacheState } from '@/hooks/useCacheState';
|
||||
import { useSystemResource } from '@/hooks/useComputingResource';
|
||||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import { ModelData } from '@/pages/Dataset/config';
|
||||
import {
|
||||
deleteServiceVersionReq,
|
||||
|
|
@ -107,6 +108,7 @@ function ServiceInfo() {
|
|||
version: searchText || undefined,
|
||||
run_state: serviceStatus,
|
||||
service_id: serviceId,
|
||||
source: ApplicationSource.Platform,
|
||||
};
|
||||
const [res] = await to(getServiceVersionsReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
@ -131,7 +133,7 @@ function ServiceInfo() {
|
|||
|
||||
// 删除模型部署
|
||||
const deleteServiceVersion = async (record: ServiceVersionData) => {
|
||||
const [res] = await to(deleteServiceVersionReq(record.id));
|
||||
const [res] = await to(deleteServiceVersionReq(ApplicationSource.Platform, record.id));
|
||||
if (res) {
|
||||
message.success('删除成功');
|
||||
// 如果是一页的唯一数据,删除后,请求第一页的数据
|
||||
|
|
@ -148,7 +150,7 @@ function ServiceInfo() {
|
|||
|
||||
// 停止模型部署
|
||||
const stopServiceVersion = async (record: ServiceVersionData) => {
|
||||
const [res] = await to(stopServiceVersionReq(record.id));
|
||||
const [res] = await to(stopServiceVersionReq(ApplicationSource.Platform, record.id));
|
||||
if (res) {
|
||||
message.success('操作成功');
|
||||
getServiceVersions();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import IframePage from '@/components/IFramePage';
|
|||
import KFIcon from '@/components/KFIcon';
|
||||
import PageTitle from '@/components/PageTitle';
|
||||
import { ServiceRunStatus } from '@/enums';
|
||||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import { getServiceVersionInfoReq } from '@/services/modelDeployment';
|
||||
import { to } from '@/utils/promise';
|
||||
import { useParams } from '@umijs/max';
|
||||
|
|
@ -32,7 +33,7 @@ function ServiceVersionInfo() {
|
|||
useEffect(() => {
|
||||
// 获取服务版本详情
|
||||
const getServiceVersionInfo = async () => {
|
||||
const [res] = await to(getServiceVersionInfoReq(id));
|
||||
const [res] = await to(getServiceVersionInfoReq(ApplicationSource.Platform, id!));
|
||||
if (res && res.data) {
|
||||
setVersionInfo(res.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import { ServiceVersionData } from '@/pages/ModelDeployment/types';
|
||||
import { getServiceVersionLogReq } from '@/services/modelDeployment';
|
||||
import { to } from '@/utils/promise';
|
||||
|
|
@ -62,6 +63,7 @@ function ServerLog({ info }: ServerLogProps) {
|
|||
start_time: logTime[0],
|
||||
end_time: logTime[1],
|
||||
id: info.id,
|
||||
source: ApplicationSource.Platform,
|
||||
};
|
||||
const [res] = await to(getServiceVersionLogReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import { ServiceVersionData } from '@/pages/ModelDeployment/types';
|
||||
import { getServiceVersionDocsReq } from '@/services/modelDeployment';
|
||||
import { to } from '@/utils/promise';
|
||||
|
|
@ -15,7 +16,7 @@ function UserGuide({ info }: UserGuideProps) {
|
|||
// 获取服务文档
|
||||
const getModelDeploymentDocs = async () => {
|
||||
if (info) {
|
||||
const [res] = await to(getServiceVersionDocsReq(info.id));
|
||||
const [res] = await to(getServiceVersionDocsReq(ApplicationSource.Platform, info.id));
|
||||
if (res && res.data && res.data.docs) {
|
||||
setDocs(JSON.stringify(res.data.docs, null, 2));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import KFModal from '@/components/KFModal';
|
||||
import { ServiceRunStatus } from '@/enums';
|
||||
import { useSystemResource } from '@/hooks/useComputingResource';
|
||||
import { ApplicationSource } from '@/pages/Application/types';
|
||||
import { type ServiceVersionData } from '@/pages/ModelDeployment/types';
|
||||
import { getServiceVersionCompareReq } from '@/services/modelDeployment';
|
||||
import { isEmpty } from '@/utils';
|
||||
|
|
@ -61,21 +62,21 @@ function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModa
|
|||
key: 'image',
|
||||
text: '镜像',
|
||||
format: (data: any) => {
|
||||
return data?.path;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'code_config',
|
||||
text: '代码配置',
|
||||
format: (data: any) => {
|
||||
return data?.show_value;
|
||||
return data?.showValue;
|
||||
},
|
||||
},
|
||||
// {
|
||||
// key: 'code_config',
|
||||
// text: '代码配置',
|
||||
// format: (data: any) => {
|
||||
// return data?.show_value;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
key: 'model',
|
||||
text: '模型',
|
||||
format: (data: any) => {
|
||||
return data?.show_value;
|
||||
return data?.showValue;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -114,6 +115,7 @@ function VersionCompareModal({ version1, version2, ...rest }: VersionCompareModa
|
|||
const params = {
|
||||
id1: version1,
|
||||
id2: version2,
|
||||
source: ApplicationSource.Platform,
|
||||
};
|
||||
const [res] = await to(getServiceVersionCompareReq(params));
|
||||
if (res && res.data) {
|
||||
|
|
|
|||
|
|
@ -384,7 +384,6 @@ const EditPipeline = () => {
|
|||
// ...dag,
|
||||
// nodes: newNodes,
|
||||
// });
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -127,15 +127,6 @@ export function getBigDatasetVersionFilesReq(datasetId: any) {
|
|||
});
|
||||
}
|
||||
|
||||
// 下载数据集版本单个文件
|
||||
export function downloadBigDatasetFile(params: any) {
|
||||
return request(`${DatasetAPIPrefix}/flintDataset/download`, {
|
||||
method: 'GET',
|
||||
params,
|
||||
skipValidating: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 上传小数据集文件
|
||||
export function uploadDatasetSmallFile(data: any, onUploadProgress: (progressEvent: any) => void) {
|
||||
return request(`${DatasetAPIPrefix}/file/upload`, {
|
||||
|
|
@ -200,14 +191,14 @@ export const getPromptTemplateUrl = (dataType: BigDataType, isMarked: number) =>
|
|||
};
|
||||
|
||||
// 点赞
|
||||
export function praiseBigDatesetReq(id: any) {
|
||||
export function praiseBigDatasetReq(id: any) {
|
||||
return request(`${DatasetAPIPrefix}/flintDatasetGroupLike/praise/${id}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
// 取消点赞
|
||||
export function unpraiseBigDatesetReq(id: any) {
|
||||
export function unpraiseBigDatasetReq(id: any) {
|
||||
return request(`${DatasetAPIPrefix}/flintDatasetGroupLike/cancelPraise/${id}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,17 +28,16 @@ export function getDatasetInfo(params) {
|
|||
|
||||
// 新增数据集
|
||||
export function addDataset(data) {
|
||||
return request(`/api/mmp/newdataset/addDatasetAndVersion`, {
|
||||
return request(`/api/mmp/newdataset/addDataset`, {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除数据集
|
||||
export function deleteDataset(params) {
|
||||
return request(`/api/mmp/newdataset/deleteDataset`, {
|
||||
export function deleteDataset(id) {
|
||||
return request(`/api/mmp/newdataset/deleteDataset/${id}`, {
|
||||
method: 'DELETE',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -130,6 +129,20 @@ export function editDatasetReq(data) {
|
|||
});
|
||||
}
|
||||
|
||||
// 点赞
|
||||
export function praiseDatasetReq(id) {
|
||||
return request(`/api/mmp/newdataset/praise/${id}`, {
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
// 取消点赞
|
||||
export function unpraiseDatasetReq(id) {
|
||||
return request(`/api/mmp/newdataset/unpraise/${id}`, {
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------模型---------------------------------
|
||||
|
||||
// 分页查询模型列表
|
||||
|
|
@ -149,10 +162,9 @@ export function addModel(data) {
|
|||
}
|
||||
|
||||
// 删除模型
|
||||
export function deleteModel(params) {
|
||||
return request(`/api/mmp/newmodel/delete`, {
|
||||
method: 'DELETE',
|
||||
params,
|
||||
export function deleteModel(id) {
|
||||
return request(`/api/mmp/newmodel/delete/${id}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -214,12 +226,12 @@ export function getModelAtlasReq(params) {
|
|||
}
|
||||
|
||||
// 实验结果导出到模型
|
||||
export function exportModelReq(data) {
|
||||
return request(`/api/mmp/models/exportModel`, {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
// export function exportModelReq(data) {
|
||||
// return request(`/api/mmp/models/exportModel`, {
|
||||
// method: 'POST',
|
||||
// data,
|
||||
// });
|
||||
// }
|
||||
|
||||
// 分页查询模型所有版本,带有参数和指标数据
|
||||
export function getModelPageVersionsReq(params) {
|
||||
|
|
@ -245,25 +257,17 @@ export function compareModelVersion(data) {
|
|||
});
|
||||
}
|
||||
|
||||
// 删除上传的文件
|
||||
export function deleteUploadFileReq(params) {
|
||||
return request(`/api/mmp/newdataset/deleteFile`, {
|
||||
method: 'DELETE',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 点赞
|
||||
export function praiseResourceReq(id) {
|
||||
export function praiseModelReq(id) {
|
||||
return request(`/api/mmp/newmodel/praise/${id}`, {
|
||||
method: 'POST',
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
// 取消点赞
|
||||
export function unpraiseResourceReq(id) {
|
||||
export function unpraiseModelReq(id) {
|
||||
return request(`/api/mmp/newmodel/unpraise/${id}`, {
|
||||
method: 'DELETE',
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -341,3 +345,11 @@ export function getUploadFileListReq(params) {
|
|||
skipLoading: true,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除上传的文件
|
||||
export function deleteUploadFileReq(params) {
|
||||
return request(`/api/mmp/newdataset/deleteFile`, {
|
||||
method: 'DELETE',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ export function jccGetResourcesReq(token: string, cardType: string) {
|
|||
type: cardType,
|
||||
},
|
||||
resourceType: 'Train', //Inference
|
||||
clusterIDs: [],
|
||||
clusterIDs: ['1865927992266461184'],
|
||||
},
|
||||
headers: {
|
||||
authorization: `${token}`,
|
||||
|
|
|
|||
|
|
@ -69,11 +69,20 @@ export const getHuoshiRoutes = async () => {
|
|||
user: {
|
||||
appList:menuInfo.data.appList,
|
||||
userInfo: userInfo.data,
|
||||
tenantInfoList: tenantInfo.data,
|
||||
configInfo:configInfo.data,
|
||||
tenant: tenantInfo.data,
|
||||
gConfig:configInfo.data,
|
||||
navList,
|
||||
consoleList
|
||||
},
|
||||
}),
|
||||
);
|
||||
sessionStorage.setItem('globalState',JSON.stringify({
|
||||
gConfig:configInfo.data,
|
||||
userInfo:userInfo.data,
|
||||
sysType:1
|
||||
}))
|
||||
localStorage.setItem('generate_subMenus','dataDistillation,dataEnhance,dataReflux,qaExtraction')
|
||||
localStorage.setItem('getCurrentZoneFun','function(e){const t=e.url.split("/")[1];let r=[];const n=sessionStorage.getItem("currentZone");let o=[null,void 0,"null","undefined"].includes(n)?"default":n;if(localStorage.serviceList&&(r=JSON.parse(localStorage.serviceList)),r.length&&t){const e=r.find(e=>e.name===t);if(e?.zones){const t=e.zones.split(",");t.includes(o)||(o=t[0])}}return o}')
|
||||
localStorage.setItem('processing_subMenus','dataClean,dataFormat,dataAnalysis')
|
||||
localStorage.setItem('currentLanguage','zh_CN')
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export function cancelFavoriteServiceReq(id: any) {
|
|||
|
||||
// 获取服务版本列表
|
||||
export function getServiceVersionsReq(data: any) {
|
||||
return request(`/api/mmp/service/serviceVersion`, {
|
||||
return request(`/api/mmp/service/version/list`, {
|
||||
method: 'GET',
|
||||
params: data,
|
||||
});
|
||||
|
|
@ -83,7 +83,7 @@ export function getServiceVersionsReq(data: any) {
|
|||
|
||||
// 创建服务版本
|
||||
export function createServiceVersionReq(data: any) {
|
||||
return request(`/api/mmp/service/serviceVersion`, {
|
||||
return request(`/api/mmp/service/version`, {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
|
|
@ -91,43 +91,43 @@ export function createServiceVersionReq(data: any) {
|
|||
|
||||
// 更新服务版本
|
||||
export function updateServiceVersionReq(data: any) {
|
||||
return request(`/api/mmp/service/serviceVersion`, {
|
||||
return request(`/api/mmp/service/version`, {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除服务版本
|
||||
export function deleteServiceVersionReq(id: any) {
|
||||
return request(`/api/mmp/service/serviceVersion/${id}`, {
|
||||
export function deleteServiceVersionReq(source: number, id: number | string) {
|
||||
return request(`/api/mmp/service/version/${source}/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// 获取服务版本详情
|
||||
export function getServiceVersionInfoReq(id: any) {
|
||||
return request(`/api/mmp/service/serviceVersionDetail/${id}`, {
|
||||
export function getServiceVersionInfoReq(source: number, id: number | string) {
|
||||
return request(`/api/mmp/service/version/${source}/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
// 停止服务版本
|
||||
export function stopServiceVersionReq(id: any) {
|
||||
return request(`/api/mmp/service/stopServiceVersion/${id}`, {
|
||||
export function stopServiceVersionReq(source: number, id: number | string) {
|
||||
return request(`/api/mmp/service/version/stop/${source}/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// 获取服务版本操作指南
|
||||
export function getServiceVersionDocsReq(id: any) {
|
||||
return request(`/api/mmp/service/getServiceVersionDocs/${id}`, {
|
||||
export function getServiceVersionDocsReq(source: number, id: number | string) {
|
||||
return request(`/api/mmp/service/version/getDocs/${source}/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
// 获取服务版本日志
|
||||
export function getServiceVersionLogReq(params: any) {
|
||||
return request(`/api/mmp/service/getServiceVersionLog`, {
|
||||
return request(`/api/mmp/service/version/getLog`, {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
|
|
@ -135,7 +135,7 @@ export function getServiceVersionLogReq(params: any) {
|
|||
|
||||
// 获取服务版本对比
|
||||
export function getServiceVersionCompareReq(params: any) {
|
||||
return request(`/api/mmp/service/serviceVersionCompare`, {
|
||||
return request(`/api/mmp/service/version/compare`, {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
|
|
@ -167,7 +167,7 @@ export function getTaskListReq(data: any) {
|
|||
});
|
||||
}
|
||||
|
||||
// 获取应用任务列表
|
||||
// 获取应用任务详情
|
||||
export function getTaskInfoReq(id: number | string) {
|
||||
return request(`/api/mmp/trainingTask/${id}`, {
|
||||
method: 'GET',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
jccGetClusterListReq,
|
||||
jccGetImagesReq,
|
||||
jccGetResourcesReq,
|
||||
jccGetResourceTypesReq,
|
||||
|
|
@ -165,15 +164,15 @@ export const getResourceTypes = async () => {
|
|||
value: v.type,
|
||||
}));
|
||||
}
|
||||
const [clusterRes] = await to(jccGetClusterListReq(state.token));
|
||||
if (
|
||||
clusterRes &&
|
||||
clusterRes.code === 200 &&
|
||||
clusterRes.data &&
|
||||
Array.isArray(clusterRes.data.list)
|
||||
) {
|
||||
state.clusters = clusterRes.data.list;
|
||||
}
|
||||
// const [clusterRes] = await to(jccGetClusterListReq(state.token));
|
||||
// if (
|
||||
// clusterRes &&
|
||||
// clusterRes.code === 200 &&
|
||||
// clusterRes.data &&
|
||||
// Array.isArray(clusterRes.data.list)
|
||||
// ) {
|
||||
// state.clusters = clusterRes.data.list;
|
||||
// }
|
||||
};
|
||||
|
||||
export const setCurrentType = async (cardType: string | undefined | null) => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
### 大模型训练 & 数据管理 (已完成)
|
||||
> 前端包路径 /home/ruoyi/projects/flint
|
||||
nginx 修改 115 行
|
||||
```nginx
|
||||
location /flint {
|
||||
add_header 'Access-Control-Allow-Private-Network' 'true' always;
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
alias /home/ruoyi/projects/flint;
|
||||
try_files $uri $uri/ @fallback_flint;
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
|
||||
location @fallback_flint {
|
||||
root /home/ruoyi/projects;
|
||||
try_files /ruoyi-ui/index.html =404;
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
}
|
||||
```
|
||||
|
||||
### 服务管理 (开发中)
|
||||
|
||||
> 前端包路径 /home/ruoyi/projects/trainfer
|
||||
nginx 修改 127 行
|
||||
```nginx
|
||||
location /trainfer {
|
||||
add_header 'Access-Control-Allow-Private-Network' 'true' always;
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
alias /home/ruoyi/projects/trainfer;
|
||||
try_files $uri $uri/ @fallback_flint;
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 集群管理 (开发中)
|
||||
|
||||
> 前端包路径 /home/ruoyi/projects/portal
|
||||
nginx 修改 139 行
|
||||
```nginx
|
||||
location /portal {
|
||||
add_header 'Access-Control-Allow-Private-Network' 'true' always;
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
alias /home/ruoyi/projects/portal;
|
||||
try_files $uri $uri/ @fallback_flint;
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
add_header 'Access-Control-Allow-Origin' $cors_origin always;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -241,28 +241,21 @@ public class NewDatasetFromGitController {
|
|||
|
||||
@PostMapping("/publish")
|
||||
@ApiOperation(value = "发布")
|
||||
@OperationNotification(value = "发布的数据集#{#datasetVo.name}需要审核,请查看",type = 2,receiver = "ADMIN",notificationUrl="/system/approval")
|
||||
@OperationNotification(value = "发布的数据集#{#datasetVo.name}需要审核,请查看", type = 2, receiver = "ADMIN", notificationUrl = "/system/approval")
|
||||
public AjaxResult publish(@RequestBody NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return AjaxResult.success(newDatasetService.publish(datasetVo, loginUser, request));
|
||||
}
|
||||
|
||||
@PostMapping("/privateToPublic")
|
||||
@ApiOperation(value = "私有库变共有库")
|
||||
public AjaxResult privateToPublic(@RequestBody NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
newDatasetService.privateToPublic(datasetVo, request);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/praise")
|
||||
@PutMapping("/praise/{id}")
|
||||
@ApiOperation(value = "点赞一个项目")
|
||||
public AjaxResult praise(@RequestBody NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.newDatasetService.praise(datasetVo, request));
|
||||
public AjaxResult praise(@PathVariable("id") Integer id, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.newDatasetService.praise(id, request));
|
||||
}
|
||||
|
||||
@PostMapping("/unpraise")
|
||||
@PutMapping("/unpraise/{id}")
|
||||
@ApiOperation(value = "取消点赞一个项目")
|
||||
public AjaxResult unpraise(@RequestBody NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.newDatasetService.unpraise(datasetVo, request));
|
||||
public AjaxResult unpraise(@PathVariable("id") Integer id, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.newDatasetService.unpraise(id, request));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,8 +167,8 @@ public class NewModelFromGitController extends BaseController {
|
|||
|
||||
@GetMapping("/getModelDependencyTree")
|
||||
@ApiOperation(value = "获取模型依赖关系树")
|
||||
public AjaxResult getModelDependencyTree(@RequestParam("id") Integer id, @RequestParam("identifier") String identifier, @RequestParam("version") String version) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.getModelDependencyTree(id, identifier, version));
|
||||
public AjaxResult getModelDependencyTree(@RequestParam("git_id") Integer gitId, @RequestParam("identifier") String identifier, @RequestParam("version") String version) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.getModelDependencyTree(gitId, identifier, version));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
|
|
@ -200,16 +200,16 @@ public class NewModelFromGitController extends BaseController {
|
|||
return AjaxResult.success(this.modelsService.getVersionsCompare(queryModelMetricsVo));
|
||||
}
|
||||
|
||||
@PostMapping("/praise")
|
||||
@PutMapping("/praise/{id}")
|
||||
@ApiOperation(value = "点赞一个项目")
|
||||
public AjaxResult praise(@RequestBody NewModel newModel, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.praise(newModel, request));
|
||||
public AjaxResult praise(@PathVariable("id") Integer id, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.praise(id, request));
|
||||
}
|
||||
|
||||
@PostMapping("/unpraise")
|
||||
@PutMapping("/unpraise/{id}")
|
||||
@ApiOperation(value = "取消点赞一个项目")
|
||||
public AjaxResult unpraise(@RequestBody NewModel newModel, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.unpraise(newModel, request));
|
||||
public AjaxResult unpraise(@PathVariable("id") Integer id, HttpServletRequest request) throws Exception {
|
||||
return AjaxResult.success(this.modelsService.unpraise(id, request));
|
||||
}
|
||||
|
||||
@PostMapping("/publish")
|
||||
|
|
@ -219,11 +219,4 @@ public class NewModelFromGitController extends BaseController {
|
|||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return AjaxResult.success(modelsService.publish(modelsVo, loginUser, request));
|
||||
}
|
||||
|
||||
@PostMapping("/privateToPublic")
|
||||
@ApiOperation(value = "私有库变共有库")
|
||||
public AjaxResult privateToPublic(@RequestBody ModelsVo modelsVo, HttpServletRequest request) throws Exception {
|
||||
modelsService.privateToPublic(modelsVo, request);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
package com.ruoyi.platform.service;
|
||||
|
||||
public interface DvcService {
|
||||
|
||||
//使用dvc初始化,跟踪,push到远程仓库的接口
|
||||
public void initaddpushDvc(String localPath) throws Exception ;
|
||||
|
||||
}
|
||||
|
|
@ -64,15 +64,15 @@ public interface ModelsService {
|
|||
|
||||
Map<String, Object> getVersionsCompare(QueryModelMetricsVo queryModelMetricsVo) throws Exception;
|
||||
|
||||
String praise(NewModel newModel, HttpServletRequest request) throws Exception;
|
||||
String praise(Integer id, HttpServletRequest request) throws Exception;
|
||||
|
||||
String unpraise(NewModel newModel, HttpServletRequest request) throws Exception;
|
||||
String unpraise(Integer id, HttpServletRequest request) throws Exception;
|
||||
|
||||
String getNextVersion(ModelsVersion modelsVersion) throws Exception;
|
||||
|
||||
void privateToPublic(ModelsVo modelsVo,HttpServletRequest request) throws Exception;
|
||||
void privateToPublic(NewModel model, HttpServletRequest request) throws Exception;
|
||||
|
||||
String publish(ModelsVo modelsVo, LoginUser loginUser,HttpServletRequest request) throws Exception;
|
||||
String publish(ModelsVo modelsVo, LoginUser loginUser, HttpServletRequest request) throws Exception;
|
||||
|
||||
void updateDesc(ModelsVo modelsVo) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ public interface NewDatasetService {
|
|||
|
||||
String publish(NewDatasetVo datasetVo, LoginUser loginUser, HttpServletRequest request) throws Exception;
|
||||
|
||||
void privateToPublic(NewDatasetVo newDatasetVo, HttpServletRequest request) throws Exception;
|
||||
void privateToPublic(NewDataset newDataset, HttpServletRequest request) throws Exception;
|
||||
|
||||
void updateDesc(NewDatasetVo datasetVo) throws Exception;
|
||||
|
||||
String praise(NewDatasetVo datasetVo, HttpServletRequest request) throws Exception;
|
||||
String praise(Integer id, HttpServletRequest request) throws Exception;
|
||||
|
||||
String unpraise(NewDatasetVo datasetVo, HttpServletRequest request) throws Exception;
|
||||
String unpraise(Integer id, HttpServletRequest request) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,12 +141,12 @@ public class ApprovalServiceImpl implements ApprovalService {
|
|||
String content = approvalRequest.getContent();
|
||||
switch (approvalRequest.getType()) {
|
||||
case "DATASET":
|
||||
NewDatasetVo dataset = JSONUtil.toBean(content, NewDatasetVo.class);
|
||||
NewDataset dataset = JSONUtil.toBean(content, NewDataset.class);
|
||||
newDatasetService.privateToPublic(dataset,request);
|
||||
break;
|
||||
case "MODEL":
|
||||
ModelsVo models = JSONUtil.toBean(content, ModelsVo.class);
|
||||
modelsService.privateToPublic(models,request);
|
||||
NewModel model = JSONUtil.toBean(content, NewModel.class);
|
||||
modelsService.privateToPublic(model,request);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
package com.ruoyi.platform.service.impl;
|
||||
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.platform.service.DvcService;
|
||||
import com.ruoyi.platform.utils.DVCUtils;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class DvcServiceImpl implements DvcService {
|
||||
@Value("${minio.accessKey}")
|
||||
String accessKeyId;
|
||||
@Value("${minio.secretKey}")
|
||||
String secretAccessKey;
|
||||
@Value("${minio.endpoint}")
|
||||
String endpoint;
|
||||
@Resource
|
||||
private DVCUtils dvcUtils;
|
||||
@Override
|
||||
public void initaddpushDvc(String localPath) throws Exception {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// dvc init 初始化
|
||||
dvcUtils.dvcInit(localPath);
|
||||
// 配置远程S3地址
|
||||
dvcUtils.dvcRemoteAdd(localPath,"");
|
||||
// dvcUtils.dvcConfigS3Credentials(localPath,endpoint, accessKeyId, secretAccessKey);
|
||||
// dvc 跟踪
|
||||
dvcUtils.dvcAdd(localPath , "data");
|
||||
// git commit
|
||||
dvcUtils.gitCommit(localPath, "commit from ci4s with "+loginUser.getUsername());
|
||||
// dvc push 到远程S3
|
||||
dvcUtils.dvcPush(localPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ public class ExperimentServiceImpl implements ExperimentService {
|
|||
List<Map<String, Object>> modelsList = (List<Map<String, Object>>) modelTrainMap.get("models");
|
||||
if (modelsList != null) {
|
||||
Map<String, Object> parentModelMap = modelsList.get(0);
|
||||
Integer id = (Integer) parentModelMap.get("model_id");
|
||||
Integer id = (Integer) parentModelMap.get("git_id");
|
||||
String identifier = (String) parentModelMap.get("model_identifier");
|
||||
String version = (String) parentModelMap.get("model_version");
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ public class ExperimentServiceImpl implements ExperimentService {
|
|||
|
||||
for (int j = 0; j < modelTargetList.size(); j++) {
|
||||
Map<String, Object> targetModel = modelTargetList.get(i);
|
||||
modelMetaVo.setId((Integer) targetModel.get("model_id"));
|
||||
modelMetaVo.setId((Integer) targetModel.get("git_id"));
|
||||
modelMetaVo.setIdentifier((String) targetModel.get("model_identifier"));
|
||||
modelMetaVo.setName((String) targetModel.get("model_name"));
|
||||
modelMetaVo.setVersion(queryNextModelVersion((String) targetModel.get("model_identifier"), (String) targetModel.get("model_owner")));
|
||||
|
|
@ -583,7 +583,7 @@ public class ExperimentServiceImpl implements ExperimentService {
|
|||
// modelMetaVo.setModelVersionVos(versionVos);
|
||||
|
||||
modelDependency.setMeta(JSON.toJSONString(modelMetaVo));
|
||||
modelDependency.setRepoId((Integer) targetModel.get("model_id"));
|
||||
modelDependency.setRepoId((Integer) targetModel.get("git_id"));
|
||||
modelDependency.setModelName((String) targetModel.get("model_name"));
|
||||
modelDependency.setIdentifier((String) targetModel.get("model_identifier"));
|
||||
modelDependency.setVersion(queryNextModelVersion((String) targetModel.get("model_identifier"), (String) targetModel.get("owner")));
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
//modelsVo复制信息到newModel
|
||||
BeanUtils.copyProperties(modelsVo, newModel);
|
||||
ConvertUtil.setCommonFields(newModel, true);
|
||||
newModelService.save(newModel);
|
||||
newModelDao.save(newModel);
|
||||
modelsVo.setId(newModel.getId());
|
||||
return modelsVo;
|
||||
}
|
||||
|
||||
|
|
@ -182,23 +183,23 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
|
||||
// 创建项目
|
||||
Map project = gitService.createProject(token, gitProjectVo);
|
||||
Integer gitlinIid = (Integer) project.get("id");
|
||||
if (gitlinIid == null) {
|
||||
Integer gitlinkIid = (Integer) project.get("id");
|
||||
if (gitlinkIid == null) {
|
||||
throw new RuntimeException("创建模型失败:" + project.get("message"));
|
||||
}
|
||||
|
||||
// 定义标签 标签1:model 标签2:ModelTag 标签3:ModelType
|
||||
gitService.createTopic(token, gitlinIid, Constant.Topic_Model, null);
|
||||
gitService.createTopic(token, gitlinkIid, Constant.Topic_Model, null);
|
||||
if (StringUtils.isNotEmpty(modelsVo.getModelTag())) {
|
||||
gitService.createTopic(token, gitlinIid, modelsVo.getModelTag(), "modeltag-");
|
||||
gitService.createTopic(token, gitlinkIid, modelsVo.getModelTag(), "modeltag-");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(modelsVo.getModelType())) {
|
||||
gitService.createTopic(token, gitlinIid, modelsVo.getModelType(), "modeltype-");
|
||||
gitService.createTopic(token, gitlinkIid, modelsVo.getModelType(), "modeltype-");
|
||||
}
|
||||
|
||||
String owner = (String) userInfo.get("login");
|
||||
String projectUrl = gitCloneEndpoint + "/" + owner + "/" + repositoryName + ".git";
|
||||
String relationPath = ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/origin";
|
||||
String relationPath = ci4sUsername + "/model/" + gitlinkIid + "/" + repositoryName + "/origin";
|
||||
String rootPath = localPath + relationPath;
|
||||
String modelPath = rootPath + "/model";
|
||||
String metaPath = rootPath + "/metadata";
|
||||
|
|
@ -221,7 +222,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
long folderSize = FileUtil.getFolderSize(folder);
|
||||
modelMetaVo.setModelSize(FileUtil.formatFileSize(folderSize));
|
||||
BeanUtils.copyProperties(modelMetaVo, modelsVo);
|
||||
modelsVo.setGitId(gitlinIid);
|
||||
modelsVo.setGitId(gitlinkIid);
|
||||
|
||||
Map<String, Object> metaMap = JSON.parseObject(JSON.toJSONString(modelMetaVo), Map.class);
|
||||
YamlUtils.generateYamlFile(metaMap, metaPath, "metadata");
|
||||
|
|
@ -229,7 +230,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
String meta = JSON.toJSONString(modelMetaVo);
|
||||
|
||||
//保存模型依赖
|
||||
modelDependency.setRepoId(gitlinIid);
|
||||
modelDependency.setRepoId(gitlinkIid);
|
||||
modelDependency.setIdentifier(repositoryName);
|
||||
modelDependency.setModelName(modelsVo.getName());
|
||||
modelDependency.setVersion("origin");
|
||||
|
|
@ -319,7 +320,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
}
|
||||
String repositoryName = modelsVo.getIdentifier() == null ? ci4sUsername + "_model_" + DateUtils.dateTimeNow() : modelsVo.getIdentifier();
|
||||
ModelDependency1 modelDependency = new ModelDependency1();
|
||||
List<ModelDependency1> oldModelDependencys = modelDependency1Dao.queryModelDependency(modelsVo.getName(), (int) modelsVo.getId(), gitLinkUsername);
|
||||
List<ModelDependency1> oldModelDependencys = modelDependency1Dao.queryModelDependency(modelsVo.getName(), modelsVo.getGitId(), gitLinkUsername);
|
||||
if (oldModelDependencys != null && !oldModelDependencys.isEmpty()) {
|
||||
if (oldModelDependencys.stream().anyMatch(oldModelDependency -> oldModelDependency.getVersion().equals(modelsVo.getVersion()))) {
|
||||
throw new Exception("模型版本已存在,请勿重复创建");
|
||||
|
|
@ -371,7 +372,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
buildingModel = modelDependency1Dao.queryByTrainTask(JSON.toJSONString(map));
|
||||
} else if (Constant.Source_Auto_Export.equals(modelsVo.getModelSource())) {
|
||||
dvcUtils.moveFiles(sourcePath, modelPath);
|
||||
buildingModel = modelDependency1Dao.getBuildingModel((int) modelsVo.getId(), modelsVo.getIdentifier());
|
||||
buildingModel = modelDependency1Dao.getBuildingModel(modelsVo.getGitId(), modelsVo.getIdentifier());
|
||||
} else {
|
||||
for (VersionVo modelVersionVo : modelsVo.getModelVersionVos()) {
|
||||
dvcUtils.copyFile(modelVersionVo.getUrl(), modelPath);
|
||||
|
|
@ -436,17 +437,17 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
modelDependency.setState(Constant.State_valid);
|
||||
modelDependency.setModelName(modelsVo.getName());
|
||||
modelDependency.setVersion(modelsVo.getVersion());
|
||||
modelDependency.setRepoId((int) modelsVo.getId());
|
||||
modelDependency.setRepoId(modelsVo.getGitId());
|
||||
modelDependency.setIdentifier(repositoryName);
|
||||
modelDependency.setMeta(meta);
|
||||
modelDependency1Dao.insert(modelDependency);
|
||||
} else {
|
||||
//更新模型依赖
|
||||
modelDependency1Dao.updateState((int) modelsVo.getId(), modelsVo.getIdentifier(), buildingModel.getVersion(), modelsVo.getVersion(), meta, Constant.State_valid);
|
||||
modelDependency1Dao.updateState(modelsVo.getGitId(), modelsVo.getIdentifier(), buildingModel.getVersion(), modelsVo.getVersion(), meta, Constant.State_valid);
|
||||
}
|
||||
} else {
|
||||
//保存模型依赖
|
||||
modelDependency.setRepoId((int) modelsVo.getId());
|
||||
modelDependency.setRepoId(modelsVo.getGitId());
|
||||
modelDependency.setIdentifier(repositoryName);
|
||||
modelDependency.setModelName(modelsVo.getName());
|
||||
modelDependency.setVersion(modelsVo.getVersion());
|
||||
|
|
@ -787,6 +788,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
modelsVo.setPraised((Boolean) reqMap.get("praised"));
|
||||
NewModel modelByIdentifier = newModelDao.getModelByIdentifier(identifier);
|
||||
modelsVo.setId(modelByIdentifier.getId());
|
||||
modelsVo.setGitId(gitId);
|
||||
return modelsVo;
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +866,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
modelDependency1Dao.deleteModelDependency(parentModel);
|
||||
|
||||
String ci4sUsername = SecurityUtils.getLoginUser().getUsername();
|
||||
dvcUtils.deleteDirectory(localPath + "/" + ci4sUsername + "/model/" + repoId + "/" + identifier);
|
||||
dvcUtils.deleteDirectory(localPath + "/" + ci4sUsername + "/model/" + repoId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -939,29 +941,30 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String praise(NewModel newModel, HttpServletRequest request) throws Exception {
|
||||
if (newModel.getIsHotStone()) {
|
||||
hotStoneService.praiseHotStoneModel(newModel.getHotStoneId(), request);
|
||||
public String praise(Integer id, HttpServletRequest request) throws Exception {
|
||||
NewModel model = newModelDao.getModelById(id);
|
||||
if (model.getIsHotStone()) {
|
||||
hotStoneService.praiseHotStoneModel(model.getHotStoneId(), request);
|
||||
} else {
|
||||
gitService.praiseProject(newModel.getGitId(), newModel.getIdentifier());
|
||||
gitService.praiseProject(model.getGitId(), model.getIdentifier());
|
||||
}
|
||||
//落表
|
||||
newModel.setPraisesCount(newModel.getPraisesCount() + 1);
|
||||
newModelService.edit(newModel);
|
||||
model.setPraisesCount(model.getPraisesCount() + 1);
|
||||
newModelService.edit(model);
|
||||
return "点赞成功";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unpraise(NewModel newModel, HttpServletRequest request) throws Exception {
|
||||
if (newModel.getIsHotStone()) {
|
||||
hotStoneService.unpraiseHotStoneModel(newModel.getHotStoneId(), request);
|
||||
public String unpraise(Integer id, HttpServletRequest request) throws Exception {
|
||||
NewModel model = newModelDao.getModelById(id);
|
||||
if (model.getIsHotStone()) {
|
||||
hotStoneService.unpraiseHotStoneModel(model.getHotStoneId(), request);
|
||||
} else {
|
||||
gitService.unpraiseProject(newModel.getGitId(), newModel.getIdentifier());
|
||||
gitService.unpraiseProject(model.getGitId(), model.getIdentifier());
|
||||
}
|
||||
|
||||
//落表
|
||||
newModel.setPraisesCount(newModel.getPraisesCount() - 1);
|
||||
newModelService.edit(newModel);
|
||||
model.setPraisesCount(model.getPraisesCount() - 1);
|
||||
newModelService.edit(model);
|
||||
return "取消点赞成功";
|
||||
}
|
||||
|
||||
|
|
@ -1036,55 +1039,54 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void privateToPublic(ModelsVo modelsVo, HttpServletRequest request) throws Exception {
|
||||
if (modelsVo.getIsHotStone()) {
|
||||
hotStoneService.publicHotStoneModel(modelsVo.getHotStoneId(), request);
|
||||
public void privateToPublic(NewModel model, HttpServletRequest request) throws Exception {
|
||||
if (model.getIsHotStone()) {
|
||||
hotStoneService.publicHotStoneModel(model.getHotStoneId(), request);
|
||||
} else {
|
||||
toPublic(modelsVo);
|
||||
toPublic(model);
|
||||
}
|
||||
newModelDao.edit(model.setIsPublic(true));
|
||||
}
|
||||
|
||||
private void toPublic(ModelsVo modelsVo) throws Exception {
|
||||
private void toPublic(NewModel model) throws Exception {
|
||||
//获取版本列表信息,每一个版本的配置文件都要更改
|
||||
String token = gitService.checkoutToken();
|
||||
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, modelsVo.getOwner(), modelsVo.getIdentifier());
|
||||
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, model.getOwner(), model.getIdentifier());
|
||||
for (Map<String, Object> branch : brancheList) {
|
||||
if (branch.get("name").equals("master")) {
|
||||
continue;
|
||||
}
|
||||
//获取每个版本的配置信息
|
||||
Map<String, Object> branchConfig = YamlUtils.loadYamlFile(localPath + modelsVo.getOwner() + "/model/" + modelsVo.getGitId() + "/" + modelsVo.getIdentifier() + "/" + branch.get("name") + "/metadata/metadata.yaml");
|
||||
Map<String, Object> branchConfig = YamlUtils.loadYamlFile(localPath + model.getOwner() + "/model/" + model.getGitId() + "/" + model.getIdentifier() + "/" + branch.get("name") + "/metadata/metadata.yaml");
|
||||
branchConfig.put("isPublic", true);
|
||||
|
||||
//更新每个版本的配置信息
|
||||
String repositoryName = modelsVo.getIdentifier();
|
||||
String repositoryName = model.getIdentifier();
|
||||
String branchName = StrUtil.toString(branch.get("name"));
|
||||
String relatePath = modelsVo.getOwner() + "/model/" + modelsVo.getGitId() + "/" + repositoryName + "/" + branchName;
|
||||
String relatePath = model.getOwner() + "/model/" + model.getGitId() + "/" + repositoryName + "/" + branchName;
|
||||
String rootPath = localPath + relatePath;
|
||||
String metaPath = rootPath + "/metadata";
|
||||
YamlUtils.generateYamlFile(JsonUtils.objectToMap(branchConfig), metaPath, "metadata");
|
||||
}
|
||||
Map projectDetail = gitService.getProjectDetail(modelsVo.getOwner(), modelsVo.getIdentifier(), token);
|
||||
Map projectDetail = gitService.getProjectDetail(model.getOwner(), model.getIdentifier(), token);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("private", false);
|
||||
param.put("name", projectDetail.get("name"));
|
||||
param.put("project_name", projectDetail.get("name"));
|
||||
param.put("project_identifier", modelsVo.getIdentifier());
|
||||
param.put("identifier", modelsVo.getIdentifier());
|
||||
gitService.updateProjectDetail(param, modelsVo.getOwner(), modelsVo.getIdentifier(), token);
|
||||
NewModel modelByIdentifier = newModelService.getModelByIdentifier(modelsVo.getIdentifier());
|
||||
newModelService.edit(modelByIdentifier.setIsPublic(true));
|
||||
param.put("project_identifier", model.getIdentifier());
|
||||
param.put("identifier", model.getIdentifier());
|
||||
gitService.updateProjectDetail(param, model.getOwner(), model.getIdentifier(), token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String publish(ModelsVo modelsVo, LoginUser loginUser, HttpServletRequest request) throws Exception {
|
||||
NewModel model = newModelDao.getModelById((Integer) modelsVo.getId());
|
||||
Set<String> roles = loginUser.getRoles();
|
||||
if (roles.contains("admin")) {
|
||||
//无需审批,直接通过
|
||||
privateToPublic(modelsVo, request);
|
||||
privateToPublic(model, request);
|
||||
return "发布成功";
|
||||
}
|
||||
ModelsVo modelsVotDesc = getModelDetail((int) modelsVo.getId(), modelsVo.getIdentifier(), modelsVo.getOwner(), modelsVo.getVersion(), false);
|
||||
String username = loginUser.getUsername();
|
||||
Long userid = loginUser.getUserid();
|
||||
ApprovalRequest approvalRequest = new ApprovalRequest();
|
||||
|
|
@ -1097,12 +1099,12 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
String titleTemplate = "{}发布的模型<b>\"{}\"</b>需要审核,请查看";
|
||||
String urlTemplate = "/dataset/model/info/{}?name={}&owner={}&identifier={}&is_public={}";
|
||||
|
||||
String titleFormat = StrUtil.format(titleTemplate, username, modelsVotDesc.getName());
|
||||
String urlFormat = StrUtil.format(urlTemplate, modelsVotDesc.getId(), modelsVotDesc.getName(), modelsVotDesc.getOwner(), modelsVotDesc.getIdentifier(), modelsVotDesc.getIsPublic());
|
||||
String titleFormat = StrUtil.format(titleTemplate, username, model.getName());
|
||||
String urlFormat = StrUtil.format(urlTemplate, model.getId(), model.getName(), model.getOwner(), model.getIdentifier(), model.getIsPublic());
|
||||
|
||||
approvalRequest.setTitle(titleFormat);
|
||||
approvalRequest.setUrl(urlFormat);
|
||||
approvalRequest.setContent(JSON.toJSONString(modelsVotDesc));
|
||||
approvalRequest.setContent(JSON.toJSONString(model));
|
||||
approvalInfoMapper.insertApproval(approvalRequest);
|
||||
return "发布成功,待管理员审核";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
//modelsVo复制信息到newModel
|
||||
BeanUtils.copyProperties(datasetVo, newDataset);
|
||||
ConvertUtil.setCommonFields(newDataset, true);
|
||||
int id = newDatasetDao.save(newDataset);
|
||||
datasetVo.setId(id);
|
||||
newDatasetDao.save(newDataset);
|
||||
datasetVo.setId(newDataset.getId());
|
||||
return datasetVo;
|
||||
}
|
||||
|
||||
|
|
@ -265,9 +265,6 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
datasetVo.setVersion(nextVersion);
|
||||
}
|
||||
|
||||
// NewDataset dataset = newDatasetDao.getDatasetById((Integer) datasetVo.getId());
|
||||
// datasetVo.setGitId(dataset.getGitId());
|
||||
|
||||
String token = gitService.checkoutToken();
|
||||
Jedis jedis = new Jedis(redisHost, redisPort);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
|
@ -406,30 +403,28 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String praise(NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
if (datasetVo.getIsHotStone()) {
|
||||
hotStoneService.praiseHotStoneDataset(datasetVo.getHotStoneId(), request);
|
||||
public String praise(Integer id, HttpServletRequest request) throws Exception {
|
||||
NewDataset dataset = newDatasetDao.getDatasetById(id);
|
||||
if (dataset.getIsHotStone()) {
|
||||
hotStoneService.praiseHotStoneDataset(dataset.getHotStoneId(), request);
|
||||
} else {
|
||||
gitService.praiseProject(datasetVo.getGitId(), datasetVo.getIdentifier());
|
||||
gitService.praiseProject(dataset.getGitId(), dataset.getIdentifier());
|
||||
}
|
||||
//落表
|
||||
NewDataset dataset = new NewDataset();
|
||||
BeanUtils.copyProperties(datasetVo, dataset);
|
||||
dataset.setPraisesCount(dataset.getPraisesCount() + 1);
|
||||
newDatasetService1.edit(dataset);
|
||||
return "点赞成功";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unpraise(NewDatasetVo datasetVo, HttpServletRequest request) throws Exception {
|
||||
if (datasetVo.getIsHotStone()) {
|
||||
hotStoneService.unpraiseHotStoneDataset(datasetVo.getHotStoneId(), request);
|
||||
public String unpraise(Integer id, HttpServletRequest request) throws Exception {
|
||||
NewDataset dataset = newDatasetDao.getDatasetById(id);
|
||||
if (dataset.getIsHotStone()) {
|
||||
hotStoneService.unpraiseHotStoneDataset(dataset.getHotStoneId(), request);
|
||||
} else {
|
||||
gitService.unpraiseProject(datasetVo.getGitId(), datasetVo.getIdentifier());
|
||||
gitService.unpraiseProject(dataset.getGitId(), dataset.getIdentifier());
|
||||
}
|
||||
//落表
|
||||
NewDataset dataset = new NewDataset();
|
||||
BeanUtils.copyProperties(datasetVo, dataset);
|
||||
dataset.setPraisesCount(dataset.getPraisesCount() - 1);
|
||||
newDatasetService1.edit(dataset);
|
||||
return "取消点赞成功";
|
||||
|
|
@ -581,7 +576,7 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String ci4sUsername = loginUser.getUsername();
|
||||
dvcUtils.deleteDirectory(localPathlocal + "/" + ci4sUsername + "/datasets/" + repoId + "/" + repo);
|
||||
dvcUtils.deleteDirectory(localPathlocal + "/" + ci4sUsername + "/datasets/" + repoId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -652,7 +647,7 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
InputStream inputStream = HttpUtils.getIntputStream(labellocalUrl + "/api/projects/" + labelDatasetVersionVo.getProjectId() + "/export?exportType=" + labelDatasetVersionVo.getExportType(), headers);
|
||||
|
||||
// 2. 直接保存zip文件,不要重新打包
|
||||
String zipFileName = labelDatasetVersionVo.getName() + "_" + labelDatasetVersionVo.getVersion() + ".zip";
|
||||
String zipFileName = labelDatasetVersionVo.getName() + "_" + DateUtils.getTime() + ".zip";
|
||||
|
||||
// 将InputStream转换为byte数组
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
|
@ -689,6 +684,7 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
datasetVersionVos.add(versionVo);
|
||||
}
|
||||
newDatasetVo.setDatasetVersionVos(datasetVersionVos);
|
||||
newDatasetVo.setGitId(newDatasetDao.getDatasetById((Integer) newDatasetVo.getId()).getGitId());
|
||||
// 调用新增版本方法
|
||||
return newCreateVersion(newDatasetVo);
|
||||
}
|
||||
|
|
@ -863,14 +859,14 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
|
||||
@Override
|
||||
public String publish(NewDatasetVo datasetVo, LoginUser loginUser, HttpServletRequest request) throws Exception {
|
||||
NewDataset dataset = newDatasetDao.getDatasetById((Integer) datasetVo.getId());
|
||||
Set<String> roles = loginUser.getRoles();
|
||||
if (roles.contains("admin")) {
|
||||
//无需审批,直接通过
|
||||
privateToPublic(datasetVo, request);
|
||||
privateToPublic(dataset, request);
|
||||
return "发布成功";
|
||||
}
|
||||
|
||||
NewDatasetVo newDatasetDesc = getNewDatasetDesc((int) datasetVo.getId(), datasetVo.getName(), datasetVo.getIdentifier(), datasetVo.getOwner(), null, false);
|
||||
String username = loginUser.getUsername();
|
||||
Long userid = loginUser.getUserid();
|
||||
ApprovalRequest approvalRequest = new ApprovalRequest();
|
||||
|
|
@ -883,57 +879,57 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
String titleTemplate = "{}发布的数据集<b>\"{}\"</b>需要审核,请查看";
|
||||
String urlTemplate = "/dataset/dataset/info/{}?name={}&owner={}&identifier={}&is_public={}";
|
||||
|
||||
String titleFormat = StrUtil.format(titleTemplate, username, newDatasetDesc.getName());
|
||||
String urlFormat = StrUtil.format(urlTemplate, newDatasetDesc.getId(), newDatasetDesc.getName(), newDatasetDesc.getOwner(), newDatasetDesc.getIdentifier(), newDatasetDesc.getIsPublic());
|
||||
String titleFormat = StrUtil.format(titleTemplate, username, dataset.getName());
|
||||
String urlFormat = StrUtil.format(urlTemplate, dataset.getId(), dataset.getName(), dataset.getOwner(), dataset.getIdentifier(), dataset.getIsPublic());
|
||||
|
||||
approvalRequest.setTitle(titleFormat);
|
||||
approvalRequest.setUrl(urlFormat);
|
||||
approvalRequest.setContent(JSON.toJSONString(newDatasetDesc));
|
||||
approvalRequest.setContent(JSON.toJSONString(dataset));
|
||||
approvalInfoMapper.insertApproval(approvalRequest);
|
||||
|
||||
return "发布成功,待管理员审核";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void privateToPublic(NewDatasetVo newDatasetVo, HttpServletRequest request) throws Exception {
|
||||
if (!newDatasetVo.getIsHotStone()) {
|
||||
hotStoneService.publicHotStoneDataset((String) newDatasetVo.getId(), request);
|
||||
newDatasetDao.updatePublicByHotStoneId((String) newDatasetVo.getId());
|
||||
public void privateToPublic(NewDataset dataset, HttpServletRequest request) throws Exception {
|
||||
if (dataset.getIsHotStone()) {
|
||||
hotStoneService.publicHotStoneDataset(dataset.getHotStoneId(), request);
|
||||
} else {
|
||||
toPublic(newDatasetVo);
|
||||
toPublic(dataset);
|
||||
}
|
||||
newDatasetDao.edit(dataset.setIsPublic(true));
|
||||
}
|
||||
|
||||
private void toPublic(NewDatasetVo newDatasetVo) {
|
||||
private void toPublic(NewDataset newDataset) {
|
||||
try {
|
||||
//获取版本列表信息,每一个版本的配置文件都要更改
|
||||
String token = gitService.checkoutToken();
|
||||
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, newDatasetVo.getOwner(), newDatasetVo.getIdentifier());
|
||||
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, newDataset.getOwner(), newDataset.getIdentifier());
|
||||
for (Map<String, Object> branch : brancheList) {
|
||||
if (branch.get("name").equals("master")) {
|
||||
continue;
|
||||
}
|
||||
//获取每个版本的配置信息
|
||||
Map<String, Object> branchConfig = YamlUtils.loadYamlFile(localPathlocal + newDatasetVo.getOwner() + "/datasets/" + newDatasetVo.getId() + "/" + newDatasetVo.getIdentifier() + "/" + branch.get("name") + "/dataset.yaml");
|
||||
Map<String, Object> branchConfig = YamlUtils.loadYamlFile(localPathlocal + newDataset.getOwner() + "/datasets/" + newDataset.getGitId() + "/" + newDataset.getIdentifier() + "/" + branch.get("name") + "/dataset.yaml");
|
||||
branchConfig.put("is_public", true);
|
||||
|
||||
//更新每个版本的配置信息
|
||||
String repositoryName = newDatasetVo.getIdentifier();
|
||||
String repositoryName = newDataset.getIdentifier();
|
||||
String branchName = StrUtil.toString(branch.get("name"));
|
||||
String relatePath = newDatasetVo.getOwner() + "/datasets/" + newDatasetVo.getId() + "/" + repositoryName + "/" + branchName;
|
||||
String relatePath = newDataset.getOwner() + "/datasets/" + newDataset.getGitId() + "/" + repositoryName + "/" + branchName;
|
||||
String localPath = localPathlocal + relatePath;
|
||||
YamlUtils.generateYamlFile(JsonUtils.objectToMap(branchConfig), localPath, "dataset");
|
||||
}
|
||||
Map projectDetail = gitService.getProjectDetail(newDatasetVo.getOwner(), newDatasetVo.getIdentifier(), token);
|
||||
Map projectDetail = gitService.getProjectDetail(newDataset.getOwner(), newDataset.getIdentifier(), token);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("private", false);
|
||||
param.put("name", projectDetail.get("name"));
|
||||
param.put("project_name", projectDetail.get("name"));
|
||||
param.put("project_identifier", newDatasetVo.getIdentifier());
|
||||
param.put("identifier", newDatasetVo.getIdentifier());
|
||||
gitService.updateProjectDetail(param, newDatasetVo.getOwner(), newDatasetVo.getIdentifier(), token);
|
||||
param.put("project_identifier", newDataset.getIdentifier());
|
||||
param.put("identifier", newDataset.getIdentifier());
|
||||
gitService.updateProjectDetail(param, newDataset.getOwner(), newDataset.getIdentifier(), token);
|
||||
} catch (Exception e) {
|
||||
logger.error("toPublic failed,e={},newDatasetVo={}", e.getMessage(), newDatasetVo);
|
||||
logger.error("toPublic failed,e={},newDataset={}", e.getMessage(), newDataset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ public class NewDatasetServiceImpl1 implements NewDatasetService1 {
|
|||
NewDataset newDataset = new NewDataset();
|
||||
//modelsVo复制信息到newModel
|
||||
BeanUtils.copyProperties(datasetVo, newDataset);
|
||||
newDataset.setId((Integer) datasetVo.getId());
|
||||
setCommonFields(newDataset,false);
|
||||
edit(newDataset);
|
||||
taskExecutor.execute(() -> {
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ public class NewModelServiceImpl implements NewModelService {
|
|||
NewModel newModel = new NewModel();
|
||||
//modelsVo复制信息到newModel
|
||||
BeanUtils.copyProperties(modelsVo, newModel);
|
||||
newModel.setId((Integer) modelsVo.getId());
|
||||
setCommonFields(newModel,false);
|
||||
edit(newModel);
|
||||
taskExecutor.execute(() -> {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ public class FileUtil {
|
|||
return directory.exists() && directory.isDirectory();
|
||||
}
|
||||
|
||||
|
||||
public static long getFolderSize(File folder) {
|
||||
long size = 0;
|
||||
File[] files = folder.listFiles(); // 获取文件夹下所有文件和子目录
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
<if test="dataset.updateBy != null and dataset.updateBy != ''">
|
||||
update_by = #{dataset.updateBy},
|
||||
</if>
|
||||
<if test="dataset.praisesCount != null">
|
||||
praises_count = #{dataset.praisesCount},
|
||||
</if>
|
||||
<if test="dataset.state != null">
|
||||
state = #{dataset.state},
|
||||
</if>
|
||||
|
|
@ -95,7 +98,7 @@
|
|||
<select id="queryByPage" resultType="com.ruoyi.platform.domain.NewDataset">
|
||||
select * from new_dataset
|
||||
<include refid="common_condition"></include>
|
||||
order by create_time desc
|
||||
order by praises_count desc, update_time desc
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
<select id="getDatasetByName" resultType="com.ruoyi.platform.domain.NewDataset">
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@
|
|||
<if test="model.updateBy != null and model.updateBy != ''">
|
||||
update_by = #{model.updateBy},
|
||||
</if>
|
||||
<if test="model.praisesCount != null">
|
||||
praises_count = #{model.praisesCount},
|
||||
</if>
|
||||
<if test="model.state != null">
|
||||
state = #{model.state},
|
||||
</if>
|
||||
|
|
@ -98,7 +101,7 @@
|
|||
<select id="queryByPage" resultType="com.ruoyi.platform.domain.NewModel">
|
||||
select * from new_model
|
||||
<include refid="common_condition"></include>
|
||||
order by create_time desc
|
||||
order by praises_count desc, update_time desc
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue