mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* mobx: poc in using each store as individual prop on the react containers * prettier test * fix: end the war between prettier vs tslint. * mobx: Move stores into their own folders * mobx: Refactor the AlertRule into its own file and add a helper-file * mobx: Move NavItem out of NavStore and remove lodash dependancy * mobx: Move ResultItem and SearchResultSection models out of the SearchStore * mobx: ServerStatsStore rename .tsx => .ts. And move ServerStat-model to its own file. * mobx: Remove lodash and jquery dependancy from ViewStore * mobx: Remove issue with double question mark
28 lines
664 B
TypeScript
28 lines
664 B
TypeScript
import { types } from 'mobx-state-tree';
|
|
import { ResultItem } from './ResultItem';
|
|
|
|
export const SearchResultSection = types
|
|
.model('SearchResultSection', {
|
|
id: types.identifier(),
|
|
title: types.string,
|
|
icon: types.string,
|
|
expanded: types.boolean,
|
|
items: types.array(ResultItem),
|
|
})
|
|
.actions(self => ({
|
|
toggle() {
|
|
self.expanded = !self.expanded;
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
self.items.push(
|
|
ResultItem.create({
|
|
id: i,
|
|
title: 'Dashboard ' + self.items.length,
|
|
icon: 'gicon gicon-dashboard',
|
|
url: 'asd',
|
|
})
|
|
);
|
|
}
|
|
},
|
|
}));
|