From f72f8c762b3731b137f21784d6e9e5dd6300e7fd Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 4 Jun 2018 16:52:20 -0700 Subject: [PATCH] goto client-side filtering (preliminary) --- interface/resources/qml/hifi/Feed.qml | 15 ++++++++++----- .../resources/qml/hifi/models/PSFListModel.qml | 2 +- .../qml/hifi/tablet/TabletAddressDialog.qml | 4 ---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 98721ba2e0..fcfb61b1ca 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -33,7 +33,6 @@ Column { property int stackedCardShadowHeight: 4; property int labelSize: 20; - property string metaverseServerUrl: ''; // FIXME loose this? property string protocol: ''; property string actions: 'snapshot'; // sendToScript doesn't get wired until after everything gets created. So we have to queue fillDestinations on nextTick. @@ -63,10 +62,16 @@ Column { }; listModelName: actions; listView: scroll; + searchFilter: filter.toUpperCase().split(/\s+/).filter(identity).join(' '); + searchItemTest: function (text, item) { + return searchFilter.split().every(function (word) { + return item.searchText.indexOf(word) >= 0; + }); + }; //HRS FIXME remove when endpoint works. } function resolveUrl(url) { - return (url.indexOf('/') === 0) ? (metaverseServerUrl + url) : url; + return (url.indexOf('/') === 0) ? (Account.metaverseServerURL + url) : url; } function makeModelData(data) { // create a new obj from data // ListModel elements will only ever have those properties that are defined by the first obj that is added. @@ -101,6 +106,9 @@ Column { console.log('fixme makeModelData', JSON.stringify(fixme)); return fixme; } + function identity(x) { + return x; + } /* FIXME property var allStories: []; property var placeMap: ({}); // Used for making stacks. @@ -172,9 +180,6 @@ Column { report('user stories'); }); } - function identity(x) { - return x; - } function makeFilteredStoryProcessor() { // answer a function(storyData) that adds it to suggestions if it matches var words = filter.toUpperCase().split(/\s+/).filter(identity); function suggestable(story) { diff --git a/interface/resources/qml/hifi/models/PSFListModel.qml b/interface/resources/qml/hifi/models/PSFListModel.qml index 6eff1cc073..124e08b6cd 100644 --- a/interface/resources/qml/hifi/models/PSFListModel.qml +++ b/interface/resources/qml/hifi/models/PSFListModel.qml @@ -101,10 +101,10 @@ Item { currentPageToRetrieve = -1; } if (searchItemTest) { - copyOfItems = copyOfItems.concat(processed); if (searchFilter) { processed = applySearchItemTest(processed); } + copyOfItems = copyOfItems.concat(processed); } if (localSort) { copyOfItems = copyOfItems.concat(processed); diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 104756967e..08f86770e6 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -34,7 +34,6 @@ StackView { height: parent !== null ? parent.height : undefined property int cardWidth: 212; property int cardHeight: 152; - property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/"; property var tablet: null; RootHttpRequest { id: http; } @@ -322,7 +321,6 @@ StackView { width: parent.width; cardWidth: 312 + (2 * 4); cardHeight: 163 + (2 * 4); - metaverseServerUrl: addressBarDialog.metaverseServerUrl; labelText: 'HAPPENING NOW'; actions: 'announcement'; filter: addressLine.text; @@ -335,7 +333,6 @@ StackView { cardWidth: 210; cardHeight: 110 + messageHeight; messageHeight: 44; - metaverseServerUrl: addressBarDialog.metaverseServerUrl; labelText: 'PLACES'; actions: 'concurrency'; filter: addressLine.text; @@ -349,7 +346,6 @@ StackView { cardHeight: 75 + messageHeight + 4; messageHeight: 32; textPadding: 6; - metaverseServerUrl: addressBarDialog.metaverseServerUrl; labelText: 'RECENT SNAPS'; actions: 'snapshot'; filter: addressLine.text;