| @@ -76,7 +76,7 @@ export default defineConfig({ | |||||
| * @name layout 插件 | * @name layout 插件 | ||||
| * @doc https://umijs.org/docs/max/layout-menu | * @doc https://umijs.org/docs/max/layout-menu | ||||
| */ | */ | ||||
| title: '复杂智能软件', | |||||
| title: '智能软件开发平台', | |||||
| layout: { | layout: { | ||||
| locale: true, | locale: true, | ||||
| ...defaultSettings, | ...defaultSettings, | ||||
| @@ -16,7 +16,7 @@ const Settings: ProLayoutProps & { | |||||
| fixSiderbar: false, | fixSiderbar: false, | ||||
| splitMenus: false, | splitMenus: false, | ||||
| colorWeak: false, | colorWeak: false, | ||||
| title: '复杂智能软件', | |||||
| title: '智能软件开发平台', | |||||
| pwa: true, | pwa: true, | ||||
| logo: '/assets/images/left-top-logo.png', | logo: '/assets/images/left-top-logo.png', | ||||
| iconfontUrl: '//at.alicdn.com/t/c/font_4511326_ndnvm4elll.js', | iconfontUrl: '//at.alicdn.com/t/c/font_4511326_ndnvm4elll.js', | ||||
| @@ -193,6 +193,7 @@ export const antd: RuntimeAntdConfig = (memo) => { | |||||
| colorSuccess: themes['successColor'], | colorSuccess: themes['successColor'], | ||||
| colorError: themes['errorColor'], | colorError: themes['errorColor'], | ||||
| colorWarning: themes['warningColor'], | colorWarning: themes['warningColor'], | ||||
| colorLink: themes['primaryColor'], | |||||
| }; | }; | ||||
| memo.theme.components ??= {}; | memo.theme.components ??= {}; | ||||
| memo.theme.components.Tabs = {}; | memo.theme.components.Tabs = {}; | ||||
| @@ -1,5 +1,3 @@ | |||||
| // @import '@/styles/theme.less'; | |||||
| .kf-radio { | .kf-radio { | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | align-items: center; | ||||
| @@ -1,4 +1,3 @@ | |||||
| @import '@/styles/theme.less'; | |||||
| .modal_title { | .modal_title { | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | align-items: center; | ||||
| @@ -1,5 +1,3 @@ | |||||
| @import '@/styles/theme.less'; | |||||
| .kf-subarea-title { | .kf-subarea-title { | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | align-items: center; | ||||
| @@ -58,7 +58,8 @@ body { | |||||
| .ant-pro-layout .ant-pro-sider-menu { | .ant-pro-layout .ant-pro-sider-menu { | ||||
| padding-top: 40px; | padding-top: 40px; | ||||
| } | } | ||||
| .ant-table-wrapper .ant-table-container table>thead>tr:first-child >*:first-child,.ant-table-wrapper .ant-table-container table>tbody>tr:first-child{ | |||||
| .ant-table-wrapper .ant-table-container table > thead > tr:first-child > *:first-child, | |||||
| .ant-table-wrapper .ant-table-container table > tbody > tr:first-child { | |||||
| padding: 0 30px; | padding: 0 30px; | ||||
| } | } | ||||
| @@ -97,7 +98,7 @@ body { | |||||
| } | } | ||||
| .ant-table-wrapper .ant-table-pagination.ant-pagination { | .ant-table-wrapper .ant-table-pagination.ant-pagination { | ||||
| margin: 0; | margin: 0; | ||||
| padding: 21px 16px; | |||||
| padding: 20px 16px; | |||||
| background-color: #fff; | background-color: #fff; | ||||
| } | } | ||||
| // .ant-table-wrapper .ant-table { | // .ant-table-wrapper .ant-table { | ||||
| @@ -112,6 +113,7 @@ body { | |||||
| } | } | ||||
| .ant-pro-layout .ant-pro-layout-container { | .ant-pro-layout .ant-pro-layout-container { | ||||
| height: 100vh; | height: 100vh; | ||||
| overflow-y: hidden; | |||||
| } | } | ||||
| .ant-modal-confirm .ant-modal-confirm-paragraph { | .ant-modal-confirm .ant-modal-confirm-paragraph { | ||||
| margin: 54px 0 auto; | margin: 54px 0 auto; | ||||
| @@ -188,32 +190,21 @@ body { | |||||
| .ant-modal .ant-modal-footer > .ant-btn + .ant-btn { | .ant-modal .ant-modal-footer > .ant-btn + .ant-btn { | ||||
| margin-left: 20px; | margin-left: 20px; | ||||
| } | } | ||||
| .ant-pagination .ant-pagination-item-active a { | |||||
| color: #fff; | |||||
| background: rgba(22, 100, 255, 0.8); | |||||
| // color: #fff; | |||||
| border-radius: 6px; | |||||
| .ant-pagination .ant-pagination-item.ant-pagination-item-active { | |||||
| background: @primary-color; | |||||
| border-width: 0; | |||||
| a { | |||||
| color: #fff; | |||||
| } | |||||
| } | } | ||||
| .ant-pagination .ant-pagination-item-active:hover { | .ant-pagination .ant-pagination-item-active:hover { | ||||
| // color: #fff; | |||||
| // background: rgba(22, 100, 255, 0.8); | |||||
| // border-color: rgba(22, 100, 255, 0.8); | |||||
| border-radius: 6px; | |||||
| color: #fff; | |||||
| background: rgba(22, 100, 255, 0.8); | |||||
| border-color: rgba(22, 100, 255, 0.8); | |||||
| } | } | ||||
| .ant-pagination .ant-pagination-item { | .ant-pagination .ant-pagination-item { | ||||
| border: 1px solid #e6e6e6; | border: 1px solid #e6e6e6; | ||||
| border-radius: 6px; | |||||
| } | |||||
| .ant-tabs { | |||||
| .ant-tabs-nav::before, | |||||
| div > .ant-tabs-nav::before { | |||||
| border: none; | |||||
| } | |||||
| .ant-tabs-nav { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| } | } | ||||
| // ::-webkit-scrollbar-button { | // ::-webkit-scrollbar-button { | ||||
| @@ -17,6 +17,6 @@ const DevelopmentEnvironment = () => { | |||||
| } | } | ||||
| }; | }; | ||||
| return <iframe style={{ width: '100%', height: '81vh', border: 0 }} src={iframeUrl}></iframe>; | |||||
| return <iframe style={{ width: '100%', height: '100%', border: 0 }} src={iframeUrl}></iframe>; | |||||
| }; | }; | ||||
| export default DevelopmentEnvironment; | export default DevelopmentEnvironment; | ||||
| @@ -12,7 +12,7 @@ import styles from './paramsModal.less'; | |||||
| type ParamsModalProps = { | type ParamsModalProps = { | ||||
| open: boolean; | open: boolean; | ||||
| onCancel: () => void; | onCancel: () => void; | ||||
| globalParam?: PipelineGlobalParam[]; | |||||
| globalParam?: PipelineGlobalParam[] | null; | |||||
| }; | }; | ||||
| function ParamsModal({ open, onCancel, globalParam = [] }: ParamsModalProps) { | function ParamsModal({ open, onCancel, globalParam = [] }: ParamsModalProps) { | ||||
| @@ -26,7 +26,7 @@ function ParamsModal({ open, onCancel, globalParam = [] }: ParamsModalProps) { | |||||
| cancelButtonProps={{ style: { display: 'none' } }} | cancelButtonProps={{ style: { display: 'none' } }} | ||||
| > | > | ||||
| <div className={styles.params_container}> | <div className={styles.params_container}> | ||||
| {globalParam.map((item) => ( | |||||
| {globalParam?.map((item) => ( | |||||
| <div key={item.param_name} className={styles.params_container_line}> | <div key={item.param_name} className={styles.params_container_line}> | ||||
| <span className={styles.params_container_line_label}>{getParamType(item)}</span> | <span className={styles.params_container_line_label}>{getParamType(item)}</span> | ||||
| <span className={styles.params_container_line_value}>{item.param_value}</span> | <span className={styles.params_container_line_value}>{item.param_value}</span> | ||||
| @@ -1,5 +1,3 @@ | |||||
| //@import '@/styles/theme.less'; | |||||
| .mirror-status-cell { | .mirror-status-cell { | ||||
| color: @text-color; | color: @text-color; | ||||
| @@ -1,5 +1,3 @@ | |||||
| @import '@/styles/theme.less'; | |||||
| .mirror-create { | .mirror-create { | ||||
| height: 100%; | height: 100%; | ||||
| @@ -90,6 +90,10 @@ function MirrorCreate() { | |||||
| message.error('文件上传失败,请重新上传文件'); | message.error('文件上传失败,请重新上传文件'); | ||||
| return; | return; | ||||
| } | } | ||||
| if (!file.response || !file.response.data) { | |||||
| message.error('文件上传失败,请重新上传文件'); | |||||
| return; | |||||
| } | |||||
| params = { | params = { | ||||
| ...omit(formData, ['fileList', 'upload_type']), | ...omit(formData, ['fileList', 'upload_type']), | ||||
| @@ -119,7 +123,7 @@ function MirrorCreate() { | |||||
| const beforeUpload: UploadProps['beforeUpload'] = () => { | const beforeUpload: UploadProps['beforeUpload'] = () => { | ||||
| const fileList = form.getFieldValue('fileList'); | const fileList = form.getFieldValue('fileList'); | ||||
| if (fileList.length >= 1) { | |||||
| if (Array.isArray(fileList) && fileList.length >= 1) { | |||||
| message.error('只允许上传一个文件'); | message.error('只允许上传一个文件'); | ||||
| return Upload.LIST_IGNORE; | return Upload.LIST_IGNORE; | ||||
| } | } | ||||
| @@ -1,5 +1,3 @@ | |||||
| @import '@/styles/theme.less'; | |||||
| .mirror-info { | .mirror-info { | ||||
| height: 100%; | height: 100%; | ||||
| @@ -6,7 +6,11 @@ import KFIcon from '@/components/KFIcon'; | |||||
| import { addModel, deleteModel, getAssetIcon, getModelList } from '@/services/dataset/index.js'; | import { addModel, deleteModel, getAssetIcon, getModelList } from '@/services/dataset/index.js'; | ||||
| import { modalConfirm } from '@/utils/ui'; | import { modalConfirm } from '@/utils/ui'; | ||||
| import { UploadOutlined } from '@ant-design/icons'; | import { UploadOutlined } from '@ant-design/icons'; | ||||
| <<<<<<< HEAD | |||||
| import { Button, Form, Input, Modal, Pagination, Radio, Select, Upload, message } from 'antd'; | import { Button, Form, Input, Modal, Pagination, Radio, Select, Upload, message } from 'antd'; | ||||
| ======= | |||||
| import { Button, Form, Input, Modal, Pagination, Select, Upload } from 'antd'; | |||||
| >>>>>>> 4065c42374905b323a937377ae9ab5f05d6ee297 | |||||
| import moment from 'moment'; | import moment from 'moment'; | ||||
| import { useEffect, useState } from 'react'; | import { useEffect, useState } from 'react'; | ||||
| import { useNavigate } from 'react-router-dom'; | import { useNavigate } from 'react-router-dom'; | ||||
| @@ -108,6 +112,10 @@ const PublicData = () => { | |||||
| setIsModalOpen(false); | setIsModalOpen(false); | ||||
| }; | }; | ||||
| const onFinish = (values) => { | const onFinish = (values) => { | ||||
| const params = { | |||||
| ...values, | |||||
| available_range: 0, | |||||
| }; | |||||
| addModel(values).then((ret) => { | addModel(values).then((ret) => { | ||||
| console.log(ret); | console.log(ret); | ||||
| getModelLists(queryFlow); | getModelLists(queryFlow); | ||||
| @@ -452,12 +460,12 @@ const PublicData = () => { | |||||
| > | > | ||||
| <Input placeholder="请输入模型描述" showCount maxLength={256} /> | <Input placeholder="请输入模型描述" showCount maxLength={256} /> | ||||
| </Form.Item> | </Form.Item> | ||||
| <Form.Item label="可见范围" name="available_range"> | |||||
| {/* <Form.Item label="可见范围" name="available_range"> | |||||
| <Radio.Group> | <Radio.Group> | ||||
| <Radio value="0">仅自己可见</Radio> | <Radio value="0">仅自己可见</Radio> | ||||
| <Radio value="1">工作空间可见</Radio> | <Radio value="1">工作空间可见</Radio> | ||||
| </Radio.Group> | </Radio.Group> | ||||
| </Form.Item> | |||||
| </Form.Item> */} | |||||
| <Form.Item | <Form.Item | ||||
| label="模型框架" | label="模型框架" | ||||
| name="model_type" | name="model_type" | ||||
| @@ -1,5 +1,3 @@ | |||||
| @import '@/styles/theme.less'; | |||||
| .model-tabs { | .model-tabs { | ||||
| margin-left: 8px; | margin-left: 8px; | ||||
| :global { | :global { | ||||
| @@ -14,7 +14,7 @@ import styles from './globalParamsDrawer.less'; | |||||
| type GlobalParamsDrawerProps = { | type GlobalParamsDrawerProps = { | ||||
| open: boolean; | open: boolean; | ||||
| onClose: () => void; | onClose: () => void; | ||||
| globalParam: PipelineGlobalParam[]; | |||||
| globalParam: PipelineGlobalParam[] | null; | |||||
| }; | }; | ||||
| const GlobalParamsDrawer = forwardRef( | const GlobalParamsDrawer = forwardRef( | ||||
| @@ -281,7 +281,7 @@ const EditPipeline = () => { | |||||
| const getFirstWorkflow = (val) => { | const getFirstWorkflow = (val) => { | ||||
| getWorkflowById(val).then((ret) => { | getWorkflowById(val).then((ret) => { | ||||
| if (ret && ret.data) { | if (ret && ret.data) { | ||||
| setGlobalParam(ret.data.global_param); | |||||
| setGlobalParam(ret.data.global_param || []); | |||||
| } | } | ||||
| if (graph && ret.data && ret.data.dag) { | if (graph && ret.data && ret.data.dag) { | ||||
| getGraphData(JSON.parse(ret.data.dag)); | getGraphData(JSON.parse(ret.data.dag)); | ||||
| @@ -393,6 +393,8 @@ const EditPipeline = () => { | |||||
| // 上下各3,左右各1 | // 上下各3,左右各1 | ||||
| [0.5, 0], | [0.5, 0], | ||||
| [0.5, 1], | [0.5, 1], | ||||
| [0, 0.5], | |||||
| [1, 0.5], | |||||
| ] | ] | ||||
| ); | ); | ||||
| }, | }, | ||||
| @@ -456,6 +458,7 @@ const EditPipeline = () => { | |||||
| anchorPointIdx: i, // flag the idx of the anchor-point circle | anchorPointIdx: i, // flag the idx of the anchor-point circle | ||||
| links: 0, // cache the number of edges connected to this shape | links: 0, // cache the number of edges connected to this shape | ||||
| visible: false, // invisible by default, shows up when links > 1 or the node is in showAnchors state | visible: false, // invisible by default, shows up when links > 1 or the node is in showAnchors state | ||||
| draggable: true, | |||||
| }); | }); | ||||
| }); | }); | ||||
| return image; | return image; | ||||
| @@ -503,7 +506,7 @@ const EditPipeline = () => { | |||||
| // config the shouldBegin and shouldEnd to make sure the create-edge is began and ended at anchor-point circles | // config the shouldBegin and shouldEnd to make sure the create-edge is began and ended at anchor-point circles | ||||
| { | { | ||||
| type: 'create-edge', | type: 'create-edge', | ||||
| // trigger: 'drag', | |||||
| trigger: 'drag', | |||||
| shouldBegin: (e) => { | shouldBegin: (e) => { | ||||
| // avoid beginning at other shapes on the node | // avoid beginning at other shapes on the node | ||||
| if (e.target && e.target.get('name') !== 'anchor-point') return false; | if (e.target && e.target.get('name') !== 'anchor-point') return false; | ||||
| @@ -619,16 +622,24 @@ const EditPipeline = () => { | |||||
| fitView: true, | fitView: true, | ||||
| fitViewPadding: [320, 320, 220, 320], | fitViewPadding: [320, 320, 220, 320], | ||||
| }); | }); | ||||
| graph.on('dblclick', (e) => { | |||||
| console.log(e.item); | |||||
| if (e.item) { | |||||
| graph.setItemState(e.item, 'nodeClicked', true); | |||||
| handlerClick(e); | |||||
| // graph.on('dblclick', (e) => { | |||||
| // console.log(e.item); | |||||
| // if (e.item) { | |||||
| // graph.setItemState(e.item, 'nodeClicked', true); | |||||
| // handlerClick(e); | |||||
| // } | |||||
| // }); | |||||
| graph.on('node:click', (e) => { | |||||
| console.log(e.target.get('name')); | |||||
| if (e.target.get('name') === 'anchor-point') { | |||||
| // create edge | |||||
| } else { | |||||
| if (e.item) { | |||||
| graph.setItemState(e.item, 'nodeClicked', true); | |||||
| handlerClick(e); | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| graph.on('click', (e) => { | |||||
| console.log(e.item); | |||||
| }); | |||||
| graph.on('aftercreateedge', (e) => { | graph.on('aftercreateedge', (e) => { | ||||
| // update the sourceAnchor and targetAnchor for the newly added edge | // update the sourceAnchor and targetAnchor for the newly added edge | ||||
| graph.updateItem(e.edge, { | graph.updateItem(e.edge, { | ||||
| @@ -666,6 +677,39 @@ const EditPipeline = () => { | |||||
| }, | }, | ||||
| }); | }); | ||||
| }); | }); | ||||
| graph.on('node:dragenter', (e) => { | |||||
| console.log(e.target.get('name')); | |||||
| console.log('node:dragenter'); | |||||
| graph.setItemState(e.item, 'nodeSelected', true); | |||||
| graph.updateItem(e.item, { | |||||
| // 节点的样式 | |||||
| style: { | |||||
| stroke: '#1664ff', | |||||
| }, | |||||
| }); | |||||
| }); | |||||
| graph.on('node:dragleave', (e) => { | |||||
| console.log(e.target.get('name')); | |||||
| console.log('node:dragleave'); | |||||
| graph.setItemState(e.item, 'nodeSelected', false); | |||||
| graph.updateItem(e.item, { | |||||
| // 节点的样式 | |||||
| style: { | |||||
| stroke: 'transparent', | |||||
| }, | |||||
| }); | |||||
| }); | |||||
| graph.on('node:dragstart', (e) => { | |||||
| console.log('node:dragstart'); | |||||
| graph.setItemState(e.item, 'nodeSelected', true); | |||||
| graph.updateItem(e.item, { | |||||
| // 节点的样式 | |||||
| style: { | |||||
| stroke: '#1664ff', | |||||
| }, | |||||
| }); | |||||
| }); | |||||
| graph.on('afterremoveitem', (e) => { | graph.on('afterremoveitem', (e) => { | ||||
| if (e.item && e.item.source && e.item.target) { | if (e.item && e.item.source && e.item.target) { | ||||
| const sourceNode = graph.findById(e.item.source); | const sourceNode = graph.findById(e.item.source); | ||||
| @@ -19,7 +19,7 @@ const items = [ | |||||
| children: [1, 2, 3, 4, 5], | children: [1, 2, 3, 4, 5], | ||||
| }, | }, | ||||
| ]; | ]; | ||||
| const modelMenus = ({ onParDragEnd }) => { | |||||
| const ModelMenus = ({ onParDragEnd }) => { | |||||
| const [modelMenusList, setModelMenusList] = useState([]); | const [modelMenusList, setModelMenusList] = useState([]); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| getComponentAll().then((ret) => { | getComponentAll().then((ret) => { | ||||
| @@ -55,6 +55,7 @@ const modelMenus = ({ onParDragEnd }) => { | |||||
| {item.value && item.value.length > 0 | {item.value && item.value.length > 0 | ||||
| ? item.value.map((ele) => ( | ? item.value.map((ele) => ( | ||||
| <div | <div | ||||
| key={ele.id} | |||||
| draggable="true" | draggable="true" | ||||
| onDragEnd={(e) => { | onDragEnd={(e) => { | ||||
| dragEnd(e, ele); | dragEnd(e, ele); | ||||
| @@ -78,4 +79,4 @@ const modelMenus = ({ onParDragEnd }) => { | |||||
| </div> | </div> | ||||
| ); | ); | ||||
| }; | }; | ||||
| export default modelMenus; | |||||
| export default ModelMenus; | |||||
| @@ -246,10 +246,10 @@ const Login: React.FC = () => { | |||||
| style={{ height: '42px', marginRight: '10px' }} | style={{ height: '42px', marginRight: '10px' }} | ||||
| alt="" | alt="" | ||||
| /> | /> | ||||
| 复杂智能软件 | |||||
| 智能软件开发平台 | |||||
| </div> | </div> | ||||
| <div className={centerTitleBoX}> | <div className={centerTitleBoX}> | ||||
| <span style={{ whiteSpace: 'nowrap' }}>复杂智能软件</span> | |||||
| <span style={{ whiteSpace: 'nowrap' }}>智能软件开发平台</span> | |||||
| <img | <img | ||||
| src="/assets/images/ai-logo.png" | src="/assets/images/ai-logo.png" | ||||
| @@ -276,7 +276,7 @@ const Login: React.FC = () => { | |||||
| <div className={rightTopTitle}> | <div className={rightTopTitle}> | ||||
| <span style={{ color: '#111111', fontSize: '36px' }}>hello~</span> | <span style={{ color: '#111111', fontSize: '36px' }}>hello~</span> | ||||
| <span style={{ color: '#606b7a', fontSize: '32px', marginLeft: '10px' }}>欢迎登陆</span> | <span style={{ color: '#606b7a', fontSize: '32px', marginLeft: '10px' }}>欢迎登陆</span> | ||||
| <span style={{ color: '#1664ff', fontSize: '32px' }}>复杂智能软件</span> | |||||
| <span style={{ color: '#1664ff', fontSize: '32px' }}>智能软件开发平台</span> | |||||
| </div> | </div> | ||||
| <div className={containerLoginForm}> | <div className={containerLoginForm}> | ||||
| <div | <div | ||||
| @@ -17,7 +17,9 @@ import org.springframework.scheduling.annotation.EnableScheduling; | |||||
| @EnableRyFeignClients | @EnableRyFeignClients | ||||
| @SpringBootApplication | @SpringBootApplication | ||||
| @EnableScheduling | @EnableScheduling | ||||
| public class RuoYiManagementPlatformApplication { | |||||
| public class | |||||
| RuoYiManagementPlatformApplication { | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(RuoYiManagementPlatformApplication.class, args); | SpringApplication.run(RuoYiManagementPlatformApplication.class, args); | ||||
| System.out.println("(♥◠‿◠)ノ゙ 复杂智能软件管理平台启动成功 ლ(´ڡ`ლ)゙ \n" + | System.out.println("(♥◠‿◠)ノ゙ 复杂智能软件管理平台启动成功 ლ(´ڡ`ლ)゙ \n" + | ||||
| @@ -158,7 +158,7 @@ public class DatasetController { | |||||
| */ | */ | ||||
| @DeleteMapping({"{id}"}) | @DeleteMapping({"{id}"}) | ||||
| @ApiOperation("根据id删除数据集") | @ApiOperation("根据id删除数据集") | ||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) { | |||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return AjaxResult.success(this.datasetService.removeById(id)); | return AjaxResult.success(this.datasetService.removeById(id)); | ||||
| } | } | ||||
| @@ -161,7 +161,7 @@ public class ModelsController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("删除模型") | @ApiOperation("删除模型") | ||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return genericsSuccess(this.modelsService.removeById(id)); | return genericsSuccess(this.modelsService.removeById(id)); | ||||
| } | } | ||||
| @@ -19,8 +19,8 @@ public class AssetIcon implements Serializable { | |||||
| /** | /** | ||||
| * 主键 | * 主键 | ||||
| */ | */ | ||||
| @ApiModelProperty(value = "资产ID") | |||||
| private Integer id; | |||||
| @ApiModelProperty(value = "资产ID") | |||||
| private Integer id; | |||||
| @ApiModelProperty(value = "资产图标名称") | @ApiModelProperty(value = "资产图标名称") | ||||
| private String name; | private String name; | ||||
| @@ -76,6 +76,13 @@ public class Dataset implements Serializable { | |||||
| @ApiModelProperty(value = "状态:0失效,1生效") | @ApiModelProperty(value = "状态:0失效,1生效") | ||||
| private Integer state; | private Integer state; | ||||
| @ApiModelProperty(value = "数据集类型名字") | |||||
| private String datasetTypeName; | |||||
| @ApiModelProperty(value = "数据集tag名字") | |||||
| private String datasetTagName; | |||||
| public Integer getId() { | public Integer getId() { | ||||
| return id; | return id; | ||||
| @@ -165,5 +172,21 @@ public class Dataset implements Serializable { | |||||
| this.state = state; | this.state = state; | ||||
| } | } | ||||
| public String getDatasetTypeName() { | |||||
| return datasetTypeName; | |||||
| } | |||||
| public String getDatasetTagName() { | |||||
| return datasetTagName; | |||||
| } | |||||
| public void setDatasetTagName(String datasetTagName) { | |||||
| this.datasetTagName = datasetTagName; | |||||
| } | |||||
| public void setDatasetTypeName(String datasetTypeName) { | |||||
| this.datasetTypeName = datasetTypeName; | |||||
| } | |||||
| } | } | ||||
| @@ -118,7 +118,7 @@ public class Image implements Serializable { | |||||
| this.updateTime = updateTime; | this.updateTime = updateTime; | ||||
| } | } | ||||
| // Getter 和 Setter | |||||
| public Integer getVersionCount() { | public Integer getVersionCount() { | ||||
| return versionCount; | return versionCount; | ||||
| } | } | ||||
| @@ -52,6 +52,16 @@ public class Models implements Serializable { | |||||
| private Integer state; | private Integer state; | ||||
| @ApiModelProperty(value = "模型类型名") | |||||
| private String modelTypeName; | |||||
| @ApiModelProperty(value = "模型tag名") | |||||
| private String modelTagName; | |||||
| public Integer getId() { | public Integer getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -158,5 +168,21 @@ public class Models implements Serializable { | |||||
| this.state = state; | this.state = state; | ||||
| } | } | ||||
| public String getModelTagName() { | |||||
| return modelTagName; | |||||
| } | |||||
| public void setModelTagName(String modelTagName) { | |||||
| this.modelTagName = modelTagName; | |||||
| } | |||||
| public String getModelTypeName() { | |||||
| return modelTypeName; | |||||
| } | |||||
| public void setModelTypeName(String modelTypeName) { | |||||
| this.modelTypeName = modelTypeName; | |||||
| } | |||||
| } | } | ||||
| @@ -84,5 +84,6 @@ public interface AssetIconDao { | |||||
| List<AssetIcon> queryByCategoryId(Integer categoryId); | List<AssetIcon> queryByCategoryId(Integer categoryId); | ||||
| AssetIcon queryByPath(String path); | |||||
| } | } | ||||
| @@ -22,6 +22,15 @@ public interface AssetIconService { | |||||
| */ | */ | ||||
| AssetIcon queryById(Integer id); | AssetIcon queryById(Integer id); | ||||
| /** | |||||
| * 通过path查询单条数据 | |||||
| * | |||||
| * @param path 路径 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| AssetIcon queryByPath(String path); | |||||
| /** | /** | ||||
| * 分页查询 | * 分页查询 | ||||
| * | * | ||||
| @@ -68,7 +68,7 @@ DatasetService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception; | ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception; | ||||
| @@ -64,7 +64,7 @@ public interface ModelsService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| ResponseEntity<InputStreamResource> downloadModels(Integer id) throws Exception; | ResponseEntity<InputStreamResource> downloadModels(Integer id) throws Exception; | ||||
| @@ -2,7 +2,6 @@ package com.ruoyi.platform.service.impl; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.domain.AssetIcon; | import com.ruoyi.platform.domain.AssetIcon; | ||||
| import com.ruoyi.platform.domain.Models; | |||||
| import com.ruoyi.platform.mapper.AssetIconDao; | import com.ruoyi.platform.mapper.AssetIconDao; | ||||
| import com.ruoyi.platform.service.AssetIconService; | import com.ruoyi.platform.service.AssetIconService; | ||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| @@ -38,6 +37,12 @@ public class AssetIconServiceImpl implements AssetIconService { | |||||
| return this.assetIconDao.queryById(id); | return this.assetIconDao.queryById(id); | ||||
| } | } | ||||
| @Override | |||||
| public AssetIcon queryByPath(String path) { | |||||
| return this.assetIconDao.queryByPath(path); | |||||
| } | |||||
| /** | /** | ||||
| * 分页查询 | * 分页查询 | ||||
| * | * | ||||
| @@ -125,4 +130,6 @@ public class AssetIconServiceImpl implements AssetIconService { | |||||
| public List<AssetIcon> queryByCategoryId(Integer categoryId) { | public List<AssetIcon> queryByCategoryId(Integer categoryId) { | ||||
| return this.assetIconDao.queryByCategoryId(categoryId); | return this.assetIconDao.queryByCategoryId(categoryId); | ||||
| } | } | ||||
| } | } | ||||
| @@ -3,10 +3,12 @@ package com.ruoyi.platform.service.impl; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.annotations.CheckDuplicate; | import com.ruoyi.platform.annotations.CheckDuplicate; | ||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import com.ruoyi.platform.domain.Dataset; | import com.ruoyi.platform.domain.Dataset; | ||||
| import com.ruoyi.platform.domain.DatasetVersion; | import com.ruoyi.platform.domain.DatasetVersion; | ||||
| import com.ruoyi.platform.mapper.DatasetDao; | import com.ruoyi.platform.mapper.DatasetDao; | ||||
| import com.ruoyi.platform.mapper.DatasetVersionDao; | import com.ruoyi.platform.mapper.DatasetVersionDao; | ||||
| import com.ruoyi.platform.service.AssetIconService; | |||||
| import com.ruoyi.platform.service.DatasetService; | import com.ruoyi.platform.service.DatasetService; | ||||
| import com.ruoyi.platform.service.DatasetVersionService; | import com.ruoyi.platform.service.DatasetVersionService; | ||||
| import com.ruoyi.platform.service.MinioService; | import com.ruoyi.platform.service.MinioService; | ||||
| @@ -58,6 +60,9 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| @Resource | @Resource | ||||
| private DatasetVersionService datasetVersionService; | private DatasetVersionService datasetVersionService; | ||||
| @Resource | |||||
| private AssetIconService assetIconService; | |||||
| @Resource | @Resource | ||||
| private MinioService minioService; | private MinioService minioService; | ||||
| @@ -77,7 +82,27 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public Dataset queryById(Integer id) { | public Dataset queryById(Integer id) { | ||||
| return this.datasetDao.queryById(id); | |||||
| Dataset dataset = this.datasetDao.queryById(id); | |||||
| if (dataset != null) { | |||||
| String dataType = dataset.getDataType(); | |||||
| String dataTag = dataset.getDataTag(); | |||||
| // 判空逻辑,只有当dataType和dataTag不为空时,才进行查询 | |||||
| if (dataType != null && !dataType.isEmpty()) { | |||||
| AssetIcon dataTypeAssetIcon = assetIconService.queryById(Integer.valueOf(dataType)); | |||||
| if (dataTypeAssetIcon != null) { | |||||
| dataset.setDatasetTypeName(dataTypeAssetIcon.getName()); | |||||
| } | |||||
| } | |||||
| if (dataTag != null && !dataTag.isEmpty()) { | |||||
| AssetIcon dataTagAssetIcon = assetIconService.queryById(Integer.valueOf(dataTag)); | |||||
| if (dataTagAssetIcon != null) { | |||||
| dataset.setDatasetTagName(dataTagAssetIcon.getName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return dataset; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -146,10 +171,10 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| Dataset dataset = this.datasetDao.queryById(id); | Dataset dataset = this.datasetDao.queryById(id); | ||||
| if (dataset == null){ | if (dataset == null){ | ||||
| return "数据集不存在"; | |||||
| throw new Exception("数据集不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | //判断权限,只有admin和创建者本身可以删除该数据集 | ||||
| @@ -157,10 +182,10 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = dataset.getCreateBy(); | String createdBy = dataset.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该数据集版本"; | |||||
| throw new Exception("无权限删除该数据集"); | |||||
| } | } | ||||
| if (datasetVersionService.queryByDatasetId(id).size()>0){ | if (datasetVersionService.queryByDatasetId(id).size()>0){ | ||||
| return "请先删除该数据集的版本文件"; | |||||
| throw new Exception("请先删除该数据集下的版本文件"); | |||||
| } | } | ||||
| dataset.setState(0); | dataset.setState(0); | ||||
| @@ -316,10 +316,10 @@ public class ImageServiceImpl implements ImageService { | |||||
| String filePath = "/data/argo-workflow/" + bucketName + "/" +path; | String filePath = "/data/argo-workflow/" + bucketName + "/" +path; | ||||
| String logs2 = k8sClientUtil.executeCommand(pod,"docker load -i "+filePath); | String logs2 = k8sClientUtil.executeCommand(pod,"docker load -i "+filePath); | ||||
| // 在容器里执行 docker tag name:tag nexus3.kube-system.svc:8083/imageName:imageTag | // 在容器里执行 docker tag name:tag nexus3.kube-system.svc:8083/imageName:imageTag | ||||
| if (StringUtils.isNoneBlank(logs2)){ | if (StringUtils.isNoneBlank(logs2)){ | ||||
| String substring = logs2.substring(logs2.lastIndexOf(harborUrl)); | |||||
| String cleanedString = substring.replaceAll("(\\r|\\n)", ""); | |||||
| String tagCmd = "docker tag " + cleanedString + " " + harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; | |||||
| String substring = logs2.substring(logs2.indexOf(":")+1).trim(); | |||||
| String tagCmd = "docker tag " + substring + " " + harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; | |||||
| String imageUrl = harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; | String imageUrl = harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; | ||||
| String pushCmd = "docker push " + imageUrl; | String pushCmd = "docker push " + imageUrl; | ||||
| String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl; | String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl; | ||||
| @@ -1,10 +1,12 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import com.ruoyi.platform.domain.Models; | import com.ruoyi.platform.domain.Models; | ||||
| import com.ruoyi.platform.domain.ModelsVersion; | import com.ruoyi.platform.domain.ModelsVersion; | ||||
| import com.ruoyi.platform.mapper.ModelsDao; | import com.ruoyi.platform.mapper.ModelsDao; | ||||
| import com.ruoyi.platform.mapper.ModelsVersionDao; | import com.ruoyi.platform.mapper.ModelsVersionDao; | ||||
| import com.ruoyi.platform.service.AssetIconService; | |||||
| import com.ruoyi.platform.service.MinioService; | import com.ruoyi.platform.service.MinioService; | ||||
| import com.ruoyi.platform.service.ModelsService; | import com.ruoyi.platform.service.ModelsService; | ||||
| import com.ruoyi.platform.service.ModelsVersionService; | import com.ruoyi.platform.service.ModelsVersionService; | ||||
| @@ -57,6 +59,9 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| @Resource | @Resource | ||||
| private MinioService minioService; | private MinioService minioService; | ||||
| @Resource | |||||
| private AssetIconService assetIconService; | |||||
| // 固定存储桶名 | // 固定存储桶名 | ||||
| private final String bucketName = "platform-data"; | private final String bucketName = "platform-data"; | ||||
| @@ -72,7 +77,23 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public Models queryById(Integer id) { | public Models queryById(Integer id) { | ||||
| return this.modelsDao.queryById(id); | |||||
| Models models = this.modelsDao.queryById(id); | |||||
| String modelType = models.getModelType(); | |||||
| String modelTag = models.getModelTag(); | |||||
| //去资产管理表中查询对应的图标名,注意判空逻辑,只有当dataType和dataTag不为空时,才进行查询 | |||||
| if(modelType != null && !modelType.isEmpty()){ | |||||
| AssetIcon modelTypeAssetIcon = assetIconService.queryById(Integer.valueOf(modelType)); | |||||
| if (modelTypeAssetIcon != null){ | |||||
| models.setModelTypeName(modelTypeAssetIcon.getName()); | |||||
| } | |||||
| } | |||||
| if(modelTag != null && !modelTag.isEmpty()){ | |||||
| AssetIcon modelTagAssetIcon = assetIconService.queryById(Integer.valueOf(modelTag)); | |||||
| if (modelTagAssetIcon != null){ | |||||
| models.setModelTagName(modelTagAssetIcon.getName()); | |||||
| } | |||||
| } | |||||
| return models; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -137,23 +158,23 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| Models models = this.modelsDao.queryById(id); | Models models = this.modelsDao.queryById(id); | ||||
| if (models == null){ | if (models == null){ | ||||
| return "模型不存在"; | |||||
| throw new Exception("模型不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | |||||
| //判断权限,只有admin和创建者本身可以删除该模型 | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = models.getCreateBy(); | String createdBy = models.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该模型"; | |||||
| throw new Exception("无权限删除该模型"); | |||||
| } | } | ||||
| if (modelsVersionService.queryByModelsId(id).size()>0){ | if (modelsVersionService.queryByModelsId(id).size()>0){ | ||||
| return "请先删除该模型的版本文件"; | |||||
| throw new Exception("请先删除该镜像下的版本文件"); | |||||
| } | } | ||||
| models.setState(0); | models.setState(0); | ||||
| return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | ||||
| @@ -207,7 +228,6 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public List<Map<String, String>> uploadModels(MultipartFile[] files, String uuid) throws Exception { | public List<Map<String, String>> uploadModels(MultipartFile[] files, String uuid) throws Exception { | ||||
| List<Map<String, String>> results = new ArrayList<>(); | List<Map<String, String>> results = new ArrayList<>(); | ||||
| for (MultipartFile file:files) { | for (MultipartFile file:files) { | ||||
| // 构建objectName | // 构建objectName | ||||
| @@ -232,7 +252,6 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| ModelsVersion version = modelsVersionService.queryByModelsVersion(modelsVersion); | ModelsVersion version = modelsVersionService.queryByModelsVersion(modelsVersion); | ||||
| String url = ""; | String url = ""; | ||||
| if (version == null) { | if (version == null) { | ||||
| //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | ||||
| @@ -43,6 +43,13 @@ | |||||
| </where> | </where> | ||||
| </select> | </select> | ||||
| <select id="queryByPath" resultMap="AssetIconMap" > | |||||
| select | |||||
| id, name,category_id, path, description, create_by, create_time, update_by, update_time, state | |||||
| from asset_icon | |||||
| where path = #{path} and state = 1 | |||||
| </select> | |||||
| <select id="queryAllByLimit" resultMap="AssetIconMap"> | <select id="queryAllByLimit" resultMap="AssetIconMap"> | ||||
| select | select | ||||
| id, name, category_id, path, description, create_by, create_time, update_by, update_time, state | id, name, category_id, path, description, create_by, create_time, update_by, update_time, state | ||||
| @@ -123,6 +130,7 @@ | |||||
| </where> | </where> | ||||
| </select> | </select> | ||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into asset_icon(name, category_id, path, description, create_by, create_time, update_by, update_time, state) | insert into asset_icon(name, category_id, path, description, create_by, create_time, update_by, update_time, state) | ||||
| values (#{assetIcon.name}, #{assetIcon.categoryId}, #{assetIcon.path}, #{assetIcon.description}, #{assetIcon.createBy}, #{assetIcon.createTime}, #{assetIcon.updateBy}, #{assetIcon.updateTime}, #{assetIcon.state}) | values (#{assetIcon.name}, #{assetIcon.categoryId}, #{assetIcon.path}, #{assetIcon.description}, #{assetIcon.createBy}, #{assetIcon.createTime}, #{assetIcon.updateBy}, #{assetIcon.updateTime}, #{assetIcon.state}) | ||||
| @@ -152,13 +152,13 @@ | |||||
| description = #{dataset.description}, | description = #{dataset.description}, | ||||
| </if> | </if> | ||||
| <if test="dataset.availableRange != null and dataset.availableRange != ''"> | <if test="dataset.availableRange != null and dataset.availableRange != ''"> | ||||
| available_range = #{dataset.availableRange} | |||||
| </if>, | |||||
| available_range = #{dataset.availableRange}, | |||||
| </if> | |||||
| <if test="dataset.dataType != null"> | <if test="dataset.dataType != null"> | ||||
| data_type = #{dataset.dataType}, | data_type = #{dataset.dataType}, | ||||
| </if> | </if> | ||||
| <if test="dataset.dataTag != null"> | <if test="dataset.dataTag != null"> | ||||
| data_tag = #{dataset.dataTag} | |||||
| data_tag = #{dataset.dataTag}, | |||||
| </if> | </if> | ||||
| <if test="dataset.createBy != null and dataset.createBy != ''"> | <if test="dataset.createBy != null and dataset.createBy != ''"> | ||||
| create_by = #{dataset.createBy}, | create_by = #{dataset.createBy}, | ||||
| @@ -179,6 +179,7 @@ | |||||
| where id = #{dataset.id} | where id = #{dataset.id} | ||||
| </update> | </update> | ||||
| <!--通过主键删除--> | <!--通过主键删除--> | ||||
| <delete id="deleteById"> | <delete id="deleteById"> | ||||
| delete from dataset where id = #{id} | delete from dataset where id = #{id} | ||||
| @@ -154,7 +154,7 @@ | |||||
| description = #{models.description}, | description = #{models.description}, | ||||
| </if> | </if> | ||||
| <if test="models.availableRange != null and models.availableRange != ''"> | <if test="models.availableRange != null and models.availableRange != ''"> | ||||
| available_range = #{models.availableRange} | |||||
| available_range = #{models.availableRange}, | |||||
| </if> | </if> | ||||
| <if test="models.modelType != null"> | <if test="models.modelType != null"> | ||||
| model_type = #{models.modelType}, | model_type = #{models.modelType}, | ||||