File tree Expand file tree Collapse file tree 2 files changed +19
-50
lines changed
components/software-center Expand file tree Collapse file tree 2 files changed +19
-50
lines changed Original file line number Diff line number Diff line change 3030 class =" card-grid grid-cols-1 sm:grid-cols-2 2xl:grid-cols-3 3xl:grid-cols-4"
3131 >
3232 <cv-tile
33- v-for =" (app, index) in appsLoaded "
33+ v-for =" (app, index) in apps "
3434 :key =" index"
3535 kind =" standard"
3636 class =" app"
155155 </div >
156156 </cv-tile >
157157 </div >
158- <infinite-loading @infinite =" infiniteScrollHandler" ></infinite-loading >
159158 </div >
160159 <AppInfoModal
161160 :app =" appInfo.app"
@@ -193,25 +192,13 @@ export default {
193192 isShown: false ,
194193 app: null ,
195194 },
196- // infinite scroll
197- appsLoaded: [],
198- pageNum: 0 ,
199- pageSize: 50 ,
200- isShownCoreAppModal: false ,
201195 };
202196 },
203197 computed: {
204198 coreApp () {
205199 return this .apps .find ((app ) => app .id == " core" );
206200 },
207201 },
208- watch: {
209- apps : function () {
210- this .appsLoaded = [];
211- this .pageNum = 0 ;
212- this .infiniteScrollHandler ();
213- },
214- },
215202 methods: {
216203 installInstance (app ) {
217204 this .$emit (" install" , app);
@@ -231,25 +218,6 @@ export default {
231218 context .appInfo .isShown = false ;
232219 }, 250 );
233220 },
234- infiniteScrollHandler ($state ) {
235- const pageApps = this .apps .slice (
236- this .pageNum * this .pageSize ,
237- (this .pageNum + 1 ) * this .pageSize
238- );
239-
240- if (pageApps .length ) {
241- this .pageNum ++ ;
242- this .appsLoaded .push (... pageApps);
243-
244- if ($state) {
245- $state .loaded ();
246- }
247- } else {
248- if ($state) {
249- $state .complete ();
250- }
251- }
252- },
253221 getApplicationCategories (app ) {
254222 let categories = [];
255223
Original file line number Diff line number Diff line change 333333 <h6 class =" search-results-title" >
334334 {{ $t("software_center.search_results") }}
335335 </h6 >
336- <AppList
337- v-if =" searchResults.length"
338- :apps =" searchResults"
339- :skeleton =" loading.listModules || loading.listCoreModules"
340- tab =" search"
341- @install =" openInstallModal"
342- key =" search-app-list"
336+ <cv-tile
337+ v-if =" !searchResults.length && !loading.listModules"
338+ kind =" standard"
343339 :light =" true"
344- />
345- <cv-tile v-else kind =" standard" :light =" true" >
340+ >
346341 <NsEmptyState
347342 :title =" $t('software_center.no_app_found')"
348343 :animationData =" GhostLottie"
355350 </template >
356351 </NsEmptyState >
357352 </cv-tile >
353+ <AppList
354+ v-else
355+ :apps =" searchResults"
356+ :skeleton =" loading.listModules || loading.listCoreModules"
357+ tab =" search"
358+ @install =" openInstallModal"
359+ key =" search-app-list"
360+ :light =" true"
361+ />
358362 </div >
359363 </div >
360364 </cv-grid >
@@ -473,9 +477,10 @@ export default {
473477 },
474478 },
475479 watch: {
476- " q.search " : function () {
477- if (! this .q .search ) {
478- this .q .view = " all" ;
480+ modules () {
481+ // perform search again when modules are updated
482+ if (this .q .view === " search" && this .q .search ) {
483+ this .searchApp (this .q .search );
479484 }
480485 },
481486 },
@@ -563,11 +568,6 @@ export default {
563568 }
564569 this .appUpdates = appUpdates;
565570 this .modules = modules;
566-
567- // perform search on browser history navigation (e.g. going back to software center)
568- if (this .q .search ) {
569- this .searchApp (this .q .search );
570- }
571571 this .listCoreModules ();
572572 },
573573 async listCoreModules () {
@@ -709,6 +709,7 @@ export default {
709709 }
710710 },
711711 contentSwitcherSelected (value ) {
712+ this .q .search = " " ;
712713 this .q .view = value;
713714 },
714715 goToUpdates () {
You can’t perform that action at this time.
0 commit comments