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
70f7dd9e
Commit
70f7dd9e
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Improved dashcard error handling
parent
fc19be9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/frontend_client/app/dashboard/actions.js
+1
-1
1 addition, 1 deletion
resources/frontend_client/app/dashboard/actions.js
resources/frontend_client/app/dashboard/components/DashCard.react.js
+21
-6
21 additions, 6 deletions
...rontend_client/app/dashboard/components/DashCard.react.js
with
22 additions
and
7 deletions
resources/frontend_client/app/dashboard/actions.js
+
1
−
1
View file @
70f7dd9e
...
...
@@ -121,7 +121,7 @@ export const removeCardFromDashboard = createAction(REMOVE_CARD_FROM_DASH);
export
const
fetchDashCardData
=
createThunkAction
(
FETCH_DASHCARD_DATASET
,
function
(
id
)
{
return
async
function
(
dispatch
,
getState
)
{
let
dashcard
=
getState
().
dashcards
[
id
];
let
result
=
await
timeout
(
Metabase
.
dataset
(
dashcard
.
card
.
dataset_query
),
10000
);
let
result
=
await
timeout
(
Metabase
.
dataset
(
dashcard
.
card
.
dataset_query
),
10000
,
"
Card took too long to load.
"
);
return
{
id
,
result
};
};
});
...
...
This diff is collapsed.
Click to expand it.
resources/frontend_client/app/dashboard/components/DashCard.react.js
+
21
−
6
View file @
70f7dd9e
...
...
@@ -13,22 +13,37 @@ import { fetchDashCardData, markNewCardSeen } from "../actions";
import
cx
from
"
classnames
"
;
class
DashCard
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
error
:
null
};
}
componentDidMount
()
{
this
.
props
.
dispatch
(
fetchDashCardData
(
this
.
props
.
dashcard
.
id
));
async
componentDidMount
()
{
// HACK: way to scroll to a newly added card
if
(
this
.
props
.
dashcard
.
justAdded
)
{
React
.
findDOMNode
(
this
).
scrollIntoView
();
this
.
props
.
dispatch
(
markNewCardSeen
(
this
.
props
.
dashcard
.
id
));
}
try
{
await
this
.
props
.
dispatch
(
fetchDashCardData
(
this
.
props
.
dashcard
.
id
));
}
catch
(
error
)
{
this
.
setState
({
error
});
}
}
renderCard
()
{
let
{
card
,
dataset
,
error
}
=
this
.
props
.
dashcard
;
let
{
card
,
dataset
}
=
this
.
props
.
dashcard
;
let
data
=
dataset
&&
dataset
.
data
;
let
{
error
}
=
this
.
state
;
if
(
error
)
{
return
<
div
>
{
error
}
<
/div>
;
let
message
=
(
error
.
data
&&
error
.
data
.
message
)
||
error
;
return
(
<
div
className
=
"
p1 text-centered flex-full flex flex-column layout-centered
"
>
<
h2
className
=
"
text-normal text-grey-2
"
>
{
message
}
<
/h2
>
<
/div
>
);
}
if
(
card
&&
data
)
{
...
...
@@ -40,9 +55,9 @@ class DashCard extends React.Component {
}
return
(
<
div
className
=
"
my4 py4
text-brand text-centered
"
>
<
div
className
=
"
p1
text-brand text-centered
flex-full flex flex-column layout-centered
"
>
<
LoadingSpinner
/>
<
h1
className
=
"
text-normal text-grey-2
"
>
Loading
...
<
/h1
>
<
h1
className
=
"
ml1
text-normal text-grey-2
"
>
Loading
...
<
/h1
>
<
/div
>
);
}
...
...
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