Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
17bedb13
Commit
17bedb13
authored
Apr 21, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1e90e94c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
169 deletions
+98
-169
.idea/workspace.xml
.idea/workspace.xml
+50
-149
src/models/Common.js
src/models/Common.js
+10
-1
src/models/packages.js
src/models/packages.js
+1
-0
src/routes/AppDetail.js
src/routes/AppDetail.js
+37
-19
No files found.
.idea/workspace.xml
View file @
17bedb13
This diff is collapsed.
Click to expand it.
src/models/Common.js
View file @
17bedb13
...
@@ -6,9 +6,18 @@ export default {
...
@@ -6,9 +6,18 @@ export default {
namespace
:
'
Common
'
,
namespace
:
'
Common
'
,
state
:
{
state
:
{
collapsed
:
false
,
collapsed
:
false
,
mode
:
'
inline
'
mode
:
'
inline
'
,
isUpload
:
false
,
percent
:
0
,
uploadStatus
:
''
,
},
},
reducers
:
{
reducers
:
{
upload
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
,
}
},
collapsed
(
state
)
{
collapsed
(
state
)
{
const
mode
=
state
.
collapsed
?
'
inline
'
:
'
vertical
'
const
mode
=
state
.
collapsed
?
'
inline
'
:
'
vertical
'
return
{...
state
,
collapsed
:
!
state
.
collapsed
,
mode
}
return
{...
state
,
collapsed
:
!
state
.
collapsed
,
mode
}
...
...
src/models/packages.js
View file @
17bedb13
...
@@ -57,6 +57,7 @@ export default {
...
@@ -57,6 +57,7 @@ export default {
try
{
try
{
const
{
data
}
=
yield
call
(
urlUpload
,
payload
)
const
{
data
}
=
yield
call
(
urlUpload
,
payload
)
yield
put
({
type
:
'
success
'
,
payload
:
{
packages
:
data
},
appId
:
payload
.
appId
})
yield
put
({
type
:
'
success
'
,
payload
:
{
packages
:
data
},
appId
:
payload
.
appId
})
message
.
info
(
'
上传成功, 打包中...
'
)
}
catch
(
e
)
{
}
catch
(
e
)
{
message
.
error
(
e
.
message
)
message
.
error
(
e
.
message
)
}
}
...
...
src/routes/AppDetail.js
View file @
17bedb13
...
@@ -19,6 +19,7 @@ import {
...
@@ -19,6 +19,7 @@ import {
Table
,
Table
,
Badge
,
Badge
,
Alert
,
Alert
,
Progress
,
message
,
message
,
Popconfirm
,
Popconfirm
,
Row
,
Row
,
...
@@ -91,18 +92,18 @@ class AppDetail extends React.Component {
...
@@ -91,18 +92,18 @@ class AppDetail extends React.Component {
};
};
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
dispatch
({
type
:
'
packages/fetch
'
,
payload
:
{
appId
:
this
.
props
.
params
.
id
}})
this
.
props
.
dispatch
({
type
:
'
packages/fetch
'
,
payload
:
{
appId
:
this
.
props
.
params
.
id
}})
}
}
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
const
{
App
:
{
developers
,
publishers
,
news
},
packages
}
=
nextProps
const
{
App
:
{
developers
,
publishers
,
news
},
packages
}
=
nextProps
// this.setState({
// this.setState({
// developers: {...defDevelopers, ...developers},
// developers: {...defDevelopers, ...developers},
// publishers: {...defPublishers, ...publishers},
// publishers: {...defPublishers, ...publishers},
// packages: [...defPackages, ...packages],
// packages: [...defPackages, ...packages],
// news: {...defNews, ...news},
// news: {...defNews, ...news},
// })
// })
if
(
this
.
state
.
packages
.
length
!==
packages
)
{
if
(
this
.
state
.
packages
.
length
!==
packages
)
{
this
.
setState
({
this
.
setState
({
packages
packages
})
})
...
@@ -188,7 +189,7 @@ class AppDetail extends React.Component {
...
@@ -188,7 +189,7 @@ class AppDetail extends React.Component {
const
{
version
,
actions
,
references
,
dependencies
}
=
values
const
{
version
,
actions
,
references
,
dependencies
}
=
values
Object
.
keys
(
actions
).
forEach
((
platform
)
=>
{
Object
.
keys
(
actions
).
forEach
((
platform
)
=>
{
if
(
actions
[
platform
])
{
if
(
actions
[
platform
])
{
actions
[
platform
]
=
JSON
.
parse
(
actions
[
platform
])
actions
[
platform
]
=
JSON
.
parse
(
actions
[
platform
])
}
}
})
})
...
@@ -279,7 +280,6 @@ class AppDetail extends React.Component {
...
@@ -279,7 +280,6 @@ class AppDetail extends React.Component {
}
}
// onUpdatePackage = (e) => {
// onUpdatePackage = (e) => {
// const {form, dispatch, params: {id}} = this.props
// const {form, dispatch, params: {id}} = this.props
//
//
...
@@ -307,7 +307,7 @@ class AppDetail extends React.Component {
...
@@ -307,7 +307,7 @@ class AppDetail extends React.Component {
let
{
upload
:
{
packages
}}
=
values
let
{
upload
:
{
packages
}}
=
values
const
_package
=
packages
.
find
(
p
=>
p
.
id
==
pack
.
id
)
const
_package
=
packages
.
find
(
p
=>
p
.
id
==
pack
.
id
)
dispatch
({
type
:
"
packages/delete
"
,
payload
:
{
appId
:
id
,
...
_package
}})
dispatch
({
type
:
"
packages/delete
"
,
payload
:
{
appId
:
id
,
...
_package
}})
}
}
});
});
}
}
...
@@ -338,7 +338,7 @@ class AppDetail extends React.Component {
...
@@ -338,7 +338,7 @@ class AppDetail extends React.Component {
let
{
packages
}
=
this
.
state
let
{
packages
}
=
this
.
state
let
_package
=
packages
[
targetKey
]
let
_package
=
packages
[
targetKey
]
if
(
_package
.
_id
)
{
if
(
_package
.
_id
)
{
this
.
onDeletePackage
(
_package
)
this
.
onDeletePackage
(
_package
)
}
}
...
@@ -756,7 +756,7 @@ class AppDetail extends React.Component {
...
@@ -756,7 +756,7 @@ class AppDetail extends React.Component {
if
(
pack
)
{
if
(
pack
)
{
return
(
return
(
<
TabPane
tab
=
{
pack
.
name
||
"
New
"
}
key
=
{
i
}
closable
=
{
packages
.
length
>
1
}
>
<
TabPane
tab
=
{
pack
.
name
||
"
New
"
}
key
=
{
i
}
closable
=
{
packages
.
length
>
1
}
>
<
Form
onSubmit
=
{
e
=>
this
.
onSubmitUpload
(
e
,
pack
)}
>
<
Form
>
<
FormItem
{...
formItemLayout
}
help
=
"
id
"
>
<
FormItem
{...
formItemLayout
}
help
=
"
id
"
>
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["id"]`
,
{
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["id"]`
,
{
...
@@ -826,16 +826,22 @@ class AppDetail extends React.Component {
...
@@ -826,16 +826,22 @@ class AppDetail extends React.Component {
<
FormItem
{...
formItemLayout
}
>
<
FormItem
{...
formItemLayout
}
>
<
div
className
=
{
styles
.
wrapSubmit
}
>
<
div
className
=
{
styles
.
wrapSubmit
}
>
{
{
pack
.
status
==
'
uploaded
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onNewPackageVersion
(
e
,
pack
)}
size
=
"
large
"
>
发布新版本
<
/Button
>
pack
.
status
==
'
uploaded
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onNewPackageVersion
(
e
,
pack
)}
size
=
"
large
"
>
发布新版本
<
/Button
>
}
}
{
{
pack
.
status
==
'
uploading
'
&&
<
Button
type
=
"
primary
"
size
=
"
large
"
disabled
>
上传中
...
<
/Button
>
pack
.
status
==
'
uploading
'
&&
<
Button
type
=
"
primary
"
size
=
"
large
"
disabled
>
处理中
...
<
/Button
>
}
}
{
{
pack
.
status
==
'
init
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onPatchPackage
(
e
,
pack
)}
size
=
"
large
"
>
保存
<
/Button
>
pack
.
status
==
'
init
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onPatchPackage
(
e
,
pack
)}
size
=
"
large
"
>
保存
<
/Button
>
}
}
{
{
pack
.
status
==
'
new
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onAddPackage
(
e
,
pack
)}
size
=
"
large
"
>
提交
<
/Button
>
pack
.
status
==
'
new
'
&&
<
Button
type
=
"
primary
"
onClick
=
{(
e
)
=>
this
.
onAddPackage
(
e
,
pack
)}
size
=
"
large
"
>
提交
<
/Button
>
}
}
<
/div
>
<
/div
>
<
/FormItem
>
<
/FormItem
>
...
@@ -850,14 +856,17 @@ class AppDetail extends React.Component {
...
@@ -850,14 +856,17 @@ class AppDetail extends React.Component {
<
p
>
locales
:
{
pack
.
locales
.
map
((
locale
,
i
)
=>
{
<
p
>
locales
:
{
pack
.
locales
.
map
((
locale
,
i
)
=>
{
return
<
span
key
=
{
i
}
style
=
{{
padding
:
"
0 2px
"
}}
>
{
locale
}
<
/span
>
return
<
span
key
=
{
i
}
style
=
{{
padding
:
"
0 2px
"
}}
>
{
locale
}
<
/span
>
})}
<
/p
>
})}
<
/p
>
<
p
>
platforms
:
{
pack
.
platforms
.
map
((
platform
,
i
)
=>
{
<
p
>
platforms
:
{
pack
.
platforms
.
map
((
platform
,
i
)
=>
{
return
<
span
key
=
{
i
}
style
=
{{
padding
:
"
0 2px
"
}}
>
{
platform
}
<
/span
>
return
<
span
key
=
{
i
}
style
=
{{
padding
:
"
0 2px
"
}}
>
{
platform
}
<
/span
>
})}
<
/p
>
})}
<
/p
>
<
p
>
files
:
{
pack
.
files
.
length
}
<
/p
>
<
p
>
files
:
{
pack
.
files
.
length
}
<
/p
>
{
pack
.
status
==
'
uploaded
'
&&
this
.
checkUploading
&&
clearInterval
(
this
.
checkUploading
)
}
<
/Card
>
<
/Card
>
}
}
{
pack
.
status
!==
'
uploaded
'
&&<
FormItem
{...
formItemLayout
}
>
{
pack
.
status
!==
'
uploaded
'
&&
<
FormItem
{...
formItemLayout
}
>
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["upload"]`
,
{})(
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["upload"]`
,
{})(
<
Tabs
defaultActiveKey
=
"
1
"
size
=
"
small
"
>
<
Tabs
defaultActiveKey
=
"
1
"
size
=
"
small
"
>
<
TabPane
tab
=
"
url上传
"
key
=
"
1
"
>
<
TabPane
tab
=
"
url上传
"
key
=
"
1
"
>
...
@@ -866,7 +875,7 @@ class AppDetail extends React.Component {
...
@@ -866,7 +875,7 @@ class AppDetail extends React.Component {
})(
})(
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
}}
>
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
}}
>
{
{
pack
.
status
==
'
failed
'
&&
<
Alert
message
=
"
上传失败,请重试
"
type
=
"
warning
"
showIcon
/>
pack
.
status
==
'
failed
'
&&
<
Alert
message
=
"
上传失败,请重试
"
type
=
"
warning
"
showIcon
/>
}
}
<
Input
<
Input
addonBefore
=
{
<
Icon
type
=
"
upload
"
/>
}
addonBefore
=
{
<
Icon
type
=
"
upload
"
/>
}
...
@@ -885,25 +894,30 @@ class AppDetail extends React.Component {
...
@@ -885,25 +894,30 @@ class AppDetail extends React.Component {
<
/TabPane
>
<
/TabPane
>
<
TabPane
tab
=
"
直接上传
"
key
=
"
2
"
>
<
TabPane
tab
=
"
直接上传
"
key
=
"
2
"
>
{
{
pack
.
status
==
'
failed
'
&&
<
Alert
message
=
"
上传失败,请重试
"
type
=
"
warning
"
showIcon
/>
pack
.
status
==
'
failed
'
&&
<
Alert
message
=
"
上传失败,请重试
"
type
=
"
warning
"
showIcon
/>
}
}
<
Dragger
<
Dragger
{...
uploadProps
}
{...
uploadProps
}
onChange
=
{(
info
)
=>
{
onChange
=
{(
info
)
=>
{
const
status
=
info
.
file
.
status
;
const
status
=
info
.
file
.
status
;
console
.
log
(
info
)
if
(
status
!
==
'
uploading
'
)
{
if
(
status
==
'
uploading
'
)
{
console
.
log
(
info
.
file
,
info
.
fileList
);
dispatch
({
type
:
'
Common/upload
'
,
payload
:
{
percent
:
info
.
file
.
percent
,
uploadStatus
:
'
active
'
,
isUpload
:
true
}})
}
}
if
(
status
===
'
done
'
)
{
if
(
status
===
'
done
'
)
{
message
.
info
(
'
上传成功, 打包中...
'
,
3
)
dispatch
({
type
:
'
packages/fetch
'
,
payload
:
{
appId
:
this
.
props
.
params
.
id
}})
dispatch
({
type
:
'
packages/fetch
'
,
payload
:
{
appId
:
this
.
props
.
params
.
id
}})
dispatch
({
type
:
'
Common/upload
'
,
payload
:
{
percent
:
0
,
uploadStatus
:
''
,
isUpload
:
false
}})
}
else
if
(
status
===
'
error
'
)
{
}
else
if
(
status
===
'
error
'
)
{
dispatch
({
type
:
'
Common/upload
'
,
payload
:
{
percent
:
info
.
file
.
percent
,
uploadStatus
:
'
exception
'
,
isUpload
:
true
}})
message
.
error
(
info
.
file
.
response
.
message
);
message
.
error
(
info
.
file
.
response
.
message
);
}
}
}}
}}
disabled
=
{
pack
.
status
!==
'
init
'
&&
pack
.
status
!==
'
failed
'
}
disabled
=
{
pack
.
status
!==
'
init
'
&&
pack
.
status
!==
'
failed
'
}
action
=
{
`
${
config
.
apiRoot
}
/v1/upload/package/
${
pack
[
"
_id
"
]}
`
}
action
=
{
`
${
config
.
apiRoot
}
/v1/upload/package/
${
pack
[
"
_id
"
]}
`
}
>
>
<
p
className
=
"
ant-upload-drag-icon
"
>
<
p
className
=
"
ant-upload-drag-icon
"
>
<
Icon
type
=
"
inbox
"
/>
<
Icon
type
=
"
inbox
"
/>
<
/p
>
<
/p
>
...
@@ -939,6 +953,7 @@ function mapStateToProps(state, props) {
...
@@ -939,6 +953,7 @@ function mapStateToProps(state, props) {
const
{
const
{
Apps
:
{
apps
},
Apps
:
{
apps
},
packages
:
{
packages
},
packages
:
{
packages
},
Common
:
{
isUpload
,
percent
,
uploadStatus
},
loading
loading
}
=
state
}
=
state
...
@@ -948,6 +963,9 @@ function mapStateToProps(state, props) {
...
@@ -948,6 +963,9 @@ function mapStateToProps(state, props) {
return
{
return
{
loading
,
loading
,
isUpload
,
percent
,
uploadStatus
,
packages
:
_packages
,
packages
:
_packages
,
App
App
};
};
...
...
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