浏览代码

权限调整

Leo 2 年之前
父节点
当前提交
706268ba7e

+ 5 - 0
src/component/CronSelect.jsx

@@ -6,6 +6,7 @@ import React, {
   useEffect,
 } from 'react'
 import styled from 'styled-components'
+import PropTypes from 'prop-types'
 
 const CronWrapper = styled.div`
   .time_wrapper {
@@ -352,3 +353,7 @@ const CronSelect = ({ cron_data }, ref) => {
 }
 
 export default forwardRef(CronSelect)
+
+CronSelect.propTypes = {
+  cron_data: PropTypes.object,
+}

+ 19 - 10
src/module/datasource/component/DatasourceAdd.jsx

@@ -8,17 +8,22 @@ import {
   ProForm,
 } from '@ant-design/pro-components'
 import { Button, Col, message, Form } from 'antd'
-import { useState } from 'react'
+import React, { useState } from 'react'
 import {
   testDataSourceConnection,
   createDataSource,
   uploadFile,
 } from '../services'
+import PropTypes from 'prop-types'
 import Base64 from 'base-64'
 
 const DATA_TYPE_MYSQL = 'mysql'
 const KERBS_VALID_FALSE = false
 
+const ProFormItem = ProForm.Item
+const ProFormPassword = ProFormText.Password
+const ProFormGroup = ProFormRadio.Group
+
 export default function DatasourceAdd({ updateDataSource }) {
   // 数据源类型
   const [dataType, setDataType] = useState(DATA_TYPE_MYSQL)
@@ -346,7 +351,7 @@ export default function DatasourceAdd({ updateDataSource }) {
       )}
       {kerbsValid && <ProFormText label="用户名" name="jdbc_username" />}
       {!kerbsValid && (
-        <ProFormText.Password
+        <ProFormPassword
           label="密码"
           name="jdbc_password"
           rules={[
@@ -357,14 +362,14 @@ export default function DatasourceAdd({ updateDataSource }) {
           ]}
         />
       )}
-      {kerbsValid && <ProFormText.Password label="密码" name="jdbc_password" />}
+      {kerbsValid && <ProFormPassword label="密码" name="jdbc_password" />}
       <ProFormTextArea
         label="详情"
         name="comments"
         fieldProps={{ autoSize: true }}
       />
       {dataType === 'mysql' && (
-        <ProFormRadio.Group
+        <ProFormGroup
           label="use SSL"
           name="use_ssl"
           rules={[
@@ -392,7 +397,7 @@ export default function DatasourceAdd({ updateDataSource }) {
         />
       )}
       {dataType === 'hive' && (
-        <ProFormRadio.Group
+        <ProFormGroup
           label="kerberos验证"
           name="kerberosValid"
           fieldProps={{
@@ -413,13 +418,13 @@ export default function DatasourceAdd({ updateDataSource }) {
       )}
 
       <Col span={12} style={{ paddingLeft: '22.5px', paddingRight: '22.5px' }}>
-        <ProForm.Item label="测试连接" name="success">
+        <ProFormItem label="测试连接" name="success">
           {testConnectBtn}
-        </ProForm.Item>
+        </ProFormItem>
       </Col>
 
       {dataType === 'hive' && kerbsValid ? (
-        <>
+        <div>
           <ProFormUploadButton
             label="keytab文件"
             name="keytab"
@@ -453,10 +458,14 @@ export default function DatasourceAdd({ updateDataSource }) {
               onChange: e => setPrincipal(e.target.value),
             }}
           />
-        </>
+        </div>
       ) : (
-        <></>
+        <div></div>
       )}
     </ModalForm>
   )
 }
+
+DatasourceAdd.propTypes = {
+  updateDataSource: PropTypes.func,
+}

+ 4 - 2
src/module/datasource/component/DatasourceManage.jsx

@@ -803,7 +803,8 @@ const DatasourceManage = ({ dataType }, ref) => {
       {dataType === 'ailab' && (
         <Table
           rowSelection={
-            ['1', '2', '3'].includes(sessionStorage.getItem('role'))
+            ['1', '2', '3'].includes(sessionStorage.getItem('role')) &&
+            sessionStorage.getItem('project_type') === '0'
               ? rowSelection
               : null
           }
@@ -812,7 +813,8 @@ const DatasourceManage = ({ dataType }, ref) => {
           bordered
           loading={dataLoading}
           footer={
-            ['1', '2', '3'].includes(sessionStorage.getItem('role'))
+            ['1', '2', '3'].includes(sessionStorage.getItem('role')) &&
+            sessionStorage.getItem('project_type') === '0'
               ? shareBtn
               : null
           }