From a2fbf8c51c0914b212bf74d1fcff7195d914e2fa Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 8 Oct 2020 18:30:55 -0400 Subject: [PATCH] leap: restore app index, remove from default --- pkg/interface/src/logic/lib/omnibox.js | 25 +++++++++++++++++++ .../src/views/components/leap/Omnibox.js | 5 +--- .../views/components/leap/OmniboxResult.js | 4 +-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/pkg/interface/src/logic/lib/omnibox.js b/pkg/interface/src/logic/lib/omnibox.js index 7f7c6195f..3c3de5dce 100644 --- a/pkg/interface/src/logic/lib/omnibox.js +++ b/pkg/interface/src/logic/lib/omnibox.js @@ -4,6 +4,7 @@ import { cite } from '~/logic/lib/util'; ['commands', []], ['subscriptions', []], ['groups', []], + ['apps', []], ['other', []] ]); @@ -28,6 +29,29 @@ const commandIndex = function (currentGroup) { return commands; }; +const appIndex = function (apps) { + // all apps are indexed from launch data + // indexed into 'apps' + const applications = []; + Object.keys(apps) + .filter((e) => { + return apps[e]?.type?.basic; + }) + .sort((a, b) => { + return a.localeCompare(b); + }) + .map((e) => { + const obj = result( + apps[e].type.basic.title, + apps[e].type.basic.linkedUrl, + apps[e].type.basic.title, + null + ); + applications.push(obj); + }); + return applications; +}; + const otherIndex = function() { const other = []; other.push(result('Home', '/~landscape/home', 'home', null)); @@ -91,6 +115,7 @@ export default function index(associations, apps, currentGroup, groups) { indexes.set('commands', commandIndex(currentGroup)); indexes.set('subscriptions', subscriptions); indexes.set('groups', landscape); + indexes.set('apps', appIndex(apps)); indexes.set('other', otherIndex()); return indexes; diff --git a/pkg/interface/src/views/components/leap/Omnibox.js b/pkg/interface/src/views/components/leap/Omnibox.js index ef00447a5..71107e615 100644 --- a/pkg/interface/src/views/components/leap/Omnibox.js +++ b/pkg/interface/src/views/components/leap/Omnibox.js @@ -55,7 +55,7 @@ export class Omnibox extends Component { } getSearchedCategories() { - return ['commands', 'groups', 'subscriptions', 'other']; + return ['commands', 'groups', 'subscriptions', 'apps', 'other']; } control(evt) { @@ -106,9 +106,6 @@ export class Omnibox extends Component { if (!this.state) { return [category, []]; } - if (category === 'apps') { - return ['apps', this.state.index.get('apps')]; - } if (category === 'other') { return ['other', this.state.index.get('other')]; } diff --git a/pkg/interface/src/views/components/leap/OmniboxResult.js b/pkg/interface/src/views/components/leap/OmniboxResult.js index 69806d945..3f92a3115 100644 --- a/pkg/interface/src/views/components/leap/OmniboxResult.js +++ b/pkg/interface/src/views/components/leap/OmniboxResult.js @@ -31,9 +31,7 @@ export class OmniboxResult extends Component { let graphic =
; if (defaultApps.includes(icon.toLowerCase()) || icon.toLowerCase() === 'links') { - icon = (icon === 'Dojo') ? 'ChevronEast' : icon; icon = (icon === 'Link') ? 'Links' : icon; - graphic = ; } else if (icon === 'logout') { graphic = ; @@ -42,7 +40,7 @@ export class OmniboxResult extends Component { } else if (icon === 'home') { graphic = ; } else { - graphic = ; + graphic = ; } return graphic;