-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jkmarx/add tools list landing page #3122
Merged
Merged
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
61f01f3
Add home module.
jkmarx f08dcd9
Add chart.js.
jkmarx 865035e
Update chart selection feature.
jkmarx 09089a6
Redirect user when clicking on chart.
jkmarx 5f4ab5c
Add pointer and home css file.
jkmarx 0dc67a2
Correct body height.
jkmarx 45c19c3
Add unit tests and fix tooltip label.
jkmarx 85907ad
Add service unit test.
jkmarx 3105127
Add ctrl unit tests.
jkmarx 7b70688
Add comments.
jkmarx 5c1a51b
Fix name.
jkmarx a778ecb
Switch to object class due to phantomjs.
jkmarx 61a6971
Fix typo.
jkmarx e1bbe74
Fix comments.
jkmarx 6435794
Add toollist component.
jkmarx fe65549
Populate tool list.
jkmarx 89a831a
Resolve merge conflicts.
jkmarx 99ce04c
Add workflow link.
jkmarx 265b54a
Different calls for getting with and without data_set_uuid.
jkmarx 7d52b57
Add api unit test.
jkmarx 06ef728
Add more unit tests.
jkmarx 32698c0
Remove typos.
jkmarx a9ed7ad
Refactor.
jkmarx File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 should 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the 2nd
return tool.workflow
always beNone
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, am I being redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a little. How about something like
or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how that improves anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to be explicit if we're going to be returning a
None
. Otherwise, someone could be left wondering why we're returningtool.workflow
after already running theif tool.workflow
.Another path could be something like: