Skip to content

Commit 9a38186

Browse files
authored
Merge pull request #571 from spadgett/projects-size-check
Fix project size check for projects sidebar
2 parents e3e35ca + 74fe2ce commit 9a38186

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

Diff for: app/mockServices/mockData.service.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,15 @@ export class DataService implements IDataService {
272272
}
273273

274274
private getLargeProjectList() {
275-
if (this.largeProjectList) {
276-
return this.largeProjectList;
275+
if (!this.largeProjectList) {
276+
this.largeProjectList = {};
277+
for (let i = 1; i <= 5000; i++) {
278+
let project = this.mockProject(i);
279+
this.largeProjectList[project.metadata.name] = project;
280+
}
277281
}
278282

279-
this.largeProjectList = {};
280-
for (let i = 1; i <= 5000; i++) {
281-
let project = this.mockProject(i);
282-
this.largeProjectList[project.metadata.name] = project;
283-
}
283+
return this.largeProjectList;
284284
}
285285

286286
private watchCallbacks(key: string) {

Diff for: dist/origin-web-catalogs.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1745,11 +1745,10 @@ webpackJsonp([ 0, 1 ], [ function(e, t) {
17451745
function e(t, r, a, s, c, o, l, d, p, h, m) {
17461746
var u = this;
17471747
this.ctrl = this, this.newProjectPanelShown = !1, this.editProjectPanelShown = !1,
1748-
this.projects = [], this.watches = [], this.maxDisplayProjects = 5, this.watchingProjects = !1,
1749-
this.init = function() {
1748+
this.watches = [], this.maxDisplayProjects = 5, this.watchingProjects = !1, this.init = function() {
17501749
u.ProjectsService.list().then(function(t) {
17511750
u.onProjectsUpdate(t), u.ctrl.isProjectListIncomplete = u.ProjectsService.isProjectListIncomplete(),
1752-
!u.ctrl.isProjectListIncomplete && i.size(u.projects) <= e.MAX_PROJETS_TO_WATCH && (u.watches.push(u.ProjectsService.watch(u.$scope, u.onProjectsUpdate)),
1751+
!u.ctrl.isProjectListIncomplete && u.ctrl.totalProjects <= e.MAX_PROJETS_TO_WATCH && (u.watches.push(u.ProjectsService.watch(u.$scope, u.onProjectsUpdate)),
17531752
u.watchingProjects = !0);
17541753
}, function() {
17551754
u.ctrl.isProjectListIncomplete = !0;

Diff for: src/components/projects-summary/projects-summary.controller.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class ProjectsSummaryController implements angular.IController {
2222
public ctrl: any = this;
2323
public newProjectPanelShown: boolean = false;
2424
public editProjectPanelShown: boolean = false;
25-
public projects: any = [];
2625
private $filter: any;
2726
private $rootScope: any;
2827
private $scope: any;
@@ -123,7 +122,7 @@ export class ProjectsSummaryController implements angular.IController {
123122
// Only watch if the list successfully completed and we are below the
124123
// maximum number of projects to watch. Otherwise the list is likely too
125124
// large to reliably watch.
126-
if (!this.ctrl.isProjectListIncomplete && _.size(this.projects) <= ProjectsSummaryController.MAX_PROJETS_TO_WATCH) {
125+
if (!this.ctrl.isProjectListIncomplete && this.ctrl.totalProjects <= ProjectsSummaryController.MAX_PROJETS_TO_WATCH) {
127126
this.watches.push(this.ProjectsService.watch(this.$scope, this.onProjectsUpdate));
128127
// If we're not watching projects, we can manually update the list
129128
// on changes.

0 commit comments

Comments
 (0)