-
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/ui tool launch input #2804
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4ad90d9
Update tool launch name styling.
jkmarx b65ac6a
Update to display name.
jkmarx d533be5
Update service to display name.
jkmarx 04d2749
Add unit tests.
jkmarx cda35f2
Update error message.
jkmarx 742707a
Fix unit test and conditional logic.
jkmarx 55d0a92
Update popover text with whys.
jkmarx 885f2e9
Fix typo.
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
71 changes: 71 additions & 0 deletions
71
refinery/ui/source/js/tool-launch/ctrls/tool-launch-name-ctrl.js
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,71 @@ | ||
/** | ||
* Tool Launch Name Ctrl | ||
* @namespace ToolLaunchNameCtrl | ||
* @desc Component controller for launch name input | ||
* @memberOf refineryApp.refineryToolLaunch | ||
*/ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('refineryApp') | ||
.controller('ToolLaunchNameCtrl', ToolLaunchNameCtrl); | ||
|
||
ToolLaunchNameCtrl.$inject = [ | ||
'$log', | ||
'$scope', | ||
'_', | ||
'settings', | ||
'toolParamsService', | ||
'toolSelectService' | ||
]; | ||
|
||
function ToolLaunchNameCtrl ( | ||
$log, | ||
$scope, | ||
_, | ||
settings, | ||
toolParamsService, | ||
toolSelectService | ||
) { | ||
var vm = this; | ||
vm.form = { name: '' }; | ||
vm.selectedTool = {}; | ||
vm.toolType = ''; | ||
vm.updateToolLaunchName = updateToolLaunchName; | ||
vm.userName = settings.djangoApp.userName; | ||
|
||
/* | ||
* --------------------------------------------------------- | ||
* Methods Definitions | ||
* --------------------------------------------------------- | ||
*/ | ||
/** | ||
/** | ||
* @name updateToolLaunchName | ||
* @desc view method which updates tool launch name when input changes | ||
* @memberOf refineryApp.refineryToolLaunch. | ||
**/ | ||
function updateToolLaunchName (inputName) { | ||
toolParamsService.toolEditForm.display_name = inputName; | ||
} | ||
/* | ||
* --------------------------------------------------------- | ||
* Watchers | ||
* --------------------------------------------------------- | ||
*/ | ||
$scope.$watchCollection( | ||
function () { | ||
return toolSelectService.selectedTool; | ||
}, | ||
function () { | ||
if (!_.isEmpty(toolSelectService.selectedTool) && | ||
toolSelectService.selectedTool.tool_type.length) { | ||
angular.copy(toolSelectService.selectedTool, vm.selectedTool); | ||
var lCToolType = toolSelectService.selectedTool.tool_type.toLowerCase(); | ||
vm.toolType = lCToolType[0].toUpperCase() + lCToolType.slice(1, lCToolType.length); | ||
} | ||
} | ||
); | ||
} | ||
})(); |
44 changes: 44 additions & 0 deletions
44
refinery/ui/source/js/tool-launch/ctrls/tool-launch-name-ctrl.spec.js
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,44 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('Controller: Tool Launch Name Ctrl', function () { | ||
var ctrl; | ||
var scope; | ||
var service; | ||
|
||
beforeEach(module('refineryApp')); | ||
beforeEach(module('refineryToolLaunch')); | ||
beforeEach(inject(function ( | ||
$rootScope, | ||
$controller, | ||
toolParamsService | ||
) { | ||
scope = $rootScope.$new(); | ||
ctrl = $controller('ToolLaunchNameCtrl', { | ||
$scope: scope | ||
}); | ||
service = toolParamsService; | ||
})); | ||
|
||
it('Tool Select ctrl should exist', function () { | ||
expect(ctrl).toBeDefined(); | ||
}); | ||
|
||
it('Data & UI displays variables should exist for views', function () { | ||
expect(ctrl.form.name).toEqual(''); | ||
expect(ctrl.selectedTool).toEqual({}); | ||
expect(ctrl.toolType).toEqual(''); | ||
}); | ||
|
||
it('updateToolLaunchName is a method', function () { | ||
expect(angular.isFunction(ctrl.updateToolLaunchName)).toBe(true); | ||
}); | ||
|
||
it('updateToolLaunchName updates correct service', function () { | ||
var testName = 'Tool Launch Name'; | ||
expect(service.toolEditForm.display_name).toEqual(''); | ||
ctrl.updateToolLaunchName(testName); | ||
expect(service.toolEditForm.display_name).toEqual(testName); | ||
}); | ||
}); | ||
})(); |
17 changes: 17 additions & 0 deletions
17
refinery/ui/source/js/tool-launch/directives/tool-launch-name.js
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 Launch Name Component | ||
* @namespace rpToolLaunchName | ||
* @desc Component for a form to add display name for tool | ||
* @memberOf refineryApp.refineryToolLaunch | ||
*/ | ||
(function () { | ||
'use strict'; | ||
angular | ||
.module('refineryToolLaunch') | ||
.component('rpToolLaunchName', { | ||
controller: 'ToolLaunchNameCtrl', | ||
templateUrl: ['$window', function ($window) { | ||
return $window.getStaticUrl('partials/tool-launch/partials/tool-launch-name.html'); | ||
}] | ||
}); | ||
})(); |
30 changes: 30 additions & 0 deletions
30
refinery/ui/source/js/tool-launch/directives/tool-launch-name.spec.js
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,30 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('rpToolLaunchName component unit test', function () { | ||
beforeEach(module('refineryApp')); | ||
beforeEach(module('refineryToolLaunch')); | ||
|
||
var directiveElement; | ||
beforeEach(inject(function ( | ||
$compile, | ||
$rootScope, | ||
$templateCache, | ||
$window | ||
) { | ||
$templateCache.put( | ||
$window.getStaticUrl('partials/tool-launch/partials/tool-launch-name.html'), | ||
'<div id="tool-launch-name"></div>' | ||
); | ||
var scope = $rootScope.$new(); | ||
var template = '<rp-tool-launch-name></rp-tool-launch-name>'; | ||
directiveElement = $compile(template)(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('generates the appropriate HTML', function () { | ||
expect(directiveElement.html()).toContain('tool-launch-name'); | ||
expect(directiveElement.html()).toContain('</div>'); | ||
}); | ||
}); | ||
})(); |
61 changes: 61 additions & 0 deletions
61
refinery/ui/source/js/tool-launch/partials/tool-launch-name.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,61 @@ | ||
<div | ||
class="panel-group" | ||
id="tool-info-display" | ||
role="tablist" | ||
aria-multiselectable="true"> | ||
|
||
<div class="panel panel-default"> | ||
<div | ||
id="tool-launch-body" | ||
class="panel-collapse" | ||
role="tabpanel" | ||
aria-labelledby="tool-body"> | ||
<div class="panel-heading" role="tab"> | ||
<h4 class="panel-title"> | ||
{{ $ctrl.toolType }} | ||
Name | ||
  | ||
<a | ||
popover-placement="right" | ||
uib-popover="Update the {{ $ctrl.toolType }} display name. The | ||
display name needs to be unique because it will help you to find a | ||
specific visualization later." | ||
popover-title="Display Name" | ||
popover-trigger="'outsideClick'" | ||
popover-append-to-body="true" | ||
tabindex="0"> | ||
<i class="fa fa-question-circle info-icon icon-only"></i> | ||
</a> | ||
</h4> | ||
</div> | ||
<div class="panel-body"> | ||
<form | ||
id="tool-launch-name" | ||
name="toolLaunchNameForm" | ||
class="navbar-form"> | ||
<input | ||
autofocus | ||
class="form-control" | ||
placeholder="{{ $ctrl.selectedTool.name }}-creation_date-{{ $ctrl.userName }}" | ||
ng-model="$ctrl.form.name" | ||
ng-change="$ctrl.updateToolLaunchName($ctrl.form.name)" | ||
name="toolLaunchName" | ||
ng-maxlength="32" | ||
ng-minlength="3"> | ||
</form> | ||
<div | ||
class='p-t-1-2 text-warning' | ||
ng-show="toolLaunchNameForm.toolLaunchName.$error.minlength"> | ||
<i class="fa fa-warning" aria-hidden="true"></i> | ||
Names must be at least 3 characters long. | ||
</div> | ||
<div | ||
class='p-t-1-2 text-warning' | ||
ng-show="toolLaunchNameForm.toolLaunchName.$error.maxlength"> | ||
<i class="fa fa-warning" aria-hidden="true"></i> | ||
Names must be shorter than 32 characters long. | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</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
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 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
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.
this should cover old vis/analysis tools w/o any display names