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
53997619
Commit
53997619
authored
6 years ago
by
Ben Wheeler
Browse files
Options
Downloads
Patches
Plain Diff
got rid of uses of undefined
parent
e10bcb13
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
+16
-15
16 additions, 15 deletions
src/lib/project-saver-hoc.jsx
with
16 additions
and
15 deletions
src/lib/project-saver-hoc.jsx
+
16
−
15
View file @
53997619
...
@@ -44,7 +44,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -44,7 +44,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
}
}
// TODO: distinguish between creating new, remixing, and saving as a copy
// TODO: distinguish between creating new, remixing, and saving as a copy
if
(
this
.
props
.
isCreatingNew
&&
!
prevProps
.
isCreatingNew
)
{
if
(
this
.
props
.
isCreatingNew
&&
!
prevProps
.
isCreatingNew
)
{
this
.
storeProject
()
this
.
storeProject
(
null
)
.
then
(
response
=>
{
.
then
(
response
=>
{
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
})
})
...
@@ -53,10 +53,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -53,10 +53,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
});
});
}
}
if
(
this
.
props
.
isCreatingCopy
&&
!
prevProps
.
isCreatingCopy
)
{
if
(
this
.
props
.
isCreatingCopy
&&
!
prevProps
.
isCreatingCopy
)
{
this
.
storeProject
(
undefined
,
{
this
.
storeProject
(
null
,
{
original_id
:
this
.
props
.
reduxProjectId
,
original_id
:
this
.
props
.
reduxProjectId
,
is_copy
:
1
,
is_copy
:
1
title
:
encodeURIComponent
(
this
.
props
.
reduxProjectTitle
)
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
...
@@ -66,10 +65,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -66,10 +65,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
});
});
}
}
if
(
this
.
props
.
isRemixing
&&
!
prevProps
.
isRemixing
)
{
if
(
this
.
props
.
isRemixing
&&
!
prevProps
.
isRemixing
)
{
this
.
storeProject
(
undefined
,
{
this
.
storeProject
(
null
,
{
original_id
:
this
.
props
.
reduxProjectId
,
original_id
:
this
.
props
.
reduxProjectId
,
is_remix
:
1
,
is_remix
:
1
title
:
encodeURIComponent
(
this
.
props
.
reduxProjectTitle
)
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
this
.
props
.
onCreatedProject
(
response
.
id
.
toString
(),
this
.
props
.
loadingState
);
...
@@ -98,10 +96,11 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -98,10 +96,11 @@ const ProjectSaverHOC = function (WrappedComponent) {
}
}
/**
/**
* storeProject:
* storeProject:
* @param {number|string|undefined} projectId defined value causes PUT/update; undefined causes POST/create
* @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
* @return {Promise} - resolves with json object containing project's existing or new id
* @param {?object} urlParams - object of params to add to querystring
*/
*/
storeProject
(
projectId
,
url
Option
s
)
{
storeProject
(
projectId
,
url
Param
s
)
{
return
this
.
props
.
vm
.
saveProjectSb3
()
return
this
.
props
.
vm
.
saveProjectSb3
()
.
then
(
content
=>
{
.
then
(
content
=>
{
const
assetType
=
storage
.
AssetType
.
Project
;
const
assetType
=
storage
.
AssetType
.
Project
;
...
@@ -115,14 +114,16 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -115,14 +114,16 @@ const ProjectSaverHOC = function (WrappedComponent) {
dataFormat
,
dataFormat
,
body
,
body
,
projectId
,
projectId
,
url
Option
s
url
Param
s
);
);
});
});
}
}
render
()
{
render
()
{
const
{
const
{
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-vars */
isCreating
:
isCreatingProp
,
isCreatingCopy
:
isCreatingCopyProp
,
isCreatingNew
:
isCreatingNewProp
,
isRemixing
:
isRemixingProp
,
isShowingWithId
:
isShowingWithIdProp
,
isShowingWithId
:
isShowingWithIdProp
,
isShowingWithoutId
:
isShowingWithoutIdProp
,
isShowingWithoutId
:
isShowingWithoutIdProp
,
isUpdating
:
isUpdatingProp
,
isUpdating
:
isUpdatingProp
,
...
@@ -146,7 +147,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -146,7 +147,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
ProjectSaverComponent
.
propTypes
=
{
ProjectSaverComponent
.
propTypes
=
{
canCreateNew
:
PropTypes
.
bool
,
canCreateNew
:
PropTypes
.
bool
,
canSave
:
PropTypes
.
bool
,
canSave
:
PropTypes
.
bool
,
isCreating
:
PropTypes
.
bool
,
isCreatingCopy
:
PropTypes
.
bool
,
isCreatingNew
:
PropTypes
.
bool
,
isRemixing
:
PropTypes
.
bool
,
isShowingWithId
:
PropTypes
.
bool
,
isShowingWithId
:
PropTypes
.
bool
,
isShowingWithoutId
:
PropTypes
.
bool
,
isShowingWithoutId
:
PropTypes
.
bool
,
isUpdating
:
PropTypes
.
bool
,
isUpdating
:
PropTypes
.
bool
,
...
@@ -157,7 +160,6 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -157,7 +160,6 @@ const ProjectSaverHOC = function (WrappedComponent) {
onUpdateProject
:
PropTypes
.
func
,
onUpdateProject
:
PropTypes
.
func
,
onUpdatedProject
:
PropTypes
.
func
,
onUpdatedProject
:
PropTypes
.
func
,
reduxProjectId
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
]),
reduxProjectId
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
]),
reduxProjectTitle
:
PropTypes
.
string
,
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
};
};
const
mapStateToProps
=
state
=>
{
const
mapStateToProps
=
state
=>
{
...
@@ -171,7 +173,6 @@ const ProjectSaverHOC = function (WrappedComponent) {
...
@@ -171,7 +173,6 @@ const ProjectSaverHOC = function (WrappedComponent) {
isUpdating
:
getIsUpdating
(
loadingState
),
isUpdating
:
getIsUpdating
(
loadingState
),
loadingState
:
loadingState
,
loadingState
:
loadingState
,
reduxProjectId
:
state
.
scratchGui
.
projectState
.
projectId
,
reduxProjectId
:
state
.
scratchGui
.
projectState
.
projectId
,
reduxProjectTitle
:
state
.
scratchGui
.
projectTitle
,
vm
:
state
.
scratchGui
.
vm
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