Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
6932dd5c
Commit
6932dd5c
authored
Nov 30, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oData
parent
ac7c0933
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
151 additions
and
1 deletion
+151
-1
pds.js
src/model/pds.js
+9
-0
pds.js
src/service/pds.js
+6
-0
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+46
-1
ODataConfigModal.jsx
src/view/Manage/Model/Component/ODataConfigModal.jsx
+90
-0
No files found.
src/model/pds.js
View file @
6932dd5c
...
...
@@ -71,4 +71,12 @@ export function* getVersions(payload) {
export
function
*
getDataServiceLocation
(
payload
)
{
return
yield
call
(
pds
.
getDataServiceLocation
,
payload
)
}
export
function
*
enableOData
(
payload
)
{
return
yield
call
(
pds
.
enableOData
,
payload
)
}
export
function
*
disableOData
(
payload
)
{
return
yield
call
(
pds
.
disableOData
,
payload
)
}
\ No newline at end of file
src/service/pds.js
View file @
6932dd5c
...
...
@@ -72,7 +72,13 @@ export function getDataServiceLocation(payload) {
return
GetJSON
(
"/pdataservice/pdsCURD/getDataServiceLocation"
,
payload
)
}
export
function
enableOData
(
payload
)
{
return
Post
(
"/pdataservice/pdsOData/enableOData"
,
payload
)
}
export
function
disableOData
(
payload
)
{
return
Post
(
"/pdataservice/pdsOData/disableOData"
,
payload
)
}
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
6932dd5c
...
...
@@ -7,6 +7,7 @@ import { Resizable } from 'react-resizable';
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
ResizeObserver
from
'rc-resize-observer'
;
import
ServiceDetail
from
'./ServiceDetailModal'
;
import
ODataConfigModal
from
'./ODataConfigModal'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
,
getQueryParam
,
paginate
,
isSzseEnv
,
formatDate
,
getDataModelerRole
}
from
'../../../../util'
;
...
...
@@ -144,6 +145,7 @@ const ModelTable = (props) => {
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
[
subData
,
setSubData
]
=
useState
([]);
const
[
serviceDetailParams
,
setServiceDetailParams
]
=
useState
({
visible
:
false
,
id
:
''
})
const
[
oDataConfigParams
,
setODataConfigParams
]
=
useState
({
visible
:
false
,
service
:
undefined
});
const
app
=
useContext
(
AppContext
);
...
...
@@ -564,6 +566,27 @@ const ModelTable = (props) => {
onHistory
&&
onHistory
(
record
.
id
);
}
const
disableODataItem
=
(
record
)
=>
{
modal
.
confirm
({
title
:
'提示!'
,
content
:
'您确定要停用该服务的OData吗?'
,
onOk
:
()
=>
{
dispatch
({
type
:
'pds.disableOData'
,
payload
:
{
params
:
{
pdsDataServiceId
:
record
.
id
}
},
callback
:
()
=>
{
showMessage
(
'success'
,
'停用成功'
);
onChange
&&
onChange
();
}
})
}
});
}
const
onSelectChange
=
keys
=>
{
setSelectedRowKeys
(
keys
);
...
...
@@ -681,6 +704,10 @@ const ModelTable = (props) => {
stateAction
(
currentItem
,
action
);
}
else
if
(
key
===
'admit'
)
{
app
.
openAdmit
?.({
dirId
:
catalogId
,
service
:
currentItem
})
}
else
if
(
key
===
'enableOData'
)
{
setODataConfigParams
({
visible
:
true
,
service
:
currentItem
})
}
else
if
(
key
===
'disableOData'
)
{
disableODataItem
(
currentItem
);
}
}
...
...
@@ -688,6 +715,13 @@ const ModelTable = (props) => {
setServiceDetailParams
({
visible
:
false
,
id
:
''
})
}
const
onODataConfigClose
=
(
refresh
=
false
)
=>
{
setODataConfigParams
({
visible
:
false
,
service
:
undefined
});
if
(
refresh
)
{
onChange
?.();
}
}
const
mergedColumns
=
()
=>
{
let
newColumns
=
[...
columns
];
// if ((modelId||'')==='' && (view==='state'||(keyword||'')!=='')) {
...
...
@@ -817,10 +851,20 @@ const ModelTable = (props) => {
})
}
{
currentItem
?.
state
?.
id
?.
indexOf
(
'4'
)
!==-
1
&&
view
!==
'grant'
&&
<
RcItem
id=
"admit"
onClick=
{
handleItemClick
}
>
getDataModelerRole
(
user
)
!==
DataModelerRoleReader
&&
currentItem
?.
state
?.
id
?.
indexOf
(
'4'
)
!==-
1
&&
view
!==
'grant'
&&
<
RcItem
id=
"admit"
onClick=
{
handleItemClick
}
>
授权
</
RcItem
>
}
{
getDataModelerRole
(
user
)
!==
DataModelerRoleReader
&&
view
!==
'grant'
&&
<
RcItem
id=
"enableOData"
onClick=
{
handleItemClick
}
>
启动OData
</
RcItem
>
}
{
getDataModelerRole
(
user
)
!==
DataModelerRoleReader
&&
view
!==
'grant'
&&
<
RcItem
id=
"disableOData"
onClick=
{
handleItemClick
}
>
停用OData
</
RcItem
>
}
{
/* {
getDataModelerRole(user)!==DataModelerRoleReader &¤tItem?.deployable && <RcItem id='createTable' onClick={handleItemClick}>
建表
...
...
@@ -829,6 +873,7 @@ const ModelTable = (props) => {
</
RcMenu
>
<
ServiceDetail
visible=
{
serviceDetailParams
.
visible
}
id=
{
serviceDetailParams
.
id
}
onClose=
{
onServiceDetailClose
}
/>
<
ODataConfigModal
visible=
{
oDataConfigParams
.
visible
}
service=
{
oDataConfigParams
.
service
}
onCancel=
{
onODataConfigClose
}
/>
{
contextHolder
}
</
div
>
);
...
...
src/view/Manage/Model/Component/ODataConfigModal.jsx
0 → 100644
View file @
6932dd5c
import
React
,
{
useState
}
from
'react'
;
import
{
Modal
,
Button
,
Form
,
Input
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
const
FC
=
(
props
)
=>
{
const
{
visible
,
service
,
onCancel
}
=
props
;
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
onOk
=
async
()
=>
{
try
{
const
row
=
await
form
.
validateFields
();
setConfirmLoading
(
true
);
dispatch
({
type
:
'pds.enableOData'
,
payload
:
{
params
:
{
pdsDataServiceId
:
service
?.
id
,
name
:
row
.
name
,
}
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
cancel
(
true
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
});
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
}
}
const
reset
=
()
=>
{
form
.
resetFields
();
setConfirmLoading
(
false
);
}
const
cancel
=
(
refresh
=
false
)
=>
{
reset
();
onCancel
?.(
refresh
);
}
const
footer
=
[
<
Button
key=
"0"
onClick=
{
()
=>
{
cancel
()}
}
>
取消
</
Button
>,
<
Button
key=
"1"
type=
"primary"
loading=
{
confirmLoading
}
onClick=
{
onOk
}
>
确定
</
Button
>,
];
return
(
<
Modal
forceRender
visible=
{
visible
}
title=
{
`启用${service?.name}的OData`
}
width=
{
540
}
onCancel=
{
()
=>
{
cancel
()}
}
footer=
{
footer
}
>
<
Form
form=
{
form
}
>
<
Form
.
Item
name=
'name'
label=
'URI'
rules=
{
[
{
required
:
true
,
message
:
'请输入URI'
,
},
]
}
>
<
Input
placeholder=
'请输入URI'
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
)
}
export
default
FC
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment