-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jkmarx/add tools list landing page (#3122)
* Add home module. * Add chart.js. * Update chart selection feature. * Redirect user when clicking on chart. * Add pointer and home css file and correct body height. * Add unit tests and comments * Fix name. * Switch to object class due to phantomjs. * Fix typo. * Fix comments. * Add toollist component. * Populate tool list. * Add workflow link. * Different calls for getting with and without data_set_uuid. * Add api unit test and more unit tests. * Remove typos. * Refactor.
- Loading branch information
Showing
16 changed files
with
343 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Tool List Ctrl | ||
* @namespace ToolListCtrl | ||
* @desc Component controller for the tool list partial. | ||
* @memberOf refineryApp.refineryHome | ||
*/ | ||
(function () { | ||
'use strict'; | ||
angular | ||
.module('refineryHome') | ||
.controller('ToolListCtrl', ToolListCtrl); | ||
|
||
ToolListCtrl.$inject = ['toolListService']; | ||
|
||
function ToolListCtrl (toolListService) { | ||
var vm = this; | ||
vm.toolList = toolListService.toolList; | ||
|
||
activate(); | ||
/* | ||
* ----------------------------------------------------------------------------- | ||
* Methods | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
function activate () { | ||
// tool list won't be updated often, so no need for api call | ||
// if list is already populated | ||
if (!vm.toolList.length) { | ||
toolListService.getTools().then(function () { | ||
vm.toolList = toolListService.toolList; | ||
}); | ||
} | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('Controller: Tool List Ctrl', function () { | ||
var ctrl; | ||
var genCtrl; | ||
var mockService; | ||
var mockServiceResponse = false; | ||
var scope; | ||
var service; | ||
var rootScope; | ||
|
||
beforeEach(module('refineryApp')); | ||
beforeEach(module('refineryHome')); | ||
beforeEach(inject(function ( | ||
$rootScope, | ||
$controller, | ||
$httpBackend, | ||
settings, | ||
toolListService | ||
) { | ||
service = toolListService; | ||
mockService = spyOn(service, 'getTools').and.callFake(function () { | ||
return { | ||
then: function () { | ||
mockServiceResponse = true; | ||
} | ||
}; | ||
}); | ||
rootScope = $rootScope; | ||
scope = rootScope.$new(); | ||
genCtrl = $controller; | ||
ctrl = $controller('ToolListCtrl', { | ||
$scope: scope | ||
}); | ||
})); | ||
|
||
it('Tool List Ctrl ctrl should exist', function () { | ||
expect(ctrl).toBeDefined(); | ||
}); | ||
|
||
it('data variables should exist for views', function () { | ||
expect(ctrl.toolList).toEqual([]); | ||
}); | ||
|
||
it('should call service when initalized', function () { | ||
scope.$apply(); | ||
expect(mockService).toHaveBeenCalled(); | ||
expect(mockServiceResponse).toEqual(true); | ||
}); | ||
|
||
it('should not call service when list exists', function () { | ||
mockServiceResponse = false; | ||
mockService.calls.reset(); | ||
angular.copy([{ name: 'FastQC' }], service.toolList); | ||
var newScope = rootScope.$new(); | ||
genCtrl('ToolListCtrl', { | ||
$scope: newScope | ||
}); | ||
newScope.$apply(); | ||
expect(mockService).not.toHaveBeenCalled(); | ||
expect(mockServiceResponse).toEqual(false); | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Tool List Component | ||
* @namespace rpToolList | ||
* @desc Component to show a list of all the tools | ||
* @memberOf refineryApp.refineryHome | ||
*/ | ||
(function () { | ||
'use strict'; | ||
angular | ||
.module('refineryHome') | ||
.component('rpToolList', { | ||
controller: 'ToolListCtrl', | ||
templateUrl: ['$window', function ($window) { | ||
return $window.getStaticUrl('partials/home/partials/tool-list.html'); | ||
}] | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('rpToolList component unit test', function () { | ||
beforeEach(module('refineryApp')); | ||
beforeEach(module('refineryHome')); | ||
|
||
var directiveElement; | ||
|
||
beforeEach(inject(function ( | ||
$compile, | ||
$httpBackend, | ||
$rootScope, | ||
$templateCache, | ||
$window, | ||
settings | ||
) { | ||
// Mock api call due to ctrl activate method | ||
$httpBackend | ||
.whenGET( | ||
settings.appRoot + | ||
settings.refineryApiV2 + '/tool_definitions/?data_set_uuid=').respond(200, []); | ||
|
||
$templateCache.put( | ||
$window.getStaticUrl('partials/home/partials/tool-list.html'), | ||
'<div id="tool-list">/div>' | ||
); | ||
|
||
var scope = $rootScope.$new(); | ||
var template = '<rp-tool-list></rp-tool-list>'; | ||
directiveElement = $compile(template)(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('generates the appropriate HTML', function () { | ||
expect(directiveElement.html()).toContain('tool-list'); | ||
expect(directiveElement.html()).toContain('</div>'); | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
<div class="row p-t-1"> | ||
<div class="col-md-4 col-md-offset-7"> | ||
<ui-select | ||
append-to-body="true" | ||
ng-model="$ctrl.selectedAttribute.select" | ||
on-select="$ctrl.updateAttribute($item)" | ||
theme="select2" | ||
class="text-left p-l-1 p-b-1"> | ||
<ui-select-match placeholder="Select an attribute"> | ||
{{$select.selected.name }} | ||
</ui-select-match> | ||
<ui-select-choices | ||
position="down" | ||
repeat="attribute in $ctrl.attributes | orderBy:'name' track by $index"> | ||
<span ng-bind-html="attribute.name"></span> | ||
</ui-select-choices> | ||
</ui-select> | ||
<canvas id="files-bar-chart"></canvas> | ||
</div> | ||
<div> | ||
<ui-select | ||
append-to-body="true" | ||
ng-model="$ctrl.selectedAttribute.select" | ||
on-select="$ctrl.updateAttribute($item)" | ||
theme="select2" | ||
class="text-left p-l-1 p-b-1"> | ||
<ui-select-match placeholder="Select an attribute"> | ||
{{$select.selected.name }} | ||
</ui-select-match> | ||
<ui-select-choices | ||
position="down" | ||
repeat="attribute in $ctrl.attributes | orderBy:'name' track by $index"> | ||
<span ng-bind-html="attribute.name"></span> | ||
</ui-select-choices> | ||
</ui-select> | ||
<canvas id="files-bar-chart"></canvas> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div> | ||
<div class="refinery-header"> | ||
<h3> | ||
Analysis and Visualization Tools | ||
</h3> | ||
</div> | ||
<ul class="list-unstyled"> | ||
<li ng-repeat="tool in $ctrl.toolList" class="p-b-1-2"> | ||
<i class="{{tool.tool_type|toolTypeIcon}} p-r-1-4" aria-hidden="true"></i> | ||
<span ng-if="tool.tool_type=='WORKFLOW'"> | ||
<a ng-href="/workflows/{{tool.workflow}}"> | ||
{{ tool.name }} | ||
</a> | ||
</span> | ||
<span ng-if="tool.tool_type!=='WORKFLOW'"> | ||
{{ tool.name }} | ||
</span> | ||
- {{ tool.description }} | ||
</li> | ||
</ul> | ||
</div> |
Oops, something went wrong.