Browse Source

(*)最新元数据权限控制

master
peng.peng 2 years ago
parent
commit
136c938340
  1. 23
      web/client/src/sections/metadataManagement/containers/databasesTable.js
  2. 24
      web/client/src/sections/metadataManagement/containers/filesTable.js
  3. 4
      web/client/src/sections/metadataManagement/containers/latestMetadata.js
  4. 24
      web/client/src/sections/metadataManagement/containers/restapisTable.js

23
web/client/src/sections/metadataManagement/containers/databasesTable.js

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Spin, Table, Popconfirm, Button, Input } from 'antd';
import { Spin, Table, Popconfirm, Button, Input, Row, Col } from 'antd';
import { ButtonGroup } from '$components';
import moment from 'moment';
import FileSaver from 'file-saver';
@ -173,13 +173,18 @@ const DatabaseTable = (props) => {
ra.applyBy == user.id && ra.resourceName === record.name);
return <ButtonGroup>
<a onClick={() => onView(record)}>查看</a>
{user.role == '数据消费者' ? null :
<>
<a style={{ marginLeft: 10 }} onClick={() => onEdit(record)}>编辑</a>
<Popconfirm
title="是否确认删除该元数据?"
onConfirm={() => confirmDelete(record.id)}
> <a style={{ marginLeft: 10 }}>删除</a></Popconfirm>
{record.type === '表' ? <a style={{ marginLeft: 10 }} onClick={() => marking(record.id)}>打标</a> : null}
{user.role == '系统管理员' ? '' : record.type === '表' ? resourceApplicationsRecords.length === 0 ?
</>
}
{user.role !== '数据消费者' ? null : record.type === '表' ? resourceApplicationsRecords.length === 0 ?
<a style={{ marginLeft: 10 }} onClick={() => applyResources(record)}>申请资源</a> :
<span style={{ marginLeft: 10, color: "#c0c0c0" }} title='已存在资源申请'>申请资源</span> : null}
</ButtonGroup>
@ -252,7 +257,9 @@ const DatabaseTable = (props) => {
}
}
return <Spin spinning={isRequesting}>
<div style={{ marginBottom: 16 }}>
<Row style={{ marginBottom: 16 }}>
<Col span={12}>
{user.role == '数据消费者' ? null : <>
<Button type='primary' onClick={() => {
dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes.join(',') })).then(res => {
if (res.success) {
@ -269,10 +276,14 @@ const DatabaseTable = (props) => {
<Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }}> 导出</Button>
</Popconfirm>
}
<Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button>
<Input style={{ width: 220, float: 'right' }} placeholder="名称/代码/类型"
</>}
</Col>
<Col span={12} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Input style={{ width: 220 }} placeholder="名称/代码/类型"
allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} />
</div >
<Button type='primary' style={{ marginLeft: 16 }} onClick={onSearch}>查询</Button>
</Col>
</Row >
<Table
scroll={{ y: clientHeight - 320 }}
rowKey='id'

