diff --git a/public/app/stores/NavStore/NavItem.ts b/public/app/stores/NavStore/NavItem.ts index 6555e96d785..4521d4291aa 100644 --- a/public/app/stores/NavStore/NavItem.ts +++ b/public/app/stores/NavStore/NavItem.ts @@ -1,10 +1,5 @@ import { types } from 'mobx-state-tree'; -const BreadcrumbItem = types.model('BreadcrumbItem', { - title: types.string, - url: types.string, -}); - export const NavItem = types.model('NavItem', { id: types.identifier(types.string), text: types.string, @@ -15,7 +10,6 @@ export const NavItem = types.model('NavItem', { active: types.optional(types.boolean, false), breadcrumbs: types.optional(types.array(types.late(() => Breadcrumb)), []), children: types.optional(types.array(types.late(() => NavItem)), []), - breadcrumbs: types.optional(types.array(BreadcrumbItem), []), }); export const Breadcrumb = types.model('Breadcrumb', { diff --git a/public/app/stores/ViewStore/ViewStore.jest.ts b/public/app/stores/ViewStore/ViewStore.jest.ts index 732f6a81038..c384b41dd68 100644 --- a/public/app/stores/ViewStore/ViewStore.jest.ts +++ b/public/app/stores/ViewStore/ViewStore.jest.ts @@ -8,18 +8,19 @@ describe('ViewStore', () => { store = ViewStore.create({ path: '', query: {}, + routeParams: {}, }); }); it('Can update path and query', () => { - store.updatePathAndQuery('/hello', { key: 1, otherParam: 'asd' }); + store.updatePathAndQuery('/hello', { key: 1, otherParam: 'asd' }, { key: 1, otherParam: 'asd' }); expect(store.path).toBe('/hello'); expect(store.query.get('key')).toBe(1); expect(store.currentUrl).toBe('/hello?key=1&otherParam=asd'); }); it('Query can contain arrays', () => { - store.updatePathAndQuery('/hello', { values: ['A', 'B'] }); + store.updatePathAndQuery('/hello', { values: ['A', 'B'] }, { key: 1, otherParam: 'asd' }); expect(toJS(store.query.get('values'))).toMatchObject(['A', 'B']); expect(store.currentUrl).toBe('/hello?values=A&values=B'); }); diff --git a/public/app/stores/ViewStore/ViewStore.ts b/public/app/stores/ViewStore/ViewStore.ts index b29ea94df91..d00bf3c429f 100644 --- a/public/app/stores/ViewStore/ViewStore.ts +++ b/public/app/stores/ViewStore/ViewStore.ts @@ -22,6 +22,7 @@ export const ViewStore = types }, })) .actions(self => { + // querystring only function updateQuery(query: any) { self.query.clear(); for (let key of Object.keys(query)) { @@ -29,6 +30,7 @@ export const ViewStore = types } } + // needed to get route parameters like slug from the url function updateRouteParams(routeParams: any) { self.routeParams.clear(); for (let key of Object.keys(routeParams)) {