Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
David Goessmann
logging-scratch-gui
Commits
b2fdb3f4
Commit
b2fdb3f4
authored
6 years ago
by
Ben Wheeler
Browse files
Options
Downloads
Patches
Plain Diff
pass project title to scratch-storage for create requests
parent
5511c7de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/project-saver-hoc.jsx
+15
-6
15 additions, 6 deletions
src/lib/project-saver-hoc.jsx
with
15 additions
and
6 deletions
src/lib/project-saver-hoc.jsx
+
15
−
6
View file @
b2fdb3f4
...
...
@@ -55,7 +55,8 @@ const ProjectSaverHOC = function (WrappedComponent) {
if
(
this
.
props
.
isCreatingCopy
&&
!
prevProps
.
isCreatingCopy
)
{
this
.
storeProject
(
null
,
{
original_id
:
this
.
props
.
reduxProjectId
,
is_copy
:
1
is_copy
:
1
,
title
:
this
.
props
.
reduxProjectTitle
})
.
then
(
response
=>
{
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
...
...
@@ -67,7 +68,8 @@ const ProjectSaverHOC = function (WrappedComponent) {
if
(
this
.
props
.
isRemixing
&&
!
prevProps
.
isRemixing
)
{
this
.
storeProject
(
null
,
{
original_id
:
this
.
props
.
reduxProjectId
,
is_remix
:
1
is_remix
:
1
,
title
:
this
.
props
.
reduxProjectTitle
})
.
then
(
response
=>
{
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
...
...
@@ -98,23 +100,27 @@ const ProjectSaverHOC = function (WrappedComponent) {
* storeProject:
* @param {number|string|undefined} projectId - defined value will PUT/update; undefined/null will POST/create
* @return {Promise} - resolves with json object containing project's existing or new id
* @param {?object}
url
Params - object of params to add to que
rystring
* @param {?object}
request
Params - object of params to add to
re
que
st body
*/
storeProject
(
projectId
,
url
Params
)
{
storeProject
(
projectId
,
request
Params
)
{
return
this
.
props
.
vm
.
saveProjectSb3
()
.
then
(
content
=>
{
const
assetType
=
storage
.
AssetType
.
Project
;
const
dataFormat
=
storage
.
DataFormat
.
SB3
;
const
body
=
new
FormData
();
body
.
append
(
'
sb3_file
'
,
content
,
'
sb3_file
'
);
if
(
requestParams
)
{
for
(
const
key
in
requestParams
)
{
body
.
append
(
key
,
requestParams
[
key
]);
}
}
// when id is undefined or null, storage.store as we have
// configured it will create a new project with id
return
storage
.
store
(
assetType
,
dataFormat
,
body
,
projectId
,
urlParams
projectId
);
});
}
...
...
@@ -134,6 +140,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
onUpdatedProject
:
onUpdatedProjectProp
,
onUpdateProject
:
onUpdateProjectProp
,
reduxProjectId
,
reduxProjectTitle
,
/* eslint-enable no-unused-vars */
...
componentProps
}
=
this
.
props
;
...
...
@@ -160,6 +167,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
onUpdateProject
:
PropTypes
.
func
,
onUpdatedProject
:
PropTypes
.
func
,
reduxProjectId
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
]),
reduxProjectTitle
:
PropTypes
.
string
,
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
};
const
mapStateToProps
=
state
=>
{
...
...
@@ -173,6 +181,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
isUpdating
:
getIsUpdating
(
loadingState
),
loadingState
:
loadingState
,
reduxProjectId
:
state
.
scratchGui
.
projectState
.
projectId
,
reduxProjectTitle
:
state
.
scratchGui
.
projectTitle
,
vm
:
state
.
scratchGui
.
vm
};
};
...
...
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