24
web/client/src/sections/metadataManagement/containers/filesTable.js

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Spin, Table, Popconfirm, Button, Input } from 'antd';
import { Spin, Table, Popconfirm, Button, Input, Row, Col } from 'antd';
import { ButtonGroup } from '$components';
import moment from 'moment';
import FileSaver from 'file-saver';
@ -207,12 +207,17 @@ const FilesTable = (props) => {
let resourceApplicationsRecords = metadataResourceApplications.filter(ra =>
ra.applyBy == user.id && ra.resourceName === record.name);
return <ButtonGroup>
{user.role == '数据消费者' ? null :
<>
<a style={{ marginLeft: 10 }} onClick={() => onEdit(record)}>编辑</a>
<Popconfirm
title="是否确认删除该元数据?"
onConfirm={() => confirmDelete(record)}
><a style={{ marginLeft: 10 }}>删除</a></Popconfirm>
<a style={{ marginLeft: 10 }} onClick={() => marking(record.id)}>打标</a>
</>
}
{user.role == '系统管理员' ? '' : resourceApplicationsRecords.length === 0 ?
<a style={{ marginLeft: 10 }} onClick={() => applyResources(record)}>申请资源</a> :
<span style={{ marginLeft: 10, color: "#c0c0c0" }} title='已存在资源申请'>申请资源</span>}
@ -298,7 +303,9 @@ const FilesTable = (props) => {
}
}
return <Spin spinning={isRequesting}>
<div style={{ marginBottom: 16 }}>
<Row style={{ marginBottom: 16 }}>
<Col span={12}>
{user.role == '数据消费者' ? null : <>
<Button type='primary' onClick={() => {
dispatch(metadataManagement.getMetadataModels({ modelTypes: '文件' })).then(res => {
if (res.success) {
@ -314,11 +321,16 @@ const FilesTable = (props) => {
: <Popconfirm title={'是否导出全部?'} onConfirm={() => handleExport(true)} okText="确定" cancelText="取消">
<Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }}> 导出</Button>
</Popconfirm>
}
<Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button>
<Input style={{ width: 220, float: 'right' }} placeholder="名称/类型"
}</>}
</Col>
<Col span={12} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Input style={{ width: 220 }} placeholder="名称/类型"
allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} />
</div >
<Button type='primary' style={{ marginLeft: 16 }} onClick={onSearch}>查询</Button>
</Col>
</Row>
<Table
scroll={{ y: clientHeight - 320 }}
rowKey='id'

4
web/client/src/sections/metadataManagement/containers/latestMetadata.js

@ -183,10 +183,10 @@ const LatestMetadata = (props) => {
<Input style={{ width: 220, marginBottom: 8 }} placeholder="输入资源目录关键字搜索"
allowClear onChange={onChangeSearch}
onKeyPress={onChangeSearch} />
<Button type='primary' style={{ marginBottom: 16 }} onClick={() => {
{user?.role == '系统管理员' && <Button type='primary' style={{ marginBottom: 16 }} onClick={() => {
setEditData({ title: '新建资源目录', add: true });
setModalVisible(true);
}}>新建资源目录</Button>
}}>新建资源目录</Button>}
<Tree
// showLine
height={clientHeight - 180}

24
web/client/src/sections/metadataManagement/containers/restapisTable.js

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Spin, Table, Popconfirm, Button, Input } from 'antd';
import { Spin, Table, Popconfirm, Button, Input, Row, Col } from 'antd';
import { ButtonGroup } from '$components';
import MetadataRestapiModal from '../components/metadataRestapiModal';
import MetadataTagModal from '../components/metadataTagModal';
@ -143,12 +143,17 @@ const RestapisTable = (props) => {
let resourceApplicationsRecords = metadataResourceApplications.filter(ra =>
ra.applyBy == user.id && ra.resourceName === record.name);
return <ButtonGroup>
{user.role == '数据消费者' ? null :
<>
<a style={{ marginLeft: 10 }} onClick={() => onEdit(record)}>编辑</a>
<Popconfirm
title="是否确认删除该元数据?"
onConfirm={() => confirmDelete(record.id)}
> <a style={{ marginLeft: 10 }}>删除</a></Popconfirm>
<a style={{ marginLeft: 10 }} onClick={() => marking(record.id)}>打标</a>
</>
}
{user.role == '系统管理员' ? '' : resourceApplicationsRecords.length === 0 ?
<a style={{ marginLeft: 10 }} onClick={() => applyResources(record)}>申请资源</a> :
<span style={{ marginLeft: 10, color: "#c0c0c0" }} title='已存在资源申请'>申请资源</span>}
@ -180,19 +185,24 @@ const RestapisTable = (props) => {
}
}
return <Spin spinning={isRequesting}>
<div style={{ marginBottom: 16 }}>
<Button type='primary' onClick={() => {
<Row style={{ marginBottom: 16 }}>
<Col span={12}>
{user.role == '数据消费者' ? null : <> <Button type='primary' onClick={() => {
dispatch(metadataManagement.getMetadataModels({ modelTypes: '接口' })).then(res => {
if (res.success) {
setEditData({ add: true, title: '新建接口元数据', record: {} });
setModalVisible(true);
}
})
}}>新建</Button>
<Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button>
<Input style={{ width: 220, float: 'right' }} placeholder="名称"
}}>新建</Button></>}
</Col>
<Col span={12} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Input style={{ width: 220 }} placeholder="名称"
allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} />
</div >
<Button type='primary' style={{ marginLeft: 16 }} onClick={onSearch}>查询</Button>
</Col>
</Row>
<Table
scroll={{ y: clientHeight - 320 }}
rowKey='id'

Loading…
Cancel
Save