mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #16080 from grafana/hugoh/no-implicit-any
Cleaning up no implicit anys in search_srv and tests
This commit is contained in:
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
||||
import { FormLabel, Select } from '@grafana/ui';
|
||||
import { getBackendSrv, BackendSrv } from 'app/core/services/backend_srv';
|
||||
|
||||
import { DashboardSearchHit } from 'app/types';
|
||||
import { DashboardSearchHit, DashboardSearchHitType } from 'app/types';
|
||||
|
||||
export interface Props {
|
||||
resourceUri: string;
|
||||
@@ -41,6 +41,21 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
async componentDidMount() {
|
||||
const prefs = await this.backendSrv.get(`/api/${this.props.resourceUri}/preferences`);
|
||||
const dashboards = await this.backendSrv.search({ starred: true });
|
||||
const defaultDashboardHit: DashboardSearchHit = {
|
||||
id: 0,
|
||||
title: 'Default',
|
||||
tags: [],
|
||||
type: '' as DashboardSearchHitType,
|
||||
uid: '',
|
||||
uri: '',
|
||||
url: '',
|
||||
folderId: 0,
|
||||
folderTitle: '',
|
||||
folderUid: '',
|
||||
folderUrl: '',
|
||||
isStarred: false,
|
||||
slug: '',
|
||||
};
|
||||
|
||||
if (prefs.homeDashboardId > 0 && !dashboards.find(d => d.id === prefs.homeDashboardId)) {
|
||||
const missing = await this.backendSrv.search({ dashboardIds: [prefs.homeDashboardId] });
|
||||
@@ -53,7 +68,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
homeDashboardId: prefs.homeDashboardId,
|
||||
theme: prefs.theme,
|
||||
timezone: prefs.timezone,
|
||||
dashboards: [{ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' }, ...dashboards],
|
||||
dashboards: [defaultDashboardHit, ...dashboards],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ export interface Section {
|
||||
id: number;
|
||||
uid: string;
|
||||
title: string;
|
||||
expanded: false;
|
||||
expanded: boolean;
|
||||
removable: boolean;
|
||||
items: any[];
|
||||
url: string;
|
||||
icon: string;
|
||||
|
||||
Reference in New Issue
Block a user