mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
mobx: removed unused SearchStore
This commit is contained in:
parent
68767acb1c
commit
d8b3fa01d0
@ -1,11 +1,9 @@
|
|||||||
import { SearchStore } from './../stores/SearchStore/SearchStore';
|
|
||||||
import { NavStore } from './../stores/NavStore/NavStore';
|
import { NavStore } from './../stores/NavStore/NavStore';
|
||||||
import { PermissionsStore } from './../stores/PermissionsStore/PermissionsStore';
|
import { PermissionsStore } from './../stores/PermissionsStore/PermissionsStore';
|
||||||
import { ViewStore } from './../stores/ViewStore/ViewStore';
|
import { ViewStore } from './../stores/ViewStore/ViewStore';
|
||||||
import { FolderStore } from './../stores/FolderStore/FolderStore';
|
import { FolderStore } from './../stores/FolderStore/FolderStore';
|
||||||
|
|
||||||
interface ContainerProps {
|
interface ContainerProps {
|
||||||
search: typeof SearchStore.Type;
|
|
||||||
nav: typeof NavStore.Type;
|
nav: typeof NavStore.Type;
|
||||||
permissions: typeof PermissionsStore.Type;
|
permissions: typeof PermissionsStore.Type;
|
||||||
view: typeof ViewStore.Type;
|
view: typeof ViewStore.Type;
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { observer } from 'mobx-react';
|
|
||||||
import { store } from 'app/stores/store';
|
|
||||||
|
|
||||||
export interface SearchResultProps {
|
export class SearchResult extends React.Component<any, any> {
|
||||||
search: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
@observer
|
|
||||||
export class SearchResult extends React.Component<SearchResultProps, any> {
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
search: store.search,
|
search: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
store.search.query();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -30,7 +21,6 @@ export interface SectionProps {
|
|||||||
section: any;
|
section: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
|
||||||
export class SearchResultSection extends React.Component<SectionProps, any> {
|
export class SearchResultSection extends React.Component<SectionProps, any> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { types } from 'mobx-state-tree';
|
import { types } from 'mobx-state-tree';
|
||||||
import { SearchStore } from './../SearchStore/SearchStore';
|
|
||||||
import { NavStore } from './../NavStore/NavStore';
|
import { NavStore } from './../NavStore/NavStore';
|
||||||
import { ViewStore } from './../ViewStore/ViewStore';
|
import { ViewStore } from './../ViewStore/ViewStore';
|
||||||
import { FolderStore } from './../FolderStore/FolderStore';
|
import { FolderStore } from './../FolderStore/FolderStore';
|
||||||
@ -7,9 +6,6 @@ import { PermissionsStore } from './../PermissionsStore/PermissionsStore';
|
|||||||
import { TeamsStore } from './../TeamsStore/TeamsStore';
|
import { TeamsStore } from './../TeamsStore/TeamsStore';
|
||||||
|
|
||||||
export const RootStore = types.model({
|
export const RootStore = types.model({
|
||||||
search: types.optional(SearchStore, {
|
|
||||||
sections: [],
|
|
||||||
}),
|
|
||||||
nav: types.optional(NavStore, {}),
|
nav: types.optional(NavStore, {}),
|
||||||
permissions: types.optional(PermissionsStore, {
|
permissions: types.optional(PermissionsStore, {
|
||||||
fetching: false,
|
fetching: false,
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import { types } from 'mobx-state-tree';
|
|
||||||
|
|
||||||
export const ResultItem = types.model('ResultItem', {
|
|
||||||
id: types.identifier(types.number),
|
|
||||||
folderId: types.optional(types.number, 0),
|
|
||||||
title: types.string,
|
|
||||||
url: types.string,
|
|
||||||
icon: types.string,
|
|
||||||
folderTitle: types.optional(types.string, ''),
|
|
||||||
});
|
|
@ -1,27 +0,0 @@
|
|||||||
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',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}));
|
|
@ -1,22 +0,0 @@
|
|||||||
import { types } from 'mobx-state-tree';
|
|
||||||
import { SearchResultSection } from './SearchResultSection';
|
|
||||||
|
|
||||||
export const SearchStore = types
|
|
||||||
.model('SearchStore', {
|
|
||||||
sections: types.array(SearchResultSection),
|
|
||||||
})
|
|
||||||
.actions(self => ({
|
|
||||||
query() {
|
|
||||||
for (let i = 0; i < 100; i++) {
|
|
||||||
self.sections.push(
|
|
||||||
SearchResultSection.create({
|
|
||||||
id: 'starred' + i,
|
|
||||||
title: 'starred',
|
|
||||||
icon: 'fa fa-fw fa-star-o',
|
|
||||||
expanded: false,
|
|
||||||
items: [],
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}));
|
|
Loading…
Reference in New Issue
Block a user