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
1daa4fd2
Commit
1daa4fd2
authored
Jan 30, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
服务发起流程
parent
bf131ba7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
223 additions
and
1 deletion
+223
-1
pds.js
src/model/pds.js
+13
-0
pds.js
src/service/pds.js
+13
-0
start-propcess.jsx
src/view/Manage/Model/Component/start-propcess.jsx
+98
-0
index.jsx
src/view/Manage/Model/index.jsx
+99
-1
No files found.
src/model/pds.js
View file @
1daa4fd2
...
...
@@ -167,4 +167,16 @@ export function* exportAll(payload) {
export
function
*
exportServices
(
payload
)
{
return
yield
call
(
pds
.
exportServices
,
payload
);
}
export
function
*
isAdmin
()
{
return
yield
call
(
pds
.
isAdmin
)
}
export
function
*
startProcess
(
payload
)
{
return
yield
call
(
pds
.
startProcess
,
payload
)
}
export
function
*
publish
(
payload
)
{
return
yield
call
(
pds
.
publish
,
payload
)
}
\ No newline at end of file
src/service/pds.js
View file @
1daa4fd2
...
...
@@ -170,4 +170,16 @@ export function exportServices(payload) {
return
callFetchRaw
(
'post'
,
'/pdataservice/pdsCURD/export/ids'
,
{...
payload
,
paramsSerializer
:
function
(
params
)
{
return
qs
.
stringify
(
params
,
{
arrayFormat
:
'repeat'
})
}})
}
export
function
isAdmin
()
{
return
Get
(
"/pdataservice/pdsSessionInfo/isAdmin"
)
}
export
function
startProcess
(
payload
)
{
return
PostJSON
(
"/pdataservice/pdsWorkflowHelper/dataServicesReleaseKickoff"
,
payload
)
}
export
function
publish
(
payload
)
{
return
PostJSON
(
"/pdataservice/pdsWorkflowHelper/dataServicesRelease"
,
payload
)
}
\ No newline at end of file
src/view/Manage/Model/Component/start-propcess.jsx
0 → 100644
View file @
1daa4fd2
import
React
,
{
useState
}
from
'react'
import
{
Modal
,
Form
,
Input
,
Spin
,
Button
}
from
'antd'
import
{
dispatch
}
from
'../../../../model'
import
{
showMessage
}
from
'../../../../util'
const
FC
=
(
props
)
=>
{
const
{
visible
,
onCancel
,
ids
}
=
props
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
form
]
=
Form
.
useForm
()
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
6
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
14
},
},
};
const
close
=
(
refresh
=
false
)
=>
{
setWaiting
(
false
)
onCancel
?.(
refresh
)
}
const
save
=
async
()
=>
{
try
{
const
values
=
await
form
.
validateFields
()
setWaiting
(
true
)
dispatch
({
type
:
'pds.startProcess'
,
payload
:
{
params
:
{
...
values
,
},
data
:
ids
??[]
},
callback
:
()
=>
{
showMessage
(
'success'
,
'申请成功!'
)
close
(
true
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
catch
(
errInfo
)
{
}
}
const
footer
=
React
.
useMemo
(()
=>
{
return
[
<
Button
key=
{
'cancel'
}
onClick=
{
()
=>
close
()
}
>
取消
</
Button
>,
<
Button
key=
{
'save'
}
type=
'primary'
disabled=
{
waiting
}
onClick=
{
()
=>
save
()
}
>
保存
</
Button
>
]
},
[
close
,
save
,
waiting
])
return
(
<
Modal
destroyOnClose
visible=
{
visible
}
title=
'申请'
width=
{
520
}
bodyStyle=
{
{
overflowX
:
'auto'
,
maxHeight
:
'80vh'
}
}
footer=
{
footer
}
onCancel=
{
()
=>
{
close
()
}
}
>
<
Spin
spinning=
{
waiting
}
>
<
Form
labelAlign=
'left'
{
...
formItemLayout
}
form=
{
form
}
>
<
Form
.
Item
label=
'申请原因'
name=
'comment'
rules=
{
[{
required
:
true
,
message
:
'请填写申请原因'
}]
}
>
<
Input
.
TextArea
placeholder=
'请在申请原因栏中描述用途说明以及必要性'
rows=
{
4
}
/>
</
Form
.
Item
>
</
Form
>
</
Spin
>
</
Modal
>
);
}
export
default
FC
\ No newline at end of file
src/view/Manage/Model/index.jsx
View file @
1daa4fd2
...
...
@@ -26,6 +26,7 @@ import StartRelease from './Component/StartRelease';
import
Offline
from
'./Component/Offline'
;
import
ImportServices
from
'./Component/ImportServices'
;
import
download
from
'../../../util/download'
;
import
StartProcess
from
'./Component/start-propcess'
;
import
'./index.less'
;
...
...
@@ -78,6 +79,13 @@ class Model extends React.Component {
loadingAttrs
:
false
,
attrs
:
[],
currentAttr
:
undefined
,
canPublish
:
false
,
loadingAdmin
:
false
,
isAdmin
:
false
,
processParams
:
{
visible
:
false
,
ids
:
undefined
,
},
}
}
...
...
@@ -85,10 +93,30 @@ class Model extends React.Component {
this
.
getModelStates
();
this
.
getPreference
();
this
.
getAttrs
();
this
.
getAdmin
();
window
?.
addEventListener
(
"storage"
,
this
.
modelEventChange
);
}
componentDidUpdate
(
prevProps
,
prevState
)
{
const
{
selectModelerIds
,
tableData
}
=
this
.
state
;
if
(
selectModelerIds
!==
prevState
.
selectModelerIds
||
tableData
!==
prevState
.
tableData
)
{
let
canPublish
=
(
selectModelerIds
??[]).
length
===
0
?
false
:
true
;
selectModelerIds
?.
forEach
(
id
=>
{
const
index
=
(
tableData
||
[]).
findIndex
(
item
=>
item
.
id
===
id
);
if
(
index
!==
-
1
)
{
if
(
tableData
[
index
].
state
?.
id
!==
'1'
)
{
canPublish
=
false
}
}
});
this
.
setState
({
canPublish
});
}
}
componentWillUnmount
()
{
window
?.
removeEventListener
(
"storage"
,
this
.
modelEventChange
);
}
...
...
@@ -99,6 +127,23 @@ class Model extends React.Component {
}
}
getAdmin
=
()
=>
{
this
.
setState
({
loadingAdmin
:
true
},
()
=>
{
dispatch
({
type
:
'pds.isAdmin'
,
callback
:
data
=>
{
this
.
setState
({
loadingAdmin
:
false
,
isAdmin
:
(
data
===
'true'
)?
true
:
false
});
},
error
:
()
=>
{
this
.
setState
({
loadingAdmin
:
false
});
}
});
})
}
getModelStates
=
()
=>
{
this
.
setState
({
loadingStates
:
true
},
()
=>
{
dispatch
({
...
...
@@ -424,6 +469,38 @@ class Model extends React.Component {
}
}
onPublishClick = () => {
const { modal } = this.props;
const { isAdmin, selectModelerIds } = this.state;
if (isAdmin) {
modal?.confirm({
title: '是否确认发布选中的服务',
onOk: () => {
dispatch({
type: 'pds.publish',
payload: {
data: selectModelerIds??[],
},
callback: () => {
showMessage("success","发布成功")
this.setState({ selectModelerIds: [] }, () => {
this.onTableChange()
})
}
})
}
})
} else {
this.setState({
processParams: {
visible: true,
ids: selectModelerIds
}
})
}
}
onSubscribeBtnClick = () => {
const { selectModelerIds } = this.state;
const { modal } = this.props;
...
...
@@ -805,6 +882,11 @@ class Model extends React.Component {
(getDataModelerRole(app?.user)!==DataModelerRoleReader) && (currentView==='dir') && <Button onClick={this.onExportClick}>导出</Button>
}
{
(getDataModelerRole(app?.user)!==DataModelerRoleReader) && !isOnlyEnding && <Tooltip title={this.state.canPublish?'':'请先选择待发布的服务'}>
<Button onClick={this.onPublishClick} disabled={!this.state.canPublish}>发布</Button>
</Tooltip>
}
{
(getDataModelerRole(app?.user)!==DataModelerRoleReader) && isOnlyEnding &&
<Tooltip title={(selectModelerIds||[]).length===0?'请先选择服务':''}>
<Button onClick={this.onSubscribeBtnClick} disabled={(selectModelerIds||[]).length===0}>收藏</Button>
...
...
@@ -879,7 +961,7 @@ class Model extends React.Component {
</div>
<div className='p-3'>
<Spin spinning={loadingTableData}>
<Spin spinning={loadingTableData
||this.state.loadingAdmin
}>
<ModelTable
loading={loadingTableData}
user={app?.user}
...
...
@@ -950,6 +1032,22 @@ class Model extends React.Component {
this.onTableChange()
}}
/>
<StartProcess
{...this.state.processParams}
onCancel={(refresh) => {
this.setState({
processParams: {
visible: false,
ids: undefined,
}
})
refresh && this.setState({ selectModelerIds: [] }, () => {
this.onTableChange()
})
}}
/>
</div>
);
}
...
...
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