Просмотр исходного кода

dashfolders: add breadcrumbs to NavStore

Daniel Lee 8 лет назад
Родитель
Сommit
10018d8455
2 измененных файлов с 9 добавлено и 1 удалено
  1. 6 0
      public/app/stores/NavStore/NavItem.ts
  2. 3 1
      public/app/stores/NavStore/NavStore.ts

+ 6 - 0
public/app/stores/NavStore/NavItem.ts

@@ -8,5 +8,11 @@ export const NavItem = types.model('NavItem', {
   icon: types.optional(types.string, ''),
   img: types.optional(types.string, ''),
   active: types.optional(types.boolean, false),
+  breadcrumbs: types.optional(types.array(types.late(() => Breadcrumb)), []),
   children: types.optional(types.array(types.late(() => NavItem)), []),
 });
+
+export const Breadcrumb = types.model('Breadcrumb', {
+  title: types.string,
+  url: types.string,
+});

+ 3 - 1
public/app/stores/NavStore/NavStore.ts

@@ -41,7 +41,7 @@ export const NavStore = types
     initFolderNav(folder: any, activeChildId: string) {
       const folderUrl = createFolderUrl(folder.id, folder.slug);
 
-      self.main = {
+      let main = {
         icon: 'fa fa-folder-open',
         id: 'manage-folder',
         subTitle: 'Manage folder dashboards & permissions',
@@ -72,6 +72,8 @@ export const NavStore = types
           },
         ],
       };
+
+      self.main = NavItem.create(main);
     },
   }));