Skip to content

Commit d5c0abd

Browse files
authored
Merge pull request #78 from fleetbase/fix/header-menu-shortcuts-sort-order
fix(menu-service): sort extensions by priority first, append shortcuts after
2 parents d742771 + 746f0e3 commit d5c0abd

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

addon/services/universe/menu-service.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,16 @@ export default class MenuService extends Service.extend(Evented) {
446446
*/
447447
getHeaderMenuItems() {
448448
const items = this.registry.getRegistry('header', 'menu-item');
449-
return A(items).sortBy('priority');
449+
// Sort extensions by priority first, then append shortcuts at the end.
450+
// Shortcuts must never interleave with extensions in the sorted list
451+
// because the default bar is built by slicing the first N items — if
452+
// shortcuts sort between extensions (e.g. priority 1.1 between 1 and 2)
453+
// they would displace real extensions from the default pinned bar.
454+
const extensions = A(items)
455+
.filter((i) => !i._isShortcut)
456+
.sortBy('priority');
457+
const shortcuts = A(items).filter((i) => i._isShortcut);
458+
return A([...extensions, ...shortcuts]);
450459
}
451460

452461
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fleetbase/ember-core",
3-
"version": "0.3.16",
3+
"version": "0.3.17",
44
"description": "Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.",
55
"keywords": [
66
"fleetbase-core",

0 commit comments

Comments
 (0)