-
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.
* Update tool launch name styling. * Update to display name. * Update service to display name. * Add unit tests. * Update error message. * Fix unit test and conditional logic. * Update popover text with whys. * Fix typo.
- Loading branch information
Showing
14 changed files
with
251 additions
and
7 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
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