mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelTitleSearch: Show datasource usage in plugins (#83922)
This commit is contained in:
parent
cb008657cb
commit
3e86a4edc8
@ -435,6 +435,12 @@ func doSearchQuery(
|
|||||||
hasConstraints = true
|
hasConstraints = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DatasourceType
|
||||||
|
if q.DatasourceType != "" {
|
||||||
|
fullQuery.AddMust(bluge.NewTermQuery(q.DatasourceType).SetField(documentFieldDSType))
|
||||||
|
hasConstraints = true
|
||||||
|
}
|
||||||
|
|
||||||
// Folder
|
// Folder
|
||||||
if q.Location != "" {
|
if q.Location != "" {
|
||||||
fullQuery.AddMust(bluge.NewTermQuery(q.Location).SetField(documentFieldLocation))
|
fullQuery.AddMust(bluge.NewTermQuery(q.Location).SetField(documentFieldLocation))
|
||||||
|
@ -18,7 +18,7 @@ type DashboardQuery struct {
|
|||||||
Query string `json:"query"`
|
Query string `json:"query"`
|
||||||
Location string `json:"location,omitempty"` // parent folder ID
|
Location string `json:"location,omitempty"` // parent folder ID
|
||||||
Sort string `json:"sort,omitempty"` // field ASC/DESC
|
Sort string `json:"sort,omitempty"` // field ASC/DESC
|
||||||
Datasource string `json:"ds_uid,omitempty"` // "datasource" collides with the JSON value at the same leel :()
|
Datasource string `json:"ds_uid,omitempty"` // "datasource" collides with the JSON value at the same level :()
|
||||||
DatasourceType string `json:"ds_type,omitempty"`
|
DatasourceType string `json:"ds_type,omitempty"`
|
||||||
Tags []string `json:"tags,omitempty"`
|
Tags []string `json:"tags,omitempty"`
|
||||||
Kind []string `json:"kind,omitempty"`
|
Kind []string `json:"kind,omitempty"`
|
||||||
|
@ -4,7 +4,7 @@ import { useAsync } from 'react-use';
|
|||||||
import AutoSizer from 'react-virtualized-auto-sizer';
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
import { GrafanaTheme2, PluginMeta } from '@grafana/data';
|
import { GrafanaTheme2, PluginMeta, PluginType } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Alert, Spinner, useStyles2 } from '@grafana/ui';
|
import { Alert, Spinner, useStyles2 } from '@grafana/ui';
|
||||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||||
@ -19,6 +19,13 @@ export function PluginUsage({ plugin }: Props) {
|
|||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
const searchQuery = useMemo<SearchQuery>(() => {
|
const searchQuery = useMemo<SearchQuery>(() => {
|
||||||
|
if (plugin.type === PluginType.datasource) {
|
||||||
|
return {
|
||||||
|
query: '*',
|
||||||
|
ds_type: plugin.id,
|
||||||
|
kind: ['dashboard'],
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
query: '*',
|
query: '*',
|
||||||
panel_type: plugin.id,
|
panel_type: plugin.id,
|
||||||
|
@ -51,7 +51,10 @@ export const usePluginDetailsTabs = (plugin?: CatalogPlugin, pageId?: PluginTabI
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.featureToggles.panelTitleSearch && pluginConfig.meta.type === PluginType.panel) {
|
if (
|
||||||
|
config.featureToggles.panelTitleSearch &&
|
||||||
|
(pluginConfig.meta.type === PluginType.panel || pluginConfig.meta.type === PluginType.datasource)
|
||||||
|
) {
|
||||||
navModelChildren.push({
|
navModelChildren.push({
|
||||||
text: PluginTabLabels.USAGE,
|
text: PluginTabLabels.USAGE,
|
||||||
icon: 'list-ul',
|
icon: 'list-ul',
|
||||||
|
Loading…
Reference in New Issue
Block a user