Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Liriae Viewer
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
ecolab
LIRIAe
Liriae Viewer
Commits
846c64ab
Commit
846c64ab
authored
3 months ago
by
Andréas Livet
Browse files
Options
Downloads
Patches
Plain Diff
Add upload percentage
parent
4b01f857
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/ViewerSidePanel.tsx
+4
-4
4 additions, 4 deletions
src/components/ViewerSidePanel.tsx
with
4 additions
and
4 deletions
src/components/ViewerSidePanel.tsx
+
4
−
4
View file @
846c64ab
...
@@ -36,6 +36,7 @@ export default function ViewerSidePanel({
...
@@ -36,6 +36,7 @@ export default function ViewerSidePanel({
const
documentsRef
=
useRef
(
liriaeDocuments
);
const
documentsRef
=
useRef
(
liriaeDocuments
);
const
[
isUploading
,
setIsUploading
]
=
useState
(
false
);
const
[
isUploading
,
setIsUploading
]
=
useState
(
false
);
const
[
uploadPercentage
,
setUploadPercentage
]
=
useState
(
"
0
"
);
// We'll need to display an alert message whether the files upload is successful or not
// We'll need to display an alert message whether the files upload is successful or not
const
{
setAlert
}
=
useContext
(
AlertContext
);
const
{
setAlert
}
=
useContext
(
AlertContext
);
const
uploadInputRef
=
useRef
<
HTMLInputElement
>
(
null
);
const
uploadInputRef
=
useRef
<
HTMLInputElement
>
(
null
);
...
@@ -159,8 +160,8 @@ export default function ViewerSidePanel({
...
@@ -159,8 +160,8 @@ export default function ViewerSidePanel({
setIsUploading
(
false
);
setIsUploading
(
false
);
},
},
onProgress
:
function
(
bytesUploaded
,
bytesTotal
)
{
onProgress
:
function
(
bytesUploaded
,
bytesTotal
)
{
var
percentage
=
((
bytesUploaded
/
bytesTotal
)
*
100
).
toFixed
(
2
);
const
percentage
=
((
bytesUploaded
/
bytesTotal
)
*
100
).
toFixed
(
0
);
console
.
log
(
bytesUploaded
,
bytesTotal
,
percentage
+
"
%
"
);
setUploadPercentage
(
percentage
)
},
},
onSuccess
:
async
function
()
{
onSuccess
:
async
function
()
{
setIsUploading
(
false
);
setIsUploading
(
false
);
...
@@ -191,7 +192,6 @@ export default function ViewerSidePanel({
...
@@ -191,7 +192,6 @@ export default function ViewerSidePanel({
// Check if there are any previous uploads to continue.
// Check if there are any previous uploads to continue.
const
previousUploads
=
await
upload
.
findPreviousUploads
();
const
previousUploads
=
await
upload
.
findPreviousUploads
();
console
.
log
(
"
Previous Uploads
"
,
previousUploads
);
// Found previous uploads so we select the first one.
// Found previous uploads so we select the first one.
if
(
previousUploads
.
length
)
{
if
(
previousUploads
.
length
)
{
upload
.
resumeFromPreviousUpload
(
previousUploads
[
0
]);
upload
.
resumeFromPreviousUpload
(
previousUploads
[
0
]);
...
@@ -348,7 +348,7 @@ export default function ViewerSidePanel({
...
@@ -348,7 +348,7 @@ export default function ViewerSidePanel({
onClick
=
{
handleClick
}
onClick
=
{
handleClick
}
priority
=
"secondary"
priority
=
"secondary"
>
>
{
isUploading
?
"
Envoi en cours
"
:
"
Ajouter des fichiers
"
}
{
isUploading
?
`
Envoi en cours
${
uploadPercentage
}
%`
:
"
Ajouter des fichiers
"
}
{
isUploading
&&
(
{
isUploading
&&
(
<
CircularProgress
<
CircularProgress
size
=
{
24
}
size
=
{
24
}
...
...
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