Browse Source

集成版

Leo 2 years ago
parent
commit
3445fd885f

+ 2 - 105
src/Main.jsx

@@ -1,18 +1,8 @@
 import React, { useState, useEffect } from 'react'
 import { routes } from './routes'
-import {
-  Layout,
-  Menu,
-  Select,
-  Divider,
-  Space,
-  Button,
-  Modal,
-  Input,
-} from 'antd'
+import { Layout, Menu, Select, Space, Button, Modal, Input } from 'antd'
 import { Routes, Route, Link, Navigate, useLocation } from 'react-router-dom'
 import styled from 'styled-components'
-import { SettingFilled, PlusOutlined, ProjectOutlined } from '@ant-design/icons'
 const { Content, Sider, Header } = Layout
 
 const SidebarDiv = styled.div`
@@ -21,39 +11,12 @@ const SidebarDiv = styled.div`
     height: 100vh;
     position: fixed;
     left: 0;
-    top: 54px;
     bottom: 0;
   }
   .content {
     overflow: initial;
     margin-left: 200px;
   }
-  .header {
-    position: fixed;
-    z-index: 1;
-    width: 100%;
-    height: 54px;
-    background: #102337;
-    display: flex;
-    justify-content: flex-end;
-    align-items: center;
-    .projects {
-      color: #fff;
-      .ant-select-arrow {
-        color: #fff;
-      }
-    }
-    .line {
-      height: 24px;
-      margin: 0 15px;
-      border-left: 1px solid #454545;
-    }
-    .setting {
-      color: #fff;
-      font-size: 20px;
-      cursor: pointer;
-    }
-  }
   .headerLogo {
     height: 32px;
     margin: 16px;
@@ -63,14 +26,10 @@ const SidebarDiv = styled.div`
     line-height: 32px;
   }
 `
-const { Option } = Select
-
-const projects = ['项目1', '项目2', '项目3']
 
 const Main = () => {
   const { pathname } = useLocation()
   const [currentSide, setCurrentSide] = useState('1')
-  const [projectsList, setProjectsList] = useState(projects)
   const [isAddProject, setIsAddProject] = useState(false)
   const [projectSetting, setProjectSetting] = useState(false)
   const [projectName, setProjectName] = useState(null)
@@ -110,70 +69,10 @@ const Main = () => {
     setCurrentSide(val.key)
   }
 
-  const addProject = () => {
-    setProjectsList([...projectsList, `项目${projectsList.length + 1}`])
-    setIsAddProject(false)
-    setProjectName(null)
-  }
-
-  const handleProjcet = () => {
-    setIsAddProject(false)
-    setProjectName(null)
-  }
-
-  const editProject = () => {
-    setProjectSetting(false)
-  }
-
-  const addProjectModal = (
-    <Modal
-      title="新建项目"
-      visible={isAddProject}
-      onOk={addProject}
-      okText="确认添加"
-      onCancel={handleProjcet}
-      cancelText="取消">
-      <Space style={{ padding: '10px 20px 30px' }}>
-        <span>项目名称:</span>
-        <Input
-          value={projectName}
-          onChange={e => {
-            setProjectName(e.target.value)
-          }}
-          style={{ width: '350px' }}
-        />
-      </Space>
-    </Modal>
-  )
-
-  const projectSettingModal = (
-    <Modal
-      title="项目设置"
-      visible={projectSetting}
-      width={'60%'}
-      onOk={editProject}
-      okText="确认"
-      onCancel={() => {
-        setProjectSetting(false)
-      }}
-      cancelText="取消">
-      <Space style={{ padding: '10px 20px 30px', display: 'flex' }}>
-        <span>项目名称:</span>
-        <Input style={{ width: '350px' }} />
-      </Space>
-      <Space style={{ padding: '10px 20px 30px', display: 'flex' }}>
-        <span>项目成员管理:</span>
-        <Button type="link">添加成员</Button>
-      </Space>
-    </Modal>
-  )
-
   return (
     <SidebarDiv>
       <Layout>
-        <Header className="header">
-        </Header>
-        <Layout hasSider style={{ marginTop: '54px' }}>
+        <Layout hasSider>
           <Sider className="sidebar">
             <div className="headerLogo">AI平台</div>
             <Menu
@@ -199,8 +98,6 @@ const Main = () => {
           </Content>
         </Layout>
       </Layout>
-      {addProjectModal}
-      {projectSettingModal}
     </SidebarDiv>
   )
 }

+ 7 - 26
src/module/datasource/component/DatasourceManage.jsx

@@ -9,7 +9,7 @@ import {
   getDataSourceInfo,
 } from '../services'
 
-export default function DatasourceManage({ onRef, dataType }) {
+export default function DatasourceManage({ onRef }) {
   // 查看数据源弹窗是否可可视
   const [dataModalVisible, setDataModalVisible] = useState(false)
   const [dsModalVisible, setDsModalVisible] = useState(false)
@@ -280,31 +280,12 @@ export default function DatasourceManage({ onRef, dataType }) {
   // 最终渲染
   return (
     <div>
-      {dataType === '自添加' && (
-        <Table
-          columns={ds_columns}
-          dataSource={dataSourceList}
-          bordered
-          loading={dataLoading}
-        />
-      )}
-      {dataType === 'AIlab' && (
-        <Table
-          rowSelection={rowSelection}
-          columns={ailab_columns}
-          dataSource={dataSourceList}
-          bordered
-          loading={dataLoading}
-        />
-      )}
-      {dataType === '数据湖' && (
-        <Table
-          columns={ds_columns}
-          dataSource={dataSourceList}
-          bordered
-          loading={dataLoading}
-        />
-      )}
+      <Table
+        columns={ds_columns}
+        dataSource={dataSourceList}
+        bordered
+        loading={dataLoading}
+      />
       {dataModal}
       {dsEditModal}
     </div>

+ 2 - 25
src/module/datasource/page/DatasourceView.jsx

@@ -26,8 +26,6 @@ export default function DatasourceView() {
   const [currentSyncPageSize, setCurrentSyncPageSize] = useState(10)
   const [currentLogPage, setCurrentLogPage] = useState(1)
   const [currentLogPageSize, setCurrentLogPageSize] = useState(10)
-  // 数据隔离
-  const [currentDataType, setCurrentDataType] = useState('自添加')
 
   useEffect(() => {
     if (state) {
@@ -56,34 +54,13 @@ export default function DatasourceView() {
     setCurrentKey('3')
   }
 
-  const changeDataType = val => {
-    setCurrentDataType(val)
-  }
-
   // Tab标签右边按钮
   const tabExtraBtn = () => {
     switch (currentKey) {
       case '1':
         return (
           <Space>
-            <Select
-              value={currentDataType}
-              onChange={changeDataType}
-              options={[
-                { value: '自添加', label: '自添加' },
-                { value: 'AIlab', label: 'AIlab' },
-                { value: '数据湖', label: '数据湖' },
-              ]}
-            />
-            {currentDataType === '自添加' && (
-              <DatasourceAdd updateDataSource={updateDataSource} />
-            )}
-            {currentDataType === 'AIlab' && (
-              <Button type="primary">创建数据表</Button>
-            )}
-            {currentDataType === '数据湖' && (
-              <Button type="primary">导入数据表</Button>
-            )}
+            <DatasourceAdd updateDataSource={updateDataSource} />
           </Space>
         )
       case '2':
@@ -112,7 +89,7 @@ export default function DatasourceView() {
           setCurrentLog(null)
         }}>
         <TabPane tab="数据源管理" key="1">
-          <DataSourceManage onRef={sourceRef} dataType={currentDataType} />
+          <DataSourceManage onRef={sourceRef} />
         </TabPane>
         <TabPane tab="同步配置" key="2">
           <DatasourceSyncView