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:
Torkel Ödegaard
2019-03-19 18:26:28 +01:00
committed by GitHub
7 changed files with 75 additions and 31 deletions

View File

@@ -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],
});
}

View File

@@ -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;