Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
indiscale-files-ui-react
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
indiscale-files-ui-react
Commits
7a350f72
Commit
7a350f72
authored
2 years ago
by
Jose Manuel Serrano Amaut
Browse files
Options
Downloads
Patches
Plain Diff
[FEAT]: Add method for setting next uploadStatus given the new status
parent
037f5dbe
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/files-ui/core/index.ts
+2
-1
2 additions, 1 deletion
src/files-ui/core/index.ts
src/files-ui/core/upload/index.ts
+2
-1
2 additions, 1 deletion
src/files-ui/core/upload/index.ts
src/files-ui/core/upload/utils.upload.ts
+30
-9
30 additions, 9 deletions
src/files-ui/core/upload/utils.upload.ts
with
34 additions
and
11 deletions
src/files-ui/core/index.ts
+
2
−
1
View file @
7a350f72
...
...
@@ -118,7 +118,8 @@ export {
addExtraData
,
addHeaders
,
sanitizeArrExtFile
,
unexpectedErrorUploadResult
unexpectedErrorUploadResult
,
setNextUploadStatus
}
from
"
./upload
"
;
export
{
...
...
This diff is collapsed.
Click to expand it.
src/files-ui/core/upload/index.ts
+
2
−
1
View file @
7a350f72
...
...
@@ -30,5 +30,6 @@ export {
completeUploadResult
,
sanitizeArrExtFile
,
unableToUploadResult
,
unexpectedErrorUploadResult
unexpectedErrorUploadResult
,
setNextUploadStatus
}
from
"
./utils.upload
"
;
This diff is collapsed.
Click to expand it.
src/files-ui/core/upload/utils.upload.ts
+
30
−
9
View file @
7a350f72
...
...
@@ -116,21 +116,42 @@ export const sleepTransition = (
}
export
const
sanitizeArrExtFile
=
(
arrExtFile
:
ExtFileInstance
[]):
ExtFile
[]
=>
{
/* console.log("sanitizeArrExtFile", arrExtFile.length, arrExtFile.filter((extFileInstance: ExtFileInstance) => extFileInstance.extraData?.deleted)
.map((extFileInstance: ExtFileInstance) => extFileInstance.toExtFile()).length);
*/
return
arrExtFile
.
filter
((
extFileInstance
:
ExtFileInstance
)
=>
!
extFileInstance
.
extraData
?.
deleted
)
.
map
((
extFileInstance
:
ExtFileInstance
)
=>
{
if
(
extFileInstance
.
uploadStatus
===
"
aborted
"
)
{
if
(
!
extFileInstance
.
uploadMessage
){
extFileInstance
.
uploadMessage
=
"
Upload aborted
"
;
}
extFileInstance
.
uploadStatus
=
"
error
"
;
if
(
extFileInstance
.
uploadStatus
===
"
aborted
"
&&
!
extFileInstance
.
uploadMessage
)
{
extFileInstance
.
uploadMessage
=
"
Upload aborted by user
"
;
//extFileInstance.uploadStatus = "error";
}
return
extFileInstance
.
toExtFile
()
});
}
/**
*
* @param extFileInstance
* @param extFileobj
*/
export
const
setNextUploadStatus
=
(
extFileInstance
:
ExtFileInstance
,
extFileobj
:
ExtFile
)
=>
{
const
prevStatus
:
UPLOADSTATUS
|
undefined
=
extFileInstance
.
uploadStatus
;
const
nextStstaus
:
UPLOADSTATUS
|
undefined
=
extFileobj
.
uploadStatus
;
if
(
prevStatus
===
"
preparing
"
&&
[
"
aborted
"
,
undefined
].
includes
(
nextStstaus
)
)
{
extFileInstance
.
uploadStatus
=
undefined
;
}
else
if
(
prevStatus
===
"
uploading
"
&&
[
"
aborted
"
,
undefined
].
includes
(
nextStstaus
)
)
{
extFileInstance
.
uploadStatus
=
"
aborted
"
;
}
extFileInstance
.
uploadMessage
=
extFileobj
.
uploadMessage
;
}
\ No newline at end of file
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