mirror of https://github.com/grafana/grafana
Chore: Typescript no-implicit any fixes progress (#17018)
* Chore: Typescript no-implicit any fixes progress * Fixed tests * Updated snapshotpull/17020/head
parent
813e3ffc15
commit
f12d47ef52
@ -1,12 +0,0 @@ |
||||
<div class="page-nav"> |
||||
<div class="page-breadcrumbs"> |
||||
<a class="breadcrumb-item active" href="/"> |
||||
<i class="fa fa-home"></i> |
||||
</a> |
||||
<a class="breadcrumb-item" ng-href="{{::item.url}}" ng-repeat="item in ctrl.model.breadcrumbs"> |
||||
{{::item.text}} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
|
||||
<dashboard-search></dashboard-search> |
||||
@ -1,54 +0,0 @@ |
||||
import coreModule from '../../core_module'; |
||||
import appEvents from 'app/core/app_events'; |
||||
import { NavModel } from '@grafana/ui'; |
||||
|
||||
export class NavbarCtrl { |
||||
model: NavModel; |
||||
|
||||
/** @ngInject */ |
||||
constructor() {} |
||||
|
||||
showSearch() { |
||||
appEvents.emit('show-dash-search'); |
||||
} |
||||
|
||||
navItemClicked(navItem, evt) { |
||||
if (navItem.clickHandler) { |
||||
navItem.clickHandler(); |
||||
evt.preventDefault(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
export function navbarDirective() { |
||||
return { |
||||
restrict: 'E', |
||||
templateUrl: 'public/app/core/components/navbar/navbar.html', |
||||
controller: NavbarCtrl, |
||||
bindToController: true, |
||||
controllerAs: 'ctrl', |
||||
scope: { |
||||
model: '=', |
||||
}, |
||||
link: (scope, elem) => {}, |
||||
}; |
||||
} |
||||
|
||||
export function pageH1() { |
||||
return { |
||||
restrict: 'E', |
||||
template: ` |
||||
<h1 class="page-header__title"> |
||||
<i class="page-header__icon {{::model.header.icon}}" ng-if="::model.header.icon"></i> |
||||
<img class="page-header__img" ng-src="{{::model.header.img}}" ng-if="::model.header.img"></i> |
||||
{{model.header.text}} |
||||
</h1> |
||||
`,
|
||||
scope: { |
||||
model: '=', |
||||
}, |
||||
}; |
||||
} |
||||
|
||||
coreModule.directive('pageH1', pageH1); |
||||
coreModule.directive('navbar', navbarDirective); |
||||
@ -1,67 +0,0 @@ |
||||
import React from 'react'; |
||||
import classNames from 'classnames'; |
||||
|
||||
export class SearchResult extends React.Component<any, any> { |
||||
constructor(props) { |
||||
super(props); |
||||
|
||||
this.state = { |
||||
search: '', |
||||
}; |
||||
} |
||||
|
||||
render() { |
||||
return this.state.search.sections.map(section => { |
||||
return <SearchResultSection section={section} key={section.id} />; |
||||
}); |
||||
} |
||||
} |
||||
|
||||
export interface SectionProps { |
||||
section: any; |
||||
} |
||||
|
||||
export class SearchResultSection extends React.Component<SectionProps, any> { |
||||
constructor(props) { |
||||
super(props); |
||||
} |
||||
|
||||
renderItem(item) { |
||||
return ( |
||||
<a className="search-item" href={item.url} key={item.id}> |
||||
<span className="search-item__icon"> |
||||
<i className="fa fa-th-large" /> |
||||
</span> |
||||
<span className="search-item__body"> |
||||
<div className="search-item__body-title">{item.title}</div> |
||||
</span> |
||||
</a> |
||||
); |
||||
} |
||||
|
||||
toggleSection = () => { |
||||
this.props.section.toggle(); |
||||
}; |
||||
|
||||
render() { |
||||
const collapseClassNames = classNames({ |
||||
fa: true, |
||||
'fa-plus': !this.props.section.expanded, |
||||
'fa-minus': this.props.section.expanded, |
||||
'search-section__header__toggle': true, |
||||
}); |
||||
|
||||
return ( |
||||
<div className="search-section" key={this.props.section.id}> |
||||
<div className="search-section__header"> |
||||
<i className={classNames('search-section__header__icon', this.props.section.icon)} /> |
||||
<span className="search-section__header__text">{this.props.section.title}</span> |
||||
<i className={collapseClassNames} onClick={this.toggleSection} /> |
||||
</div> |
||||
{this.props.section.expanded && ( |
||||
<div className="search-section__items">{this.props.section.items.map(this.renderItem)}</div> |
||||
)} |
||||
</div> |
||||
); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue