meanjs / mean

MEAN.JS - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js -
http://meanjs.org
MIT License
4.87k stars 1.98k forks source link

Ordering of processing menus can cause menu to not be constructed #1079

Open kokokenada opened 8 years ago

kokokenada commented 8 years ago

If the sub menus are processed prior to parent, you get a silent failure (or reported failure if//when PR #1076 is merged) .The ordered appeared of processing to be alphabetic - need to confirm. Possible work around is to the change the order of the files in config/assets.

Steps to reproduce are to add to the admin menu defined by the users module in a module that is alphabetically before "users".

mleanos commented 8 years ago

@kokokenada I can't reproduce using the method you described. Although, I'm not 100% sure I am understanding the steps...

I added a new menu item to the users-admin.client.menus client config here: https://github.com/meanjs/mean/blob/master/modules/users/client/config/users-admin.client.menus.js

my updated Menus config looks like this, after my change:

'use strict';

// Configuring the Articles module
angular.module('users.admin').run(['Menus',
  function (Menus) {
    Menus.addSubMenuItem('topbar', 'admin', {
      title: 'Manage Users',
      state: 'admin.users'
    });

    Menus.addSubMenuItem('topbar', 'admin', {
      title: 'Look at Chat',
      state: 'chat'
    });
  }
]);

Does this produce the issue for you?

kokokenada commented 8 years ago

The one that caused my trouble was:

// Configuring the debug module
angular.module('core-ext').run(['Menus',
  function (Menus) {
    Menus.addSubMenuItem('topbar', 'admin', {
      title: 'Debug',
      state: 'admin.debug'
    });
 }

]);

It was in a module named "core-ext". I double checked my work around, and it was to process core first by separating it in config/assets/defaults, so my original description looks off...

mleanos commented 8 years ago

@kokokenada Can you provide a screen shot of the error?

I'll try reproducing again..

holaontiveros commented 8 years ago

I just had the same error, i've applied #1076 and throws this errors:

captura
kokokenada commented 8 years ago

1076 only changes the to be reported. (The behavior I observed was for menu item to be displayed.) A workaround is to edit the config/assets/default.js so that the modules are processed in the correct order. A permanent fix would be to change menus.client.service.js to store the orphans and assemble the menu at the end of processing or to devise an approach to automatically process in the correct order.

popod commented 7 years ago

I've the same problem.. any permanent fix for this ?