Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
f9702d90
Unverified
Commit
f9702d90
authored
May 24, 2021
by
Paul Kaplan
Committed by
GitHub
May 24, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5437 from paulkaplan/fix-studio-project-adding-errors
Handle more types of project add errors
parents
2c53c703
b0eae61d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
src/views/studio/l10n.json
src/views/studio/l10n.json
+5
-1
src/views/studio/studio-project-adder.jsx
src/views/studio/studio-project-adder.jsx
+14
-2
No files found.
src/views/studio/l10n.json
View file @
f9702d90
...
...
@@ -26,7 +26,11 @@
"studio.projectsEmpty1"
:
"This studio has no projects yet."
,
"studio.projectsEmpty2"
:
"Suggest projects you want to add in the comments!"
,
"studio.browseProjects"
:
"Browse Projects"
,
"studio.projectErrors.checkUrl"
:
"Could not add project. Check the URL and try again."
,
"studio.projectErrors.checkUrl"
:
"Could not find that project. Check the URL and try again."
,
"studio.projectErrors.generic"
:
"Could not add project."
,
"studio.projectErrors.tooFast"
:
"You are adding projects too quickly."
,
"studio.projectErrors.permission"
:
"You do not have permission to add that project."
,
"studio.projectErrors.duplicate"
:
"That project is already in this studio."
,
"studio.creatorRole"
:
"Studio Creator"
,
...
...
src/views/studio/studio-project-adder.jsx
View file @
f9702d90
...
...
@@ -5,10 +5,22 @@ import {connect} from 'react-redux';
import
classNames
from
'
classnames
'
;
import
{
FormattedMessage
,
intlShape
,
injectIntl
}
from
'
react-intl
'
;
import
{
addProject
}
from
'
./lib/studio-project-actions
'
;
import
{
Errors
,
addProject
}
from
'
./lib/studio-project-actions
'
;
import
UserProjectsModal
from
'
./modals/user-projects-modal.jsx
'
;
import
ValidationMessage
from
'
../../components/forms/validation-message.jsx
'
;
const
errorToMessageId
=
error
=>
{
switch
(
error
)
{
case
Errors
.
NETWORK
:
return
'
studio.projectErrors.generic
'
;
case
Errors
.
SERVER
:
return
'
studio.projectErrors.generic
'
;
case
Errors
.
PERMISSION
:
return
'
studio.projectErrors.permission
'
;
case
Errors
.
DUPLICATE
:
return
'
studio.projectErrors.duplicate
'
;
case
Errors
.
RATE_LIMIT
:
return
'
studio.projectErrors.tooFast
'
;
case
Errors
.
UNKNOWN_PROJECT
:
return
'
studio.projectErrors.checkUrl
'
;
default
:
return
'
studio.projectErrors.generic
'
;
}
};
const
StudioProjectAdder
=
({
intl
,
onSubmit
})
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
...
...
@@ -30,7 +42,7 @@ const StudioProjectAdder = ({intl, onSubmit}) => {
<
ValidationMessage
mode=
"error"
className=
"validation-left"
message=
{
<
FormattedMessage
id=
"studio.projectErrors.checkUrl"
/>
}
message=
{
<
FormattedMessage
id=
{
errorToMessageId
(
error
)
}
/>
}
/>
</
div
>
}
<
input
...
...
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