mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Connections: Pass keywords from the backend to CommandPalette (#80276)
* pass keywords from the backend to CommandPalette * add csv and json to keywords
This commit is contained in:
parent
343422537e
commit
15af2e5053
@ -26,6 +26,8 @@ export interface NavLinkDTO {
|
|||||||
pluginId?: string;
|
pluginId?: string;
|
||||||
// Whether the page is used to create a new resource. We may place these in a different position in the UI.
|
// Whether the page is used to create a new resource. We may place these in a different position in the UI.
|
||||||
isCreateAction?: boolean;
|
isCreateAction?: boolean;
|
||||||
|
// Optional keywords to match on when searching (e.g. in the CommandPalette)
|
||||||
|
keywords?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NavModelItem extends NavLinkDTO {
|
export interface NavModelItem extends NavLinkDTO {
|
||||||
|
@ -67,6 +67,7 @@ type NavLink struct {
|
|||||||
EmptyMessageId string `json:"emptyMessageId,omitempty"`
|
EmptyMessageId string `json:"emptyMessageId,omitempty"`
|
||||||
PluginID string `json:"pluginId,omitempty"` // (Optional) The ID of the plugin that registered nav link (e.g. as a standalone plugin page)
|
PluginID string `json:"pluginId,omitempty"` // (Optional) The ID of the plugin that registered nav link (e.g. as a standalone plugin page)
|
||||||
IsCreateAction bool `json:"isCreateAction,omitempty"`
|
IsCreateAction bool `json:"isCreateAction,omitempty"`
|
||||||
|
Keywords []string `json:"keywords,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *NavLink) Sort() {
|
func (node *NavLink) Sort() {
|
||||||
|
@ -500,6 +500,7 @@ func (s *ServiceImpl) buildDataConnectionsNavLink(c *contextmodel.ReqContext) *n
|
|||||||
SubTitle: "Browse and create new connections",
|
SubTitle: "Browse and create new connections",
|
||||||
Url: baseUrl + "/add-new-connection",
|
Url: baseUrl + "/add-new-connection",
|
||||||
Children: []*navtree.NavLink{},
|
Children: []*navtree.NavLink{},
|
||||||
|
Keywords: []string{"csv", "graphite", "json", "loki", "prometheus", "sql", "tempo"},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Data sources
|
// Data sources
|
||||||
|
@ -22,7 +22,7 @@ function navTreeToActions(navTree: NavModelItem[], parents: NavModelItem[] = [])
|
|||||||
navItem = enrichHelpItem({ ...navItem });
|
navItem = enrichHelpItem({ ...navItem });
|
||||||
delete navItem.url;
|
delete navItem.url;
|
||||||
}
|
}
|
||||||
const { url, target, text, isCreateAction, children, onClick } = navItem;
|
const { url, target, text, isCreateAction, children, onClick, keywords } = navItem;
|
||||||
const hasChildren = Boolean(children?.length);
|
const hasChildren = Boolean(children?.length);
|
||||||
|
|
||||||
if (!(url || onClick || hasChildren)) {
|
if (!(url || onClick || hasChildren)) {
|
||||||
@ -44,6 +44,7 @@ function navTreeToActions(navTree: NavModelItem[], parents: NavModelItem[] = [])
|
|||||||
target,
|
target,
|
||||||
parent: parents.length > 0 && !isCreateAction ? idForNavItem(parents[parents.length - 1]) : undefined,
|
parent: parents.length > 0 && !isCreateAction ? idForNavItem(parents[parents.length - 1]) : undefined,
|
||||||
perform: onClick,
|
perform: onClick,
|
||||||
|
keywords: keywords?.join(' '),
|
||||||
priority: priority,
|
priority: priority,
|
||||||
subtitle: isCreateAction ? undefined : subtitle,
|
subtitle: isCreateAction ? undefined : subtitle,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user