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
766c1201
Unverified
Commit
766c1201
authored
10 months ago
by
Uladzimir Havenchyk
Committed by
GitHub
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Drop unused isDashboardParameterWithoutMapping function (#42103)
parent
0dc75042
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/parameters/utils/dashboards.ts
+0
-16
0 additions, 16 deletions
frontend/src/metabase/parameters/utils/dashboards.ts
frontend/src/metabase/parameters/utils/dashboards.unit.spec.js
+0
-90
0 additions, 90 deletions
...end/src/metabase/parameters/utils/dashboards.unit.spec.js
with
0 additions
and
106 deletions
frontend/src/metabase/parameters/utils/dashboards.ts
+
0
−
16
View file @
766c1201
...
...
@@ -94,22 +94,6 @@ export function hasMapping(parameter: Parameter, dashboard: Dashboard) {
});
}
export
function
isDashboardParameterWithoutMapping
(
parameter
:
Parameter
,
dashboard
:
Dashboard
,
)
{
if
(
!
dashboard
||
!
dashboard
.
parameters
)
{
return
false
;
}
const
parameterExistsOnDashboard
=
dashboard
.
parameters
.
some
(
dashParam
=>
dashParam
.
id
===
parameter
.
id
,
);
const
parameterHasMapping
=
hasMapping
(
parameter
,
dashboard
);
return
parameterExistsOnDashboard
&&
!
parameterHasMapping
;
}
function
getMappings
(
dashcards
:
QuestionDashboardCard
[]):
ExtendedMapping
[]
{
return
dashcards
.
flatMap
(
dashcard
=>
{
const
{
parameter_mappings
,
card
,
series
}
=
dashcard
;
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/parameters/utils/dashboards.unit.spec.js
+
0
−
90
View file @
766c1201
...
...
@@ -3,7 +3,6 @@ import {
createParameter
,
setParameterName
,
hasMapping
,
isDashboardParameterWithoutMapping
,
getParametersMappedToDashcard
,
hasMatchingParameters
,
getFilteringParameterValuesMap
,
...
...
@@ -192,95 +191,6 @@ describe("metabase/parameters/utils/dashboards", () => {
});
});
describe
(
"
isDashboardParameterWithoutMapping
"
,
()
=>
{
const
parameter
=
{
id
:
"
foo
"
};
it
(
"
should return false when passed a falsy dashboard
"
,
()
=>
{
expect
(
isDashboardParameterWithoutMapping
(
parameter
,
undefined
)).
toBe
(
false
,
);
});
it
(
"
should return false when the given parameter is not found in the dashboard's parameters list
"
,
()
=>
{
const
brokenDashboard
=
{
dashcards
:
[
{
parameter_mappings
:
[
{
parameter_id
:
"
bar
"
,
},
{
// having this parameter mapped but not in the parameters list shouldn't happen in practice,
// but I am proving the significance of having the parameter exist in the dashboard's parameters list
parameter_id
:
"
foo
"
,
},
],
},
],
parameters
:
[
{
id
:
"
bar
"
,
},
],
};
expect
(
isDashboardParameterWithoutMapping
(
parameter
,
brokenDashboard
),
).
toBe
(
false
);
});
it
(
"
should return false when the given parameter is both found in the dashboard's parameters and also mapped
"
,
()
=>
{
const
dashboard
=
{
dashcards
:
[
{
parameter_mappings
:
[
{
parameter_id
:
"
bar
"
,
},
{
parameter_id
:
"
foo
"
,
},
],
},
],
parameters
:
[
{
id
:
"
bar
"
,
},
{
id
:
"
foo
"
},
],
};
expect
(
isDashboardParameterWithoutMapping
(
parameter
,
dashboard
)).
toBe
(
false
,
);
});
it
(
"
should return true when the given parameter is found on the dashboard but is not mapped
"
,
()
=>
{
const
dashboard
=
{
dashcards
:
[
{
parameter_mappings
:
[
{
parameter_id
:
"
bar
"
,
},
],
},
],
parameters
:
[
{
id
:
"
bar
"
,
},
{
id
:
"
foo
"
},
],
};
expect
(
isDashboardParameterWithoutMapping
(
parameter
,
dashboard
)).
toBe
(
true
,
);
});
});
describe
(
"
getParametersMappedToDashcard
"
,
()
=>
{
const
dashboard
=
{
parameters
:
[
...
...
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