Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
0062ee2c
Commit
0062ee2c
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
Created a new file to dowload a the entire collection
parent
866fe16a
No related branches found
No related tags found
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!32
Homologa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/CollectionDowloadButton.js
+58
-0
58 additions, 0 deletions
src/Components/CollectionDowloadButton.js
with
58 additions
and
0 deletions
src/Components/CollectionDowloadButton.js
0 → 100644
+
58
−
0
View file @
0062ee2c
import
React
,
{
useContext
,
useState
,
useEffect
}
from
'
react
'
;
import
axios
from
'
axios
'
;
import
GetAppIcon
from
'
@material-ui/icons/GetApp
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
styled
from
'
styled-components
'
;
import
{
apiUrl
,
apiDomain
}
from
'
../env
'
;
import
FollowCollectionButton
from
'
./FollowCollectionButton.js
'
;
import
{
Store
}
from
'
../Store.js
'
import
{
Grid
}
from
'
@material-ui/core
'
;
const
DowloadButton
=
(
props
)
=>
{
const
{
state
}
=
useContext
(
Store
);
const
[
download_url
,
setDownloadUrl
]
=
useState
(
''
);
useEffect
(()
=>
{
const
body
=
{
"
package
"
:
{
"
object
"
:
[{
"
type
"
:
"
Collection
"
,
"
id
"
:
props
.
id
}]
}
};
axios
.
post
(
apiUrl
+
'
/package
'
,
body
)
.
catch
(
err
=>
{
if
(
err
.
response
&&
err
.
response
.
status
===
302
)
{
setDownloadUrl
(
apiDomain
+
'
/
'
+
err
.
response
.
data
.
url
);
}
});
},
[
props
.
id
]);
return
(
<>
<
DownloadAnchor
href
=
{
download_url
}
>
<
DownloadButton
variant
=
"
outlined
"
color
=
"
primary
"
startIcon
=
{
<
GetAppIcon
fontSize
=
"
large
"
/>
}
size
=
"
small
"
>
<
ButtonText
>
Baixar
Coleção
<
/ButtonText
>
<
/DownloadButton
>
<
/DownloadAnchor>
<
/
>
)
}
const
ButtonText
=
styled
.
span
`
font-weight: bolder;
font-size: 1.2em;
`
const
DownloadButton
=
styled
(
Button
)
`
padding-left: 10;
padding-right: 10;
width: 250px;
`
const
DownloadAnchor
=
styled
.
a
`
text-decoration: none !important;
`
export
default
DowloadButton
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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