Leo il y a 2 ans
Parent
commit
c2c13e7c64

+ 10 - 3
src/module/datasource/component/DatasourceEdit.jsx

@@ -130,7 +130,6 @@ export default function DatasourceAdd({ ds_id, ds_info, setDsModalVisible }) {
         params['use_ssl'] = useSSL ? 1 : 0
         params['kerberos'] = kerbsValid ? 1 : 0
         if (kerbsValid) {
-          console.log(keytabFile, krd5File)
           if (keytabFile && keytabFile.length) {
             const keytab = await uploadKerbFile(keytabFile)
             params['keytab'] = keytab
@@ -387,7 +386,11 @@ export default function DatasourceAdd({ ds_id, ds_info, setDsModalVisible }) {
         <>
           <ProFormUploadButton
             label="keytab文件"
-            title="上传keyTabPath"
+            title={
+              form.getFieldValue('keytab')
+                ? '重新上传keyTabPath'
+                : '上传keyTabPath'
+            }
             fieldProps={{ ...keytabUpProps }}
             max={1}
             accept=".keytab"
@@ -395,7 +398,11 @@ export default function DatasourceAdd({ ds_id, ds_info, setDsModalVisible }) {
           <Col span={12} />
           <ProFormUploadButton
             label="krb5config文件"
-            title="上传krb5config"
+            title={
+              form.getFieldValue('krb5config')
+                ? '重新上传krb5config'
+                : '上传krb5config'
+            }
             fieldProps={{ ...krd5UpProps }}
             max={1}
             accept=".conf"

+ 2 - 3
src/module/datasource/component/LogWatcher.jsx

@@ -41,14 +41,13 @@ const LogWatcher = () => {
   }, [state])
 
   const returnLogTable = () => {
-    console.log('111')
     navigate('/datasource', {
       state: { key: '3' },
     })
   }
   return (
     <LogWrapper>
-      {/* <div className="return">
+      <div className="return">
         <Button
           type="primary"
           onClick={() => {
@@ -56,7 +55,7 @@ const LogWatcher = () => {
           }}>
           返回上一级
         </Button>
-      </div> */}
+      </div>
       <pre className="log">{logData}</pre>
     </LogWrapper>
   )

+ 10 - 1
src/module/datasource/page/DatasourceView.jsx

@@ -4,8 +4,9 @@ import DatasourceAdd from '../component/DatasourceAdd'
 import DatasourceSyncView from '../component/DatasourceSyncView'
 import DatasourceLog from '../component/DatasourceLog'
 import React, { useState } from 'react'
-import { Link, useNavigate } from 'react-router-dom'
+import { Link, useNavigate, useLocation } from 'react-router-dom'
 import styled from 'styled-components'
+import { useEffect } from 'react'
 const { TabPane } = Tabs
 
 const Datasource = styled.div`
@@ -14,6 +15,7 @@ const Datasource = styled.div`
 
 export default function DatasourceView() {
   const navigate = useNavigate()
+  const { state } = useLocation()
   // 数据源管理ref
   const sourceRef = React.createRef()
   const logRef = React.createRef()
@@ -21,6 +23,12 @@ export default function DatasourceView() {
   const [currentKey, setCurrentKey] = useState('1')
   const [currentLog, setCurrentLog] = useState(null)
 
+  useEffect(() => {
+    if (state) {
+      setCurrentKey(state.key)
+    }
+  }, [state])
+
   // 更新数据源列表
   const updateDataSource = () => {
     sourceRef.current.updateSourceList()
@@ -57,6 +65,7 @@ export default function DatasourceView() {
         activeKey={currentKey}
         onTabClick={key => {
           if (key === '3') updateLogs()
+          navigate('/datasource', { state: { key } })
         }}
         onChange={key => {
           setCurrentKey(key)