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
c8c54cc1
Commit
c8c54cc1
authored
8 years ago
by
Lewis Liu
Browse files
Options
Downloads
Patches
Plain Diff
Hiding revision history for non-admin users
parent
21e4eb4a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/components/Sidebar.jsx
+6
-3
6 additions, 3 deletions
frontend/src/metabase/components/Sidebar.jsx
frontend/src/metabase/reference/selectors.js
+11
-9
11 additions, 9 deletions
frontend/src/metabase/reference/selectors.js
with
17 additions
and
12 deletions
frontend/src/metabase/components/Sidebar.jsx
+
6
−
3
View file @
c8c54cc1
...
...
@@ -29,9 +29,12 @@ const Sidebar = ({
<
Breadcrumbs
crumbs
=
{
breadcrumbs
}
inSidebar
=
{
true
}
/>
</
div
>
}
{
Object
.
values
(
sections
).
map
(
section
=>
<
SidebarItem
key
=
{
section
.
id
}
href
=
{
section
.
id
}
{
...
section
}
/>
)
}
{
Object
.
values
(
sections
)
.
filter
(
section
=>
!
section
.
hidden
)
.
map
(
section
=>
<
SidebarItem
key
=
{
section
.
id
}
href
=
{
section
.
id
}
{
...
section
}
/>
)
}
</
ul
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/reference/selectors.js
+
11
−
9
View file @
c8c54cc1
...
...
@@ -49,7 +49,7 @@ const referenceSections = {
const
getReferenceSections
=
(
state
)
=>
referenceSections
;
const
getMetricSections
=
(
metric
)
=>
metric
?
{
const
getMetricSections
=
(
metric
,
user
)
=>
metric
?
{
[
`/reference/metrics/
${
metric
.
id
}
`
]:
{
id
:
`/reference/metrics/
${
metric
.
id
}
`
,
name
:
'
Details
'
,
...
...
@@ -77,6 +77,7 @@ const getMetricSections = (metric) => metric ? {
name
:
`Revision history for
${
metric
.
name
}
`
,
sidebar
:
'
Revision history
'
,
breadcrumb
:
`
${
metric
.
name
}
`
,
hidden
:
user
&&
!
user
.
is_superuser
,
fetch
:
{
fetchMetrics
:
[],
fetchRevisions
:
[
'
metric
'
,
metric
.
id
],
fetchTableMetadata
:
[
metric
.
table_id
]},
get
:
'
getMetricRevisions
'
,
icon
:
"
history
"
,
...
...
@@ -84,7 +85,7 @@ const getMetricSections = (metric) => metric ? {
}
}
:
{};
const
getListSections
=
(
list
)
=>
list
?
{
const
getListSections
=
(
list
,
user
)
=>
list
?
{
[
`/reference/lists/
${
list
.
id
}
`
]:
{
id
:
`/reference/lists/
${
list
.
id
}
`
,
name
:
'
Details
'
,
...
...
@@ -125,6 +126,7 @@ const getListSections = (list) => list ? {
name
:
`Revision history for
${
list
.
name
}
`
,
sidebar
:
'
Revision history
'
,
breadcrumb
:
`
${
list
.
name
}
`
,
hidden
:
user
&&
!
user
.
is_superuser
,
fetch
:
{
fetchLists
:
[],
fetchRevisions
:
[
'
list
'
,
list
.
id
],
fetchTableMetadata
:
[
list
.
table_id
]},
get
:
'
getListRevisions
'
,
icon
:
"
history
"
,
...
...
@@ -132,7 +134,7 @@ const getListSections = (list) => list ? {
}
}
:
{};
const
getListFieldSections
=
(
list
,
field
)
=>
list
&&
field
?
{
const
getListFieldSections
=
(
list
,
field
,
user
)
=>
list
&&
field
?
{
[
`/reference/lists/
${
list
.
id
}
/fields/
${
field
.
id
}
`
]:
{
id
:
`/reference/lists/
${
list
.
id
}
/fields/
${
field
.
id
}
`
,
name
:
'
Details
'
,
...
...
@@ -226,6 +228,8 @@ const idsToObjectMap = (ids, objects) => ids
.
map
(
id
=>
objects
[
id
])
.
reduce
((
map
,
object
)
=>
i
.
assoc
(
map
,
object
.
id
,
object
),
{});
export
const
getUser
=
(
state
)
=>
state
.
currentUser
;
export
const
getSectionId
=
(
state
)
=>
state
.
router
.
location
.
pathname
;
export
const
getMetricId
=
(
state
)
=>
Number
.
parseInt
(
state
.
router
.
params
.
metricId
);
...
...
@@ -323,19 +327,19 @@ const getTableQuestions = createSelector(
);
export
const
getSections
=
createSelector
(
[
getSectionId
,
getMetric
,
getList
,
getDatabase
,
getTable
,
getField
,
getFieldByList
,
getReferenceSections
],
(
sectionId
,
metric
,
list
,
database
,
table
,
field
,
fieldByList
,
referenceSections
)
=>
{
[
getSectionId
,
getMetric
,
getList
,
getDatabase
,
getTable
,
getField
,
getFieldByList
,
getUser
,
getReferenceSections
],
(
sectionId
,
metric
,
list
,
database
,
table
,
field
,
fieldByList
,
user
,
referenceSections
)
=>
{
// can be simplified if we had a single map of all sections
if
(
referenceSections
[
sectionId
])
{
return
referenceSections
;
}
const
metricSections
=
getMetricSections
(
metric
);
const
metricSections
=
getMetricSections
(
metric
,
user
);
if
(
metricSections
[
sectionId
])
{
return
metricSections
;
}
const
listSections
=
getListSections
(
list
);
const
listSections
=
getListSections
(
list
,
user
);
if
(
listSections
[
sectionId
])
{
return
listSections
;
}
...
...
@@ -484,6 +488,4 @@ export const getHasRevisionHistory = createSelector(
section
.
type
===
'
list
'
)
export
const
getUser
=
(
state
)
=>
state
.
currentUser
;
export
const
getIsEditing
=
(
state
)
=>
state
.
reference
.
isEditing
;
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