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
74b02afd
Unverified
Commit
74b02afd
authored
3 years ago
by
Gustavo Saiani
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove flow types (#17337)
parent
7bc3013f
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/dashboard/components/Dashboard.jsx
+10
-117
10 additions, 117 deletions
frontend/src/metabase/dashboard/components/Dashboard.jsx
with
10 additions
and
117 deletions
frontend/src/metabase/dashboard/components/Dashboard.jsx
+
10
−
117
View file @
74b02afd
...
...
@@ -3,11 +3,11 @@
import
React
,
{
Component
}
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
{
Box
}
from
"
grid-styled
"
;
import
{
t
}
from
"
ttag
"
;
import
DashboardHeader
from
"
./DashboardHeader
"
;
import
DashboardGrid
from
"
./DashboardGrid
"
;
import
LoadingAndErrorWrapper
from
"
metabase/components/LoadingAndErrorWrapper
"
;
import
{
t
}
from
"
ttag
"
;
import
Parameters
from
"
metabase/parameters/components/Parameters/Parameters
"
;
import
EmptyState
from
"
metabase/components/EmptyState
"
;
import
{
DashboardSidebars
}
from
"
./DashboardSidebars
"
;
...
...
@@ -17,120 +17,10 @@ import DashboardControls from "../hoc/DashboardControls";
import
_
from
"
underscore
"
;
import
cx
from
"
classnames
"
;
import
type
{
LocationDescriptor
,
ApiError
,
QueryParams
,
}
from
"
metabase-types/types
"
;
import
type
{
CardId
,
VisualizationSettings
}
from
"
metabase-types/types/Card
"
;
import
type
{
DashboardWithCards
,
DashboardId
,
DashCardId
,
}
from
"
metabase-types/types/Dashboard
"
;
import
type
{
Revision
}
from
"
metabase-types/types/Revision
"
;
import
type
{
Parameter
,
ParameterId
,
ParameterValues
,
ParameterOption
,
}
from
"
metabase-types/types/Parameter
"
;
type
Props
=
{
location
:
LocationDescriptor
,
dashboardId
:
DashboardId
,
dashboard
:
DashboardWithCards
,
dashboardBeforeEditing
:
?
DashboardWithCards
,
revisions
:
{
[
key
:
string
]:
Revision
[]
},
isAdmin
:
boolean
,
isEditable
:
boolean
,
isEditing
:
boolean
,
isEditingParameter
:
boolean
,
isSharing
:
boolean
,
parameters
:
Parameter
[],
parameterValues
:
ParameterValues
,
addCardOnLoad
:
DashboardId
,
initialize
:
()
=>
Promise
<
void
>
,
addCardToDashboard
:
({
dashId
:
DashCardId
,
cardId
:
CardId
})
=>
void
,
addTextDashCardToDashboard
:
({
dashId
:
DashCardId
})
=>
void
,
archiveDashboard
:
(
dashboardId
:
DashboardId
)
=>
void
,
fetchDashboard
:
(
dashboardId
:
DashboardId
,
queryParams
:
?
QueryParams
)
=>
void
,
saveDashboardAndCards
:
()
=>
Promise
<
void
>
,
setDashboardAttributes
:
({
[
attribute
:
string
]:
any
})
=>
void
,
fetchDashboardCardData
:
(
options
:
{
reload
:
boolean
,
clear
:
boolean
,
})
=>
Promise
<
void
>
,
cancelFetchDashboardCardData
:
()
=>
Promise
<
void
>
,
setEditingParameter
:
(
parameterId
:
?
ParameterId
)
=>
void
,
setEditingDashboard
:
(
isEditing
:
false
|
DashboardWithCards
)
=>
void
,
setSharing
:
(
isSharing
:
boolean
)
=>
void
,
addParameter
:
(
option
:
ParameterOption
)
=>
Promise
<
Parameter
>
,
removeParameter
:
(
parameterId
:
ParameterId
)
=>
void
,
setParameterName
:
(
parameterId
:
ParameterId
,
name
:
string
)
=>
void
,
setParameterValue
:
(
parameterId
:
ParameterId
,
value
:
string
)
=>
void
,
setParameterDefaultValue
:
(
parameterId
:
ParameterId
,
defaultValue
:
string
,
)
=>
void
,
setParameterIndex
:
(
parameterId
:
ParameterId
,
index
:
number
)
=>
void
,
isAddParameterPopoverOpen
:
boolean
,
showAddParameterPopover
:
()
=>
void
,
hideAddParameterPopover
:
()
=>
void
,
editingParameter
:
?
Parameter
,
refreshPeriod
:
number
,
setRefreshElapsedHook
:
Function
,
isFullscreen
:
boolean
,
isNightMode
:
boolean
,
hideParameters
:
?
string
,
onRefreshPeriodChange
:
(?
number
)
=>
void
,
onNightModeChange
:
boolean
=>
void
,
onFullscreenChange
:
boolean
=>
void
,
loadDashboardParams
:
()
=>
void
,
onReplaceAllDashCardVisualizationSettings
:
(
dashcardId
:
DashCardId
,
settings
:
VisualizationSettings
,
)
=>
void
,
onUpdateDashCardVisualizationSettings
:
(
dashcardId
:
DashCardId
,
settings
:
VisualizationSettings
,
)
=>
void
,
onUpdateDashCardColumnSettings
:
(
dashcardId
:
DashCardId
,
column
:
any
,
settings
:
VisualizationSettings
,
)
=>
void
,
onChangeLocation
:
string
=>
void
,
setErrorPage
:
(
error
:
ApiError
)
=>
void
,
onCancel
:
()
=>
void
,
onSharingClick
:
()
=>
void
,
onEmbeddingClick
:
()
=>
void
,
};
type
State
=
{
error
:
?
ApiError
,
};
// NOTE: move DashboardControls HoC to container
@
DashboardControls
export
default
class
Dashboard
extends
Component
{
props
:
Props
;
state
:
State
=
{
state
=
{
error
:
null
,
showAddQuestionSidebar
:
false
,
};
...
...
@@ -172,7 +62,7 @@ export default class Dashboard extends Component {
this
.
loadDashboard
(
this
.
props
.
dashboardId
);
}
UNSAFE_componentWillReceiveProps
(
nextProps
:
Props
)
{
UNSAFE_componentWillReceiveProps
(
nextProps
)
{
if
(
this
.
props
.
dashboardId
!==
nextProps
.
dashboardId
)
{
this
.
loadDashboard
(
nextProps
.
dashboardId
);
}
else
if
(
...
...
@@ -187,10 +77,11 @@ export default class Dashboard extends Component {
this
.
props
.
cancelFetchDashboardCardData
();
}
async
loadDashboard
(
dashboardId
:
DashboardId
)
{
async
loadDashboard
(
dashboardId
)
{
this
.
props
.
initialize
();
this
.
props
.
loadDashboardParams
();
const
{
addCardOnLoad
,
fetchDashboard
,
...
...
@@ -215,7 +106,7 @@ export default class Dashboard extends Component {
}
}
setEditing
=
(
isEditing
:
false
|
DashboardWithCards
)
=>
{
setEditing
=
isEditing
=>
{
this
.
props
.
onRefreshPeriodChange
(
null
);
this
.
props
.
setEditingDashboard
(
isEditing
);
...
...
@@ -224,7 +115,7 @@ export default class Dashboard extends Component {
});
};
setDashboardAttribute
=
(
attribute
:
string
,
value
:
any
)
=>
{
setDashboardAttribute
=
(
attribute
,
value
)
=>
{
this
.
props
.
setDashboardAttributes
({
id
:
this
.
props
.
dashboard
.
id
,
attributes
:
{
[
attribute
]:
value
},
...
...
@@ -260,6 +151,7 @@ export default class Dashboard extends Component {
isSharing
,
hideParameters
,
}
=
this
.
props
;
const
{
error
,
showAddQuestionSidebar
}
=
this
.
state
;
isNightMode
=
isNightMode
&&
isFullscreen
;
...
...
@@ -294,7 +186,8 @@ export default class Dashboard extends Component {
className
=
{
cx
(
"
Dashboard flex-full
"
,
{
"
Dashboard--fullscreen
"
:
isFullscreen
,
"
Dashboard--night
"
:
isNightMode
,
"
full-height
"
:
isEditing
||
isSharing
,
// prevents header from scrolling so we can have a fixed sidebar
// prevents header from scrolling so we can have a fixed sidebar
"
full-height
"
:
isEditing
||
isSharing
,
})
}
loading
=
{
!
dashboard
}
error
=
{
error
}
...
...
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