Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Commit

Permalink
Feature/org slow (#154)
Browse files Browse the repository at this point in the history
* Added loading gif and reduced the number of calls to backend

* Fixed workflow search (previously had typo)
  • Loading branch information
kcao-guidewire authored and denis-yuen committed Apr 12, 2017
1 parent 704a179 commit e590187
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 18 deletions.
4 changes: 1 addition & 3 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ angular
controllerAs: 'Maintenance'
})
.when('/organizations', {
templateUrl: 'views/organizations.html',
controller: 'OrganizationsCtrl',
controllerAs: 'Organizations'
templateUrl: 'views/organizations.html'
})
.when('/organizations/:org', {
templateUrl: 'views/org.html',
Expand Down
43 changes: 32 additions & 11 deletions app/scripts/controllers/organizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ angular.module('dockstore.ui')
'$routeParams',
function($scope, OrganizationService, $q, $routeParams) {
$scope.org = $routeParams.org;
$scope.display = false;
$scope.tools = false;
$scope.workflows = false;

var getOrgs = function() {
return OrganizationService.getOrganizations();
Expand Down Expand Up @@ -66,6 +67,7 @@ angular.module('dockstore.ui')
var tools = ordered[i];
$scope.orgToTools[$scope.organizations[i]] = tools;
}
$scope.tools = true;
},

mapWorkflows = function(resultFromApi) {
Expand All @@ -75,23 +77,42 @@ angular.module('dockstore.ui')
var workflows = ordered[i];
$scope.orgToWorkflows[$scope.organizations[i]] = workflows;
}
$scope.display = true;
$scope.workflows = true;
},

reportProblems = function(fault) {
return $q.reject(fault);
};

var getOrgsPromise = getOrgs();
var setUp = function () {
var org = $scope.org;

getOrgsPromise
.then(assignTools)
.then(mapTools)
.catch(reportProblems);
if (org) {
var organizations = [];
organizations.push(org);

getOrgsPromise
.then(assignWorkflows)
.then(mapWorkflows)
.catch(reportProblems);
assignTools(organizations)
.then(mapTools)
.catch(reportProblems);

assignWorkflows(organizations)
.then(mapWorkflows)
.catch(reportProblems);
} else {
var getOrgsPromise = getOrgs();

getOrgsPromise
.then(assignTools)
.then(mapTools)
.catch(reportProblems);

getOrgsPromise
.then(assignWorkflows)
.then(mapWorkflows)
.catch(reportProblems);
}
};

setUp();
}
]);
2 changes: 1 addition & 1 deletion app/scripts/controllers/workflowsgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular.module('dockstore.ui')
/* Filter by organization */
var location = $location.search();
if (location.hasOwnProperty("organization")) {
organization = location.namespace;
organization = location.organization;
}

/* Column Sorting */
Expand Down
7 changes: 5 additions & 2 deletions app/templates/organizations.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ <h3 class="available-containers">
</div>
</div>

<div class="container view-content" style="margin-top: 20px">
<div class="container view-content centerPageSection" style="margin-top: 20px">
<div class="row">
<div class="col-md-12">
<div ng-if="organizations.length !== 0">
<div ng-if="!workflows || !tools">
<img class="center-block" src="styles/images/loading.gif">
</div>
<div ng-if="workflows && tools">
<div ng-repeat="organization in organizations">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" data-collapsible="expandable">
<div class="panel panel-default">
Expand Down
2 changes: 1 addition & 1 deletion app/views/org.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3 class="available-containers">
</div>

<div class="container view-content">
<div ng-if="display" class="row">
<div ng-if="workflows && tools" class="row">
<div ng-if="orgToTools[org].length > 0">
<h3>Tools</h3>
<ul ng-repeat="tool in orgToTools[org]">
Expand Down

0 comments on commit e590187

Please sign in to comment.