Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
515e7e9e
Unverified
Commit
515e7e9e
authored
5 years ago
by
Paul Rosenzweig
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Display error message from setup submit (#11042)
parent
282a92be
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/setup/components/PreferencesStep.jsx
+21
-1
21 additions, 1 deletion
frontend/src/metabase/setup/components/PreferencesStep.jsx
with
21 additions
and
1 deletion
frontend/src/metabase/setup/components/PreferencesStep.jsx
+
21
−
1
View file @
515e7e9e
...
...
@@ -11,6 +11,8 @@ import StepTitle from "./StepTitle";
import
CollapsedStep
from
"
./CollapsedStep
"
;
export
default
class
PreferencesStep
extends
Component
{
state
=
{
errorMessage
:
null
};
static
propTypes
=
{
stepNumber
:
PropTypes
.
number
.
isRequired
,
activeStep
:
PropTypes
.
number
.
isRequired
,
...
...
@@ -32,7 +34,11 @@ export default class PreferencesStep extends Component {
e
.
preventDefault
();
// okay, this is the big one. we actually submit everything to the api now and complete the process.
this
.
props
.
submitSetup
();
const
{
payload
}
=
await
this
.
props
.
submitSetup
();
// a successful payload is null
const
errorMessage
=
payload
&&
payload
.
data
?
getErrorMessage
(
payload
.
data
)
:
null
;
this
.
setState
({
errorMessage
});
MetabaseAnalytics
.
trackEvent
(
"
Setup
"
,
...
...
@@ -113,6 +119,9 @@ export default class PreferencesStep extends Component {
<
div
className
=
"Form-actions"
>
<
button
className
=
"Button Button--primary"
>
{
t
`Next`
}
</
button
>
{
/* FIXME: <mb-form-message form="usageForm"></mb-form-message>*/
}
{
this
.
state
.
errorMessage
&&
(
<
div
className
=
"text-error ml1"
>
{
this
.
state
.
errorMessage
}
</
div
>
)
}
</
div
>
</
form
>
</
Box
>
...
...
@@ -120,3 +129,14 @@ export default class PreferencesStep extends Component {
}
}
}
function
getErrorMessage
(
data
)
{
const
{
errors
,
message
}
=
data
;
if
(
message
)
{
return
message
;
}
if
(
errors
)
{
return
Object
.
values
(
errors
)[
0
];
}
return
null
;
}
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