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
a8d5ea64
Unverified
Commit
a8d5ea64
authored
9 months ago
by
Nick Fitzpatrick
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(command-palette): fix docs url (#44113)
parent
a95ff7f5
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/palette/components/PaletteResults.unit.spec.tsx
+10
-0
10 additions, 0 deletions
.../metabase/palette/components/PaletteResults.unit.spec.tsx
frontend/src/metabase/palette/hooks/useCommandPalette.tsx
+7
-5
7 additions, 5 deletions
frontend/src/metabase/palette/hooks/useCommandPalette.tsx
with
17 additions
and
5 deletions
frontend/src/metabase/palette/components/PaletteResults.unit.spec.tsx
+
10
−
0
View file @
a8d5ea64
...
...
@@ -261,4 +261,14 @@ describe("PaletteResults", () => {
// One call is always made to determine if the instance has models inside useCommandPaletteBasicActions
expect
(
fetchMock
.
calls
(
"
path:/api/search
"
).
length
).
toBe
(
1
);
});
it
(
"
should provide a link to docs with the proper url param
"
,
async
()
=>
{
setup
({
query
:
"
model
"
});
expect
(
await
screen
.
findByRole
(
"
link
"
,
{
name
:
/Search documentation/
}),
).
toHaveAttribute
(
"
href
"
,
expect
.
stringContaining
(
"
?query=model
"
));
// One call is always made to determine if the instance has models inside useCommandPaletteBasicActions
expect
(
fetchMock
.
calls
(
"
path:/api/search
"
).
length
).
toBe
(
2
);
});
});
This diff is collapsed.
Click to expand it.
frontend/src/metabase/palette/hooks/useCommandPalette.tsx
+
7
−
5
View file @
a8d5ea64
...
...
@@ -85,6 +85,9 @@ export const useCommandPalette = ({
);
const
docsAction
=
useMemo
<
PaletteAction
[]
>
(()
=>
{
const
link
=
debouncedSearchText
?
getDocsSearchUrl
({
query
:
debouncedSearchText
})
:
docsUrl
;
const
ret
:
PaletteAction
[]
=
[
{
id
:
"
search_docs
"
,
...
...
@@ -95,11 +98,10 @@ export const useCommandPalette = ({
keywords
:
debouncedSearchText
,
// Always match the debouncedSearchText string
icon
:
"
document
"
,
perform
:
()
=>
{
if
(
debouncedSearchText
)
{
window
.
open
(
getDocsSearchUrl
({
debouncedSearchText
}));
}
else
{
window
.
open
(
docsUrl
);
}
window
.
open
(
link
);
},
extra
:
{
href
:
link
,
},
},
];
...
...
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