Skip to content

Commit

Permalink
Refactor - simplify popover in input group. (#1800)
Browse files Browse the repository at this point in the history
* Remove unused method.

* Fix parsing error. (#1801)

* Fix parsing error.

* Fix bound bug by using the auto-resize ui-grid module. (#1802)

* Fix bound bug by using the auto-resize ui-grid module.

* Remove unused dependency.

* Fix unit test.

* Jkmarx/data set 2 fix button hide (#1804)

* Show tool icon when selected.

* Fix hidden button bug.

* Add styles.
  • Loading branch information
jkmarx committed Jun 16, 2017
1 parent 987a586 commit 4d447de
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 119 deletions.
6 changes: 3 additions & 3 deletions refinery/ui/source/js/file-browser/ctrls/ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@
function toggleToolPanel () {
if (toolService.isToolPanelCollapsed) {
toolService.isToolPanelCollapsed = false;
vm.collapsedToolPanel = toolService.isToolPanelCollapsed;
} else {
toolService.isToolPanelCollapsed = true;
vm.collapsedToolPanel = toolService.isToolPanelCollapsed;
resetGridService.setRefreshGridFlag(true);
}
// resize window with toggling
vm.collapsedToolPanel = toolService.isToolPanelCollapsed;
vm.gridApi.core.handleWindowResize();
}

// Helper method which check for any data updates during soft loads (tabbing)
Expand Down
9 changes: 9 additions & 0 deletions refinery/ui/source/js/file-browser/ctrls/ctrl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
});

describe('Toggle Tool Panel', function () {
beforeEach(inject(function () {
var mockGridApi = {
handleWindowResize: function () { return; }
};
ctrl.gridApi = angular.copy({
core: {}
});
angular.copy(mockGridApi, ctrl.gridApi.core);
}));
it('toggleToolPanel is method', function () {
expect(angular.isFunction(ctrl.toggleToolPanel)).toBe(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// show even though the panel is collapsed
scope.dropAttributePanel = function (e, attributeName, attributeObj) {
e.preventDefault();
var escapeAttributeName = attributeName.replace(' ', '-');
var escapeAttributeName = attributeName.replace(/ /g, '-');
var attributeTitle = angular.element(
document.querySelector('#attribute-panel-' + escapeAttributeName)
);
Expand Down Expand Up @@ -70,7 +70,8 @@

// When panel is minimized, selected fields continue to show
scope.showField = function (field, internalName, attributeName) {
var escapedAttributeName = attributeName.replace(' ', '-');
var escapedAttributeName = attributeName.replace(/ /g, '-');

var selectedIndex = -1;
if (selectedFilterService.attributeSelectedFields[internalName] !== undefined) {
selectedIndex = selectedFilterService
Expand All @@ -92,7 +93,7 @@
var encodedAttribute = selectedFilterService
.stringifyAndEncodeAttributeObj(attributeInternalName, allFields[ind]);
if (queryFields.indexOf(encodedAttribute) > -1) {
var escapeAttributeName = attributeName.replace(' ', '-');
var escapeAttributeName = attributeName.replace(/ /g, '-');
var attributeTitle = angular.element(
document.querySelector('#attribute-panel-' + escapeAttributeName)
);
Expand Down
5 changes: 2 additions & 3 deletions refinery/ui/source/js/file-browser/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

angular
.module('refineryFileBrowser', [
'dndLists',
'ui.grid',
'ui.grid.selection',
'ui.grid.autoResize',
'ui.grid.infiniteScroll',
'ui.grid.resizeColumns',
'ui.select'
'ui.select',
]);
})();
8 changes: 4 additions & 4 deletions refinery/ui/source/js/file-browser/module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
expect(hasModule('ui.grid')).toEqual(true);
});

it('should have "ui.grid.selection" as a dependency', function () {
expect(hasModule('ui.grid.selection')).toEqual(true);
it('should have "ui.grid.autoResize" as a dependency', function () {
expect(hasModule('ui.grid.autoResize')).toEqual(true);
});

it('should have "ui.grid.infiniteScroll" as a dependency', function () {
Expand All @@ -39,8 +39,8 @@
expect(hasModule('ui.grid.resizeColumns')).toEqual(true);
});

it('should have "dndLists" as a dependency', function () {
expect(hasModule('dndLists')).toEqual(true);
it('should have "ui.select" as a dependency', function () {
expect(hasModule('ui.select')).toEqual(true);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div id="assay-files-table"
ui-grid="FBCtrl.gridOptions"
ui-grid-auto-resize
ui-grid-infinite-scroll
ui-grid-resize-columns
class="grid">
Expand Down
6 changes: 0 additions & 6 deletions refinery/ui/source/js/tool-launch/ctrls/input-group-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
vm.removeAllGroups = removeAllGroups;
vm.removeGroup = removeGroup; // Refreshes all selection
vm.selectedTool = {};
vm.setDisplayInputFile = setDisplayInputFile;


/*
Expand Down Expand Up @@ -81,11 +80,6 @@
vm.selectionObj = nodeService.selectionObj;
}

// Vm method which sets which input file type to display in popover help.//
function setDisplayInputFile (inputObj) {
angular.copy(inputObj, fileService.displayInputFile);
}

/*
* ---------------------------------------------------------
* Watchers
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

angular.module('refineryToolLaunch')
.component('rpInputGroupHelpPopover', {
controller: 'InputGroupHelpPopoverCtrl',
bindings: {
displayFile: '<',
displayFileColor: '<'
},
templateUrl: ['$window', function ($window) {
return $window.getStaticUrl('partials/tool-launch/partials/input-group-help-popover.html');
}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
aria-multiselectable="true">
<ul>
<li
ng-style="{'color': $ctrl.inputFileTypeColor[$ctrl.displayInputFile.uuid],
'border-color': $ctrl.inputFileTypeColor[$ctrl.displayInputFile.uuid]}">
{{ $ctrl.displayInputFile.name }}:
ng-style="{'color': $ctrl.displayFileColor,
'border-color': $ctrl.displayFileColor}">
{{ $ctrl.displayFile.name }}:
<
<div
class='fileTypes'
ng-repeat="fileObj in $ctrl.displayInputFile.allowed_filetypes">
ng-repeat="fileObj in $ctrl.displayFile.allowed_filetypes">
{{fileObj.name}}
<span ng-if="$index < $ctrl.displayInputFile.allowed_filetypes.length - 1">
<span ng-if="$index < $ctrl.displayFile.allowed_filetypes.length - 1">
,
</span>
</div>
>
<br>
<em>{{ $ctrl.displayInputFile.description }}</em>
<em>{{ $ctrl.displayFile.description }}</em>
</li>
</ul>
</div>

7 changes: 4 additions & 3 deletions refinery/ui/source/js/tool-launch/partials/input-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ <h4>
popover-title="Input Group File Types"
popover-trigger="focus"
popover-append-to-body="true"
ng-click="$ctrl.setDisplayInputFile(inputFile)"
tabindex="0">
<i class="fa fa-question-circle info-icon icon-only"></i>
</a>
Expand Down Expand Up @@ -105,7 +104,9 @@ <h4>

<script type="text/ng-template" id="inputgrouphelppopover.html">
<div>
<rp-input-group-help-popover>
</rp-input-group-help-popover>
<rp-input-group-help-popover
display-file='inputFile'
display-file-color='$ctrl.inputFileTypeColor[inputFile.uuid]'>
</rp-input-group-help-popover>
</div>
</script>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span class="p-l-1-3">
<span id="tool-select-button">
<button
class="btn btn-primary btn-xs"
ng-disabled="$ctrl.needMoreNodes()"
Expand Down
6 changes: 4 additions & 2 deletions refinery/ui/source/js/tool-launch/partials/tool-select.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<ui-select
id="tool-select-drop-down"
append-to-body="true"
search-enabled="false"
ng-model="$ctrl.selectedTool.select"
on-select="$ctrl.updateTool($item)"
theme="select2"
class="ui-select-drop text-left">
<ui-select-match placeholder="Select a tool">
<span ng-bind="$select.selected.name"></span>
<i class="{{tool.tool_type|toolTypeIcon}} p-r-1-4" aria-hidden="true"></i>{{
$select.selected.name }}
</ui-select-match>
<ui-select-choices
position="down"
repeat="tool in $ctrl.tools track by $index">
<i class="{{tool.tool_type|toolTypeIcon}}" aria-hidden="true"></i>{{ tool.name }}
<i class="{{tool.tool_type|toolTypeIcon}} p-r-1-4" aria-hidden="true"></i>{{ tool.name }}
</ui-select-choices>
</ui-select>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
vm.attributesObj = {}; // displayName: internalName, ex Name:
vm.currentGroup = []; // index for the group coordinates
vm.currentTypes = []; // tracks whether depths are pair or list
vm.displayInputFile = {}; // for input-group-help-popover, tracks selected
vm.groupCollection = {}; // contains groups with their selected row's info
vm.hideNodePopover = false;
vm.inputFileTypes = []; // maintains the required input types
Expand Down Expand Up @@ -141,7 +140,6 @@
}
vm.groupCollection = {};
vm.nodeSelectCollection = {};
vm.displayInputFile = {};
angular.copy({}, nodeService.selectionObj);
}

Expand All @@ -151,7 +149,6 @@
function resetToolRelated () {
vm.currentGroup = [];
vm.currentTypes = [];
vm.displayInputFile = {};
vm.groupCollection = {};
vm.hideNodePopover = false;
vm.inputFileTypes = [];
Expand Down
2 changes: 1 addition & 1 deletion refinery/ui/source/js/tool-launch/views/tool-display.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2>
</h2>
</div>

<div>
<div id="tool-select-panel">
<rp-tool-select></rp-tool-select>
<rp-tool-launch-button></rp-tool-launch-button>
</div>
Expand Down
18 changes: 14 additions & 4 deletions refinery/ui/source/styles/file-browser.less
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@
padding-left: 5px;
padding-right: 5px;

.ui-select-drop {
width: 150px;
}

.ui-select-placeholder {
display: inline;
}
Expand Down Expand Up @@ -253,6 +249,20 @@
-webkit-border-radius: 10px;
border-radius: 10px;
}

#tool-select-panel {
width: 100%;
#tool-select-drop-down {
width: 70%;
}
#tool-select-button {
margin-left: .1em;
margin-right: .5em;
margin-top: .1em;
float: right;
}
}

}

#tool-panel-show-button {
Expand Down

0 comments on commit 4d447de

Please sign in to comment.