Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
13ebe8bf
Commit
13ebe8bf
authored
Nov 06, 2021
by
Fernando Arias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First pass at corpus upload commit
* Store package ID on upload
parent
e8f11cc0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
8 deletions
+35
-8
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/mutations/upload_complete.mutation.graphql
...gement/graphql/mutations/upload_complete.mutation.graphql
+5
-0
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/queries/get_corpuses.query.graphql
...pus_management/graphql/queries/get_corpuses.query.graphql
+1
-0
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/resolvers/resolvers.js
...guration/corpus_management/graphql/resolvers/resolvers.js
+29
-8
No files found.
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/mutations/upload_complete.mutation.graphql
0 → 100644
View file @
13ebe8bf
mutation
uploadComplete
(
$projectPath
:
ID
!,
$packageId
:
Int
!)
{
uploadComplete
(
projectPath
:
$projectPath
,
packageId
:
$packageId
)
@client
{
errors
}
}
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/queries/get_corpuses.query.graphql
View file @
13ebe8bf
...
...
@@ -7,5 +7,6 @@ query getCorpuses($projectPath: ID!) {
isUploading
progress
cancelSource
uploadedPackageId
}
}
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/resolvers/resolvers.js
View file @
13ebe8bf
...
...
@@ -4,6 +4,7 @@ import { publishPackage } from '~/api/packages_api';
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
getCorpusesQuery
from
'
../queries/get_corpuses.query.graphql
'
;
import
updateProgress
from
'
../mutations/update_progress.mutation.graphql
'
;
import
uploadComplete
from
'
../mutations/upload_complete.mutation.graphql
'
;
export
default
{
Query
:
{
...
...
@@ -22,6 +23,7 @@ export default {
isUploading
:
false
,
progress
:
0
,
cancelSource
:
null
,
uploadedPackageId
:
null
,
__typename
:
'
UploadState
'
,
};
},
...
...
@@ -91,19 +93,43 @@ export default {
variables
:
{
projectPath
},
});
const
d
ata
=
produce
(
sourceData
,
(
draftState
)
=>
{
const
targetD
ata
=
produce
(
sourceData
,
(
draftState
)
=>
{
const
{
uploadState
}
=
draftState
;
uploadState
.
isUploading
=
true
;
uploadState
.
cancelSource
=
source
;
});
cache
.
writeQuery
({
query
:
getCorpusesQuery
,
d
ata
,
variables
:
{
projectPath
}
});
cache
.
writeQuery
({
query
:
getCorpusesQuery
,
targetD
ata
,
variables
:
{
projectPath
}
});
publishPackage
(
{
projectPath
,
name
,
version
:
0
,
fileName
:
name
,
files
},
{
status
:
'
hidden
'
,
select
:
'
package_file
'
},
{
onUploadProgress
,
cancelToken
:
source
.
token
},
);
)
.
then
(({
data
})
=>
{
client
.
mutate
({
mutation
:
uploadComplete
,
variables
:
{
projectPath
,
packageId
:
data
.
package_id
},
});
})
.
catch
((
e
)
=>
{
/* TODO: Error handling */
});
},
uploadComplete
:
(
_
,
{
projectPath
,
packageId
},
{
cache
})
=>
{
const
sourceData
=
cache
.
readQuery
({
query
:
getCorpusesQuery
,
variables
:
{
projectPath
},
});
const
data
=
produce
(
sourceData
,
(
draftState
)
=>
{
const
{
uploadState
}
=
draftState
;
uploadState
.
isUploading
=
false
;
uploadState
.
cancelSource
=
null
;
uploadState
.
uploadedPackageId
=
packageId
;
});
cache
.
writeQuery
({
query
:
getCorpusesQuery
,
data
,
variables
:
{
projectPath
}
});
},
updateProgress
:
(
_
,
{
projectPath
,
progress
},
{
cache
})
=>
{
const
sourceData
=
cache
.
readQuery
({
...
...
@@ -115,11 +141,6 @@ export default {
const
{
uploadState
}
=
draftState
;
uploadState
.
isUploading
=
true
;
uploadState
.
progress
=
progress
;
if
(
progress
>=
100
)
{
uploadState
.
isUploading
=
false
;
uploadState
.
cancelSource
=
null
;
}
});
cache
.
writeQuery
({
query
:
getCorpusesQuery
,
data
,
variables
:
{
projectPath
}
});
...
...
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