Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
6f452a06
Commit
6f452a06
authored
7 years ago
by
Alexandru Munteanu
Browse files
Options
Downloads
Patches
Plain Diff
Delete file and add link to preview
parent
f093afe8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/component-wizard/src/components/FileItem.js
+6
-4
6 additions, 4 deletions
packages/component-wizard/src/components/FileItem.js
packages/component-wizard/src/components/Files.js
+10
-11
10 additions, 11 deletions
packages/component-wizard/src/components/Files.js
with
16 additions
and
15 deletions
packages/component-wizard/src/components/FileItem.js
+
6
−
4
View file @
6f452a06
...
@@ -13,11 +13,13 @@ const parseFileSize = size => {
...
@@ -13,11 +13,13 @@ const parseFileSize = size => {
return
`
${
Math
.
floor
(
gbSize
)}
GB`
return
`
${
Math
.
floor
(
gbSize
)}
GB`
}
else
if
(
Math
.
floor
(
mbSize
))
{
}
else
if
(
Math
.
floor
(
mbSize
))
{
return
`
${
Math
.
floor
(
mbSize
)}
MB`
return
`
${
Math
.
floor
(
mbSize
)}
MB`
}
else
if
(
Math
.
floor
(
kbSize
))
{
return
`
${
Math
.
floor
(
kbSize
)}
kB`
}
}
return
`
${
Math
.
floor
(
kbS
ize
)
}
kB
`
return
`
${
s
ize
}
bytes
`
}
}
const
FileItem
=
({
dragHandle
,
name
,
size
,
id
,
removeFile
})
=>
(
const
FileItem
=
({
dragHandle
,
name
,
size
,
id
,
removeFile
,
...
rest
})
=>
(
<
div
className
=
{
classnames
(
classes
[
'
file-item
'
])}
>
<
div
className
=
{
classnames
(
classes
[
'
file-item
'
])}
>
{
dragHandle
}
{
dragHandle
}
<
div
className
=
{
classnames
(
classes
.
info
)}
>
<
div
className
=
{
classnames
(
classes
.
info
)}
>
...
@@ -25,9 +27,9 @@ const FileItem = ({ dragHandle, name, size, id, removeFile }) => (
...
@@ -25,9 +27,9 @@ const FileItem = ({ dragHandle, name, size, id, removeFile }) => (
<
span
>
{
parseFileSize
(
size
)}
<
/span
>
<
span
>
{
parseFileSize
(
size
)}
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
{
classnames
(
classes
.
buttons
)}
>
<
div
className
=
{
classnames
(
classes
.
buttons
)}
>
<
button
title
=
"
Preview
"
>
<
a
href
=
{
rest
.
signedUrl
}
target
=
"
_blank
"
>
<
Icon
color
=
"
#666
"
>
eye
<
/Icon
>
<
Icon
color
=
"
#666
"
>
eye
<
/Icon
>
<
/
button
>
<
/
a
>
<
button
onClick
=
{
removeFile
(
id
)}
title
=
"
Delete
"
>
<
button
onClick
=
{
removeFile
(
id
)}
title
=
"
Delete
"
>
<
Icon
color
=
"
#666
"
>
trash
-
2
<
/Icon
>
<
Icon
color
=
"
#666
"
>
trash
-
2
<
/Icon
>
<
/button
>
<
/button
>
...
...
This diff is collapsed.
Click to expand it.
packages/component-wizard/src/components/Files.js
+
10
−
11
View file @
6f452a06
...
@@ -133,17 +133,16 @@ export default compose(
...
@@ -133,17 +133,16 @@ export default compose(
updateFragment
,
updateFragment
,
})
=>
type
=>
id
=>
e
=>
{
})
=>
type
=>
id
=>
e
=>
{
e
.
preventDefault
()
e
.
preventDefault
()
deleteFile
(
id
).
then
(()
=>
{
deleteFile
(
id
)
const
newFiles
=
files
[
type
].
filter
(
f
=>
f
.
id
!==
id
)
const
newFiles
=
files
[
type
].
filter
(
f
=>
f
.
id
!==
id
)
setFiles
(
newFiles
,
type
)
setFiles
(
newFiles
,
type
)
updateFragment
(
project
,
{
updateFragment
(
project
,
{
submitted
:
new
Date
(),
submitted
:
new
Date
(),
...
version
,
...
version
,
files
:
{
files
:
{
...
version
.
files
,
...
version
.
files
,
[
type
]:
newFiles
,
[
type
]:
newFiles
,
},
},
})
})
})
},
},
}),
}),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment